@@ -8,107 +8,106 @@ struct FocusTimerSheet: View {
88
99 var body : some View {
1010 VStack ( spacing: 0 ) {
11- HStack {
12- Button ( action: onDismiss) {
13- Image ( systemName: " chevron.left " )
14- . font ( . body)
15- }
16- . buttonStyle ( . plain)
17- Text ( " Focus Timer " )
18- . font ( . headline)
19- Spacer ( )
20- }
21- . padding ( )
22-
23- Divider ( )
24-
25- VStack ( spacing: 20 ) {
26- Spacer ( )
11+ SheetHeader ( title: " Focus Timer " )
2712
28- TimerRingView (
29- progress: focusTimer. isIdle ? 0 : focusTimer. progress,
30- label: focusTimer. isIdle
31- ? " \( focusTimer. state. durationSeconds / 60 ) m "
32- : focusTimer. formattedRemaining,
33- size: 140
34- )
13+ ScrollView {
14+ VStack ( spacing: 16 ) {
15+ // Timer ring in glass section
16+ VStack ( spacing: 16 ) {
17+ TimerRingView (
18+ progress: focusTimer. isIdle ? 0 : focusTimer. progress,
19+ label: focusTimer. isIdle
20+ ? " \( focusTimer. state. durationSeconds / 60 ) m "
21+ : focusTimer. formattedRemaining,
22+ size: 140
23+ )
24+ }
25+ . frame ( maxWidth: . infinity)
26+ . padding ( . vertical, 16 )
27+ . glassEffect ( . regular, in: RoundedRectangle ( cornerRadius: 12 ) )
3528
36- if focusTimer. isIdle {
37- HStack ( spacing: 8 ) {
38- ForEach ( presets, id: \. self) { minutes in
39- Button ( " \( minutes) m " ) {
40- focusTimer. setDuration ( minutes: minutes)
29+ // Presets in glass section (only when idle)
30+ if focusTimer. isIdle {
31+ HStack ( spacing: 8 ) {
32+ ForEach ( presets, id: \. self) { minutes in
33+ Button ( " \( minutes) m " ) {
34+ focusTimer. setDuration ( minutes: minutes)
35+ }
36+ . buttonStyle ( . bordered)
37+ . controlSize ( . small)
38+ . tint ( focusTimer. state. durationSeconds == minutes * 60 ? . accentColor : . gray)
4139 }
42- . buttonStyle ( . bordered)
43- . controlSize ( . small)
44- . tint ( focusTimer. state. durationSeconds == minutes * 60 ? . accentColor : . gray)
4540 }
41+ . frame ( maxWidth: . infinity)
42+ . padding ( . vertical, 12 )
43+ . glassEffect ( . regular, in: RoundedRectangle ( cornerRadius: 12 ) )
4644 }
47- }
4845
49- HStack ( spacing: 12 ) {
50- if focusTimer. isIdle {
51- Button ( " Start " ) {
52- focusTimer. start ( )
53- }
54- . buttonStyle ( . borderedProminent)
55- . disabled ( focusTimer. state. durationSeconds == 0 )
56- } else if focusTimer. isRunning {
57- Button ( " Pause " ) {
58- focusTimer. pause ( )
59- }
60- . buttonStyle ( . bordered)
46+ // Controls
47+ HStack ( spacing: 12 ) {
48+ if focusTimer. isIdle {
49+ Button ( " Start " ) {
50+ focusTimer. start ( )
51+ }
52+ . buttonStyle ( . borderedProminent)
53+ . disabled ( focusTimer. state. durationSeconds == 0 )
54+ } else if focusTimer. isRunning {
55+ Button ( " Pause " ) {
56+ focusTimer. pause ( )
57+ }
58+ . buttonStyle ( . bordered)
59+
60+ if !focusTimer. state. strictMode {
61+ Button ( " Stop " ) {
62+ focusTimer. stop ( )
63+ }
64+ . buttonStyle ( . bordered)
65+ . tint ( . red)
66+ }
67+ } else if focusTimer. isPaused {
68+ Button ( " Resume " ) {
69+ focusTimer. resume ( )
70+ }
71+ . buttonStyle ( . borderedProminent)
6172
62- if !focusTimer. state. strictMode {
6373 Button ( " Stop " ) {
6474 focusTimer. stop ( )
6575 }
6676 . buttonStyle ( . bordered)
6777 . tint ( . red)
6878 }
69- } else if focusTimer. isPaused {
70- Button ( " Resume " ) {
71- focusTimer. resume ( )
72- }
73- . buttonStyle ( . borderedProminent)
74-
75- Button ( " Stop " ) {
76- focusTimer. stop ( )
77- }
78- . buttonStyle ( . bordered)
79- . tint ( . red)
8079 }
81- }
8280
83- if focusTimer. isIdle {
84- Toggle ( " Strict Mode " , isOn: Binding (
85- get: { focusTimer. state. strictMode } ,
86- set: { newValue in
87- focusTimer. state. strictMode = newValue
88- }
89- ) )
90- . toggleStyle ( . switch)
91- . controlSize ( . small)
92- . padding ( . horizontal, 40 )
81+ // Strict mode toggle in glass section (only when idle)
82+ if focusTimer. isIdle {
83+ VStack ( spacing: 6 ) {
84+ Toggle ( " Strict Mode " , isOn: Binding (
85+ get: { focusTimer. state. strictMode } ,
86+ set: { newValue in
87+ focusTimer. state. strictMode = newValue
88+ }
89+ ) )
90+ . toggleStyle ( . switch)
91+ . controlSize ( . small)
9392
94- Text ( " Strict mode prevents stopping the timer early " )
95- . font ( . caption2)
96- . foregroundStyle ( . tertiary)
93+ Text ( " Strict mode prevents stopping the timer early " )
94+ . font ( . caption2)
95+ . foregroundStyle ( . tertiary)
96+ . frame ( maxWidth: . infinity, alignment: . leading)
97+ }
98+ . padding ( . horizontal, 12 )
99+ . padding ( . vertical, 10 )
100+ . glassEffect ( . regular, in: RoundedRectangle ( cornerRadius: 12 ) )
101+ }
97102 }
98-
99- Spacer ( )
103+ . padding ( . horizontal )
104+ . padding ( . vertical , 8 )
100105 }
101- . padding ( )
102-
103- Divider ( )
104106
105- HStack {
106- Spacer ( )
107- Button ( " Done " , action: onDismiss)
108- . buttonStyle ( . borderedProminent)
109- . controlSize ( . small)
110- }
111- . padding ( )
107+ SheetFooter (
108+ trailingTitle: " Done " ,
109+ trailingAction: onDismiss
110+ )
112111 }
113112 }
114113}
0 commit comments