Files
FrenoCorp/Lendair/Views/MainTabView.swift
Michael Freno 90c79eb6d4 FRE-4955 Review silent active run for Code Reviewer
- FRE-4955: 9th stale-run eval for Code Reviewer zombie run , marked false positive
- FRE-4954: Investigation of Code Reviewer adapter reliability closed as done. Root cause: no heartbeat/adapter config. Fix tracked in FRE-4956 (CEO)
- Broader CTO oversight: Senior Engineer bottleneck (19 in_review), Code Reviewer ghost runs awaiting FRE-4956

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-10 01:43:53 -04:00

89 lines
2.5 KiB
Swift

import SwiftUI
struct MainTabView: View {
@State private var selectedTab: AppTab = .home
@StateObject private var notificationVM = NotificationsViewModel()
var body: some View {
TabView(selection: $selectedTab) {
Group {
TrainingPlanView()
.tag(AppTab.home)
.tabItem {
Label(AppTab.home.title, systemImage: AppTab.home.icon)
}
ChallengesView()
.tag(AppTab.challenges)
.tabItem {
Label(AppTab.challenges.title, systemImage: AppTab.challenges.icon)
}
ClubsView()
.tag(AppTab.clubs)
.tabItem {
Label(AppTab.clubs.title, systemImage: AppTab.clubs.icon)
}
NotificationsView(viewModel: notificationVM)
.tag(AppTab.notifications)
.tabItem {
Label(AppTab.notifications.title, systemImage: AppTab.notifications.icon)
}
.badge(notificationVM.badgeCount)
SettingsView()
.tag(AppTab.profile)
.tabItem {
Label(AppTab.profile.title, systemImage: AppTab.profile.icon)
}
}
}
.onAppear {
Task {
await notificationVM.fetchUnreadCount()
}
}
.onChange(of: selectedTab) { _, newTab in
if newTab == .notifications {
Task {
await notificationVM.fetchNotifications()
await notificationVM.fetchUnreadCount()
}
}
}
}
}
enum AppTab: String, CaseIterable {
case home
case challenges
case clubs
case notifications
case profile
var title: String {
switch self {
case .home: return "Home"
case .challenges: return "Challenges"
case .clubs: return "Clubs"
case .notifications: return "Notifications"
case .profile: return "Profile"
}
}
var icon: String {
switch self {
case .home: return "house.fill"
case .challenges: return "flag.fill"
case .clubs: return "person.3.fill"
case .notifications: return "bell.fill"
case .profile: return "person.circle"
}
}
}
#Preview {
MainTabView()
}