-
Notifications
You must be signed in to change notification settings - Fork 7
Chat Phase 2b-2b/c — ephemeral messages + in-app help + all-threads + lightbox zoom #241
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
12 commits
Select commit
Hold shift + click to select a range
0672938
docs: Phase 2b-2b/c spec + plan — ephemeral + help + all-threads + zoom
jaylfc 50f0fe4
feat(chat): expires_at column + periodic sweep for ephemeral messages
jaylfc 50fb297
feat(chat): routes honor channel ephemeral_ttl_seconds when sending
jaylfc 6d81684
feat(chat): GET /channels/{id}/threads lists thread parents with repl…
jaylfc 4603cfb
feat(chat): GET /api/docs/chat-guide serves markdown for in-app help …
jaylfc 4400a5e
feat(desktop): channel ephemeral TTL dropdown + header badge
jaylfc f8d44f1
feat(desktop): in-app HelpPanel replaces external chat-guide link
jaylfc f20ecb2
feat(desktop): AllThreadsList panel to browse all threads in a channel
jaylfc 1ebf6fe
feat(desktop): AttachmentLightbox zoom + pan
jaylfc 329b37f
build: rebuild desktop bundle for Phase 2b-2b/c
jaylfc d079378
test(e2e): Phase 2b-2b/c — help panel + all-threads stubs
jaylfc 923dac6
fix(chat): address 241 review feedback
jaylfc 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| import { useEffect, useState } from "react"; | ||
|
|
||
| interface ThreadSummary { | ||
| id: string; | ||
| author_id: string; | ||
| content: string; | ||
| reply_count: number; | ||
| last_reply_at: number | null; | ||
| } | ||
|
|
||
| function relativeTs(ts: number | null): string { | ||
| if (!ts) return ""; | ||
| const diff = Date.now() - ts * 1000; | ||
| const mins = Math.floor(diff / 60000); | ||
| if (mins < 1) return "now"; | ||
| if (mins < 60) return `${mins}m ago`; | ||
| const hrs = Math.floor(mins / 60); | ||
| if (hrs < 24) return `${hrs}h ago`; | ||
| const days = Math.floor(hrs / 24); | ||
| if (days < 7) return `${days}d ago`; | ||
| return new Date(ts * 1000).toLocaleDateString(); | ||
| } | ||
|
|
||
| export function AllThreadsList({ | ||
| channelId, | ||
| onClose, | ||
| onJumpToThread, | ||
| }: { | ||
| channelId: string; | ||
| onClose: () => void; | ||
| onJumpToThread: (parentId: string) => void; | ||
| }) { | ||
| const [threads, setThreads] = useState<ThreadSummary[]>([]); | ||
| const [loading, setLoading] = useState(true); | ||
| const [error, setError] = useState<string | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| const ac = new AbortController(); | ||
| setLoading(true); | ||
| setError(null); | ||
| fetch(`/api/chat/channels/${channelId}/threads`, { signal: ac.signal }) | ||
| .then((r) => { | ||
| if (!r.ok) throw new Error(`HTTP ${r.status}`); | ||
| return r.json(); | ||
| }) | ||
| .then((data) => setThreads(data.threads ?? [])) | ||
| .catch((e) => { | ||
| if ((e as Error).name === "AbortError") return; | ||
| setError(e instanceof Error ? e.message : "failed"); | ||
| }) | ||
| .finally(() => { | ||
| // ac.signal.aborted is true when we've been superseded | ||
| if (!ac.signal.aborted) setLoading(false); | ||
| }); | ||
| return () => ac.abort(); | ||
| }, [channelId]); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| return ( | ||
| <aside | ||
| role="complementary" | ||
| aria-label="All threads" | ||
| className="fixed top-0 right-0 h-full w-[360px] bg-shell-surface border-l border-white/10 shadow-xl flex flex-col z-40" | ||
| > | ||
| <header className="flex items-center justify-between px-4 py-3 border-b border-white/10"> | ||
| <h2 className="text-sm font-semibold">All threads</h2> | ||
| <button onClick={onClose} aria-label="Close" className="text-lg leading-none opacity-60 hover:opacity-100">×</button> | ||
| </header> | ||
|
|
||
| <div className="flex-1 overflow-y-auto px-2 py-2"> | ||
| {loading && ( | ||
| <div className="px-2 py-4 text-xs text-shell-text-tertiary">Loading…</div> | ||
| )} | ||
| {error && ( | ||
| <div role="alert" className="text-xs text-red-300 bg-red-500/10 border border-red-500/30 rounded px-2 py-2 mx-2"> | ||
| {error} | ||
| </div> | ||
| )} | ||
| {!loading && !error && threads.length === 0 && ( | ||
| <div className="px-2 py-4 text-xs text-shell-text-tertiary">No threads yet.</div> | ||
| )} | ||
| {!loading && !error && threads.length > 0 && ( | ||
| <ul> | ||
| {threads.map((t) => ( | ||
| <li key={t.id}> | ||
| <button | ||
| className="w-full text-left px-3 py-2.5 rounded hover:bg-white/5 flex flex-col gap-0.5" | ||
| onClick={() => onJumpToThread(t.id)} | ||
| > | ||
| <span className="text-xs text-shell-text-secondary line-clamp-2">{t.content}</span> | ||
| <div className="flex items-center gap-2 text-[11px] text-shell-text-tertiary"> | ||
| <span>@{t.author_id}</span> | ||
| <span>·</span> | ||
| <span>{t.reply_count} {t.reply_count === 1 ? "reply" : "replies"}</span> | ||
| {t.last_reply_at && ( | ||
| <> | ||
| <span>·</span> | ||
| <span>{relativeTs(t.last_reply_at)}</span> | ||
| </> | ||
| )} | ||
| </div> | ||
| </button> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| )} | ||
| </div> | ||
| </aside> | ||
| ); | ||
| } | ||
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
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.