Files
ds-chat/frontend/src/components/ChatPane.css
T
ksmithandClaude Sonnet 5 aeb2f3f6a5 Phase 3: PWA offline caching (frontend only)
Adds a real Workbox runtime-caching strategy on top of the Phase 1 app-shell
precache: StaleWhileRevalidate (cache-and-refresh) for the five read
endpoints (rooms/mine, open rooms, room messages, room members, invites/mine)
with a bounded/expiring cache per endpoint, while /api/auth/* and all
mutations stay network-only. An OfflineBanner (navigator.onLine-driven) and
a clearer Composer status line ("Connecting..." vs "You're offline") surface
what's actually happening; api/client.ts gains a NetworkError distinct from
ApiError so a genuine cache-miss-while-offline shows a quiet empty state
instead of a red error.

Manual offline testing (backend stopped, `vite preview` against the real
production service worker) surfaced a real gap the plan hadn't accounted
for: GET /api/auth/me is intentionally NetworkOnly, but that meant
ProtectedRoute could never confirm a session while offline and always
bounced to /login -- none of the newly-cached room/message data was ever
reachable. Fixed by caching a minimal, non-sensitive "last known user" in
localStorage (lib/lastUser.ts) and having AuthContext fall back to it for
any *unconfirmed* auth check (network failure, or a down backend answering
through a live reverse proxy with its own 502/503/504 -- both happen in
real deployments, not just literal airplane-mode). Only a server-confirmed
401 still clears it and signs the user out; every real action still
re-checks the actual session cookie server-side, so this can't grant
anything -- it only keeps cached UI reachable.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-13 21:34:26 -06:00

77 lines
1.3 KiB
CSS

.chat-pane {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
background: var(--ds-void);
}
.chat-pane-header {
height: 56px;
min-height: 56px;
display: flex;
align-items: center;
gap: var(--sp-2);
padding: 0 var(--sp-4);
border-bottom: 1px solid var(--ds-border);
background: var(--ds-surface);
}
.chat-pane-back {
background: transparent;
border: none;
color: var(--ds-muted);
cursor: pointer;
display: flex;
padding: 4px;
flex: none;
}
.chat-pane-title-block {
min-width: 0;
flex: 1;
}
.chat-pane-title {
font-weight: 700;
font-size: 0.96rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.chat-pane-subtitle {
font-size: 0.76rem;
color: var(--ds-muted);
}
.chat-pane-info-btn {
width: 32px;
height: 32px;
border-radius: var(--radius);
background: transparent;
border: 1px solid var(--ds-border);
color: var(--ds-accent);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
flex: none;
}
.chat-pane-info-btn-active {
background: var(--ds-surface-2);
}
.chat-pane-error {
color: var(--ds-danger);
font-size: 0.86rem;
padding: var(--sp-2) var(--sp-4) 0;
margin: 0;
}
.chat-pane-note {
color: var(--ds-muted);
}