Skip to content

Commit e379128

Browse files
style: adopt PR #129 quota-strip sizing and card rhythm on chat list
The 5h/7d strip uses #129's measured layout — styrene_24 percentages in fixed right-aligned columns, styrene_20 dim tags, a 30px vertically centered band — and its vertical rhythm: list top at 148, 10px card gaps (90px pitch, keeping the mid-card clip affordance). Card internals unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 424abb2 commit e379128

1 file changed

Lines changed: 43 additions & 23 deletions

File tree

firmware/src/ui.cpp

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,21 @@ static void apply_anim_visibility(void); // status-line rule (§2.3)
488488
// Geometry — the capability gate limits these views to 480×480-class panels
489489
// (the S3 2.16 and the sim); other geometries need a layout pass before their
490490
// flag can flip, so these are tuned constants, not breakpoints.
491-
#define CHAT_QSTRIP_Y 104 // chats view: one-line quota strip
492-
#define CHAT_LIST_Y 140 // top of the card viewport
493-
#define CHAT_CARD_PITCH 88
491+
// Quota strip + vertical rhythm ported from PR #129's combined 5h/7d row
492+
// (the visual language issue #135 credits): a 30px band at content_y with
493+
// dim styrene_20 tags, styrene_24 percentages in a fixed right-aligned
494+
// column, 10px bars, and a 14px(+4) gap down to the first card.
495+
#define CHAT_ROW_H 30 // strip band height; text/bar vcentered in it
496+
#define CHAT_ROW_BAR_H 10
497+
#define CHAT_ROW_LBL_W 32 // "5h"/"7d" column
498+
#define CHAT_ROW_PCT_W 58 // percentage column (right-aligned, fixed)
499+
#define CHAT_ROW_COL_GAP 12 // label|bar|pct column gap
500+
#define CHAT_ROW_HALF_GAP 20 // between the 5h and 7d halves
501+
#define CHAT_ROW_GAP 14 // strip band ↓ card list (plus 4, per #129)
494502
#define CHAT_CARD_H 80
503+
#define CHAT_CARD_GAP 10 // between cards (#129 ch_card_gap)
504+
#define CHAT_CARD_PITCH (CHAT_CARD_H + CHAT_CARD_GAP)
495505
#define CHAT_CARD_PAD_Y 8
496-
#define CHAT_LIST_H (3 * CHAT_CARD_PITCH + CHAT_CARD_PITCH / 2) // 3.5 pitches (§2.5)
497506
// ONE-CHAT: two boxes — the 5h quota panel (exact RESTING "Current" panel)
498507
// on top, the chat card below it.
499508
#define FOCUS_CARD_H 150
@@ -1133,29 +1142,40 @@ static void build_session_views(lv_obj_t* parent) {
11331142

11341143
// ---- SEVERAL-CHATS (§1.4): one-line quota strip + the card list ----
11351144
chats_group = make_session_group(parent);
1136-
const int half = L.content_w / 2;
1137-
// Tags and percentages center on the bar: the label line box is taller
1138-
// than the bar, so its y derives from the bar's midline. Measured against
1139-
// zoomed screenshots: Styrene's digit mass centers on its line box, so no
1140-
// extra nudge is needed.
1141-
const int strip_lh = lv_font_get_line_height(&font_styrene_16);
1142-
const int strip_bar_h = 10;
1143-
const int strip_txt_y = CHAT_QSTRIP_Y + strip_bar_h / 2 - strip_lh / 2;
1145+
// Combined 5h/7d row, PR #129 geometry: [dim tag | bar | big pct] twice,
1146+
// each element vertically centered in the CHAT_ROW_H band.
1147+
const int half = (L.content_w - CHAT_ROW_HALF_GAP) / 2;
1148+
const int strip_bar_w = half - CHAT_ROW_LBL_W - CHAT_ROW_PCT_W - 2 * CHAT_ROW_COL_GAP;
1149+
const int tag_y = L.content_y +
1150+
(CHAT_ROW_H - lv_font_get_line_height(&font_styrene_20)) / 2;
1151+
const int pct_y = L.content_y +
1152+
(CHAT_ROW_H - lv_font_get_line_height(&font_styrene_24)) / 2;
11441153
for (int i = 0; i < 2; i++) {
1145-
const int x0 = L.margin + i * (half + 10);
1146-
cq_tag[i] = make_card_label(chats_group, &font_styrene_16, COL_DIM);
1147-
lv_obj_set_pos(cq_tag[i], x0, strip_txt_y);
1148-
cq_bar[i] = make_bar(chats_group, x0 + 32, CHAT_QSTRIP_Y, 122, strip_bar_h);
1149-
cq_pct[i] = make_card_label(chats_group, &font_styrene_16, COL_TEXT);
1150-
lv_obj_set_pos(cq_pct[i], x0 + 164, strip_txt_y);
1154+
const int x0 = L.margin + i * (half + CHAT_ROW_HALF_GAP);
1155+
cq_tag[i] = make_card_label(chats_group, &font_styrene_20, COL_DIM);
1156+
lv_obj_set_width(cq_tag[i], CHAT_ROW_LBL_W);
1157+
lv_obj_set_pos(cq_tag[i], x0, tag_y);
1158+
cq_bar[i] = make_bar(chats_group,
1159+
x0 + CHAT_ROW_LBL_W + CHAT_ROW_COL_GAP,
1160+
L.content_y + (CHAT_ROW_H - CHAT_ROW_BAR_H) / 2,
1161+
strip_bar_w, CHAT_ROW_BAR_H);
1162+
cq_pct[i] = make_card_label(chats_group, &font_styrene_24, COL_TEXT);
1163+
lv_obj_set_width(cq_pct[i], CHAT_ROW_PCT_W);
1164+
lv_obj_set_style_text_align(cq_pct[i], LV_TEXT_ALIGN_RIGHT, 0);
1165+
lv_obj_set_pos(cq_pct[i],
1166+
x0 + CHAT_ROW_LBL_W + 2 * CHAT_ROW_COL_GAP + strip_bar_w,
1167+
pct_y);
11511168
}
11521169

1153-
// Card viewport: sized to 3½ card pitches so an overfull list is visibly
1154-
// cut mid-card (§2.5). No scrolling in this round — ordering guarantees
1155-
// everything urgent is above the fold.
1170+
// Card viewport: fills from the strip down to the bottom margin, so an
1171+
// overfull list is visibly cut mid-card (§2.5 — with the #129 pitch the
1172+
// 4th card shows 42 of 80 px). No scrolling in this round — ordering
1173+
// guarantees everything urgent is above the fold.
1174+
const int list_y = L.content_y + CHAT_ROW_H + CHAT_ROW_GAP + 4; // #129 ch_list_y
1175+
const int list_h = L.scr_h - L.margin - list_y;
11561176
cards_cont = lv_obj_create(chats_group);
1157-
lv_obj_set_pos(cards_cont, L.margin, CHAT_LIST_Y);
1158-
lv_obj_set_size(cards_cont, L.content_w, CHAT_LIST_H);
1177+
lv_obj_set_pos(cards_cont, L.margin, list_y);
1178+
lv_obj_set_size(cards_cont, L.content_w, list_h);
11591179
lv_obj_set_style_bg_opa(cards_cont, LV_OPA_TRANSP, 0);
11601180
lv_obj_set_style_border_width(cards_cont, 0, 0);
11611181
lv_obj_set_style_pad_all(cards_cont, 0, 0);

0 commit comments

Comments
 (0)