Add Plant Rooms/Zones feature for organizing plants by location
Implements Phase 3 of the feature roadmap: - Room entity with 7 default rooms (Kitchen, Living Room, Bedroom, etc.) - RoomRepositoryProtocol and CoreDataRoomRepository for persistence - CreateDefaultRoomsUseCase and ManageRoomsUseCase for CRUD operations - RoomsListView with swipe-to-delete and drag-to-reorder - RoomEditorView with SF Symbol icon picker - RoomPickerView for assigning plants to rooms - Updated Plant entity (location → roomID) and PlantDetailView - Added "Manage Rooms" section in SettingsView Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,9 @@ struct PlantDetailView: View {
|
||||
} else if let error = viewModel.error {
|
||||
errorView(error: error)
|
||||
} else {
|
||||
// Room assignment section
|
||||
roomSection
|
||||
|
||||
// Care information section
|
||||
if let careInfo = viewModel.careInfo {
|
||||
CareInformationSection(careInfo: careInfo)
|
||||
@@ -293,6 +296,34 @@ struct PlantDetailView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Room Section
|
||||
|
||||
private var roomSection: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Text("Location")
|
||||
.font(.headline)
|
||||
|
||||
RoomPickerView(
|
||||
selectedRoomID: Binding(
|
||||
get: { viewModel.plant.roomID },
|
||||
set: { newRoomID in
|
||||
Task {
|
||||
await viewModel.updateRoom(to: newRoomID)
|
||||
}
|
||||
}
|
||||
),
|
||||
onRoomChanged: { newRoomID in
|
||||
Task {
|
||||
await viewModel.updateRoom(to: newRoomID)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.cornerRadius(12)
|
||||
}
|
||||
|
||||
// MARK: - Identification Info Section
|
||||
|
||||
private var identificationInfoSection: some View {
|
||||
|
||||
Reference in New Issue
Block a user