Files
honeyDueKMP/iosApp/iosApp/Subviews/Residence/ResidenceCard.swift
2025-11-05 17:15:17 -06:00

91 lines
2.5 KiB
Swift

import SwiftUI
import ComposeApp
struct ResidenceCard: View {
let residence: ResidenceWithTasks
var body: some View {
VStack(alignment: .leading, spacing: 12) {
VStack(alignment: .leading, spacing: 4) {
Text(residence.name)
.font(.title3)
.fontWeight(.bold)
.foregroundColor(.primary)
Text(residence.streetAddress)
.font(.subheadline)
.foregroundColor(.secondary)
Text("\(residence.city), \(residence.stateProvince)")
.font(.subheadline)
.foregroundColor(.secondary)
}
Divider()
HStack(spacing: 24) {
TaskStatChip(
icon: "list.bullet",
value: "\(residence.taskSummary.total)",
label: "Tasks",
color: .blue
)
TaskStatChip(
icon: "checkmark.circle.fill",
value: "\(residence.taskSummary.completed)",
label: "Done",
color: .green
)
TaskStatChip(
icon: "clock.fill",
value: "\(residence.taskSummary.pending)",
label: "Pending",
color: .orange
)
}
}
.padding(20)
.background(Color(.systemBackground))
.cornerRadius(12)
.shadow(color: Color.black.opacity(0.05), radius: 5, x: 0, y: 2)
}
}
#Preview {
ResidenceCard(residence: ResidenceWithTasks(
id: 1,
owner: 1,
ownerUsername: "testuser",
name: "My Home",
propertyType: "House",
streetAddress: "123 Main St",
apartmentUnit: nil,
city: "San Francisco",
stateProvince: "CA",
postalCode: "94102",
country: "USA",
bedrooms: 3,
bathrooms: 2.5,
squareFootage: 1800,
lotSize: 0.25,
yearBuilt: 2010,
description: nil,
purchaseDate: nil,
purchasePrice: nil,
isPrimary: true,
taskSummary: TaskSummary(
total: 10,
completed: 3,
pending: 5,
inProgress: 2,
overdue: 0
),
tasks: [],
createdAt: "2024-01-01T00:00:00Z",
updatedAt: "2024-01-01T00:00:00Z"
))
.padding()
}