Begin statistics creation

This commit is contained in:
Christoph Hagen
2025-08-31 16:27:32 +02:00
parent f972a2c020
commit 96bd07bdb7
33 changed files with 1406 additions and 187 deletions

View File

@@ -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() {