diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Navigation/Navigation+Category.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Navigation/Navigation+Category.swift index 0bf8eee448..da1f0f4f0f 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Navigation/Navigation+Category.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Navigation/Navigation+Category.swift @@ -12,6 +12,7 @@ extension Navigation { case activities case remotes case stories + case carereceivers // MARK: Internal diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift new file mode 100644 index 0000000000..6e98fb5850 --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift @@ -0,0 +1,35 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import DesignKit +import SwiftUI + +// MARK: - CarereceiversView + +struct CarereceiverView: View { + // MARK: Internal + + var body: some View { + Button { + self.rootOwnerViewModel.isCarereceiverSettingsViewPresented = true + } label: { + CarereceiverAvatarCell(carereceiver: self.rootOwnerViewModel.currentCarereceiver!) + } + .onDisappear { + self.rootOwnerViewModel.currentCarereceiver = nil + } + .sheet(isPresented: self.$rootOwnerViewModel.isCarereceiverSettingsViewPresented) { + CarereceiverSettingsView(modifiedCarereceiver: self.rootOwnerViewModel.currentCarereceiver!) + } + } + + // MARK: Private + + @ObservedObject private var rootOwnerViewModel: RootOwnerViewModel = .shared + @ObservedObject private var styleManager: StyleManager = .shared +} + +#Preview { + CarereceiverView() +} diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+CategoryLabel.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+CategoryLabel.swift index 67ffbc82c7..06c7bc51db 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+CategoryLabel.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+CategoryLabel.swift @@ -36,6 +36,10 @@ extension MainView { case .stories: self.title = String(l10n.MainView.Sidebar.CategoryLabel.stories.characters) self.systemImage = "book" + + case .carereceivers: + self.title = String(l10n.MainView.Sidebar.CategoryLabel.carereceivers.characters) + self.systemImage = "person.circle" } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+l10n.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+l10n.swift index 42476795ac..db6b7535db 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+l10n.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView+l10n.swift @@ -16,6 +16,7 @@ extension l10n { static let activities = LocalizedString("main_view.sidebar.category_label.activities", value: "Activities", comment: "The title of the category 'Activities'") static let remotes = LocalizedString("main_view.sidebar.category_label.remotes", value: "Remotes", comment: "The title of the category 'Remotes'") static let stories = LocalizedString("main_view.sidebar.category_label.stories", value: "Stories", comment: "The title of the category 'Stories'") + static let carereceivers = LocalizedString("main_view.sidebar.category_label.carereceivers", value: "Care Receivers", comment: "The title of the category 'Care Receivers'") } static let navigationTitle = LocalizedString("main_view.sidebar.navigation_title", value: "Leka App", comment: "The title of the sidebar") @@ -23,6 +24,8 @@ extension l10n { static let sectionInformation = LocalizedString("main_view.sidebar.section.information", value: "Information", comment: "The title of the section 'Information'") static let sectionContent = LocalizedString("main_view.sidebar.section.content", value: "Content", comment: "The title of the section 'Content'") + + static let sectionTracking = LocalizedString("main_view.sidebar.section.tracking", value: "Tracking", comment: "The title of the section 'Tracking'") } } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift index ff1c8b9be9..992737fb8b 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift @@ -50,6 +50,10 @@ struct MainView: View { CategoryLabel(category: .stories) } + Section(String(l10n.MainView.Sidebar.sectionTracking.characters)) { + CategoryLabel(category: .carereceivers) + } + VStack(alignment: .center, spacing: 20) { if self.authManagerViewModel.userAuthenticationState == .loggedIn { Button { @@ -102,6 +106,12 @@ struct MainView: View { .font(.largeTitle) .bold() + case .carereceivers: + CarereceiverPicker() + .navigationDestination(isPresented: .constant(self.rootOwnerViewModel.isCarereceiverSelected)) { + CarereceiverView() + } + case .none: Text("Select a category") .font(.largeTitle)