Skip to content

Commit 90ffc40

Browse files
Cawlummclaude
andcommitted
feat(mobile): Date 2/3 · Duration 1/3 row; drop redundant '(min)' label
- 'min' already rides the value, so the field label is just 'Duration'. - Date takes 2/3 of the row, Duration 1/3 (Date benefits from the width; the timer is a compact stepper). - Slim DurationField to fit the 1/3 column: w-8 ± end caps, smaller 'min', dropped the invisible centering balancer (no room) — no clipping at 1–3 digits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ccq3rvfb9ArzS2DidghJm5
1 parent e7bae93 commit 90ffc40

3 files changed

Lines changed: 16 additions & 31 deletions

File tree

mobile/app/(tabs)/workouts/[id]/edit.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export default function EditWorkout() {
259259
{/* Date + duration share a row (matches the Log form). Editing the date only
260260
shifts the day; the original time-of-day is preserved on submit. */}
261261
<View className="flex-row gap-3">
262-
<View className="flex-1">
262+
<View className="flex-[2]">
263263
<FieldHeader icon={CalendarDays} label="Date" />
264264
<DateInput
265265
value={formData.date}
@@ -268,14 +268,8 @@ export default function EditWorkout() {
268268
/>
269269
</View>
270270
<View className="flex-1">
271-
<FieldHeader
272-
icon={Clock}
273-
label="Duration (min)"
274-
// h/m readout only once it means something — "0h 5m" is noise.
275-
hint={formData.duration >= 60
276-
? `= ${Math.floor(formData.duration / 60)}h ${formData.duration % 60}m`
277-
: undefined}
278-
/>
271+
{/* "min" already rides the value, so the label stays just "Duration". */}
272+
<FieldHeader icon={Clock} label="Duration" />
279273
<DurationField
280274
value={formData.duration}
281275
onChange={(m) => setFormData((prev) => ({ ...prev, duration: m }))}

mobile/app/(tabs)/workouts/new.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export default function AddWorkout() {
240240
half column; DateInput opens its picker in a full-width Modal so the
241241
half-width trigger doesn't crush the calendar. */}
242242
<View className="flex-row gap-3">
243-
<View className="flex-1">
243+
<View className="flex-[2]">
244244
<FieldHeader icon={CalendarDays} label="Date" />
245245
<DateInput
246246
value={formData.date}
@@ -249,14 +249,8 @@ export default function AddWorkout() {
249249
/>
250250
</View>
251251
<View className="flex-1">
252-
<FieldHeader
253-
icon={Clock}
254-
label="Duration (min)"
255-
// h/m readout only once it means something — "0h 5m" is noise.
256-
hint={formData.duration >= 60
257-
? `= ${Math.floor(formData.duration / 60)}h ${formData.duration % 60}m`
258-
: undefined}
259-
/>
252+
{/* "min" already rides the value, so the label stays just "Duration". */}
253+
<FieldHeader icon={Clock} label="Duration" />
260254
<DurationField
261255
value={formData.duration}
262256
onChange={(m) => setFormData((prev) => ({ ...prev, duration: m }))}

mobile/src/components/workouts/DurationField.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ export function DurationField({ value, onChange, inputAccessoryViewID }: {
3131
accessibilityLabel="Decrease duration"
3232
onPress={() => step(-STEP)}
3333
disabled={!canDec}
34-
className={`w-11 items-center justify-center border-r border-surface-border active:bg-surface-muted ${canDec ? '' : 'opacity-40'}`}
34+
className={`w-8 items-center justify-center border-r border-surface-border active:bg-surface-muted ${canDec ? '' : 'opacity-40'}`}
3535
>
36-
<Minus size={18} color={canDec ? accent : colors.txMuted} strokeWidth={2.4} />
36+
<Minus size={16} color={canDec ? accent : colors.txMuted} strokeWidth={2.4} />
3737
</Pressable>
3838

39-
{/* An invisible "min" on the left balances the real one on the right, so the
40-
value is flanked by equal widths and sits dead-center in the segment — no
41-
matter the digit count — while "min" still reads to its right (no overlap). */}
39+
{/* The value + "min" read as one centered group. This column is only ~1/3 of the
40+
row, so the control stays compact: slim ± end caps and a small "min". */}
4241
<View className="flex-1 flex-row items-center justify-center">
43-
<Text className="mr-1 font-sans text-sm opacity-0" style={{ lineHeight: LINE }} aria-hidden>min</Text>
4442
<TextInput
4543
value={value ? String(value) : ''}
4644
onChangeText={(t) => onChange(Number(t.replace(/[^0-9]/g, '')) || 0)}
@@ -55,13 +53,12 @@ export function DurationField({ value, onChange, inputAccessoryViewID }: {
5553
// Share one lineHeight across the value + "min" so items-center lines up
5654
// their text boxes exactly (iOS renders placeholder/value low otherwise).
5755
// includeFontPadding:false drops Android's extra glyph padding.
58-
style={{ fontVariant: ['tabular-nums'], minWidth: 16, maxWidth: 44, lineHeight: LINE, includeFontPadding: false }}
56+
style={{ fontVariant: ['tabular-nums'], minWidth: 14, maxWidth: 40, lineHeight: LINE, includeFontPadding: false }}
5957
/>
60-
{/* Nudge "min" down to sit on the value's optical line. The bold value renders
61-
low within its line box on iOS (web centers it, so this looks slightly low
62-
in the harness but correct on device); transform keeps it out of layout. */}
58+
{/* Nudge "min" down to sit on the value's optical line (the bold value renders
59+
low within its line box on iOS); transform keeps it out of layout. */}
6360
<Text
64-
className="ml-1 font-sans text-sm text-tx-muted"
61+
className="ml-0.5 font-sans text-xs text-tx-muted"
6562
style={{ lineHeight: LINE, transform: [{ translateY: MIN_NUDGE }] }}
6663
>
6764
min
@@ -72,9 +69,9 @@ export function DurationField({ value, onChange, inputAccessoryViewID }: {
7269
accessibilityRole="button"
7370
accessibilityLabel="Increase duration"
7471
onPress={() => step(STEP)}
75-
className="w-11 items-center justify-center border-l border-surface-border active:bg-surface-muted"
72+
className="w-8 items-center justify-center border-l border-surface-border active:bg-surface-muted"
7673
>
77-
<Plus size={18} color={accent} strokeWidth={2.4} />
74+
<Plus size={16} color={accent} strokeWidth={2.4} />
7875
</Pressable>
7976
</View>
8077
)

0 commit comments

Comments
 (0)