diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index 59e7050..40e1495 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -65,60 +65,68 @@ struct ContentView: View { var body: some View { let columns: [GridItem] = self._columns() + let timers: [AbstractTimer] = Array(self.timers) - GeometryReader { reader in - let width: CGFloat = reader.size.width / CGFloat(columns.count) - 15.0 - - VStack { + Group { + if timers.count > 0 { - ScrollView { + GeometryReader { reader in + let width: CGFloat = reader.size.width / CGFloat(columns.count) - 15.0 - LazyVGrid( - columns: columns, - spacing: itemSpacing - ) { + VStack { + + ScrollView { + + LazyVGrid( + columns: columns, + spacing: itemSpacing + ) { + + ReorderableForEach(items: timers) { timer in + + DialView(timer: timer, isEditingBinding: self.$isEditing, frameSize: width, handler: { id in + self._handleSiriTips(timerId: id) + }) + .environment(\.managedObjectContext, viewContext) + .environmentObject(Conductor.maestro) + .environmentObject(boringContext) + } moveAction: { from, to in + self._reorder(from: from, to: to) + } + + } + }.padding(.horizontal, itemSpacing) + + // if !self.tipsShown, let tip = Preferences.tipToShow { + // TipView(tip: tip) { + // self._hideTip(tip) + // }.padding() + // } - ReorderableForEach(items: Array(self.timers)) { timer in + Spacer() + + SiriTipView(intent: StartTimerIntent(), isVisible: self.$siriTipShown) + .siriTipViewStyle(SiriTipViewStyle.dark).padding() + + if !conductor.liveTimers.isEmpty { + + HStack(alignment: .center) { + VolumeView().padding(12.0) + }.frame(width: 300.0, height: 40.0) + .background(Color(white: 0.9)) + .cornerRadius(16.0) - DialView(timer: timer, isEditingBinding: self.$isEditing, frameSize: width, handler: { id in - self._handleSiriTips(timerId: id) - }) + LiveTimerListView() .environment(\.managedObjectContext, viewContext) - .environmentObject(Conductor.maestro) - .environmentObject(boringContext) - } moveAction: { from, to in - self._reorder(from: from, to: to) + .environmentObject(conductor) + .foregroundColor(.white) + .background(Color(white: 0.1)) + .cornerRadius(32.0, corners: [.topRight, .topLeft]) } - } - }.padding(.horizontal, itemSpacing) - -// if !self.tipsShown, let tip = Preferences.tipToShow { -// TipView(tip: tip) { -// self._hideTip(tip) -// }.padding() -// } - - Spacer() - - SiriTipView(intent: StartTimerIntent(), isVisible: self.$siriTipShown) - .siriTipViewStyle(SiriTipViewStyle.dark).padding() - - if !conductor.liveTimers.isEmpty { - - HStack(alignment: .center) { - VolumeView().padding(12.0) - }.frame(width: 300.0, height: 40.0) - .background(Color(white: 0.9)) - .cornerRadius(16.0) - - LiveTimerListView() - .environment(\.managedObjectContext, viewContext) - .environmentObject(conductor) - .foregroundColor(.white) - .background(Color(white: 0.1)) - .cornerRadius(32.0, corners: [.topRight, .topLeft]) } + } else { + Text("You'll find your timers here. Start by creating them on the left screen") } } .navigationTitle("Home") @@ -133,15 +141,6 @@ struct ContentView: View { // .environment(\.managedObjectContext, viewContext) }) .toolbar { -// ToolbarItem(placement: .navigationBarTrailing) { -// Button { -// self.boringContext.isShowingNewData = true -// } label: { -// HStack { -// Image(systemName: "plus") -// } -// } -// } ToolbarItem(placement: .navigationBarTrailing) { Button { withAnimation { @@ -154,7 +153,6 @@ struct ContentView: View { } .onAppear { self._askPermissions() -// self.showLiveTimersSheet = !conductor.liveTimers.isEmpty } .onOpenURL { url in self._performActionIfPossible(url: url) diff --git a/LeCountdown/fr.lproj/Localizable.strings b/LeCountdown/fr.lproj/Localizable.strings index 481443e..3bb8699 100644 --- a/LeCountdown/fr.lproj/Localizable.strings +++ b/LeCountdown/fr.lproj/Localizable.strings @@ -247,3 +247,4 @@ "Timer %@ started" = "Le minuteur %@ a démarré"; "The timer has not been found in the app" = "Le minuteur n'a pas été trouvé dans l'app"; "In-app purchase disabled" = "Les achats in-app sont désactivés. Veuillez les activer si vous souhaitez vous abonner"; +"You'll find your timers here. Start by creating them on the left screen" = "Vous retrouverez vos minuteurs ici. Commencez par en créer dans l'écran de gauche";