Khunndev Cursor commited on
Commit
bd603dd
Β·
1 Parent(s): 12c56cd

Renovate UI: directional native navigation, design tokens, dead-code cleanup

Browse files
frontend/src/App.tsx CHANGED
@@ -14,8 +14,16 @@ const STEPS: Step[] = ['capture', 'preview', 'counting', 'results']
14
 
15
  export default function App() {
16
  const [step, setStep] = useState<Step>('capture')
 
17
  const [lang, setLang] = useState<Lang>('th')
18
 
 
 
 
 
 
 
 
19
  // image
20
  const [image, setImage] = useState<HTMLImageElement | null>(null)
21
  const [imageSrc, setImageSrc] = useState('')
@@ -58,7 +66,7 @@ export default function App() {
58
  setImageDims({ w: img.naturalWidth, h: img.naturalHeight })
59
  setDetections([])
60
  setGroups([])
61
- setStep('preview')
62
  }
63
  img.src = url
64
  }
@@ -70,7 +78,7 @@ export default function App() {
70
  if (!image) return
71
  setBusy(true)
72
  setStatus(t(lang, 'processing'))
73
- setStep('counting')
74
  try {
75
  const dets = await runDetection(image, {
76
  useTiling,
@@ -83,10 +91,10 @@ export default function App() {
83
  setDetections(clustered.detections)
84
  setGroups(clustered.groups)
85
  setStatus(`Done (${getActiveBackend()})`)
86
- setStep('results')
87
  } catch (err) {
88
  setStatus(String(err))
89
- setStep('preview')
90
  } finally {
91
  setBusy(false)
92
  }
@@ -103,7 +111,7 @@ export default function App() {
103
  }
104
 
105
  const resetToCapture = () => {
106
- setStep('capture')
107
  setDetections([])
108
  setGroups([])
109
  setImage(null)
@@ -116,10 +124,10 @@ export default function App() {
116
  const stepIdx = STEPS.indexOf(step)
117
 
118
  return (
119
- <div className="fixed inset-0 flex flex-col overflow-hidden bg-[#020617]">
120
  {/* ── Header ──────────────────────────────────────────────────── */}
121
  <header
122
- className="relative flex shrink-0 items-center justify-between bg-[#020617] px-4"
123
  style={{
124
  paddingTop: 'max(0.75rem, env(safe-area-inset-top))',
125
  paddingBottom: '0.625rem',
@@ -130,7 +138,7 @@ export default function App() {
130
  <div className="relative">
131
  <img src="/icon.svg" alt="" className="h-7 w-7 rounded-xl" />
132
  <span
133
- className={`absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full border-2 border-[#020617] transition-colors duration-700 ${
134
  modelReady ? 'bg-emerald-400' : 'animate-pulse bg-amber-400'
135
  }`}
136
  />
@@ -169,8 +177,8 @@ export default function App() {
169
  <div className="absolute inset-x-0 bottom-0 h-px bg-gradient-to-r from-transparent via-white/10 to-transparent" />
170
  </header>
171
 
172
- {/* ── Step views β€” key forces remount β†’ triggers step-enter CSS animation ── */}
173
- <div key={step} className="step-enter flex flex-1 flex-col overflow-hidden">
174
  {step === 'capture' && (
175
  <StepCapture
176
  lang={lang}
@@ -214,7 +222,7 @@ export default function App() {
214
  counts={counts}
215
  onUpdate={setDetections}
216
  onExpectedChange={handleExpectedChange}
217
- onRecount={() => { setStep('preview') }}
218
  onNewPhoto={resetToCapture}
219
  />
220
  )}
 
14
 
15
  export default function App() {
16
  const [step, setStep] = useState<Step>('capture')
17
+ const [navDir, setNavDir] = useState<'push' | 'pop'>('push')
18
  const [lang, setLang] = useState<Lang>('th')
19
 
20
+ // Navigate between steps, deriving the slide direction from step order so the
21
+ // transition reads like a native push (forward) / pop (back) navigation.
22
+ const navigate = (next: Step) => {
23
+ setNavDir(STEPS.indexOf(next) >= STEPS.indexOf(step) ? 'push' : 'pop')
24
+ setStep(next)
25
+ }
26
+
27
  // image
28
  const [image, setImage] = useState<HTMLImageElement | null>(null)
29
  const [imageSrc, setImageSrc] = useState('')
 
66
  setImageDims({ w: img.naturalWidth, h: img.naturalHeight })
67
  setDetections([])
68
  setGroups([])
69
+ navigate('preview')
70
  }
71
  img.src = url
72
  }
 
78
  if (!image) return
79
  setBusy(true)
80
  setStatus(t(lang, 'processing'))
81
+ navigate('counting')
82
  try {
83
  const dets = await runDetection(image, {
84
  useTiling,
 
91
  setDetections(clustered.detections)
92
  setGroups(clustered.groups)
93
  setStatus(`Done (${getActiveBackend()})`)
94
+ navigate('results')
95
  } catch (err) {
96
  setStatus(String(err))
97
+ navigate('preview')
98
  } finally {
99
  setBusy(false)
100
  }
 
111
  }
112
 
113
  const resetToCapture = () => {
114
+ navigate('capture')
115
  setDetections([])
116
  setGroups([])
117
  setImage(null)
 
124
  const stepIdx = STEPS.indexOf(step)
125
 
126
  return (
127
+ <div className="fixed inset-0 flex flex-col overflow-hidden bg-[var(--bg)]">
128
  {/* ── Header ──────────────────────────────────────────────────── */}
129
  <header
130
+ className="relative flex shrink-0 items-center justify-between bg-[var(--bg)] px-4"
131
  style={{
132
  paddingTop: 'max(0.75rem, env(safe-area-inset-top))',
133
  paddingBottom: '0.625rem',
 
138
  <div className="relative">
139
  <img src="/icon.svg" alt="" className="h-7 w-7 rounded-xl" />
140
  <span
141
+ className={`absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full border-2 border-[var(--bg)] transition-colors duration-700 ${
142
  modelReady ? 'bg-emerald-400' : 'animate-pulse bg-amber-400'
143
  }`}
144
  />
 
177
  <div className="absolute inset-x-0 bottom-0 h-px bg-gradient-to-r from-transparent via-white/10 to-transparent" />
178
  </header>
179
 
180
+ {/* ── Step views β€” key forces remount β†’ triggers directional nav animation ── */}
181
+ <div key={step} className={`${navDir === 'push' ? 'nav-push' : 'nav-pop'} flex flex-1 flex-col overflow-hidden`}>
182
  {step === 'capture' && (
183
  <StepCapture
184
  lang={lang}
 
222
  counts={counts}
223
  onUpdate={setDetections}
224
  onExpectedChange={handleExpectedChange}
225
+ onRecount={() => navigate('preview')}
226
  onNewPhoto={resetToCapture}
227
  />
228
  )}
frontend/src/components/DetectionCanvas.tsx DELETED
@@ -1,417 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react'
2
- import type { Detection, DiameterGroup, ToolMode } from '../lib/types'
3
-
4
- interface Props {
5
- image: HTMLImageElement | null
6
- detections: Detection[]
7
- groups: DiameterGroup[]
8
- tool: ToolMode
9
- selectedGroupId: number
10
- onUpdate: (detections: Detection[]) => void
11
- onCanvasReady?: (canvas: HTMLCanvasElement | null) => void
12
- }
13
-
14
- // --- drawing helpers ---
15
-
16
- function hexToRgb(hex: string): [number, number, number] {
17
- const v = parseInt(hex.replace('#', ''), 16)
18
- return [(v >> 16) & 255, (v >> 8) & 255, v & 255]
19
- }
20
-
21
- function drawDetections(
22
- ctx: CanvasRenderingContext2D,
23
- detections: Detection[],
24
- groups: DiameterGroup[],
25
- scale: number,
26
- ) {
27
- const dense = detections.length > 300
28
- const showNumbers = detections.length <= 500
29
-
30
- detections.forEach((d, idx) => {
31
- const group = groups.find((g) => g.id === d.groupId) ?? groups[0]
32
- const color = group?.color ?? '#ef4444'
33
- const [r, g, b] = hexToRgb(color)
34
-
35
- const px = d.xmin * scale
36
- const py = d.ymin * scale
37
- const pw = (d.xmax - d.xmin) * scale
38
- const ph = (d.ymax - d.ymin) * scale
39
- const cx = px + pw / 2
40
- const cy = py + ph / 2
41
- const radius = Math.max(dense ? 4 : 6, Math.min(pw, ph) / 2)
42
-
43
- ctx.save()
44
-
45
- // filled circle – semi-transparent group color
46
- ctx.beginPath()
47
- ctx.arc(cx, cy, radius, 0, Math.PI * 2)
48
- ctx.fillStyle = `rgba(${r},${g},${b},0.30)`
49
- ctx.fill()
50
-
51
- // ring border
52
- ctx.strokeStyle = `rgba(${r},${g},${b},0.90)`
53
- ctx.lineWidth = Math.max(1.5, radius * 0.14)
54
- ctx.stroke()
55
-
56
- // number label centered inside circle
57
- if (!dense && showNumbers && radius >= 7) {
58
- const fs = Math.max(9, Math.min(radius * 0.85, 15))
59
- ctx.font = `bold ${fs}px sans-serif`
60
- ctx.textAlign = 'center'
61
- ctx.textBaseline = 'middle'
62
- // dark shadow for readability
63
- ctx.fillStyle = 'rgba(0,0,0,0.55)'
64
- ctx.fillText(String(idx + 1), cx + 0.6, cy + 0.6)
65
- ctx.fillStyle = '#ffffff'
66
- ctx.fillText(String(idx + 1), cx, cy)
67
- }
68
-
69
- ctx.restore()
70
- })
71
- }
72
-
73
- // --- component ---
74
-
75
- export function DetectionCanvas({
76
- image,
77
- detections,
78
- groups,
79
- tool,
80
- selectedGroupId,
81
- onUpdate,
82
- onCanvasReady,
83
- }: Props) {
84
- const containerRef = useRef<HTMLDivElement>(null)
85
- const canvasRef = useRef<HTMLCanvasElement>(null)
86
-
87
- // Area selection (image coords)
88
- const areaRef = useRef<{ x1: number; y1: number; x2: number; y2: number } | null>(null)
89
- const areaStartRef = useRef<{ x: number; y: number } | null>(null)
90
-
91
- // Zoom / pan (client coords)
92
- const transformRef = useRef({ scale: 1, tx: 0, ty: 0 })
93
-
94
- // Multi-touch tracking
95
- const activeRef = useRef(new Map<number, { x: number; y: number }>())
96
- const pinchRef = useRef<{ dist: number; mx: number; my: number } | null>(null)
97
- // Pan (one finger in view mode, or while zoomed)
98
- const panStartRef = useRef<{ x: number; y: number; tx: number; ty: number } | null>(null)
99
- // Double tap
100
- const lastTapRef = useRef(0)
101
- // Display zoom scale for UI
102
- const [displayScale, setDisplayScale] = useState(1)
103
-
104
- useEffect(() => {
105
- onCanvasReady?.(canvasRef.current)
106
- }, [onCanvasReady, image, detections])
107
-
108
- // Render canvas content
109
- useEffect(() => {
110
- const canvas = canvasRef.current
111
- if (!canvas || !image) {
112
- return
113
- }
114
- const ctx = canvas.getContext('2d')
115
- if (!ctx) {
116
- return
117
- }
118
-
119
- const maxW = canvas.parentElement?.clientWidth ?? image.naturalWidth
120
- const scale = Math.min(1, maxW / image.naturalWidth)
121
- canvas.width = Math.round(image.naturalWidth * scale)
122
- canvas.height = Math.round(image.naturalHeight * scale)
123
-
124
- ctx.clearRect(0, 0, canvas.width, canvas.height)
125
- ctx.drawImage(image, 0, 0, canvas.width, canvas.height)
126
-
127
- drawDetections(ctx, detections, groups, scale)
128
-
129
- const area = areaRef.current
130
- if (area) {
131
- ctx.save()
132
- ctx.strokeStyle = 'rgba(255,255,255,0.9)'
133
- ctx.fillStyle = 'rgba(255,255,255,0.08)'
134
- ctx.lineWidth = 2
135
- ctx.setLineDash([6, 4])
136
- const ax = area.x1 * scale
137
- const ay = area.y1 * scale
138
- const aw = (area.x2 - area.x1) * scale
139
- const ah = (area.y2 - area.y1) * scale
140
- ctx.fillRect(ax, ay, aw, ah)
141
- ctx.strokeRect(ax, ay, aw, ah)
142
- ctx.restore()
143
- }
144
- }, [image, detections, groups])
145
-
146
- // --- transform helpers ---
147
-
148
- const applyTransform = () => {
149
- const canvas = canvasRef.current
150
- if (!canvas) {
151
- return
152
- }
153
- const { scale, tx, ty } = transformRef.current
154
- canvas.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`
155
- setDisplayScale(scale)
156
- }
157
-
158
- const clampTransform = () => {
159
- const canvas = canvasRef.current
160
- const container = containerRef.current
161
- if (!canvas || !container) {
162
- return
163
- }
164
- const t = transformRef.current
165
- if (t.scale <= 1) {
166
- transformRef.current = { scale: 1, tx: 0, ty: 0 }
167
- } else {
168
- const cw = container.clientWidth
169
- const ch = container.clientHeight
170
- // canvas layout size (unscaled)
171
- const lw = canvas.offsetWidth
172
- const lh = canvas.offsetHeight
173
- t.tx = Math.min(0, Math.max(cw - lw * t.scale, t.tx))
174
- t.ty = Math.min(0, Math.max(ch - lh * t.scale, t.ty))
175
- }
176
- setDisplayScale(transformRef.current.scale)
177
- applyTransform()
178
- }
179
-
180
- // Convert client pointer position β†’ image-space coordinates
181
- const toImageCoords = (clientX: number, clientY: number) => {
182
- const canvas = canvasRef.current!
183
- const rect = canvas.getBoundingClientRect()
184
- return {
185
- x: ((clientX - rect.left) / rect.width) * image!.naturalWidth,
186
- y: ((clientY - rect.top) / rect.height) * image!.naturalHeight,
187
- }
188
- }
189
-
190
- const findHit = (x: number, y: number) => {
191
- for (let i = detections.length - 1; i >= 0; i--) {
192
- const d = detections[i]
193
- if (x >= d.xmin && x <= d.xmax && y >= d.ymin && y <= d.ymax) {
194
- return i
195
- }
196
- }
197
- return -1
198
- }
199
-
200
- // --- pointer event handlers ---
201
-
202
- const handlePointerDown = (e: React.PointerEvent) => {
203
- if (!image) {
204
- return
205
- }
206
- e.currentTarget.setPointerCapture(e.pointerId)
207
- activeRef.current.set(e.pointerId, { x: e.clientX, y: e.clientY })
208
-
209
- // Two-finger pinch start
210
- if (activeRef.current.size === 2) {
211
- panStartRef.current = null
212
- areaStartRef.current = null
213
- const pts = [...activeRef.current.values()]
214
- const dist = Math.hypot(pts[1].x - pts[0].x, pts[1].y - pts[0].y)
215
- const mx = (pts[0].x + pts[1].x) / 2
216
- const my = (pts[0].y + pts[1].y) / 2
217
- pinchRef.current = { dist, mx, my }
218
- return
219
- }
220
-
221
- if (activeRef.current.size > 2) {
222
- return
223
- }
224
-
225
- // Double-tap to reset zoom
226
- const now = Date.now()
227
- if (now - lastTapRef.current < 280) {
228
- transformRef.current = { scale: 1, tx: 0, ty: 0 }
229
- applyTransform()
230
- lastTapRef.current = 0
231
- pinchRef.current = null
232
- panStartRef.current = null
233
- return
234
- }
235
- lastTapRef.current = now
236
-
237
- // While zoomed or in view mode: pan
238
- if (transformRef.current.scale > 1 || tool === 'view') {
239
- panStartRef.current = { x: e.clientX, y: e.clientY, tx: transformRef.current.tx, ty: transformRef.current.ty }
240
- return
241
- }
242
-
243
- // Edit tools
244
- const { x, y } = toImageCoords(e.clientX, e.clientY)
245
-
246
- if (tool === 'area') {
247
- areaStartRef.current = { x, y }
248
- areaRef.current = { x1: x, y1: y, x2: x, y2: y }
249
- return
250
- }
251
-
252
- const hit = findHit(x, y)
253
- if (tool === 'delete' && hit >= 0) {
254
- onUpdate(detections.filter((_, i) => i !== hit))
255
- return
256
- }
257
- if (tool === 'reassign' && hit >= 0) {
258
- onUpdate(detections.map((d, i) => (i === hit ? { ...d, groupId: selectedGroupId, manual: true } : d)))
259
- return
260
- }
261
- if (tool === 'add') {
262
- const size = 24
263
- onUpdate([
264
- ...detections,
265
- {
266
- id: `manual-${Date.now()}`,
267
- xmin: x - size / 2,
268
- ymin: y - size / 2,
269
- xmax: x + size / 2,
270
- ymax: y + size / 2,
271
- confidence: 1,
272
- groupId: selectedGroupId,
273
- manual: true,
274
- },
275
- ])
276
- }
277
- }
278
-
279
- const handlePointerMove = (e: React.PointerEvent) => {
280
- if (!activeRef.current.has(e.pointerId)) {
281
- return
282
- }
283
- activeRef.current.set(e.pointerId, { x: e.clientX, y: e.clientY })
284
-
285
- // Pinch zoom + pan
286
- if (activeRef.current.size === 2 && pinchRef.current) {
287
- const pts = [...activeRef.current.values()]
288
- const dist = Math.hypot(pts[1].x - pts[0].x, pts[1].y - pts[0].y)
289
- const mx = (pts[0].x + pts[1].x) / 2
290
- const my = (pts[0].y + pts[1].y) / 2
291
-
292
- const t = transformRef.current
293
- const scaleDelta = dist / pinchRef.current.dist
294
- const newScale = Math.max(1, Math.min(6, t.scale * scaleDelta))
295
-
296
- // zoom centered at pinch midpoint (in canvas layout coords)
297
- const container = containerRef.current
298
- if (container) {
299
- const cr = container.getBoundingClientRect()
300
- const localMx = mx - cr.left
301
- const localMy = my - cr.top
302
- // point in canvas layout before scale
303
- const originX = (localMx - t.tx) / t.scale
304
- const originY = (localMy - t.ty) / t.scale
305
- t.tx = localMx - originX * newScale
306
- t.ty = localMy - originY * newScale
307
- }
308
- t.scale = newScale
309
-
310
- // additionally pan by midpoint movement
311
- t.tx += mx - pinchRef.current.mx
312
- t.ty += my - pinchRef.current.my
313
-
314
- clampTransform()
315
- pinchRef.current = { dist, mx, my }
316
- return
317
- }
318
-
319
- // Single-finger pan
320
- if (panStartRef.current && activeRef.current.size === 1) {
321
- transformRef.current.tx = panStartRef.current.tx + (e.clientX - panStartRef.current.x)
322
- transformRef.current.ty = panStartRef.current.ty + (e.clientY - panStartRef.current.y)
323
- clampTransform()
324
- return
325
- }
326
-
327
- // Area selection drag
328
- if (areaStartRef.current && tool === 'area' && image) {
329
- const { x, y } = toImageCoords(e.clientX, e.clientY)
330
- areaRef.current = {
331
- x1: Math.min(areaStartRef.current.x, x),
332
- y1: Math.min(areaStartRef.current.y, y),
333
- x2: Math.max(areaStartRef.current.x, x),
334
- y2: Math.max(areaStartRef.current.y, y),
335
- }
336
- onUpdate([...detections])
337
- }
338
- }
339
-
340
- const handlePointerUp = (e: React.PointerEvent) => {
341
- if (e.currentTarget.hasPointerCapture(e.pointerId)) {
342
- e.currentTarget.releasePointerCapture(e.pointerId)
343
- }
344
-
345
- // Finish area select
346
- if (tool === 'area' && areaRef.current && areaStartRef.current) {
347
- const a = areaRef.current
348
- if (a.x2 > a.x1 && a.y2 > a.y1) {
349
- onUpdate(
350
- detections.map((d) => {
351
- const cx = (d.xmin + d.xmax) / 2
352
- const cy = (d.ymin + d.ymax) / 2
353
- return cx >= a.x1 && cx <= a.x2 && cy >= a.y1 && cy <= a.y2
354
- ? { ...d, groupId: selectedGroupId, manual: true }
355
- : d
356
- }),
357
- )
358
- }
359
- }
360
-
361
- activeRef.current.delete(e.pointerId)
362
-
363
- if (activeRef.current.size < 2) {
364
- pinchRef.current = null
365
- }
366
- if (activeRef.current.size === 0) {
367
- panStartRef.current = null
368
- areaStartRef.current = null
369
- areaRef.current = null
370
- onUpdate([...detections])
371
- }
372
- }
373
-
374
- const resetZoom = () => {
375
- transformRef.current = { scale: 1, tx: 0, ty: 0 }
376
- setDisplayScale(1)
377
- applyTransform()
378
- }
379
-
380
- if (!image) {
381
- return null
382
- }
383
-
384
- return (
385
- <div
386
- ref={containerRef}
387
- className="relative overflow-hidden rounded-2xl border border-slate-700/80 bg-black shadow-lg"
388
- >
389
- <canvas
390
- ref={canvasRef}
391
- style={{ transformOrigin: '0 0', display: 'block', width: '100%' }}
392
- className="select-none touch-none"
393
- onPointerDown={handlePointerDown}
394
- onPointerMove={handlePointerMove}
395
- onPointerUp={handlePointerUp}
396
- onPointerCancel={handlePointerUp}
397
- />
398
- {/* Zoom badge + reset */}
399
- {displayScale > 1 && (
400
- <button
401
- type="button"
402
- onClick={resetZoom}
403
- className="absolute top-2 right-2 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white/90 backdrop-blur-sm active:scale-95"
404
- aria-label="Reset zoom"
405
- >
406
- {displayScale.toFixed(1)}Γ— βœ•
407
- </button>
408
- )}
409
- {/* Zoom hint (show once when results load) */}
410
- {displayScale === 1 && detections.length > 0 && (
411
- <div className="pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/60 px-3 py-1 text-xs text-white/60 backdrop-blur-sm">
412
- Pinch to zoom Β· double-tap to reset
413
- </div>
414
- )}
415
- </div>
416
- )
417
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/components/EmptyState.tsx DELETED
@@ -1,42 +0,0 @@
1
- import { Camera, ImagePlus } from 'lucide-react'
2
- import { t } from '../lib/i18n'
3
- import type { Lang } from '../lib/types'
4
-
5
- interface Props {
6
- lang: Lang
7
- onCamera: () => void
8
- onGallery: () => void
9
- }
10
-
11
- export function EmptyState({ lang, onCamera, onGallery }: Props) {
12
- return (
13
- <div className="flex flex-1 flex-col items-center justify-center px-4 py-10">
14
- <div className="w-full max-w-sm rounded-2xl border border-dashed border-slate-600/80 bg-slate-900/40 p-8 text-center">
15
- <div className="mx-auto mb-5 flex h-20 w-20 items-center justify-center rounded-full bg-slate-800/80 ring-1 ring-slate-700">
16
- <Camera className="text-blue-400" size={36} strokeWidth={1.5} />
17
- </div>
18
- <h2 className="text-lg font-semibold text-white">{t(lang, 'getStarted')}</h2>
19
- <p className="mt-2 text-sm leading-relaxed text-slate-400">{t(lang, 'noImage')}</p>
20
- <div className="mt-6 flex flex-col gap-3">
21
- <button
22
- type="button"
23
- className="flex h-12 items-center justify-center gap-2 rounded-xl bg-blue-600 text-base font-semibold text-white active:scale-[0.98]"
24
- onClick={onCamera}
25
- >
26
- <Camera size={20} />
27
- {t(lang, 'takePhoto')}
28
- </button>
29
- <button
30
- type="button"
31
- className="flex h-12 items-center justify-center gap-2 rounded-xl bg-slate-800 text-base font-medium text-slate-200 active:scale-[0.98]"
32
- onClick={onGallery}
33
- >
34
- <ImagePlus size={20} />
35
- {t(lang, 'chooseFile')}
36
- </button>
37
- </div>
38
- </div>
39
- <p className="mt-6 text-center text-xs text-slate-500">{t(lang, 'company')}</p>
40
- </div>
41
- )
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/components/ExportSheet.tsx CHANGED
@@ -103,7 +103,7 @@ export function ExportSheet({
103
  className="flex min-h-[50px] w-full items-center justify-center rounded-2xl bg-white/7 text-[15px] font-semibold text-white/70 transition-colors duration-150 active:bg-white/12"
104
  onClick={onClose}
105
  >
106
- Cancel
107
  </button>
108
  </div>
109
  </div>
 
103
  className="flex min-h-[50px] w-full items-center justify-center rounded-2xl bg-white/7 text-[15px] font-semibold text-white/70 transition-colors duration-150 active:bg-white/12"
104
  onClick={onClose}
105
  >
106
+ {t(lang, 'cancel')}
107
  </button>
108
  </div>
109
  </div>
frontend/src/components/MobileHeader.tsx DELETED
@@ -1,55 +0,0 @@
1
- import { Settings } from 'lucide-react'
2
- import { cn } from '../lib/utils'
3
- import { t } from '../lib/i18n'
4
- import type { Lang } from '../lib/types'
5
-
6
- interface Props {
7
- lang: Lang
8
- modelReady: boolean
9
- settingsOpen: boolean
10
- onToggleLang: () => void
11
- onToggleSettings: () => void
12
- }
13
-
14
- export function MobileHeader({ lang, modelReady, settingsOpen, onToggleLang, onToggleSettings }: Props) {
15
- return (
16
- <header className="sticky top-0 z-40 border-b border-slate-800/80 bg-slate-950/90 px-4 pb-3 pt-[max(0.75rem,env(safe-area-inset-top))] backdrop-blur-md">
17
- <div className="flex items-center gap-3">
18
- <img src="/icon.svg" alt="" className="h-10 w-10 shrink-0 rounded-xl" />
19
- <div className="min-w-0 flex-1">
20
- <h1 className="truncate text-base font-bold leading-tight text-white">{t(lang, 'title')}</h1>
21
- <p className="truncate text-xs text-slate-400">{t(lang, 'subtitle')}</p>
22
- </div>
23
- <div className="flex shrink-0 items-center gap-1.5">
24
- <span
25
- className={cn(
26
- 'h-2 w-2 rounded-full',
27
- modelReady ? 'bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.6)]' : 'animate-pulse bg-amber-400',
28
- )}
29
- title={modelReady ? t(lang, 'modelReady') : t(lang, 'loadingModel')}
30
- />
31
- <button
32
- type="button"
33
- className="flex h-10 w-10 items-center justify-center rounded-xl bg-slate-800 text-sm font-medium text-slate-200 active:scale-95"
34
- onClick={onToggleLang}
35
- aria-label="Switch language"
36
- >
37
- {lang === 'th' ? 'EN' : 'TH'}
38
- </button>
39
- <button
40
- type="button"
41
- className={cn(
42
- 'flex h-10 w-10 items-center justify-center rounded-xl active:scale-95',
43
- settingsOpen ? 'bg-blue-600 text-white' : 'bg-slate-800 text-slate-200',
44
- )}
45
- onClick={onToggleSettings}
46
- aria-label={t(lang, 'settings')}
47
- aria-expanded={settingsOpen}
48
- >
49
- <Settings size={18} />
50
- </button>
51
- </div>
52
- </div>
53
- </header>
54
- )
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/components/ProcessingOverlay.tsx DELETED
@@ -1,20 +0,0 @@
1
- import { Loader2 } from 'lucide-react'
2
- import { t } from '../lib/i18n'
3
- import type { Lang } from '../lib/types'
4
-
5
- interface Props {
6
- lang: Lang
7
- status: string
8
- }
9
-
10
- export function ProcessingOverlay({ lang, status }: Props) {
11
- return (
12
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/80 px-6 backdrop-blur-sm">
13
- <div className="w-full max-w-xs rounded-2xl border border-slate-700 bg-slate-900 p-6 text-center shadow-2xl">
14
- <Loader2 className="mx-auto mb-4 animate-spin text-emerald-400" size={40} />
15
- <p className="text-base font-semibold text-white">{t(lang, 'processing')}</p>
16
- <p className="mt-2 line-clamp-3 text-sm text-slate-400">{status || t(lang, 'pleaseWait')}</p>
17
- </div>
18
- </div>
19
- )
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/components/ResultCanvas.tsx CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * ResultCanvas
3
  * Phase 1 – Animation: circles draw in one-by-one (arc sweep) with a count-up.
4
- * Phase 2 – Interactive: zoom/pan + edit tools (same as DetectionCanvas).
5
  * Tap during animation to skip to the final frame.
6
  */
7
  import { useEffect, useRef, useState } from 'react'
 
1
  /**
2
  * ResultCanvas
3
  * Phase 1 – Animation: circles draw in one-by-one (arc sweep) with a count-up.
4
+ * Phase 2 – Interactive: zoom/pan + edit tools.
5
  * Tap during animation to skip to the final frame.
6
  */
7
  import { useEffect, useRef, useState } from 'react'
frontend/src/components/ResultsSummary.tsx DELETED
@@ -1,35 +0,0 @@
1
- import { t } from '../lib/i18n'
2
- import type { DiameterGroup, Lang } from '../lib/types'
3
-
4
- interface Props {
5
- lang: Lang
6
- total: number
7
- groups: DiameterGroup[]
8
- counts: Record<number, number>
9
- }
10
-
11
- export function ResultsSummary({ lang, total, groups, counts }: Props) {
12
- return (
13
- <section className="rounded-2xl border border-emerald-500/30 bg-gradient-to-br from-emerald-950/50 to-slate-900/80 p-4">
14
- <div className="flex items-end justify-between gap-4">
15
- <div>
16
- <p className="text-xs font-medium uppercase tracking-wide text-emerald-400/80">{t(lang, 'total')}</p>
17
- <p className="text-4xl font-bold tabular-nums leading-none text-white">{total.toLocaleString()}</p>
18
- </div>
19
- {groups.length > 0 && (
20
- <div className="flex flex-wrap justify-end gap-1.5">
21
- {groups.map((g) => (
22
- <span
23
- key={g.id}
24
- className="inline-flex items-center gap-1.5 rounded-full bg-slate-950/50 px-2.5 py-1 text-xs font-medium text-slate-200 ring-1 ring-slate-700/80"
25
- >
26
- <span className="h-2 w-2 rounded-full" style={{ background: g.color }} />
27
- {counts[g.id] ?? 0}
28
- </span>
29
- ))}
30
- </div>
31
- )}
32
- </div>
33
- </section>
34
- )
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/components/StepCapture.tsx CHANGED
@@ -45,7 +45,7 @@ export function StepCapture({ lang, modelReady, onCamera, onGallery }: Props) {
45
 
46
  {/* Model-ready dot */}
47
  <span
48
- className={`absolute -right-1.5 -top-1.5 h-5 w-5 rounded-full border-[3px] border-[#020617] transition-all duration-700 ${
49
  modelReady
50
  ? 'bg-emerald-400 shadow-[0_0_12px_rgba(52,211,153,0.8)]'
51
  : 'animate-pulse bg-amber-400 shadow-[0_0_10px_rgba(251,191,36,0.7)]'
 
45
 
46
  {/* Model-ready dot */}
47
  <span
48
+ className={`absolute -right-1.5 -top-1.5 h-5 w-5 rounded-full border-[3px] border-[var(--bg)] transition-all duration-700 ${
49
  modelReady
50
  ? 'bg-emerald-400 shadow-[0_0_12px_rgba(52,211,153,0.8)]'
51
  : 'animate-pulse bg-amber-400 shadow-[0_0_10px_rgba(251,191,36,0.7)]'
frontend/src/components/StepCounting.tsx CHANGED
@@ -32,7 +32,7 @@ export function StepCounting({ lang, status, imageSrc }: Props) {
32
  <div
33
  className="pointer-events-none absolute inset-0"
34
  style={{
35
- background: 'radial-gradient(ellipse 70% 60% at 50% 50%, transparent 20%, #020617 100%)',
36
  }}
37
  />
38
 
@@ -95,21 +95,10 @@ export function StepCounting({ lang, status, imageSrc }: Props) {
95
  <div className="h-0.5 w-48 overflow-hidden rounded-full bg-white/10">
96
  <div
97
  className="h-full rounded-full bg-emerald-400"
98
- style={{ animation: 'slide 1.8s ease-in-out infinite', width: '35%' }}
99
  />
100
  </div>
101
  </div>
102
-
103
- <style>{`
104
- @keyframes spin {
105
- to { transform: rotate(360deg); }
106
- }
107
- @keyframes slide {
108
- 0% { transform: translateX(-200%); }
109
- 60% { transform: translateX(380%); }
110
- 100% { transform: translateX(380%); }
111
- }
112
- `}</style>
113
  </div>
114
  )
115
  }
 
32
  <div
33
  className="pointer-events-none absolute inset-0"
34
  style={{
35
+ background: 'radial-gradient(ellipse 70% 60% at 50% 50%, transparent 20%, var(--bg) 100%)',
36
  }}
37
  />
38
 
 
95
  <div className="h-0.5 w-48 overflow-hidden rounded-full bg-white/10">
96
  <div
97
  className="h-full rounded-full bg-emerald-400"
98
+ style={{ animation: 'track-slide 1.8s ease-in-out infinite', width: '35%' }}
99
  />
100
  </div>
101
  </div>
 
 
 
 
 
 
 
 
 
 
 
102
  </div>
103
  )
104
  }
frontend/src/components/StepPreview.tsx CHANGED
@@ -90,7 +90,7 @@ export function StepPreview({
90
  </p>
91
 
92
  {/* ── Scrollable settings ────────────────────────────────────── */}
93
- <div className="flex-1 overflow-y-auto px-4 pb-2 pt-2">
94
  <SettingsPanel
95
  lang={lang}
96
  open={true}
 
90
  </p>
91
 
92
  {/* ── Scrollable settings ────────────────────────────────────── */}
93
+ <div className="native-scroll flex-1 overflow-y-auto px-4 pb-2 pt-2">
94
  <SettingsPanel
95
  lang={lang}
96
  open={true}
frontend/src/components/StepResults.tsx CHANGED
@@ -88,7 +88,7 @@ export function StepResults({
88
 
89
  {/* ── Scrollable body ────────────────────────────────────────── */}
90
  <div
91
- className="flex-1 overflow-y-auto px-4"
92
  style={{ paddingBottom: 'max(1.5rem, env(safe-area-inset-bottom))' }}
93
  >
94
  <div className="space-y-4">
@@ -122,10 +122,7 @@ export function StepResults({
122
 
123
  {/* Correction tools β€” slide in after animation */}
124
  {animDone && (
125
- <div
126
- className="space-y-4"
127
- style={{ animation: 'step-enter 0.35s cubic-bezier(0.22,1,0.36,1) both' }}
128
- >
129
  {groups.length > 0 && (
130
  <GroupPanel
131
  lang={lang}
 
88
 
89
  {/* ── Scrollable body ────────────────────────────────────────── */}
90
  <div
91
+ className="native-scroll flex-1 overflow-y-auto px-4"
92
  style={{ paddingBottom: 'max(1.5rem, env(safe-area-inset-bottom))' }}
93
  >
94
  <div className="space-y-4">
 
122
 
123
  {/* Correction tools β€” slide in after animation */}
124
  {animDone && (
125
+ <div className="rise-enter space-y-4">
 
 
 
126
  {groups.length > 0 && (
127
  <GroupPanel
128
  lang={lang}
frontend/src/components/StickyActionBar.tsx DELETED
@@ -1,96 +0,0 @@
1
- import { Camera, Download, ImagePlus, Loader2, RotateCcw } from 'lucide-react'
2
- import { cn } from '../lib/utils'
3
- import { t } from '../lib/i18n'
4
- import type { Lang } from '../lib/types'
5
-
6
- interface Props {
7
- lang: Lang
8
- hasImage: boolean
9
- hasResults: boolean
10
- busy: boolean
11
- modelReady: boolean
12
- onCamera: () => void
13
- onGallery: () => void
14
- onCount: () => void
15
- onExport: () => void
16
- onNewPhoto: () => void
17
- }
18
-
19
- export function StickyActionBar({
20
- lang,
21
- hasImage,
22
- hasResults,
23
- busy,
24
- modelReady,
25
- onCamera,
26
- onGallery,
27
- onCount,
28
- onExport,
29
- onNewPhoto,
30
- }: Props) {
31
- return (
32
- <div className="fixed inset-x-0 bottom-0 z-40 border-t border-slate-800/80 bg-slate-950/95 px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur-md">
33
- {hasResults ? (
34
- <div className="mx-auto flex max-w-lg gap-2">
35
- <button
36
- type="button"
37
- className="flex h-12 flex-1 items-center justify-center gap-2 rounded-xl bg-slate-800 text-sm font-medium active:scale-[0.98]"
38
- onClick={onExport}
39
- >
40
- <Download size={18} />
41
- {t(lang, 'export')}
42
- </button>
43
- <button
44
- type="button"
45
- disabled={busy || !modelReady}
46
- className="flex h-12 flex-[2] items-center justify-center gap-2 rounded-xl bg-emerald-600 text-sm font-bold text-white active:scale-[0.98] disabled:opacity-50"
47
- onClick={onCount}
48
- >
49
- {busy ? <Loader2 className="animate-spin" size={18} /> : <RotateCcw size={18} />}
50
- {t(lang, 'recount')}
51
- </button>
52
- </div>
53
- ) : (
54
- <div className="mx-auto flex max-w-lg items-center gap-2">
55
- <button
56
- type="button"
57
- className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-slate-800 active:scale-95"
58
- onClick={onCamera}
59
- aria-label={t(lang, 'takePhoto')}
60
- >
61
- <Camera size={22} />
62
- </button>
63
- <button
64
- type="button"
65
- className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-slate-800 active:scale-95"
66
- onClick={onGallery}
67
- aria-label={t(lang, 'chooseFile')}
68
- >
69
- <ImagePlus size={22} />
70
- </button>
71
- <button
72
- type="button"
73
- disabled={!hasImage || busy || !modelReady}
74
- className={cn(
75
- 'flex h-12 min-w-0 flex-1 items-center justify-center gap-2 rounded-xl text-base font-bold text-white active:scale-[0.98] disabled:opacity-50',
76
- hasImage ? 'bg-emerald-600' : 'bg-slate-700',
77
- )}
78
- onClick={onCount}
79
- >
80
- {busy ? <Loader2 className="animate-spin" size={20} /> : null}
81
- {t(lang, 'count')}
82
- </button>
83
- </div>
84
- )}
85
- {hasImage && !hasResults && (
86
- <button
87
- type="button"
88
- className="mx-auto mt-2 block text-xs text-slate-500 underline-offset-2 hover:text-slate-300 hover:underline"
89
- onClick={onNewPhoto}
90
- >
91
- {t(lang, 'newPhoto')}
92
- </button>
93
- )}
94
- </div>
95
- )
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/index.css CHANGED
@@ -1,11 +1,44 @@
1
  @import 'tailwindcss';
2
 
 
 
 
3
  :root {
4
  /* Platform-native font stack: SF Pro on iOS/macOS, Roboto on Android, Segoe UI on Windows */
5
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue',
6
  system-ui, 'Segoe UI', Roboto, sans-serif;
7
- color: #f8fafc;
8
- background: #020617;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  -webkit-tap-highlight-color: transparent;
10
  -webkit-text-size-adjust: 100%;
11
  }
@@ -17,7 +50,17 @@ html {
17
  body {
18
  margin: 0;
19
  min-height: 100dvh;
20
- background: #020617;
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  #root {
@@ -44,37 +87,77 @@ input[type='number']::-webkit-inner-spin-button {
44
  margin: 0;
45
  }
46
 
47
- /* ─── Page-level step transition ─────────────────────────────── */
48
- @keyframes step-enter {
49
- from { opacity: 0; transform: translateY(18px); }
50
- to { opacity: 1; transform: translateY(0); }
 
 
 
51
  }
52
 
53
- /* ─── Bottom-sheet entrance ──────────────────────────────────── */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  @keyframes sheet-up {
55
  from { transform: translateY(100%); }
56
  to { transform: translateY(0); }
57
  }
58
-
59
- /* ─── Overlay fade ───────────────────────────────────────────── */
60
  @keyframes fade-in {
61
  from { opacity: 0; }
62
  to { opacity: 1; }
63
  }
 
 
 
 
 
 
 
 
 
64
 
65
- /* ─── Logo breathing ─────────────────────────────────────────── */
 
 
66
  @keyframes breathe {
67
  0%, 100% { transform: scale(1); }
68
  50% { transform: scale(1.035); }
69
  }
70
-
71
- /* ─── Glow pulse ─────────────────────────────────────────────── */
72
  @keyframes glow-pulse {
73
  0%, 100% { opacity: 0.35; transform: scale(1); }
74
  50% { opacity: 0.55; transform: scale(1.08); }
75
  }
 
 
 
 
 
 
 
 
76
 
77
- /* ─── Slide-in animation utility ─────────────────────────────── */
78
- .step-enter { animation: step-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
79
- .sheet-enter { animation: sheet-up 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
80
- .overlay-enter { animation: fade-in 0.2s ease-out both; }
 
 
 
 
 
 
 
1
  @import 'tailwindcss';
2
 
3
+ /* ──────────────────────────────────────────────────────────────
4
+ Native design tokens
5
+ ────────────────────────────────────────────────────────────── */
6
  :root {
7
  /* Platform-native font stack: SF Pro on iOS/macOS, Roboto on Android, Segoe UI on Windows */
8
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue',
9
  system-ui, 'Segoe UI', Roboto, sans-serif;
10
+
11
+ /* surfaces */
12
+ --bg: #060a15;
13
+ --surface: rgba(255, 255, 255, 0.06);
14
+ --surface-2: rgba(255, 255, 255, 0.09);
15
+ --surface-active: rgba(255, 255, 255, 0.14);
16
+ --hairline: rgba(255, 255, 255, 0.08);
17
+
18
+ /* text */
19
+ --text: #f5f7fb;
20
+ --text-dim: rgba(255, 255, 255, 0.5);
21
+ --text-faint: rgba(255, 255, 255, 0.3);
22
+
23
+ /* accents */
24
+ --accent: #3b82f6;
25
+ --accent-press: #2563eb;
26
+ --green: #10b981;
27
+ --green-press: #059669;
28
+ --ios-toggle: #34c759;
29
+
30
+ /* shape */
31
+ --r-sm: 0.75rem;
32
+ --r-md: 1rem;
33
+ --r-lg: 1.25rem;
34
+ --r-xl: 1.75rem;
35
+
36
+ /* motion */
37
+ --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
38
+ --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
39
+
40
+ color: var(--text);
41
+ background: var(--bg);
42
  -webkit-tap-highlight-color: transparent;
43
  -webkit-text-size-adjust: 100%;
44
  }
 
50
  body {
51
  margin: 0;
52
  min-height: 100dvh;
53
+ background: var(--bg);
54
+ /* prevent text selection flashes on tap, like a native app */
55
+ -webkit-user-select: none;
56
+ user-select: none;
57
+ }
58
+
59
+ /* re-enable selection only where it's useful */
60
+ input,
61
+ textarea {
62
+ -webkit-user-select: text;
63
+ user-select: text;
64
  }
65
 
66
  #root {
 
87
  margin: 0;
88
  }
89
 
90
+ /* momentum scrolling, hidden scrollbars (native feel) */
91
+ .native-scroll {
92
+ -webkit-overflow-scrolling: touch;
93
+ scrollbar-width: none;
94
+ }
95
+ .native-scroll::-webkit-scrollbar {
96
+ display: none;
97
  }
98
 
99
+ /* ──────────────────────────────────────────────────────────────
100
+ Directional navigation transitions (iOS UINavigationController)
101
+ ────────────────────────────────────────────────────────────── */
102
+ @keyframes nav-push {
103
+ from { opacity: 0; transform: translateX(28px); }
104
+ to { opacity: 1; transform: translateX(0); }
105
+ }
106
+ @keyframes nav-pop {
107
+ from { opacity: 0; transform: translateX(-28px); }
108
+ to { opacity: 1; transform: translateX(0); }
109
+ }
110
+ .nav-push { animation: nav-push 0.36s var(--ease-ios) both; }
111
+ .nav-pop { animation: nav-pop 0.36s var(--ease-ios) both; }
112
+
113
+ /* ──────────────────────────────────────────────────────────────
114
+ Bottom sheet / overlay
115
+ ────────────────────────────────────────────────────────────── */
116
  @keyframes sheet-up {
117
  from { transform: translateY(100%); }
118
  to { transform: translateY(0); }
119
  }
 
 
120
  @keyframes fade-in {
121
  from { opacity: 0; }
122
  to { opacity: 1; }
123
  }
124
+ .sheet-enter { animation: sheet-up 0.42s var(--ease-ios) both; }
125
+ .overlay-enter { animation: fade-in 0.22s ease-out both; }
126
+
127
+ /* generic content reveal */
128
+ @keyframes rise {
129
+ from { opacity: 0; transform: translateY(16px); }
130
+ to { opacity: 1; transform: translateY(0); }
131
+ }
132
+ .rise-enter { animation: rise 0.34s var(--ease-out) both; }
133
 
134
+ /* ──────────────────────────────────────────────────────────────
135
+ Ambient / loading flourishes
136
+ ─────────────────────────────────────────────────���──────────── */
137
  @keyframes breathe {
138
  0%, 100% { transform: scale(1); }
139
  50% { transform: scale(1.035); }
140
  }
 
 
141
  @keyframes glow-pulse {
142
  0%, 100% { opacity: 0.35; transform: scale(1); }
143
  50% { opacity: 0.55; transform: scale(1.08); }
144
  }
145
+ @keyframes spin {
146
+ to { transform: rotate(360deg); }
147
+ }
148
+ @keyframes track-slide {
149
+ 0% { transform: translateX(-200%); }
150
+ 60% { transform: translateX(380%); }
151
+ 100% { transform: translateX(380%); }
152
+ }
153
 
154
+ /* respect reduced motion */
155
+ @media (prefers-reduced-motion: reduce) {
156
+ *,
157
+ *::before,
158
+ *::after {
159
+ animation-duration: 0.001ms !important;
160
+ animation-iteration-count: 1 !important;
161
+ transition-duration: 0.001ms !important;
162
+ }
163
+ }
frontend/src/lib/i18n.ts CHANGED
@@ -38,8 +38,8 @@ const messages = {
38
  exportJson: 'Data (JSON)',
39
  exportCsv: 'Spreadsheet (CSV)',
40
  export: 'Export results',
 
41
  highAccuracy: 'High accuracy (multi-tile)',
42
- enhanceImage: 'Enhance image',
43
  filterOutliers: 'Filter outliers',
44
  mismatch: 'Mismatch',
45
  selectGroup: 'Tap a group, then use tools to correct detections.',
@@ -86,8 +86,8 @@ const messages = {
86
  exportJson: 'ΰΈ‚ΰΉ‰ΰΈ­ΰΈ‘ΰΈΉΰΈ₯ (JSON)',
87
  exportCsv: 'ΰΈ•ΰΈ²ΰΈ£ΰΈ²ΰΈ‡ (CSV)',
88
  export: 'ΰΈͺΰΉˆΰΈ‡ΰΈ­ΰΈ­ΰΈΰΈœΰΈ₯ΰΈ₯ัพธ์',
 
89
  highAccuracy: 'ΰΈ„ΰΈ§ΰΈ²ΰΈ‘ΰΉΰΈ‘ΰΉˆΰΈ™ΰΈ’ΰΈ³ΰΈͺΰΈΉΰΈ‡ (ΰΈ«ΰΈ₯ΰΈ²ΰΈ’ΰΈͺΰΉˆΰΈ§ΰΈ™)',
90
- enhanceImage: 'ΰΈ›ΰΈ£ΰΈ±ΰΈšΰΈ ΰΈ²ΰΈžΰΈ­ΰΈ±ΰΈ•ΰΉ‚ΰΈ™ΰΈ‘ΰΈ±ΰΈ•ΰΈ΄',
91
  filterOutliers: 'ΰΈΰΈ£ΰΈ­ΰΈ‡ΰΈ„ΰΉˆΰΈ²ΰΈœΰΈ΄ΰΈ”ΰΈ›ΰΈΰΈ•ΰΈ΄',
92
  mismatch: 'ΰΉ„ΰΈ‘ΰΉˆΰΈ•ΰΈ£ΰΈ‡',
93
  selectGroup: 'แตะเΰΈ₯ือกกΰΈ₯ุ่ฑ แΰΈ₯ΰΉ‰ΰΈ§ΰΉƒΰΈŠΰΉ‰ΰΉ€ΰΈ„ΰΈ£ΰΈ·ΰΉˆΰΈ­ΰΈ‡ΰΈ‘ΰΈ·ΰΈ­ΰΉΰΈΰΉ‰ΰΉ„ΰΈ‚ΰΈˆΰΈΈΰΈ”ΰΈ•ΰΈ£ΰΈ§ΰΈˆΰΈˆΰΈ±ΰΈš',
 
38
  exportJson: 'Data (JSON)',
39
  exportCsv: 'Spreadsheet (CSV)',
40
  export: 'Export results',
41
+ cancel: 'Cancel',
42
  highAccuracy: 'High accuracy (multi-tile)',
 
43
  filterOutliers: 'Filter outliers',
44
  mismatch: 'Mismatch',
45
  selectGroup: 'Tap a group, then use tools to correct detections.',
 
86
  exportJson: 'ΰΈ‚ΰΉ‰ΰΈ­ΰΈ‘ΰΈΉΰΈ₯ (JSON)',
87
  exportCsv: 'ΰΈ•ΰΈ²ΰΈ£ΰΈ²ΰΈ‡ (CSV)',
88
  export: 'ΰΈͺΰΉˆΰΈ‡ΰΈ­ΰΈ­ΰΈΰΈœΰΈ₯ΰΈ₯ัพธ์',
89
+ cancel: 'ฒกเΰΈ₯ิก',
90
  highAccuracy: 'ΰΈ„ΰΈ§ΰΈ²ΰΈ‘ΰΉΰΈ‘ΰΉˆΰΈ™ΰΈ’ΰΈ³ΰΈͺΰΈΉΰΈ‡ (ΰΈ«ΰΈ₯ΰΈ²ΰΈ’ΰΈͺΰΉˆΰΈ§ΰΈ™)',
 
91
  filterOutliers: 'ΰΈΰΈ£ΰΈ­ΰΈ‡ΰΈ„ΰΉˆΰΈ²ΰΈœΰΈ΄ΰΈ”ΰΈ›ΰΈΰΈ•ΰΈ΄',
92
  mismatch: 'ΰΉ„ΰΈ‘ΰΉˆΰΈ•ΰΈ£ΰΈ‡',
93
  selectGroup: 'แตะเΰΈ₯ือกกΰΈ₯ุ่ฑ แΰΈ₯ΰΉ‰ΰΈ§ΰΉƒΰΈŠΰΉ‰ΰΉ€ΰΈ„ΰΈ£ΰΈ·ΰΉˆΰΈ­ΰΈ‡ΰΈ‘ΰΈ·ΰΈ­ΰΉΰΈΰΉ‰ΰΉ„ΰΈ‚ΰΈˆΰΈΈΰΈ”ΰΈ•ΰΈ£ΰΈ§ΰΈˆΰΈˆΰΈ±ΰΈš',