From ebca274e5a1773bc5ce994bf730f7ccd61e43de9 Mon Sep 17 00:00:00 2001 From: Astra Date: Sun, 20 Apr 2025 20:08:13 +0900 Subject: [PATCH] "Final-ish" design --- config.ts | 10 +- src/App.svelte | 3 + src/app.css | 1 + src/lib/PostComponent.svelte | 219 ++++++++++++++++++++++++++++++----- src/lib/pdsfetch.ts | 2 + 5 files changed, 202 insertions(+), 33 deletions(-) diff --git a/config.ts b/config.ts index a507eb3..b8284a6 100644 --- a/config.ts +++ b/config.ts @@ -6,7 +6,7 @@ export class Config { * The base URL of the PDS (Personal Data Server) * @default "https://pds.witchcraft.systems" */ - static readonly PDS_URL: string = "https://ap.brid.gy"; + static readonly PDS_URL: string = "https://pds.witchcraft.systems"; /** * The base URL of the frontend service for linking to replies @@ -18,5 +18,11 @@ export class Config { * Maximum number of posts to fetch from the PDS per user * @default 10 */ - static readonly MAX_POSTS_PER_USER: number = 1; + static readonly MAX_POSTS_PER_USER: number = 22; + + /** + * Footer text for the dashboard + * @default "Astrally projected from witchcraft.systems" + */ + static readonly FOOTER_TEXT: string = "Astrally projected from witchcraft.systems"; } \ No newline at end of file diff --git a/src/App.svelte b/src/App.svelte index c5a024c..fbf59f1 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -2,6 +2,7 @@ import PostComponent from "./lib/PostComponent.svelte"; import AccountComponent from "./lib/AccountComponent.svelte"; import { fetchAllPosts, Post, getAllMetadataFromPds } from "./lib/pdsfetch"; + import { Config } from "../config"; const postsPromise = fetchAllPosts(); const accountsPromise = getAllMetadataFromPds(); @@ -19,6 +20,7 @@ {/each} +

{@html Config.FOOTER_TEXT}

{:catch error}

Error: {error.message}

@@ -74,6 +76,7 @@ background-color: #0d0620; height: 80vh; padding: 20px; + margin-left: 20px; } #accountsList { display: flex; diff --git a/src/app.css b/src/app.css index 988c405..05a51fd 100644 --- a/src/app.css +++ b/src/app.css @@ -40,6 +40,7 @@ a { } a:hover { color: #535bf2; + text-decoration: underline; } body { diff --git a/src/lib/PostComponent.svelte b/src/lib/PostComponent.svelte index b240c95..fc24700 100644 --- a/src/lib/PostComponent.svelte +++ b/src/lib/PostComponent.svelte @@ -1,7 +1,58 @@
@@ -14,24 +65,30 @@ /> {/if}
{#if post.replyingUri} - replying to {post.replyingUri.repo} + replying to {post.replyingUri.repo} {/if} -
{post.text}
{#if post.quotingUri} quoting {post.quotingUri.repo} {/if} - {#if post.imagesCid} -
- {#each post.imagesCid as imageLink} - Post Image - {/each} +
{post.text}
+ {#if post.imagesCid && post.imagesCid.length > 0} +
+ Post Image {currentImageIndex + 1} of {post.imagesCid.length} + + {#if post.imagesCid.length > 1} +
+ +
+ {#each post.imagesCid as _, i} +
+ {/each} +
+ +
+ {/if}
{/if} {#if post.videosLinkCid} {/if}
diff --git a/src/lib/pdsfetch.ts b/src/lib/pdsfetch.ts index 61be9bf..d48e1b9 100644 --- a/src/lib/pdsfetch.ts +++ b/src/lib/pdsfetch.ts @@ -32,6 +32,7 @@ class Post { authorDid: string; authorAvatarCid: string | null; postCid: string; + recordName: string; authorHandle: string; displayName: string; text: string; @@ -47,6 +48,7 @@ class Post { account: AccountMetadata, ) { this.postCid = record.cid; + this.recordName = record.uri.split("/").slice(-1)[0]; this.authorDid = account.did; this.authorAvatarCid = account.avatarCid; this.authorHandle = account.handle;