fix(sessions): Messages stat card + slim prune button (#855)

* fix(sessions): show Messages stat + slim prune button

The Active stat card always rendered 0: the mobile model declared
'val active: Int = 0', a key GET /api/sessions/stats never sends
(backend returns total/active_store/archived/messages/by_source), and
with ignoreUnknownKeys = true deserialization silently fell back to 0.

Rework the stats row instead of just key-mapping:
- Messages card replaces Active, reading the 'messages' key
  (db.message_count(), web_routers/sessions.py:523-550)
- Prune becomes a slim 52dp icon-only card (contentDescription keeps it
  accessible) so the Messages card keeps width for large counts

* feat(sessions): compact stat counts (100k / 1.23m) for Total & Messages

formatCompactCount renders counts as max 3 digits + unit letter:
987 -> '987', 100987 -> '100k', 1234567 -> '1.23m', 100000000 -> '100m'.
Applied to both the Total and Messages stat cards so large numbers fit
the row. Covered by SessionsStatsFormatTest (5 test cases).

* fix(sessions): label prune + empty-cleanup buttons, drop top select toggle

- Prune card now sizes to its label (icon + 'Prune' text) instead of a
  52dp icon-only square, staying compact via wrap-content width.
- Empty-session cleanup becomes a labeled FilledTonalButton (icon +
  'Delete empty sessions', count badge kept) instead of a bare icon.
- Removed the top-bar select toggle (SelectAll icon); selection mode
  remains reachable via long-press > Select on any session row.
- Dropped now-orphaned content_desc_enter/exit_selection strings (en/ko).

* fix(sessions): prune card wrap-content width + shorter cleanup label

The prune card dropped its fixed 52dp width but kept fillMaxSize on the
inner Box — as an unweighted Row child that expands to the full row
width, starving the weighted Total/Messages cards (reported broken on
device). The Box now fills height only, so the Card wraps to its
content (icon + 'Prune').

Empty-session cleanup button label shortened to 'Delete empty'.

* fix(sessions): stack prune label under icon, cleanup button reads 'Empty'

- Prune card: trash icon above the 'Prune' label (column layout),
  still wrap-content width so Total/Messages keep their space.
- Empty-session cleanup button label shortened to 'Empty'.

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-08-09 15:35:42 +03:00
1 parent 3b033a025b
commit 57dc4cdf5c
6 files changed
+108 -43

No files matched your search

+2 -4
View File
@@ -506,13 +506,13 @@
<string name="sessions_search_match_label">Match</string>
<string name="sessions_search_model_label">Model</string>
<string name="sessions_stat_total">Total</string>
<string name="sessions_stat_active">Active</string>
<string name="sessions_stat_messages">Messages</string>
<string name="sessions_action_prune">Prune</string>
<string name="sessions_prune_title">Prune Old Sessions</string>
<string name="sessions_prune_desc">Delete sessions older than the specified number of days.</string>
<string name="sessions_prune_days_label">Days threshold</string>
<string name="sessions_prune_confirm">Prune</string>
<string name="sessions_empty_cleanup_desc">Delete empty sessions</string>
<string name="sessions_empty_cleanup_desc">Empty</string>
<string name="sessions_empty_cleanup_title">Delete empty sessions?</string>
<string name="sessions_empty_cleanup_message">Delete %1$d empty session(s). Active and archived sessions are kept.</string>
<string name="sessions_empty_cleanup_confirm">Delete</string>
@@ -527,8 +527,6 @@
<string name="sessions_action_rename">Rename</string>
<string name="sessions_rename_title">Rename Session</string>
<string name="sessions_rename_hint">Session title</string>
<string name="content_desc_enter_selection">Select sessions</string>
<string name="content_desc_exit_selection">Exit selection</string>
<!-- Toolsets Screen -->
<string name="toolsets_empty_title">No toolsets reported</string>