Skip to content

Commit c6f66eb

Browse files
google-labs-jules[bot]arii
authored andcommitted
feat(frontend): Improve mobile usability of TimerControls
- Increases the minimum height of START/STOP buttons to 64px. - Adds a press-and-scale animation to START/STOP buttons for better interactive feedback. - Enlarges the stepper buttons to a 56x56px touch target. - Refactors duplicated sx props into shared constants for improved maintainability.
1 parent 2a35a7c commit c6f66eb

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

app/client/control/components/TimerControls.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ import Stack from '@mui/material/Stack'
2424
import TextField from '@mui/material/TextField'
2525
import Typography from '@mui/material/Typography'
2626
import { useCallback, useEffect, useRef, useState } from 'react'
27+
28+
const actionButtonSx = {
29+
flex: 1,
30+
fontWeight: 'bold',
31+
py: 1.5,
32+
minHeight: '64px',
33+
transition: 'transform 0.1s ease-in-out',
34+
'&:active': {
35+
transform: 'scale(0.95)',
36+
},
37+
}
38+
39+
const stepperButtonSx = {
40+
backgroundColor: 'grey.700',
41+
color: 'white',
42+
'&:hover': { backgroundColor: 'grey.600' },
43+
width: 56,
44+
height: 56,
45+
}
46+
2747
const TimerControls = () => {
2848
const { timerData, sendData } = useWebSocket()
2949
// Local state is source of truth for editing
@@ -281,12 +301,7 @@ const TimerControls = () => {
281301
color="primary"
282302
onClick={() => setWorkTime((prev) => Math.max(0, prev - 5))}
283303
aria-label="Decrease work duration"
284-
sx={{
285-
backgroundColor: 'grey.700',
286-
color: 'white',
287-
'&:hover': { backgroundColor: 'grey.600' },
288-
p: 2,
289-
}}
304+
sx={stepperButtonSx}
290305
>
291306
<Remove fontSize="large" />
292307
</IconButton>
@@ -333,12 +348,7 @@ const TimerControls = () => {
333348
color="primary"
334349
onClick={() => setWorkTime((prev) => prev + 5)}
335350
aria-label="Increase work duration"
336-
sx={{
337-
backgroundColor: 'grey.700',
338-
color: 'white',
339-
'&:hover': { backgroundColor: 'grey.600' },
340-
p: 2,
341-
}}
351+
sx={stepperButtonSx}
342352
>
343353
<Add fontSize="large" />
344354
</IconButton>
@@ -359,12 +369,7 @@ const TimerControls = () => {
359369
color="primary"
360370
onClick={() => setRestTime((prev) => Math.max(0, prev - 5))}
361371
aria-label="Decrease rest duration"
362-
sx={{
363-
backgroundColor: 'grey.700',
364-
color: 'white',
365-
'&:hover': { backgroundColor: 'grey.600' },
366-
p: 2,
367-
}}
372+
sx={stepperButtonSx}
368373
>
369374
<Remove fontSize="large" />
370375
</IconButton>
@@ -410,12 +415,7 @@ const TimerControls = () => {
410415
color="primary"
411416
onClick={() => setRestTime((prev) => prev + 5)}
412417
aria-label="Increase rest duration"
413-
sx={{
414-
backgroundColor: 'grey.700',
415-
color: 'white',
416-
'&:hover': { backgroundColor: 'grey.600' },
417-
p: 2,
418-
}}
418+
sx={stepperButtonSx}
419419
>
420420
<Add fontSize="large" />
421421
</IconButton>
@@ -430,7 +430,7 @@ const TimerControls = () => {
430430
variant="contained"
431431
color="success"
432432
onClick={() => sendTimerCommand('START')}
433-
sx={{ flex: 1, fontWeight: 'bold', py: 1.5 }}
433+
sx={actionButtonSx}
434434
startIcon={<PlayArrow fontSize="large" />}
435435
>
436436
START
@@ -440,7 +440,7 @@ const TimerControls = () => {
440440
variant="contained"
441441
color="error"
442442
onClick={() => sendTimerCommand('STOP')}
443-
sx={{ flex: 1, fontWeight: 'bold', py: 1.5 }}
443+
sx={actionButtonSx}
444444
startIcon={<Stop fontSize="large" />}
445445
>
446446
STOP

0 commit comments

Comments
 (0)