@@ -15,94 +15,92 @@ struct LogView: View {
1515 }
1616
1717 var body : some View {
18- NavigationStack {
19- Form {
20- Section ( " Flow " ) {
21- FlowPickerView ( selection: $viewModel. flow)
22- }
18+ Form {
19+ Section ( " Flow " ) {
20+ FlowPickerView ( selection: $viewModel. flow)
21+ }
2322
24- Section ( " Mood & Energy " ) {
25- HStack {
26- ForEach ( Mood . allCases, id: \. self) { mood in
27- VStack {
28- Image ( systemName: mood. icon)
29- . font ( . title2)
30- . padding ( 8 )
31- . background ( viewModel. mood == mood ? Color . themeAccent. opacity ( 0.2 ) : Color . clear)
32- . clipShape ( Circle ( ) )
33- Text ( mood. description)
34- . font ( . caption2)
35- }
36- . frame ( maxWidth: . infinity)
37- . onTapGesture { viewModel. mood = mood }
23+ Section ( " Mood & Energy " ) {
24+ HStack {
25+ ForEach ( Mood . allCases, id: \. self) { mood in
26+ VStack {
27+ Image ( systemName: mood. icon)
28+ . font ( . title2)
29+ . padding ( 8 )
30+ . background ( viewModel. mood == mood ? Color . themeAccent. opacity ( 0.2 ) : Color . clear)
31+ . clipShape ( Circle ( ) )
32+ Text ( mood. description)
33+ . font ( . caption2)
3834 }
35+ . frame ( maxWidth: . infinity)
36+ . onTapGesture { viewModel. mood = mood }
3937 }
40- . padding ( . vertical, 8 )
38+ }
39+ . padding ( . vertical, 8 )
4140
42- HStack {
43- ForEach ( EnergyLevel . allCases, id: \. self) { energy in
44- VStack {
45- Image ( systemName: energy. icon)
46- . font ( . title2)
47- . padding ( 8 )
48- . background ( viewModel. energy == energy ? Color . themeAccent. opacity ( 0.2 ) : Color
49- . clear)
50- . clipShape ( Circle ( ) )
51- Text ( energy. description)
52- . font ( . caption2)
53- }
54- . frame ( maxWidth: . infinity)
55- . onTapGesture { viewModel. energy = energy }
41+ HStack {
42+ ForEach ( EnergyLevel . allCases, id: \. self) { energy in
43+ VStack {
44+ Image ( systemName: energy. icon)
45+ . font ( . title2)
46+ . padding ( 8 )
47+ . background ( viewModel. energy == energy ? Color . themeAccent. opacity ( 0.2 ) : Color
48+ . clear)
49+ . clipShape ( Circle ( ) )
50+ Text ( energy. description)
51+ . font ( . caption2)
5652 }
53+ . frame ( maxWidth: . infinity)
54+ . onTapGesture { viewModel. energy = energy }
5755 }
58- . padding ( . vertical, 8 )
5956 }
57+ . padding ( . vertical, 8 )
58+ }
6059
61- Section ( " Pain Level: \( Int ( viewModel. painLevel) ) " ) {
62- Slider ( value: $viewModel. painLevel, in: 0 ... 10 , step: 1 )
63- . accentColor ( . themePeriod)
64- }
60+ Section ( " Pain Level: \( Int ( viewModel. painLevel) ) " ) {
61+ Slider ( value: $viewModel. painLevel, in: 0 ... 10 , step: 1 )
62+ . accentColor ( . themePeriod)
63+ }
6564
66- Section ( " Symptoms " ) {
67- SymptomGridView ( selectedSymptoms: $viewModel. selectedSymptoms, symptoms: SymptomType . defaults)
68- }
65+ Section ( " Symptoms " ) {
66+ SymptomGridView ( selectedSymptoms: $viewModel. selectedSymptoms, symptoms: SymptomType . defaults)
67+ }
6968
70- Section {
71- ZStack ( alignment: . topLeading) {
72- if viewModel. notes. isEmpty {
73- Text ( " Empty " )
74- . foregroundColor ( . secondary. opacity ( 0.5 ) )
75- . padding ( . horizontal, 4 )
76- . padding ( . vertical, 8 )
77- }
69+ Section {
70+ ZStack ( alignment: . topLeading) {
71+ if viewModel. notes. isEmpty {
72+ Text ( " Empty " )
73+ . foregroundColor ( . secondary. opacity ( 0.5 ) )
74+ . padding ( . horizontal, 4 )
75+ . padding ( . vertical, 8 )
76+ }
7877
79- TextEditor ( text: $viewModel. notes)
80- . frame ( minHeight: 100 )
81- . onChange ( of: viewModel. notes) { _, newValue in
82- if newValue. count > 500 {
83- viewModel. notes = String ( newValue. prefix ( 500 ) )
84- }
78+ TextEditor ( text: $viewModel. notes)
79+ . frame ( minHeight: 100 )
80+ . onChange ( of: viewModel. notes) { _, newValue in
81+ if newValue. count > 500 {
82+ viewModel. notes = String ( newValue. prefix ( 500 ) )
8583 }
86- }
87- } header: {
88- HStack {
89- Text ( " Notes " )
90- Image ( systemName: " pencil " )
91- . font ( . caption)
92- }
84+ }
9385 }
94- }
95- . navigationTitle ( " Log Day " )
96- . navigationBarTitleDisplayMode ( . inline)
97- . toolbar {
98- ToolbarItem ( placement: . navigationBarTrailing) {
99- Button ( " Dismiss " ) { dismiss ( ) }
100- . fontWeight ( . medium)
86+ } header: {
87+ HStack {
88+ Text ( " Notes " )
89+ Image ( systemName: " pencil " )
90+ . font ( . caption)
10191 }
10292 }
103- . onDisappear {
104- viewModel. save ( )
93+ }
94+ . navigationTitle ( " Log Day " )
95+ . navigationBarTitleDisplayMode ( . inline)
96+ . toolbar {
97+ ToolbarItem ( placement: . navigationBarTrailing) {
98+ Button ( " Dismiss " ) { dismiss ( ) }
99+ . fontWeight ( . medium)
105100 }
106101 }
102+ . onDisappear {
103+ viewModel. save ( )
104+ }
107105 }
108106}
0 commit comments