@ -281,70 +281,37 @@ struct MatchDetailView: View {
}
}
. tint ( . master )
. tint ( . master )
}
}
. toolbar {
ToolbarItem ( placement : . topBarTrailing ) {
Menu {
if match . courtIndex != nil {
Button ( role : . destructive ) {
match . removeCourt ( )
save ( )
} label : {
Text ( " Supprimer le terrain " )
}
}
Button ( role : . destructive ) {
match . startDate = nil
match . endDate = nil
save ( )
} label : {
Text ( " Supprimer l'horaire " )
}
// . r e f r e s h a b l e {
Button ( role : . destructive ) {
// i f m a t c h . i s B r o a d c a s t e d ( ) {
match . resetScores ( )
// m a t c h . r e f r e s h B r o a d c a s t ( )
save ( )
// }
} label : {
// }
Text ( " Supprimer les scores " )
// . t o o l b a r {
}
// T o o l b a r I t e m ( p l a c e m e n t : . t o p B a r T r a i l i n g ) {
// M e n u {
} label : {
// B u t t o n {
LabelOptions ( )
// s c o r e T y p e = . l i v e
}
// } l a b e l : {
}
// L a b e l ( " S a i s i e L i v e " , s y s t e m I m a g e : " a i r p l a y a u d i o . c i r c l e " )
}
// }
//
// B u t t o n {
// s c o r e T y p e = . p r e p a r e
// } l a b e l : {
// L a b e l ( " P r é p a r e r " , s y s t e m I m a g e : " c a l e n d a r " )
// }
//
// D i v i d e r ( )
// M e n u {
// i f m a t c h . f i e l d I n d e x > 0 {
// B u t t o n ( r o l e : . d e s t r u c t i v e ) {
// m a t c h . c u r r e n t T o u r n a m e n t ? . r e m o v e F i e l d ( m a t c h . f i e l d I n d e x )
// m a t c h . f i e l d I n d e x = 0
// m a t c h . r e f r e s h B r o a d c a s t ( )
// s a v e ( )
// } l a b e l : {
// L a b e l ( " S u p p r i m e r l e t e r r a i n " , s y s t e m I m a g e : " f i g u r e . r u n " )
// }
// }
// B u t t o n ( r o l e : . d e s t r u c t i v e ) {
// m a t c h . r e s t a r t M a t c h ( )
// s a v e ( )
// } l a b e l : {
// L a b e l ( " S u p p r i m e r l ' h o r a i r e " , s y s t e m I m a g e : " x m a r k . c i r c l e . f i l l " )
// }
//
// B u t t o n ( r o l e : . d e s t r u c t i v e ) {
// m a t c h . r e s e t S c o r e ( )
// s a v e ( )
// } l a b e l : {
// L a b e l ( " S u p p r i m e r l e s s c o r e s " , s y s t e m I m a g e : " x m a r k . c i r c l e . f i l l " )
// }
//
// i f m a t c h . i s F e d e r a l T o u r n a m e n t = = f a l s e & & m a t c h . i s F r i e n d l y M a t c h = = f a l s e {
// B u t t o n ( r o l e : . d e s t r u c t i v e ) {
// m a t c h . r e s e t M a t c h ( )
// s a v e ( )
// } l a b e l : {
// L a b e l ( " S u p p r i m e r l e s é q u i p e s e t l e s s c o r e s " , s y s t e m I m a g e : " x m a r k . c i r c l e . f i l l " )
// }
// }
// } l a b e l : {
// T e x t ( " É d i t e r " )
// }
//
// } l a b e l : {
// L a b e l ( " O p t i o n s " , s y s t e m I m a g e : " e l l i p s i s . c i r c l e " )
// }
// }
// }
. navigationTitle ( match . matchTitle ( ) )
. navigationTitle ( match . matchTitle ( ) )
. navigationBarTitleDisplayMode ( . inline )
. navigationBarTitleDisplayMode ( . inline )
. toolbarBackground ( . visible , for : . navigationBar )
. toolbarBackground ( . visible , for : . navigationBar )
@ -365,8 +332,6 @@ struct MatchDetailView: View {
@ ViewBuilder
@ ViewBuilder
var menuView : some View {
var menuView : some View {
broadcastView
if match . hasStarted ( ) {
if match . hasStarted ( ) {
Section {
Section {
editionView
editionView
@ -455,23 +420,10 @@ struct MatchDetailView: View {
}
}
}
}
// i f m a t c h . c a n B r o a d c a s t ( ) = = t r u e {
// P i c k e r ( s e l e c t i o n : $ b r o a d c a s t e d ) {
// T e x t ( " O u i " ) . t a g ( t r u e )
// T e x t ( " N o n " ) . t a g ( f a l s e )
// } l a b e l : {
// T e x t ( " D i f f u s e r a u t o m a t i q u e m e n t " )
// }
// }
RowButtonView ( " Valider " ) {
RowButtonView ( " Valider " ) {
match . validateMatch ( fromStartDate : startDateSetup = = . now ? Date ( ) : startDate , toEndDate : endDate , fieldSetup : fieldSetup )
match . validateMatch ( fromStartDate : startDateSetup = = . now ? Date ( ) : startDate , toEndDate : endDate , fieldSetup : fieldSetup )
if broadcasted {
broadcastAndSave ( )
} else {
save ( )
save ( )
}
isEditing . toggle ( )
isEditing . toggle ( )
@ -481,22 +433,6 @@ struct MatchDetailView: View {
}
}
}
}
@ ViewBuilder
var broadcastView : some View {
Section {
// i f m a t c h . i s B r o a d c a s t e d ( ) {
// R o w B u t t o n V i e w ( " A r r ê t e r d e d i f f u s e r " ) {
// m a t c h . s t o p B r o a d c a s t ( )
// s a v e ( )
// }
// } e l s e i f m a t c h . c a n B r o a d c a s t ( ) = = t r u e {
// R o w B u t t o n V i e w ( " D i f f u s e r " , s y s t e m I m a g e : " a i r p l a y v i d e o " ) {
// b r o a d c a s t A n d S a v e ( )
// }
// }
}
}
var shareView : some View {
var shareView : some View {
NavigationLink {
NavigationLink {
// E d i t S h a r i n g V i e w ( m a t c h : m a t c h )
// E d i t S h a r i n g V i e w ( m a t c h : m a t c h )
@ -509,16 +445,6 @@ struct MatchDetailView: View {
private func save ( ) {
private func save ( ) {
try ? dataStore . matches . addOrUpdate ( instance : match )
try ? dataStore . matches . addOrUpdate ( instance : match )
}
}
private func broadcastAndSave ( ) {
Task {
// t r y ? a w a i t m a t c h . b r o a d c a s t ( )
await MainActor . run {
}
}
}
}
}
# Preview {
# Preview {