@@ -45,121 +45,6 @@ struct HomeView: View {
4545 }
4646 }
4747
48- @ViewBuilder
49- private func coverContent( _ coverStore: Store < HomeFeature . FullScreenCoverState , Never > ) -> some View {
50- switch coverStore. destination {
51- case . todoEditor:
52- if let selectedCategory = coverStore. selectedTodoCategory {
53- TodoEditorView (
54- store: coordinator. makeTodoEditorStore ( category: selectedCategory) ,
55- onCreateSuccess: {
56- store. send ( . setPresentation( . todoEditor, false ) )
57- store. send ( . fetchData)
58- }
59- )
60- }
61- case . search:
62- SearchView ( store: coordinator. makeSearchStore ( ) )
63- }
64- }
65-
66- @ViewBuilder
67- private func sheetContent( _ sheetStore: Store < HomeFeature . SheetState , HomeFeature . Sheet > ) -> some View {
68- if sheetStore. state == . contentPicker {
69- NavigationStack {
70- List {
71- Section {
72- if store. isPreferencesLoading {
73- LoadingView ( )
74- } else {
75- let preferences = store. preferences. filter ( \. isVisible)
76- ForEach ( preferences, id: \. id) { item in
77- Button {
78- DispatchQueue . main. async {
79- openTodoEditor ( for: item. category)
80- }
81- } label: {
82- labelImage (
83- text: item. localizedName,
84- systemName: item. symbolName,
85- imageColor: item. color
86- )
87- }
88- }
89- }
90- } header: {
91- Text ( " TODO " )
92- . foregroundStyle ( Color ( . label) )
93- }
94-
95- Section {
96- Button {
97- store. send ( . tapWebPageInput)
98- } label: {
99- labelImage (
100- text: " URL " ,
101- systemName: " globe " ,
102- imageColor: . blue
103- )
104- }
105- } header: {
106- Text ( " Web Page " )
107- . foregroundStyle ( Color ( . label) )
108- }
109- }
110- . navigationDestination (
111- item: $store. scope ( state: \. webPageInput, action: \. webPageInput)
112- ) { _ in
113- Form {
114- Section {
115- TextField (
116- " https:// " ,
117- text: Binding (
118- get: { store. webPageURLInput } ,
119- set: { store. send ( . updateWebPageURLInput( $0) ) }
120- )
121- )
122- . textInputAutocapitalization ( . never)
123- . keyboardType ( . URL)
124- } footer: {
125- Text ( String ( localized: " home_webpage_input_message " ) )
126- }
127- }
128- . scrollDisabled ( true )
129- . navigationTitle ( Text ( String ( localized: " home_webpage_input_title " ) ) )
130- . navigationBarTitleDisplayMode ( . inline) // 설정 안하면 섹션 위에 내비게이션 large 만큼 영역 먹음
131- . toolbar {
132- ToolbarItem ( placement: . topBarTrailing) {
133- Button ( String ( localized: " home_add " ) ) {
134- store. send ( . addWebPage)
135- }
136- }
137- }
138- }
139- . navigationTitle ( Text ( String ( localized: " nav_home_content " ) ) )
140- . navigationBarTitleDisplayMode ( . inline) // 설정 안하면 섹션 위에 내비게이션 large 만큼 영역 먹음
141- . toolbar {
142- ToolbarItem ( placement: . topBarLeading) {
143- Button {
144- store. send ( . sheet( . presented( . tapCloseButton) ) )
145- } label: {
146- Image ( systemName: " xmark " )
147- . bold ( )
148- }
149- }
150- }
151- }
152- } else {
153- CategoryManageView (
154- preferences: store. preferences,
155- onDismiss: { array in
156- store. send ( . sheet( . dismiss) )
157- store. send ( . orderTodoCategory( array) , animation: . default)
158- }
159- )
160- }
161- }
162-
16348 private var todoSection : some View {
16449 Section ( content: {
16550 if store. isPreferencesLoading {
@@ -282,6 +167,121 @@ struct HomeView: View {
282167 }
283168 }
284169
170+ @ViewBuilder
171+ private func sheetContent( _ sheetStore: Store < HomeFeature . SheetState , HomeFeature . Sheet > ) -> some View {
172+ if sheetStore. state == . contentPicker {
173+ NavigationStack {
174+ List {
175+ Section {
176+ if store. isPreferencesLoading {
177+ LoadingView ( )
178+ } else {
179+ let preferences = store. preferences. filter ( \. isVisible)
180+ ForEach ( preferences, id: \. id) { item in
181+ Button {
182+ DispatchQueue . main. async {
183+ openTodoEditor ( for: item. category)
184+ }
185+ } label: {
186+ labelImage (
187+ text: item. localizedName,
188+ systemName: item. symbolName,
189+ imageColor: item. color
190+ )
191+ }
192+ }
193+ }
194+ } header: {
195+ Text ( " TODO " )
196+ . foregroundStyle ( Color ( . label) )
197+ }
198+
199+ Section {
200+ Button {
201+ store. send ( . tapWebPageInput)
202+ } label: {
203+ labelImage (
204+ text: " URL " ,
205+ systemName: " globe " ,
206+ imageColor: . blue
207+ )
208+ }
209+ } header: {
210+ Text ( " Web Page " )
211+ . foregroundStyle ( Color ( . label) )
212+ }
213+ }
214+ . navigationDestination (
215+ item: $store. scope ( state: \. webPageInput, action: \. webPageInput)
216+ ) { _ in
217+ Form {
218+ Section {
219+ TextField (
220+ " https:// " ,
221+ text: Binding (
222+ get: { store. webPageURLInput } ,
223+ set: { store. send ( . updateWebPageURLInput( $0) ) }
224+ )
225+ )
226+ . textInputAutocapitalization ( . never)
227+ . keyboardType ( . URL)
228+ } footer: {
229+ Text ( String ( localized: " home_webpage_input_message " ) )
230+ }
231+ }
232+ . scrollDisabled ( true )
233+ . navigationTitle ( Text ( String ( localized: " home_webpage_input_title " ) ) )
234+ . navigationBarTitleDisplayMode ( . inline) // 설정 안하면 섹션 위에 내비게이션 large 만큼 영역 먹음
235+ . toolbar {
236+ ToolbarItem ( placement: . topBarTrailing) {
237+ Button ( String ( localized: " home_add " ) ) {
238+ store. send ( . addWebPage)
239+ }
240+ }
241+ }
242+ }
243+ . navigationTitle ( Text ( String ( localized: " nav_home_content " ) ) )
244+ . navigationBarTitleDisplayMode ( . inline) // 설정 안하면 섹션 위에 내비게이션 large 만큼 영역 먹음
245+ . toolbar {
246+ ToolbarItem ( placement: . topBarLeading) {
247+ Button {
248+ store. send ( . sheet( . presented( . tapCloseButton) ) )
249+ } label: {
250+ Image ( systemName: " xmark " )
251+ . bold ( )
252+ }
253+ }
254+ }
255+ }
256+ } else {
257+ CategoryManageView (
258+ preferences: store. preferences,
259+ onDismiss: { array in
260+ store. send ( . sheet( . dismiss) )
261+ store. send ( . orderTodoCategory( array) , animation: . default)
262+ }
263+ )
264+ }
265+ }
266+
267+ @ViewBuilder
268+ private func coverContent( _ coverStore: Store < HomeFeature . FullScreenCoverState , Never > ) -> some View {
269+ switch coverStore. destination {
270+ case . todoEditor:
271+ if let selectedCategory = coverStore. selectedTodoCategory {
272+ TodoEditorView (
273+ store: coordinator. makeTodoEditorStore ( category: selectedCategory) ,
274+ onCreateSuccess: {
275+ store. send ( . setPresentation( . todoEditor, false ) )
276+ store. send ( . fetchData)
277+ }
278+ )
279+ }
280+ case . search:
281+ SearchView ( store: coordinator. makeSearchStore ( ) )
282+ }
283+ }
284+
285285 @ViewBuilder
286286 private func todoCategoryRow( _ item: TodoCategoryItem ) -> some View {
287287 if isCompactLayout {
0 commit comments