- Replace 5-tab layout with 4 tabs: Dashboard, Timer, Entries, Settings - Dashboard: add Work Time Balance section using /client-targets API, showing per-client weekly progress bar, overtime/undertime label and expandable week breakdown - Time Entries: replace flat list with UICalendarView month grid; tap a day to see that day's entries; add filter sheet (date range, project, client); new TimeEntryDetailSheet for creating and editing entries; duration shown as Xh Ymin - Settings tab: user info header, navigation to Clients and Projects, logout button - ClientsListView: list with NavigationLink to ClientDetailView - ClientDetailView: inline client editing + full work time target CRUD (create, edit, delete target; add/delete balance corrections with date, hours, description) - ProjectsListView: grouped by client, NavigationLink to ProjectDetailView - ProjectDetailView: edit name, description, colour, client assignment - Add ClientTarget, WeekBalance, BalanceCorrection models and APIEndpoints for /client-targets routes - Update TimeInterval formatter: add formattedShortDuration (Xh Ymin / Xmin / <1min) used throughout app; keep formattedDuration for live timer display
55 lines
1.2 KiB
Swift
55 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
@main
|
|
struct TimeTrackerApp: App {
|
|
@StateObject private var authManager = AuthManager.shared
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
.environmentObject(authManager)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct RootView: View {
|
|
@EnvironmentObject var authManager: AuthManager
|
|
|
|
var body: some View {
|
|
Group {
|
|
if authManager.isAuthenticated {
|
|
MainTabView()
|
|
} else {
|
|
LoginView()
|
|
}
|
|
}
|
|
.task {
|
|
await authManager.checkAuthState()
|
|
}
|
|
}
|
|
}
|
|
|
|
struct MainTabView: View {
|
|
@State private var selectedTab = 0
|
|
|
|
var body: some View {
|
|
TabView(selection: $selectedTab) {
|
|
DashboardView()
|
|
.tabItem { Label("Dashboard", systemImage: "chart.bar") }
|
|
.tag(0)
|
|
|
|
TimerView()
|
|
.tabItem { Label("Timer", systemImage: "timer") }
|
|
.tag(1)
|
|
|
|
TimeEntriesView()
|
|
.tabItem { Label("Entries", systemImage: "calendar") }
|
|
.tag(2)
|
|
|
|
SettingsView()
|
|
.tabItem { Label("Settings", systemImage: "gearshape") }
|
|
.tag(3)
|
|
}
|
|
}
|
|
}
|