Begin statistics creation
This commit is contained in:
@@ -5,9 +5,18 @@ struct LabelCreationView: View {
|
||||
@Environment(\.colorScheme)
|
||||
private var colorScheme
|
||||
|
||||
@Environment(\.language)
|
||||
private var language
|
||||
|
||||
@Binding
|
||||
var labels: [ContentLabel]
|
||||
|
||||
@State
|
||||
private var showWorkoutSelection = false
|
||||
|
||||
@State
|
||||
private var selectedWorkouts: [FileResource] = []
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
ForEach($labels, id: \.icon) { label in
|
||||
@@ -25,10 +34,25 @@ struct LabelCreationView: View {
|
||||
.cornerRadius(8)
|
||||
}
|
||||
.onMove(perform: moveLabel)
|
||||
Button("Load workout") { showWorkoutSelection = true }
|
||||
.padding(.vertical, 2)
|
||||
Button("Add new label", action: addLabel)
|
||||
.padding(.vertical, 2)
|
||||
}
|
||||
.frame(minHeight: 250)
|
||||
.sheet(isPresented: $showWorkoutSelection) {
|
||||
MultiFileSelectionView(
|
||||
selectedFiles: $selectedWorkouts,
|
||||
allowedType: .route)
|
||||
}
|
||||
.onChange(of: selectedWorkouts) {
|
||||
let workouts = selectedWorkouts.compactMap { $0.routeOverview }
|
||||
guard !workouts.isEmpty else {
|
||||
return
|
||||
}
|
||||
let overview = RouteOverview.combine(workouts)
|
||||
overview.update(labels: &labels, language: language)
|
||||
}
|
||||
}
|
||||
|
||||
private func addLabel() {
|
||||
|
||||
Reference in New Issue
Block a user