- Remove AppColors struct, migrate to iOS system colors throughout - Redesign ContractorFormSheet to use native SwiftUI Form components - Add color-coded icons to contractor form sections - Improve dark mode contrast for task cards - Add background colors to document detail fields - Fix text alignment issues in ContractorDetailView - Make task completion lists expandable/collapsible by default - Clear app badge on launch and when app becomes active - Update button styling with proper gradients and shadows - Improve form field focus states and accessibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
97 lines
3.9 KiB
Swift
97 lines
3.9 KiB
Swift
import SwiftUI
|
|
import ComposeApp
|
|
|
|
struct HomeScreenView: View {
|
|
@StateObject private var viewModel = ResidenceViewModel()
|
|
@StateObject private var loginViewModel = LoginViewModel()
|
|
|
|
var body: some View {
|
|
NavigationView {
|
|
ZStack {
|
|
Color(.systemGroupedBackground)
|
|
.ignoresSafeArea()
|
|
|
|
if viewModel.isLoading {
|
|
VStack(spacing: AppSpacing.lg) {
|
|
ProgressView()
|
|
.scaleEffect(1.2)
|
|
Text("Loading...")
|
|
.font(.body)
|
|
.foregroundColor(Color(.secondaryLabel))
|
|
}
|
|
} else {
|
|
ScrollView(showsIndicators: false) {
|
|
VStack(spacing: AppSpacing.xl) {
|
|
// Greeting Header
|
|
VStack(alignment: .leading, spacing: AppSpacing.xs) {
|
|
Text("Hello!")
|
|
.font(.title.weight(.bold))
|
|
.fontWeight(.bold)
|
|
.foregroundColor(Color(.label))
|
|
|
|
Text("Welcome to MyCrib")
|
|
.font(.body)
|
|
.foregroundColor(Color(.secondaryLabel))
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(.horizontal, AppSpacing.md)
|
|
.padding(.top, AppSpacing.md)
|
|
|
|
// Overview Card
|
|
if let summary = viewModel.residenceSummary {
|
|
OverviewCard(summary: summary.summary)
|
|
.transition(.scale.combined(with: .opacity))
|
|
}
|
|
|
|
// Navigation Cards
|
|
VStack(spacing: AppSpacing.md) {
|
|
NavigationLink(destination: ResidencesListView()) {
|
|
HomeNavigationCard(
|
|
icon: "house.fill",
|
|
title: "Residences",
|
|
subtitle: "Manage your properties"
|
|
)
|
|
}
|
|
.buttonStyle(PlainButtonStyle())
|
|
|
|
NavigationLink(destination: AllTasksView()) {
|
|
HomeNavigationCard(
|
|
icon: "checkmark.circle.fill",
|
|
title: "Tasks",
|
|
subtitle: "View and manage all tasks"
|
|
)
|
|
}
|
|
.buttonStyle(PlainButtonStyle())
|
|
}
|
|
.padding(.horizontal, AppSpacing.md)
|
|
}
|
|
.padding(.vertical, AppSpacing.md)
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("MyCrib")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.toolbar {
|
|
ToolbarItem(placement: .navigationBarTrailing) {
|
|
Button(action: {
|
|
loginViewModel.logout()
|
|
}) {
|
|
HStack(spacing: AppSpacing.xs) {
|
|
Image(systemName: "rectangle.portrait.and.arrow.right")
|
|
.font(.system(size: 18, weight: .semibold))
|
|
}
|
|
.foregroundColor(.red)
|
|
}
|
|
}
|
|
}
|
|
.onAppear {
|
|
viewModel.loadResidenceSummary()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
HomeScreenView()
|
|
}
|