diff --git a/src/components/embeds/QuoteComponent.svelte b/src/components/embeds/QuoteComponent.svelte index 83d0fad..d5c2dd8 100644 --- a/src/components/embeds/QuoteComponent.svelte +++ b/src/components/embeds/QuoteComponent.svelte @@ -56,7 +56,7 @@ {#snippet quoteContent(record: ATProtoRecord)} {#if record instanceof BasePost}
- +
{:else if record instanceof FeedGeneratorRecord} diff --git a/src/components/posts/BlockedPostContent.svelte b/src/components/posts/BlockedPostContent.svelte index bb2b267..ca51182 100644 --- a/src/components/posts/BlockedPostContent.svelte +++ b/src/components/posts/BlockedPostContent.svelte @@ -6,9 +6,9 @@ import PostBody from './PostBody.svelte'; import ThreadRootParentRaw from './ThreadRootParentRaw.svelte'; - let { post, context }: { post: Post, context: PostContext } = $props(); + let { post, placement }: { post: Post, placement: PostPlacement } = $props(); - setContext('post', { post, context }); + setContext('post', { post, placement }); {#if post.isPageRoot && post.parentReference} diff --git a/src/components/posts/BlockedPostView.svelte b/src/components/posts/BlockedPostView.svelte index 4fe6f21..e6812d2 100644 --- a/src/components/posts/BlockedPostView.svelte +++ b/src/components/posts/BlockedPostView.svelte @@ -10,10 +10,10 @@ type Props = { reason: string; post: BlockedPost | DetachedQuotePost; - context: PostContext; + placement: PostPlacement; } - let { reason, post, context }: Props = $props(); + let { reason, post, placement }: Props = $props(); let biohazardEnabled = $derived(account.biohazardEnabled !== false); let loading = $state(false); @@ -77,7 +77,7 @@ {/if}

- + {:else} {/if} diff --git a/src/components/posts/PostComponent.svelte b/src/components/posts/PostComponent.svelte index 960895f..2b2f587 100644 --- a/src/components/posts/PostComponent.svelte +++ b/src/components/posts/PostComponent.svelte @@ -30,12 +30,12 @@ type Props = { post: Post, - context: PostContext, + placement: PostPlacement, highlightedMatches?: string[] | undefined, class?: string | undefined } - let { post, context, highlightedMatches = undefined, ...props }: Props = $props(); + let { post, placement, highlightedMatches = undefined, ...props }: Props = $props(); let collapsed = $state(false); let replies: AnyPost[] = $state(post.replies); @@ -43,7 +43,7 @@ let missingHiddenReplies: number | undefined = $state(); let hiddenRepliesError: Error | undefined = $state(); - setContext('post', { post, context }); + setContext('post', { post, placement }); // TODO: make Post reactive let quoteCount: number | undefined = $state(post.quoteCount); @@ -122,10 +122,10 @@ {/if} {/snippet} -
+
- {#if context == 'thread' && !post.isPageRoot} + {#if placement == 'thread' && !post.isPageRoot} {/if} @@ -141,16 +141,16 @@ {/if} {#if post.replyCount == 1 && (replies[0] instanceof Post) && replies[0].author.did == post.author.did} - + {:else} {#each replies as reply (reply.uri)} {#if shouldRenderReply(reply)} - + {/if} {/each} {/if} - {#if context == 'thread' && !repliesLoaded} + {#if placement == 'thread' && !repliesLoaded} {#if post.hasMoreReplies} {:else if post.hasHiddenReplies && account.biohazardEnabled !== false} diff --git a/src/components/posts/PostFooter.svelte b/src/components/posts/PostFooter.svelte index a4d226c..28737cc 100644 --- a/src/components/posts/PostFooter.svelte +++ b/src/components/posts/PostFooter.svelte @@ -6,7 +6,7 @@ import { showLoginDialog } from '../../skythread.js'; import { showError } from '../../utils.js'; - let { post, context }: { post: Post, context: PostContext } = getContext('post'); + let { post, placement }: { post: Post, placement: PostPlacement } = getContext('post'); let { quoteCount }: { quoteCount: number | undefined } = $props(); let isLiked = $state(post.liked); @@ -67,15 +67,15 @@ {post.repostCount} {/if} - {#if post.replyCount > 0 && (context == 'quotes' || context == 'feed')} + {#if post.replyCount > 0 && (placement == 'quotes' || placement == 'feed')} {post.replyCount > 1 ? `${post.replyCount} replies` : '1 reply'} {/if} - {#if quoteCount && context != 'quote'} - {#if context == 'quotes' || context == 'feed' || post.isPageRoot} + {#if quoteCount && placement != 'quote'} + {#if placement == 'quotes' || placement == 'feed' || post.isPageRoot} {quoteCount > 1 ? `${quoteCount} quotes` : '1 quote'} @@ -87,7 +87,7 @@ {/if} {/if} - {#if context == 'thread' && post.isRestrictingReplies} + {#if placement == 'thread' && post.isRestrictingReplies} Limited replies {/if} diff --git a/src/components/posts/PostHeader.svelte b/src/components/posts/PostHeader.svelte index 9e5f16d..17714ab 100644 --- a/src/components/posts/PostHeader.svelte +++ b/src/components/posts/PostHeader.svelte @@ -4,8 +4,8 @@ import { PostPresenter } from '../../utils/post_presenter.js'; import PostSubtreeLink from './PostSubtreeLink.svelte'; - let { post, context }: { post: Post, context: PostContext } = getContext('post'); - let presenter = new PostPresenter(post, context); + let { post, placement }: { post: Post, placement: PostPlacement } = getContext('post'); + let presenter = new PostPresenter(post, placement); let avatar: HTMLImageElement | undefined = $state(); @@ -43,10 +43,10 @@ {presenter.formattedTimestamp} - {#if (post.replyCount > 0 && !post.isPageRoot) || ['quote', 'quotes', 'feed'].includes(context)} + {#if (post.replyCount > 0 && !post.isPageRoot) || ['quote', 'quotes', 'feed'].includes(placement)} • - {#if ['quote', 'quotes', 'feed'].includes(context)} + {#if ['quote', 'quotes', 'feed'].includes(placement)} {:else} diff --git a/src/components/posts/PostWrapper.svelte b/src/components/posts/PostWrapper.svelte index f81c8df..012b9bd 100644 --- a/src/components/posts/PostWrapper.svelte +++ b/src/components/posts/PostWrapper.svelte @@ -14,17 +14,17 @@ - feed - a post on the hashtag feed page */ - let { post, context }: { post: AnyPost, context: PostContext } = $props(); + let { post, placement }: { post: AnyPost, placement: PostPlacement } = $props(); {#if post instanceof Post} - + {:else} -
+
{#if post instanceof BlockedPost} - + {:else if post instanceof DetachedQuotePost} - + {:else} {/if} diff --git a/src/components/posts/ThreadRootParent.svelte b/src/components/posts/ThreadRootParent.svelte index 1d11399..2e2212a 100644 --- a/src/components/posts/ThreadRootParent.svelte +++ b/src/components/posts/ThreadRootParent.svelte @@ -13,7 +13,7 @@

{:else if post instanceof BlockedPost}
- +
{:else if post instanceof MissingPost}

diff --git a/src/pages/HashtagPage.svelte b/src/pages/HashtagPage.svelte index b126a2b..dbbf63d 100644 --- a/src/pages/HashtagPage.svelte +++ b/src/pages/HashtagPage.svelte @@ -56,7 +56,7 @@ {#each posts as post (post.uri)} - + {/each} {:else if !loadingFailed} diff --git a/src/pages/LycanSearchPage.svelte b/src/pages/LycanSearchPage.svelte index 02d0352..704fb3c 100644 --- a/src/pages/LycanSearchPage.svelte +++ b/src/pages/LycanSearchPage.svelte @@ -206,7 +206,7 @@

...

{:else} {#each results as post (post.uri)} - + {/each} {#if finishedPosts}

{results.length > 0 ? "No more results." : "No results."}

diff --git a/src/pages/NotificationsPage.svelte b/src/pages/NotificationsPage.svelte index d3fe94c..de5b40b 100644 --- a/src/pages/NotificationsPage.svelte +++ b/src/pages/NotificationsPage.svelte @@ -58,7 +58,7 @@ {/if} - + {/each} {:else if !loadingFailed} diff --git a/src/pages/QuotesPage.svelte b/src/pages/QuotesPage.svelte index 6541c3f..602c62c 100644 --- a/src/pages/QuotesPage.svelte +++ b/src/pages/QuotesPage.svelte @@ -65,7 +65,7 @@ {/if} - + {/each} {:else if !loadingFailed} diff --git a/src/pages/ThreadPage.svelte b/src/pages/ThreadPage.svelte index 6c69601..99d91e5 100644 --- a/src/pages/ThreadPage.svelte +++ b/src/pages/ThreadPage.svelte @@ -66,9 +66,9 @@ {/if} - + {:else} - + {/if} {:else if !loadingFailed} diff --git a/src/pages/TimelineSearchPage.svelte b/src/pages/TimelineSearchPage.svelte index f223748..c9dd333 100644 --- a/src/pages/TimelineSearchPage.svelte +++ b/src/pages/TimelineSearchPage.svelte @@ -79,7 +79,7 @@
{#each results as post (post.uri)} - + {/each}
{/if} diff --git a/src/types.d.ts b/src/types.d.ts index feaf320..e552355 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -25,4 +25,4 @@ type AnyPost = import("./models/posts.js").Post | import("./models/posts.js").MissingPost | import("./models/posts.js").DetachedQuotePost; -type PostContext = 'thread' | 'parent' | 'quote' | 'quotes' | 'feed'; +type PostPlacement = 'thread' | 'parent' | 'quote' | 'quotes' | 'feed'; diff --git a/src/utils/post_presenter.ts b/src/utils/post_presenter.ts index 80deadf..3dc982b 100644 --- a/src/utils/post_presenter.ts +++ b/src/utils/post_presenter.ts @@ -13,17 +13,17 @@ export class PostPresenter { */ post: Post; - context: PostContext; + placement: PostPlacement; - constructor(post: Post, context: PostContext) { + constructor(post: Post, placement: PostPlacement) { this.post = post; - this.context = context; + this.placement = placement; } get timeFormatForTimestamp(): Intl.DateTimeFormatOptions { - if (this.context == 'quotes' || this.context == 'feed') { + if (this.placement == 'quotes' || this.placement == 'feed') { return { weekday: 'short', day: 'numeric', month: 'short', year: 'numeric', hour: 'numeric', minute: 'numeric' }; - } else if (this.post.isPageRoot || this.context != 'thread') { + } else if (this.post.isPageRoot || this.placement != 'thread') { return { day: 'numeric', month: 'short', year: 'numeric', hour: 'numeric', minute: 'numeric' }; } else if (this.post.pageRoot && !sameDay(this.post.createdAt, this.post.pageRoot.createdAt)) { return { day: 'numeric', month: 'short', hour: 'numeric', minute: 'numeric' };