wip
This commit is contained in:
77
Workouts/Views/Settings/SettingsView.swift
Normal file
77
Workouts/Views/Settings/SettingsView.swift
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// SettingsView.swift
|
||||
// Workouts
|
||||
//
|
||||
// Created by rzen on 7/13/25 at 10:24 AM.
|
||||
//
|
||||
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import SwiftData
|
||||
|
||||
struct SettingsView: View {
|
||||
@Environment(\.modelContext) private var modelContext
|
||||
|
||||
|
||||
var splitsCount: Int? { try? modelContext.fetchCount(FetchDescriptor<Split>()) }
|
||||
var musclesCount: Int? { try? modelContext.fetchCount(FetchDescriptor<Muscle>()) }
|
||||
var muscleGroupsCount: Int? { try? modelContext.fetchCount(FetchDescriptor<MuscleGroup>()) }
|
||||
var exerciseTypeCount: Int? { try? modelContext.fetchCount(FetchDescriptor<ExerciseType>()) }
|
||||
var exercisesCount: Int? { try? modelContext.fetchCount(FetchDescriptor<Exercise>()) }
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section (header: Text("Lists")) {
|
||||
NavigationLink(destination: SplitsListView()) {
|
||||
HStack {
|
||||
Text("Splits")
|
||||
Spacer()
|
||||
Text("\(splitsCount ?? 0)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
NavigationLink(destination: MuscleGroupsListView()) {
|
||||
HStack {
|
||||
Text("Muscle Groups")
|
||||
Spacer()
|
||||
Text("\(muscleGroupsCount ?? 0)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
NavigationLink(destination: MusclesListView()) {
|
||||
HStack {
|
||||
Text("Muscles")
|
||||
Spacer()
|
||||
Text("\(musclesCount ?? 0)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
NavigationLink(destination: ExerciseTypeListView()) {
|
||||
HStack {
|
||||
Text("Exercise Types")
|
||||
Spacer()
|
||||
Text("\(exerciseTypeCount ?? 0)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
NavigationLink(destination: ExercisesListView()) {
|
||||
HStack {
|
||||
Text("Exercises")
|
||||
Spacer()
|
||||
Text("\(exercisesCount ?? 0)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Settings")
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user