-
-
Notifications
You must be signed in to change notification settings - Fork 52
Public reaction list pages for each post #490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
718e620
Add public reaction list pages for each post
dahlia 7a665c6
Render custom emoji image in the reactions page heading
dahlia 68aabdb
Add a PR link to the changelog
dahlia dc1ccd5
Extract post title summary helper
dahlia 3af6eff
Extract PostForView type from Post.tsx
dahlia 335095a
Look up reaction image URL from post.reactions
dahlia e88fe4b
Share the post-view Drizzle relations clause
dahlia 88b6dfb
Treat empty post summary as missing
dahlia 176074f
Key the public account list items by account.id
dahlia 62945a1
Use PostForView in SSR page interfaces
dahlia 3513c0d
Key the quote list rows by post id
dahlia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { escape } from "es-toolkit"; | ||
|
|
||
| import { renderCustomEmojis } from "../custom-emoji"; | ||
| import { proxyUrl } from "../media-proxy"; | ||
| import type { Account } from "../schema"; | ||
| import { sanitizeHtml } from "../xss"; | ||
|
|
||
| export interface PublicAccountListProps { | ||
| readonly accounts: readonly Account[]; | ||
| readonly baseUrl: URL | string; | ||
| } | ||
|
|
||
| export function PublicAccountList({ | ||
| accounts, | ||
| baseUrl, | ||
| }: PublicAccountListProps) { | ||
| return ( | ||
| <ul class="mt-4 divide-y divide-neutral-200 dark:divide-neutral-800"> | ||
| {accounts.map((account) => ( | ||
|
dahlia marked this conversation as resolved.
|
||
| <li key={account.id}> | ||
| <PublicAccountItem account={account} baseUrl={baseUrl} /> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ); | ||
| } | ||
|
|
||
| interface PublicAccountItemProps { | ||
| readonly account: Account; | ||
| readonly baseUrl: URL | string; | ||
| } | ||
|
|
||
| function PublicAccountItem({ account, baseUrl }: PublicAccountItemProps) { | ||
| const nameHtml = renderCustomEmojis( | ||
| escape(account.name), | ||
| account.emojis, | ||
| baseUrl, | ||
| ); | ||
| const bioHtml = renderCustomEmojis( | ||
| sanitizeHtml(account.bioHtml ?? ""), | ||
| account.emojis, | ||
| baseUrl, | ||
| ); | ||
| const href = account.url ?? account.iri; | ||
| const avatar = proxyUrl(account.avatarUrl, baseUrl); | ||
| return ( | ||
| <article class="flex items-start gap-4 py-6"> | ||
| <a href={href} class="shrink-0"> | ||
| {avatar ? ( | ||
| <img | ||
| src={avatar} | ||
| alt="" | ||
| width={48} | ||
| height={48} | ||
| class="size-12 rounded-full object-cover" | ||
| /> | ||
| ) : ( | ||
| <span class="block size-12 rounded-full bg-neutral-200 dark:bg-neutral-800" /> | ||
| )} | ||
| </a> | ||
| <div class="min-w-0 flex-1"> | ||
| <a | ||
| href={href} | ||
| class="block font-semibold text-neutral-900 hover:underline dark:text-neutral-100" | ||
| dangerouslySetInnerHTML={{ __html: nameHtml }} | ||
| /> | ||
| <p class="select-all text-xs text-neutral-500 dark:text-neutral-400"> | ||
| {account.handle} | ||
| </p> | ||
| {bioHtml && ( | ||
| <div | ||
| class="prose prose-sm prose-neutral dark:prose-invert prose-a:text-brand-700 dark:prose-a:text-brand-400 mt-2 max-w-none break-words" | ||
| dangerouslySetInnerHTML={{ __html: bioHtml }} | ||
| /> | ||
| )} | ||
| </div> | ||
| </article> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.