Khunndev Sisyphus commited on
Commit
bb3304c
·
1 Parent(s): eef382a

Refine the results dock and group panel with a hero total and polished controls.

Browse files

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

frontend/src/components/GroupPanel.tsx CHANGED
@@ -38,27 +38,43 @@ export function GroupPanel({
38
  type="button"
39
  onClick={() => onSelectGroup(g.id)}
40
  className={cn(
41
- 'flex min-h-[56px] w-full items-center gap-3 px-4 text-left transition-colors duration-150',
42
  selected ? 'bg-[var(--surface-active)]' : 'active:bg-[var(--surface-2)]',
43
  )}
44
  >
 
45
  <span
46
- className="h-3 w-3 shrink-0 rounded-full ring-2 ring-[var(--hairline)]"
 
 
 
 
 
 
47
  style={{ background: g.color }}
48
  />
49
 
50
- <span className="flex-1 text-[15px] text-[var(--text)]">{g.label}</span>
51
 
52
  <div className="flex items-center gap-2" onClick={(e) => e.stopPropagation()}>
53
  {mismatch && (
54
- <span className="text-xs font-semibold text-[var(--warning)]">≠{g.expected}</span>
 
 
 
 
 
 
 
 
55
  )}
56
  <input
57
  type="number"
58
  inputMode="numeric"
59
  min={0}
60
  placeholder={t(lang, 'expected')}
61
- className="h-8 w-20 rounded-xl border border-[var(--border)] bg-[var(--surface)] px-2.5 text-center text-sm text-[var(--text)] placeholder:text-[var(--text-faint)] focus:outline-none focus:ring-2 focus:ring-[var(--brand-ring)]"
 
62
  value={g.expected ?? ''}
63
  onChange={(e) => {
64
  const v = e.target.value
@@ -69,9 +85,10 @@ export function GroupPanel({
69
 
70
  <span
71
  className={cn(
72
- 'min-w-[2.5rem] text-right text-2xl font-bold tabular-nums leading-none',
73
  mismatch ? 'text-[var(--warning)]' : 'text-[var(--brand)]',
74
  )}
 
75
  >
76
  {count}
77
  </span>
 
38
  type="button"
39
  onClick={() => onSelectGroup(g.id)}
40
  className={cn(
41
+ 'relative flex min-h-[56px] w-full items-center gap-3 px-4 text-left transition-colors duration-150',
42
  selected ? 'bg-[var(--surface-active)]' : 'active:bg-[var(--surface-2)]',
43
  )}
44
  >
45
+ {/* selection accent — group's own colour */}
46
  <span
47
+ aria-hidden
48
+ className="absolute left-0 top-3 bottom-3 w-[3px] rounded-r-full transition-opacity duration-200"
49
+ style={{ background: g.color, opacity: selected ? 1 : 0 }}
50
+ />
51
+
52
+ <span
53
+ className="h-3 w-3 shrink-0 rounded-full ring-1 ring-[var(--hairline)] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.08)]"
54
  style={{ background: g.color }}
55
  />
56
 
57
+ <span className="flex-1 text-[15px] font-medium text-[var(--text)]">{g.label}</span>
58
 
59
  <div className="flex items-center gap-2" onClick={(e) => e.stopPropagation()}>
60
  {mismatch && (
61
+ <span
62
+ className="ct-badge ct-badge--warning !gap-1 !px-1.5 !py-0.5 !text-[11px]"
63
+ title={t(lang, 'mismatch')}
64
+ >
65
+ <span className="inline-flex h-1.5 w-1.5 rounded-full bg-[var(--warning)]" />
66
+ <span className="tabular-nums" style={{ fontFamily: 'var(--font-mono)' }}>
67
+ {g.expected}
68
+ </span>
69
+ </span>
70
  )}
71
  <input
72
  type="number"
73
  inputMode="numeric"
74
  min={0}
75
  placeholder={t(lang, 'expected')}
76
+ className="h-8 w-20 rounded-[var(--r-md)] border border-[var(--hairline-strong)] bg-[var(--surface)] px-2.5 text-center text-sm tabular-nums text-[var(--text)] shadow-[var(--shadow-inset)] placeholder:text-[var(--text-faint)] focus:border-[var(--brand)] focus:shadow-none focus:outline-none focus:ring-2 focus:ring-[var(--brand-ring)]"
77
+ style={{ fontFamily: 'var(--font-mono)' }}
78
  value={g.expected ?? ''}
79
  onChange={(e) => {
80
  const v = e.target.value
 
85
 
86
  <span
87
  className={cn(
88
+ 'min-w-[2.5rem] text-right text-2xl font-bold leading-none tabular-nums',
89
  mismatch ? 'text-[var(--warning)]' : 'text-[var(--brand)]',
90
  )}
91
+ style={{ fontFamily: 'var(--font-mono)' }}
92
  >
93
  {count}
94
  </span>
frontend/src/components/ResultsDock.tsx CHANGED
@@ -51,23 +51,19 @@ export function ResultsDock({
51
 
52
  return (
53
  <div
54
- className="rise-enter native-scroll max-h-[46vh] shrink-0 overflow-y-auto border-t border-[var(--hairline)] bg-[var(--header-bg)] shadow-[0_-4px_24px_rgba(15,23,42,0.06)]"
55
  style={{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))' }}
56
  >
57
  {/* count + groups */}
58
- <div className="flex items-end justify-between gap-3 px-4 pt-3">
59
- <div>
60
- <p className="text-[10px] font-semibold uppercase tracking-widest text-[var(--text-faint)]">
61
- {t(lang, 'total')}
62
- </p>
63
- <p className="text-[40px] font-bold tabular-nums leading-none text-[var(--brand)]">
64
- {total}
65
- </p>
66
  </div>
67
 
68
  {groups.length > 1 && (
69
- <div className="flex max-w-[58%] flex-wrap justify-end gap-1.5">
70
- {groups.map((g) => {
71
  const active = g.id === selectedGroupId
72
  const count = counts[g.id] ?? 0
73
  const diff = g.expected !== undefined && g.expected !== count
@@ -76,16 +72,37 @@ export function ResultsDock({
76
  key={g.id}
77
  type="button"
78
  onClick={() => onSelectGroup(g.id)}
 
 
 
 
79
  className={cn(
80
- 'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold transition-colors',
81
  active
82
- ? 'border-[var(--brand)] bg-[var(--brand-light)] text-[var(--brand)]'
83
- : 'border-[var(--hairline)] bg-[var(--surface)] text-[var(--text-dim)]',
84
  )}
85
  >
86
- <span className="h-2 w-2 rounded-full" style={{ background: g.color }} />
87
- {g.label}: {count}
88
- {diff && <span className="text-[var(--warning)]">≠</span>}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  </button>
90
  )
91
  })}
@@ -95,14 +112,17 @@ export function ResultsDock({
95
 
96
  {/* expected count for selected group */}
97
  {selected && groups.length > 0 && (
98
- <div className="mt-2 flex items-center gap-2 px-4">
99
  <span
100
- className="h-2.5 w-2.5 shrink-0 rounded-full"
101
  style={{ background: selected.color }}
102
  />
103
- <span className="flex-1 text-sm text-[var(--text-dim)]">{selected.label}</span>
 
 
104
  {mismatch && (
105
- <span className="text-xs font-semibold text-[var(--warning)]">
 
106
  {t(lang, 'mismatch')}
107
  </span>
108
  )}
@@ -111,34 +131,42 @@ export function ResultsDock({
111
  inputMode="numeric"
112
  min={0}
113
  placeholder={t(lang, 'expected')}
114
- className="h-8 w-[4.5rem] rounded-lg border border-[var(--border)] bg-[var(--surface)] px-2 text-center text-sm text-[var(--text)] placeholder:text-[var(--text-faint)] focus:outline-none focus:ring-2 focus:ring-[var(--brand-ring)]"
 
115
  value={selected.expected ?? ''}
116
  onChange={(e) => {
117
  const v = e.target.value
118
  onExpectedChange(selected.id, v === '' ? undefined : Number(v))
119
  }}
120
  />
121
- <span className="min-w-[2rem] text-right text-lg font-bold tabular-nums text-[var(--brand)]">
 
 
 
122
  {counts[selected.id] ?? 0}
123
  </span>
124
  </div>
125
  )}
126
 
127
- {/* tools */}
128
  <div className="mt-3 px-3">
129
- <p className="mb-1.5 px-1 text-[10px] font-semibold uppercase tracking-widest text-[var(--text-faint)]">
130
- {t(lang, 'tools')}
131
- </p>
132
- <div className="grid grid-cols-5 gap-1 rounded-xl border border-[var(--hairline)] bg-[var(--surface-2)] p-1">
133
- {TOOLS.map(({ id, icon: Icon, labelKey, activeClass }) => {
134
  const active = tool === id
135
  return (
136
  <button
137
  key={id}
138
  type="button"
 
 
 
 
139
  className={cn(
140
- 'flex flex-col items-center gap-0.5 rounded-lg py-2 text-[10px] font-semibold transition-all active:scale-95',
141
- active ? activeClass : 'text-[var(--text-dim)]',
 
 
142
  )}
143
  onClick={() => onToolChange(id)}
144
  >
@@ -155,25 +183,21 @@ export function ResultsDock({
155
 
156
  {/* primary actions */}
157
  <div className="mt-3 grid grid-cols-3 gap-2 px-4">
158
- <button type="button" className="ct-btn-secondary !min-h-11 !text-sm" onClick={onNewPhoto}>
159
  <Camera size={16} />
160
  {t(lang, 'resultsBack')}
161
  </button>
162
- <button
163
- type="button"
164
- className="flex min-h-11 items-center justify-center gap-1.5 rounded-[var(--r-lg)] border border-[var(--border)] bg-[var(--surface)] text-sm font-semibold text-[var(--text)] shadow-[var(--shadow-sm)] active:scale-[0.98] active:bg-[var(--surface-2)]"
165
- onClick={onRecount}
166
- >
167
  <RotateCcw size={16} />
168
  {t(lang, 'recount')}
169
  </button>
170
- <button type="button" className="ct-btn-primary !min-h-11 !text-sm" onClick={onExport}>
171
  <Download size={16} />
172
  {t(lang, 'export')}
173
  </button>
174
  </div>
175
 
176
- <p className="mt-2 pb-1 text-center text-[10px] font-medium tracking-wide text-[var(--text-faint)]">
177
  {t(lang, 'creditFooter')}
178
  </p>
179
  </div>
 
51
 
52
  return (
53
  <div
54
+ className="rise-enter native-scroll max-h-[46vh] shrink-0 overflow-y-auto border-t border-[var(--hairline-strong)] bg-[var(--header-bg)] shadow-[0_-6px_30px_rgba(15,23,42,0.08)]"
55
  style={{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))' }}
56
  >
57
  {/* count + groups */}
58
+ <div className="flex items-start justify-between gap-3 px-4 pt-3.5">
59
+ <div className="shrink-0">
60
+ <p className="ct-section-label mb-1">{t(lang, 'total')}</p>
61
+ <p className="ct-count">{total}</p>
 
 
 
 
62
  </div>
63
 
64
  {groups.length > 1 && (
65
+ <div className="flex max-w-[58%] flex-wrap justify-end gap-1.5 pt-1.5">
66
+ {groups.map((g, idx) => {
67
  const active = g.id === selectedGroupId
68
  const count = counts[g.id] ?? 0
69
  const diff = g.expected !== undefined && g.expected !== count
 
72
  key={g.id}
73
  type="button"
74
  onClick={() => onSelectGroup(g.id)}
75
+ style={{
76
+ animation: 'rise 0.32s var(--ease-out) both',
77
+ animationDelay: `${0.05 + idx * 0.04}s`,
78
+ }}
79
  className={cn(
80
+ 'inline-flex items-center gap-1.5 rounded-[var(--r-pill)] border px-2.5 py-1 text-xs font-semibold transition-all duration-150 active:scale-95',
81
  active
82
+ ? 'border-[var(--brand)] bg-[var(--brand-light)] text-[var(--brand)] shadow-[var(--shadow-xs)]'
83
+ : 'border-[var(--hairline)] bg-[var(--surface)] text-[var(--text-dim)] hover:border-[var(--hairline-strong)] hover:text-[var(--text)]',
84
  )}
85
  >
86
+ <span
87
+ className="h-2 w-2 rounded-full shadow-[inset_0_0_0_1px_rgba(0,0,0,0.08)]"
88
+ style={{ background: g.color }}
89
+ />
90
+ <span>{g.label}</span>
91
+ <span
92
+ className={cn(
93
+ 'font-bold tabular-nums',
94
+ active ? 'text-[var(--brand)]' : 'text-[var(--text)]',
95
+ )}
96
+ style={{ fontFamily: 'var(--font-mono)' }}
97
+ >
98
+ {count}
99
+ </span>
100
+ {diff && (
101
+ <span
102
+ className="ml-0.5 inline-flex h-1.5 w-1.5 rounded-full bg-[var(--warning)] shadow-[0_0_0_2px_var(--warning-light)]"
103
+ aria-label={t(lang, 'mismatch')}
104
+ />
105
+ )}
106
  </button>
107
  )
108
  })}
 
112
 
113
  {/* expected count for selected group */}
114
  {selected && groups.length > 0 && (
115
+ <div className="mx-4 mt-2.5 flex items-center gap-2.5 rounded-[var(--r-lg)] border border-[var(--hairline)] bg-[var(--surface-2)] px-3 py-2">
116
  <span
117
+ className="h-2.5 w-2.5 shrink-0 rounded-full shadow-[inset_0_0_0_1px_rgba(0,0,0,0.08)]"
118
  style={{ background: selected.color }}
119
  />
120
+ <span className="flex-1 truncate text-[13px] font-medium text-[var(--text-dim)]">
121
+ {selected.label}
122
+ </span>
123
  {mismatch && (
124
+ <span className="ct-badge ct-badge--warning !gap-1 !px-2 !py-0.5 !text-[11px]">
125
+ <span className="inline-flex h-1.5 w-1.5 rounded-full bg-[var(--warning)]" />
126
  {t(lang, 'mismatch')}
127
  </span>
128
  )}
 
131
  inputMode="numeric"
132
  min={0}
133
  placeholder={t(lang, 'expected')}
134
+ className="h-8 w-[4.5rem] rounded-[var(--r-md)] border border-[var(--hairline-strong)] bg-[var(--surface)] px-2 text-center text-sm tabular-nums text-[var(--text)] shadow-[var(--shadow-inset)] placeholder:text-[var(--text-faint)] focus:border-[var(--brand)] focus:shadow-none focus:outline-none focus:ring-2 focus:ring-[var(--brand-ring)]"
135
+ style={{ fontFamily: 'var(--font-mono)' }}
136
  value={selected.expected ?? ''}
137
  onChange={(e) => {
138
  const v = e.target.value
139
  onExpectedChange(selected.id, v === '' ? undefined : Number(v))
140
  }}
141
  />
142
+ <span
143
+ className="min-w-[2rem] text-right text-xl font-bold leading-none tabular-nums text-[var(--brand)]"
144
+ style={{ fontFamily: 'var(--font-mono)' }}
145
+ >
146
  {counts[selected.id] ?? 0}
147
  </span>
148
  </div>
149
  )}
150
 
151
+ {/* tools — segmented control */}
152
  <div className="mt-3 px-3">
153
+ <p className="ct-section-label mb-1.5 px-1">{t(lang, 'tools')}</p>
154
+ <div className="grid grid-cols-5 gap-1 rounded-[var(--r-lg)] border border-[var(--hairline)] bg-[var(--surface-sunken)] p-1 shadow-[var(--shadow-inset)]">
155
+ {TOOLS.map(({ id, icon: Icon, labelKey, activeClass }, idx) => {
 
 
156
  const active = tool === id
157
  return (
158
  <button
159
  key={id}
160
  type="button"
161
+ style={{
162
+ animation: 'rise 0.30s var(--ease-out) both',
163
+ animationDelay: `${0.05 + idx * 0.035}s`,
164
+ }}
165
  className={cn(
166
+ 'flex flex-col items-center gap-1 rounded-[var(--r-md)] py-2 text-[10px] font-semibold transition-all duration-150 active:scale-95',
167
+ active
168
+ ? cn(activeClass, 'shadow-[var(--shadow-sm)]')
169
+ : 'text-[var(--text-dim)] hover:bg-[var(--surface)] hover:text-[var(--text)]',
170
  )}
171
  onClick={() => onToolChange(id)}
172
  >
 
183
 
184
  {/* primary actions */}
185
  <div className="mt-3 grid grid-cols-3 gap-2 px-4">
186
+ <button type="button" className="ct-btn-secondary !min-h-11 !gap-1.5 !text-sm" onClick={onNewPhoto}>
187
  <Camera size={16} />
188
  {t(lang, 'resultsBack')}
189
  </button>
190
+ <button type="button" className="ct-btn-secondary !min-h-11 !gap-1.5 !text-sm" onClick={onRecount}>
 
 
 
 
191
  <RotateCcw size={16} />
192
  {t(lang, 'recount')}
193
  </button>
194
+ <button type="button" className="ct-btn-primary !min-h-11 !gap-1.5 !text-sm" onClick={onExport}>
195
  <Download size={16} />
196
  {t(lang, 'export')}
197
  </button>
198
  </div>
199
 
200
+ <p className="mt-2.5 pb-1 text-center text-[10px] font-medium tracking-wide text-[var(--text-faint)]">
201
  {t(lang, 'creditFooter')}
202
  </p>
203
  </div>