diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index eb4e993..a13a9ba 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -23,6 +23,7 @@ struct ContentView: View { @State private var siriTipShown: Bool = false + @State var showAddSheet: Bool = false @State private var showSettingsSheet: Bool = false @State private var showStatsSheet: Bool = false @State private var showSubscriptionSheet: Bool = false @@ -42,6 +43,7 @@ struct ContentView: View { TimersView(isEditing: self.$isEditing, showSubscriptionSheet: self.$showSubscriptionSheet, + showAddSheet: self.$showAddSheet, siriHandler: { timer in self._handleSiriTips(timer: timer) }) @@ -80,7 +82,7 @@ struct ContentView: View { .sheet(isPresented: self.$boringContext.isShowingNewData, content: { }) .toolbar { - MainToolbarView(isEditing: self.$isEditing) + MainToolbarView(isEditing: self.$isEditing, showAddSheet: self.$showAddSheet) } .onAppear { self.showTip = Preferences.tipToShow @@ -136,7 +138,6 @@ struct ContentView: View { } } } - } } else { @@ -150,10 +151,10 @@ struct ContentView: View { struct MainToolbarView: ToolbarContent { @Binding var isEditing: Bool - + @Binding var showAddSheet: Bool + @State var showSettingsSheet: Bool = false @State var showStatsSheet: Bool = false - @State var showAddSheet: Bool = false @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \AbstractTimer.order, ascending: true)], @@ -176,20 +177,6 @@ struct MainToolbarView: ToolbarContent { } } ToolbarItemGroup(placement: .navigationBarTrailing) { -// if !self.records.isEmpty { -// Button { -// withAnimation { -// self.showStatsSheet.toggle() -// } -// } label: { -// Image(systemName: "scroll") -// } -// .sheet(isPresented: self.$showStatsSheet, content: { -// NavigationStack { -// ActivitiesView() -// } -// }) -// } if !self.timers.isEmpty { Button { withAnimation { @@ -263,7 +250,7 @@ struct Toolbar_Previews: PreviewProvider { } .navigationTitle("Title") .toolbar { - MainToolbarView(isEditing: .constant(false)) + MainToolbarView(isEditing: .constant(false), showAddSheet: .constant(false)) } } } diff --git a/LeCountdown/Views/TimersView.swift b/LeCountdown/Views/TimersView.swift index 8326989..51b0c07 100644 --- a/LeCountdown/Views/TimersView.swift +++ b/LeCountdown/Views/TimersView.swift @@ -15,6 +15,7 @@ struct TimersView: View { @Binding var isEditing: Bool @Binding var showSubscriptionSheet: Bool + @Binding var showAddSheet: Bool var siriHandler: ((AbstractTimer) -> ()) @@ -67,10 +68,13 @@ struct TimersView: View { } .padding(.horizontal, itemSpacing) } else { - Text("Disclaimer") - .monospaced() - .padding(32.0) - .multilineTextAlignment(.center) + + Button { + self.showAddSheet = true + } label: { + AddButtonView().frame(width: 180.0) + } + } } @@ -116,8 +120,19 @@ struct TimersView: View { } +struct AddButtonView: View { + var body: some View { + VStack(spacing: 8.0) { + Image(systemName: "plus.circle").font(.system(size: 60.0)) + Text("Create your first timer or stopwatch!") + } + } +} + struct TimersView_Previews: PreviewProvider { static var previews: some View { - TimersView(isEditing: .constant(false), showSubscriptionSheet: .constant(false), siriHandler: { _ in }) + TimersView(isEditing: .constant(false), showSubscriptionSheet: .constant(false), showAddSheet: .constant(false), siriHandler: { _ in }) + AddButtonView() + } } diff --git a/LeCountdown/en.lproj/Localizable.strings b/LeCountdown/en.lproj/Localizable.strings index 5b47e1d..2412a94 100644 --- a/LeCountdown/en.lproj/Localizable.strings +++ b/LeCountdown/en.lproj/Localizable.strings @@ -2,3 +2,4 @@ "Disclaimer" = "This is a beta version of Enchant.\n\nPlease don't depend on the app for critical events :)\n\n If you have some feedback or an issue, please tell me about it through the settings or within Testflight!"; "Widget Tip" = "Quickly launch your timers with widgets. You can add them by modifying your home or lock screen."; "Play confirmation sound" = "Play sound on start"; +"Create your first timer or stopwatch!" = "Create your first timer or stopwatch!"; diff --git a/LeCountdown/fr.lproj/Localizable.strings b/LeCountdown/fr.lproj/Localizable.strings index 50ff150..5b1f9f9 100644 --- a/LeCountdown/fr.lproj/Localizable.strings +++ b/LeCountdown/fr.lproj/Localizable.strings @@ -286,3 +286,4 @@ "Select and launch your timers" = "Choisissez vos raccourcis"; "Create your own timer" = "Créer un minuteur"; "Create your own stopwatch" = "Créer un chronomètre"; +"Create your first timer or stopwatch!" = "Créer votre premier minuteur ou chronomètre !";