docs: update CLAUDE.md with auto-login, health endpoint, sidebar changes

- Add auto-login feature description (lightning bolt toggle, startup flow)
- Add server health with online_users and 15s periodic health checks
- Update sidebar layout: DMs above channels (3-item preview, bubble to
  top, unread badge), collapsible member list with persisted state
This commit is contained in:
jevb
2026-03-28 11:30:02 +01:00
parent 7df7da470b
commit 63df9e15e8
3 changed files with 82 additions and 22 deletions
+3 -1
View File
@@ -937,7 +937,8 @@ Identical to `GET /health` but under the versioned prefix.
{
"status": "ok",
"version": "1.2.0",
"uptime": 86400
"uptime": 86400,
"online_users": 3
}
```
@@ -946,6 +947,7 @@ Identical to `GET /health` but under the versioned prefix.
| `status` | string | Always `"ok"` |
| `version` | string | Server version string |
| `uptime` | int64 | Server uptime in seconds |
| `online_users` | int | Number of connected WebSocket clients |
---
+62 -19
View File
@@ -733,11 +733,14 @@ position without a nuke-and-rebuild approach.
```text
+----------------------------------+
| SERVER HEADER | Server name, invite button
| [Server Icon] ServerName [+] |
| SERVER HEADER | Server name, online count, invite
| [OC] ServerName [Invite] |
+----------------------------------+
| SEARCH BAR | Jump to channel/user
| [Search...] |
| DIRECT MESSAGES (3) [+] | Unread total badge, new DM button
| ● user1 (2) | Max 3 visible, bubbles to top
| ● user2 | on new message
| ● user3 |
| View all messages (7) | Shown when >3 DMs exist
+----------------------------------+
| TEXT CHANNELS |
| ▼ General | Category-grouped, collapsible
@@ -750,17 +753,11 @@ position without a nuke-and-rebuild approach.
| 🔊 Voice Chat | User avatars in channel
| 🎤 User1 🔇 User2 |
+----------------------------------+
| DIRECT MESSAGES |
| [+] Start New DM | Opens member picker
| @ user1 (2) | Unread count badge
| @ user2 |
+----------------------------------+
| MEMBERS (drag-to-resize) |
| MEMBERS ── 12 online | Role-grouped, status dots
| ▸ admin |
| 🟢 AdminUser |
| ▸ member |
| 🟢 User1 🌙 User2 |
| ▼ MEMBERS (collapsible) | Collapses to header-only bar
| OWNER ── 1 | Role-grouped, status dots
| 🟢 AdminUser | Drag-to-resize handle
| MEMBER ── 3 | Scrollable list
| 🟢 User1 🌙 User2 | Collapsed state persisted
+----------------------------------+
| VOICE WIDGET | Only visible when in voice
| 🔊 Voice Chat [📡 12ms] | Connection quality indicator
@@ -777,18 +774,38 @@ position without a nuke-and-rebuild approach.
The sidebar has two modes tracked by `uiStore.sidebarMode`:
- **"channels"** -- Full server view (header, channels, voice, DMs, members)
- **"channels"** -- Full server view (header, DMs preview, channels, voice, members)
- **"dms"** -- Replaces server header with "Back to Server" header,
hides channel list, shows only DM conversations
hides channel list, shows full DM conversations list
Clicking a DM switches to DM mode. "Back to Server" returns to channel
mode and restores the previously active channel.
mode and restores the previously active channel. The "View all messages"
button in the DM preview section also switches to DM mode.
### DM Preview Section
In channel mode, the DM section appears **above** text channels:
- Shows the 3 most recent DM conversations
- DMs with new messages automatically bubble to the top
- Red unread badge on the "DIRECT MESSAGES" header shows total unread count
- "View all messages (N)" link appears when more than 3 DMs exist
- Collapsible via the category header arrow
### Member List
The member list section is collapsible:
- Clicking the MEMBERS header toggles between expanded and collapsed
- Collapsed state shows only the header bar (no wasted space)
- Expanded state is scrollable with a drag-to-resize handle
- Collapsed/expanded state is persisted in `localStorage` (`owncord:member-list-collapsed`)
- Saved height is restored on expand (`owncord:member-list-height`)
### SidebarArea.ts
The `createSidebarArea()` factory composes:
- DM preview section (top 3 DMs with unread badges)
- Channel sidebar or DM sidebar (reactive, based on `sidebarMode`)
- Member list (drag-to-resize handle)
- Member list (collapsible, drag-to-resize handle)
- Voice widget (conditional, based on `voiceStore.currentChannelId`)
- User bar (avatar, username, settings, quick-switch)
- Channel modals (create, edit, delete -- mounted on demand)
@@ -1274,6 +1291,32 @@ each saved server profile. Results show status indicators:
- yellow: slow (>1500ms latency)
- red: offline (unreachable / timeout)
Health checks also display the **online user count** from the
`online_users` field in the `/api/v1/health` response.
Health checks **repeat every 15 seconds** while on the ConnectPage
so servers that come back online are detected automatically. The
interval is cleared when navigating away from the ConnectPage.
### Auto-Login
One server profile can be marked as the auto-login target via
`setAutoLogin(id)`. Only one profile can have `autoConnect: true`
at a time — enabling it on one clears all others. Setting auto-login
also forces `rememberPassword: true` so credentials are saved.
On startup, if an auto-login profile exists with saved credentials:
1. Show "Auto-connecting..." overlay with server name and cancel button
2. Load credentials from Windows Credential Manager
3. Call `api.login()` automatically
4. If 2FA required → fall back to TOTP overlay
5. If login fails → show error, revert to normal login form
6. If cancelled → revert to normal login form
Auto-login is skipped when arriving via quick-switch (sessionStorage
flag). The toggle is a lightning bolt icon on each server card in
the ServerPanel.
---
## Quick Server Switch
+17 -2
View File
@@ -304,13 +304,28 @@ It shares the `channel-sidebar` CSS container class.
- Active state highlighting
- Unread dot indicator
### 5.2.1 DM Preview Section (Channel Mode)
In channel mode, a DM preview section appears **above** text channels
in the unified sidebar:
- Shows the **3 most recent** DM conversations
- DMs with new messages **bubble to the top** automatically
(both `updateDmLastMessage` and `updateDmLastMessagePreview`
move the channel to index 0)
- Red unread badge on the "DIRECT MESSAGES" header shows total
unread count across all DMs
- "View all messages (N)" link appears when more than 3 DMs exist
and switches to full DM mode
- Collapsible via the category header arrow
### 5.3 Sidebar Mode Switching
**File:** `Client/tauri-client/src/pages/main-page/SidebarArea.ts`
The sidebar has two modes:
- **Channel mode:** Shows text/voice channels, members, voice widget
- **DM mode:** Shows DmSidebar with conversation list
- **Channel mode:** Shows DM preview (top 3), text/voice channels,
collapsible members, voice widget
- **DM mode:** Shows DmSidebar with full conversation list
Switching is controlled by the UI store: