@@ -197,40 +197,42 @@ struct FavoriteConfirmationDialog: View {
197197 . map { ( $0, proposedFavorites [ $0. id] ?? nil ) } )
198198 showDialog = true
199199 }
200- . customAlert (
201- isPresented: $showDialog,
202- content: {
203- FavoriteConfirmationDialogContents (
204- lineOrRoute: lineOrRoute,
205- stop: stop, directions: directions,
206- selectedDirection: selectedDirection,
207- context: context,
208- favoritesToSave: favoritesToSave,
209- updateLocalFavorite: { direction, isFavorite in
210- favoritesToSave [ direction] = isFavorite
211- }
212- )
213- } ,
214- actions: {
215- if directions. isEmpty {
200+ . customAlert ( isPresented: $showDialog) {
201+ FavoriteConfirmationDialogContents (
202+ lineOrRoute: lineOrRoute,
203+ stop: stop, directions: directions,
204+ selectedDirection: selectedDirection,
205+ context: context,
206+ favoritesToSave: favoritesToSave,
207+ updateLocalFavorite: { direction, isFavorite in
208+ favoritesToSave [ direction] = isFavorite
209+ }
210+ )
211+ } actions: {
212+ if directions. isEmpty {
213+ Button { onClose ( ) } label: { Text ( " Okay " ) }
214+ } else {
215+ MultiButton {
216+ Button { onClose ( ) } label: { Text ( " Cancel " ) }
217+
216218 Button {
219+ updateFavorites ( favoritesToSave
220+ . reduce (
221+ into: [ RouteStopDirection: FavoriteSettings? ] ( )
222+ ) { partialResult, entry in
223+ partialResult [ RouteStopDirection (
224+ route: lineOrRoute. id,
225+ stop: stop. id,
226+ direction: entry. key. id
227+ ) ] = entry. value
228+ } )
217229 onClose ( )
218230 } label: {
219- Text ( " Okay " )
220- }
221- } else {
222- MultiButton {
223- FavoriteConfirmationDialogActions (
224- lineOrRoute: lineOrRoute,
225- stop: stop,
226- favoritesToSave: favoritesToSave,
227- updateFavorites: updateFavorites,
228- onClose: onClose
229- )
230- }
231+ Text ( " Add " )
232+ } . disabled ( favoritesToSave. values. allSatisfy { $0 == nil } )
231233 }
232234 }
233- )
235+ }
234236 }
235237}
236238
@@ -262,18 +264,21 @@ struct FavoriteConfirmationDialogContents: View {
262264 VStack {
263265 Text ( AttributedString . tryMarkdown ( headerText) )
264266 . font ( Typography . body)
267+ . foregroundStyle ( Color . text)
265268 . accessibilityAddTraits ( . isHeader)
266269 . accessibilityHeading ( . h1)
267270 if directions. count == 1 , directions. first!. id != selectedDirection {
268271 Text ( " \( DirectionLabel . directionNameFormatted ( directions. first!) ) service only " )
269272 . font ( Typography . footnoteSemibold)
273+ . foregroundStyle ( Color . text)
270274 . padding ( . horizontal, 16 )
271275 . padding ( . top, 8 )
272276 }
273277
274278 if directions. isEmpty {
275279 Text ( " This stop is drop-off only " )
276280 . font ( Typography . footnoteSemibold)
281+ . foregroundStyle ( Color . text)
277282 . padding ( . horizontal, 16 )
278283 . padding ( . top, 8 )
279284 } else {
@@ -321,6 +326,7 @@ struct DirectionButtons: View {
321326 VStack ( spacing: 0 ) {
322327 HStack ( spacing: 0 ) {
323328 DirectionLabel ( direction: directionValue. direction)
329+ . foregroundStyle ( Color . text)
324330 . frame ( maxWidth: . infinity, maxHeight: . infinity, alignment: . leading)
325331 Spacer ( )
326332 StarIcon (
@@ -345,33 +351,3 @@ struct DirectionButtons: View {
345351 . padding ( . top, 8 )
346352 }
347353}
348-
349- struct FavoriteConfirmationDialogActions : View {
350- let lineOrRoute : LineOrRoute
351- let stop : Stop
352- let favoritesToSave : [ Direction : FavoriteSettings ? ]
353- let updateFavorites : ( [ RouteStopDirection : FavoriteSettings ? ] ) -> Void
354- let onClose : ( ) -> Void
355-
356- var body : some View {
357- Button {
358- onClose ( )
359- } label: {
360- Text ( " Cancel " )
361- }
362-
363- Button {
364- updateFavorites ( favoritesToSave
365- . reduce ( into: [ RouteStopDirection: FavoriteSettings? ] ( ) ) { partialResult, entry in
366- partialResult [ RouteStopDirection (
367- route: lineOrRoute. id,
368- stop: stop. id,
369- direction: entry. key. id
370- ) ] = entry. value
371- } )
372- onClose ( )
373- } label: {
374- Text ( " Add " )
375- } . disabled ( favoritesToSave. values. allSatisfy { $0 == nil } )
376- }
377- }
0 commit comments