[PR #4178] [MERGED] feat(chat-sidebar): per-chat liveness signals, thumbnail row banners, and configurable backgrounds #6269

Closed
opened 2026-10-23 04:08:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4178
Author: @Gunterlie
Created: 7/27/2026
Status: ✅ Merged
Merged: 7/27/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/chat-list-liveness


📝 Commits (8)

  • c678f7b feat(chat-sidebar): show per-chat liveness and avatar banner
  • 996ef75 fix(chat-sidebar): show generating pulse for background chats
  • e13469b feat(chat-sidebar): use the chat's own background for the row banner
  • 3490257 feat(chat-sidebar): relative timestamps, named unread, hover peek
  • 22d95b4 perf(chat-sidebar): thumbnail row banners and make them configurable
  • e55e172 Merge branch 'staging' into feat/chat-list-liveness
  • 6375bde Merge branch 'staging' into feat/chat-list-liveness
  • f616eca fix(backgrounds): make thumbnail caching race-safe

📊 Changes

12 files changed (+483 additions, -41 deletions)

View changed files

📝 packages/client/src/components/chat/ConversationPresenceCard.tsx (+1 -26)
➕ packages/client/src/components/layout/ChatRowPeek.tsx (+149 -0)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+110 -4)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+52 -0)
📝 packages/client/src/components/panels/settings/BackgroundPicker.tsx (+11 -1)
📝 packages/client/src/hooks/use-chats.ts (+17 -0)
📝 packages/client/src/lib/backgrounds.ts (+13 -6)
➕ packages/client/src/lib/relative-time.ts (+46 -0)
📝 packages/client/src/localization/locales/en.json (+11 -0)
📝 packages/client/src/stores/ui.store.ts (+14 -0)
📝 packages/server/src/routes/backgrounds.routes.ts (+56 -4)
📝 packages/shared/src/constants/defaults.ts (+3 -0)

📄 Description

Linked issue

No linked issue yet. Per CONTRIBUTING.md § Before You Open a Pull Request, one should be opened to gather opinions before this is submitted.

Why this change

The chat sidebar lacked per-chat liveness cues: no way to see which chat is currently generating, no typing indicators for background chats, no visual distinction for the active chat beyond a colored bar, and unread indicators only showed a dot without context. Row banners rendered full-resolution user uploads (up to ~8 MB decoded each) for every chat in the list.

What changed

Per-chat liveness signals

  • Active generating pulse: a pulsing dot on rows whose abortControllers map has an entry.
  • Per-chat typing indicator: shows when another chat in a non-active session has an active generation.
  • Chat notifications: named unread indicator showing the chat's title/character when receiving a system notification for a background chat.
  • Input drafts: a subtle indicator on rows that have unsaved draft text.
  • Liveness state is read through stable store selectors (agent.store.ts) so rows don't re-render on every unrelated store write.

Hover peek

  • Hovering a chat row opens a peek card with the last few messages, rendered with a speaker rail so who-said-what is readable at a glance.
  • Peek closes on scroll, Escape, or pointer-leave.

Row banner with thumbnails

  • Each chat row shows its own background image as a muted banner accent, using a server-generated 320px-wide WebP thumbnail.
  • Thumbnail endpoint: GET /api/backgrounds/file/:filename?w=320 — sharp resize → WebP, cached to DATA_DIR/backgrounds-thumbs/, written atomically. Falls back to streaming the original when sharp is unavailable (Android/Termux) or the source is an animated GIF.
  • chatBackgroundMetadataToUrl(value, width?) appends the width param; BackgroundPicker.tsx also uses the 320px thumbnail.
  • New setting: Appearance → Backgrounds → Chat List Backgrounds — hover (default, = only on hover/active), always (every row), off. Rendered as a dropdown rather than a card grid to match the rest of the Appearance panel. Synced across devices. On mobile the hover default degrades to active-row-only since touch devices don't fire hover events.

Relative timestamps

  • formatRelativeContact uses Intl.RelativeTimeFormat with the user's locale and style:"narrow" (→ "now", "5m ago"). One cached formatter per locale, no new i18n keys.

Fixes from review

  • Active-row accent bar: moved to left-0 so it isn't clipped by overflow-hidden on the row.
  • Peek query key: includes limit so stale data is correctly invalidated.
  • Name labels: used side="right" on the dropdown to prevent overflow.
  • Folder expansion no longer loops: the sidebar stopped re-requesting expansion for folders that were already expanded, which caused an unbounded request loop.
  • Client-only unread notifications are no longer pruned by the chat store when server state syncs, so background-chat unread markers survive a refresh of the chat list.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify the generating pulse (green dot) appears on the correct chat row while generation is active.
  • Manually verify the typing indicator appears for background chats during generation.
  • Manually verify named unread indicators show the chat title/character on notification, and still show after the chat list refetches.
  • Manually verify the input draft indicator appears and disappears when typing/clearing in a background chat.
  • Manually verify the hover peek opens with the speaker rail and closes on scroll / Escape / pointer-leave.
  • Manually verify expanding a folder issues one request, not a repeating loop (check devtools network tab).
  • Manually verify the row banner shows the correct background and degrades gracefully when no background is set.
  • Manually verify the "Chat List Backgrounds" dropdown cycles through hover/always/off and the sidebar responds.
  • Manually verify thumbnails load at 320px width (check devtools network tab for ?w=320 requests returning image/webp).
  • Manually verify the accent bar is fully visible (not clipped) on the active row.
  • Manually verify relative timestamps display correctly in English and another locale.
  • Manually verify mobile: no hover event = active-row-only banner on touch devices.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4178 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/27/2026 **Status:** ✅ Merged **Merged:** 7/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/chat-list-liveness` --- ### 📝 Commits (8) - [`c678f7b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c678f7b0cbfe00f3e61a42e3e256e038e27d1589) feat(chat-sidebar): show per-chat liveness and avatar banner - [`996ef75`](https://github.com/Pasta-Devs/Marinara-Engine/commit/996ef75c00af728dfa3a7d22370872b9fc4cd7e8) fix(chat-sidebar): show generating pulse for background chats - [`e13469b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e13469bd428e3f69b7a470cff0daa09d53708b2e) feat(chat-sidebar): use the chat's own background for the row banner - [`3490257`](https://github.com/Pasta-Devs/Marinara-Engine/commit/34902579c02feda25a13c652264e99c18a7178ba) feat(chat-sidebar): relative timestamps, named unread, hover peek - [`22d95b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/22d95b4bc99f5d9b76dfe35aa404f238709048ef) perf(chat-sidebar): thumbnail row banners and make them configurable - [`e55e172`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e55e1729b0a3ac325d52aafa0a4b0b897a898fbd) Merge branch 'staging' into feat/chat-list-liveness - [`6375bde`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6375bdea90925953d5925d0e0a19812a114a2b47) Merge branch 'staging' into feat/chat-list-liveness - [`f616eca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f616eca5a3aae3b14d6501687b25e49bf2fdbcfb) fix(backgrounds): make thumbnail caching race-safe ### 📊 Changes **12 files changed** (+483 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ConversationPresenceCard.tsx` (+1 -26) ➕ `packages/client/src/components/layout/ChatRowPeek.tsx` (+149 -0) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+110 -4) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+52 -0) 📝 `packages/client/src/components/panels/settings/BackgroundPicker.tsx` (+11 -1) 📝 `packages/client/src/hooks/use-chats.ts` (+17 -0) 📝 `packages/client/src/lib/backgrounds.ts` (+13 -6) ➕ `packages/client/src/lib/relative-time.ts` (+46 -0) 📝 `packages/client/src/localization/locales/en.json` (+11 -0) 📝 `packages/client/src/stores/ui.store.ts` (+14 -0) 📝 `packages/server/src/routes/backgrounds.routes.ts` (+56 -4) 📝 `packages/shared/src/constants/defaults.ts` (+3 -0) </details> ### 📄 Description ## Linked issue No linked issue yet. Per `CONTRIBUTING.md § Before You Open a Pull Request`, one should be opened to gather opinions before this is submitted. ## Why this change The chat sidebar lacked per-chat liveness cues: no way to see which chat is currently generating, no typing indicators for background chats, no visual distinction for the active chat beyond a colored bar, and unread indicators only showed a dot without context. Row banners rendered full-resolution user uploads (up to ~8 MB decoded each) for every chat in the list. ## What changed **Per-chat liveness signals** - Active generating pulse: a pulsing dot on rows whose `abortControllers` map has an entry. - Per-chat typing indicator: shows when another chat in a non-active session has an active generation. - Chat notifications: named unread indicator showing the chat's title/character when receiving a system notification for a background chat. - Input drafts: a subtle indicator on rows that have unsaved draft text. - Liveness state is read through stable store selectors (`agent.store.ts`) so rows don't re-render on every unrelated store write. **Hover peek** - Hovering a chat row opens a peek card with the last few messages, rendered with a speaker rail so who-said-what is readable at a glance. - Peek closes on scroll, `Escape`, or pointer-leave. **Row banner with thumbnails** - Each chat row shows its own background image as a muted banner accent, using a server-generated 320px-wide WebP thumbnail. - Thumbnail endpoint: `GET /api/backgrounds/file/:filename?w=320` — sharp resize → WebP, cached to `DATA_DIR/backgrounds-thumbs/`, written atomically. Falls back to streaming the original when sharp is unavailable (Android/Termux) or the source is an animated GIF. - `chatBackgroundMetadataToUrl(value, width?)` appends the width param; `BackgroundPicker.tsx` also uses the 320px thumbnail. - New setting: **Appearance → Backgrounds → Chat List Backgrounds** — `hover` (default, = only on hover/active), `always` (every row), `off`. Rendered as a dropdown rather than a card grid to match the rest of the Appearance panel. Synced across devices. On mobile the `hover` default degrades to active-row-only since touch devices don't fire hover events. **Relative timestamps** - `formatRelativeContact` uses `Intl.RelativeTimeFormat` with the user's locale and `style:"narrow"` (→ "now", "5m ago"). One cached formatter per locale, no new i18n keys. **Fixes from review** - Active-row accent bar: moved to `left-0` so it isn't clipped by `overflow-hidden` on the row. - Peek query key: includes `limit` so stale data is correctly invalidated. - Name labels: used `side="right"` on the dropdown to prevent overflow. - Folder expansion no longer loops: the sidebar stopped re-requesting expansion for folders that were already expanded, which caused an unbounded request loop. - Client-only unread notifications are no longer pruned by the chat store when server state syncs, so background-chat unread markers survive a refresh of the chat list. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - [x] Manually verify the generating pulse (green dot) appears on the correct chat row while generation is active. - [x] Manually verify the typing indicator appears for background chats during generation. - [x] Manually verify named unread indicators show the chat title/character on notification, and still show after the chat list refetches. - [x] Manually verify the input draft indicator appears and disappears when typing/clearing in a background chat. - [x] Manually verify the hover peek opens with the speaker rail and closes on scroll / Escape / pointer-leave. - [x] Manually verify expanding a folder issues one request, not a repeating loop (check devtools network tab). - [x] Manually verify the row banner shows the correct background and degrades gracefully when no background is set. - [x] Manually verify the "Chat List Backgrounds" dropdown cycles through hover/always/off and the sidebar responds. - [x] Manually verify thumbnails load at 320px width (check devtools network tab for `?w=320` requests returning `image/webp`). - [x] Manually verify the accent bar is fully visible (not clipped) on the active row. - [x] Manually verify relative timestamps display correctly in English and another locale. - [x] Manually verify mobile: no hover event = active-row-only banner on touch devices. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <!-- Add before/after screenshots or recordings showing row banners, liveness cues, hover peek, and the new setting --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6269
No description provided.