From 8fa3bf22e633a1161ac6c559c3c372e51d879fb0 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Wed, 14 Feb 2024 15:03:00 +0100 Subject: [PATCH 1/3] :lipstick: (LekaApp): Upgrade AvatarPicker ListView --- .../Views/AvatarPicker/AvatarPicker+ListView.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/AvatarPicker/AvatarPicker+ListView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/AvatarPicker/AvatarPicker+ListView.swift index 521e568922..8bf80e41f6 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/AvatarPicker/AvatarPicker+ListView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/AvatarPicker/AvatarPicker+ListView.swift @@ -29,11 +29,12 @@ extension AvatarPicker { .animation(.easeIn, value: self.selected) } } - .padding(.horizontal, 10) + .padding() } - .frame(height: 180) } + .listRowBackground(Color.clear) } + .listRowInsets(EdgeInsets()) } } From 547fc159aa713cfec084fe558b7887a546b051d0 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Wed, 14 Feb 2024 15:08:02 +0100 Subject: [PATCH 2/3] :recycle: (LekaApp): Refactor createProfile views UI --- Apps/LekaApp/Resources/Localizable.xcstrings | 10 ++-- .../Views/Profiles/CreateCaregiverView.swift | 57 +++++++++++-------- .../Profiles/CreateCarereceiverView.swift | 40 ++++++++----- 3 files changed, 63 insertions(+), 44 deletions(-) diff --git a/Apps/LekaApp/Resources/Localizable.xcstrings b/Apps/LekaApp/Resources/Localizable.xcstrings index e80647dd65..927c218a1a 100644 --- a/Apps/LekaApp/Resources/Localizable.xcstrings +++ b/Apps/LekaApp/Resources/Localizable.xcstrings @@ -549,13 +549,13 @@ "en": { "stringUnit": { "state": "new", - "value": "Caregiver name" + "value": "Name" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Nom d'accompagnant" + "value": "Nom" } } } @@ -627,7 +627,7 @@ "fr": { "stringUnit": { "state": "translated", - "value": "Cr\u00e9er un profil de personne accompagn\u00e9e" + "value": "Cr\u00e9er un profil d'accompagnant" } } } @@ -693,13 +693,13 @@ "en": { "stringUnit": { "state": "new", - "value": "Carereceiver name" + "value": "Name" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Nom de la personne accompagn\u00e9e" + "value": "Nom" } } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift index 42ccf20c0a..5be4e06feb 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift @@ -17,15 +17,23 @@ struct CreateCaregiverView: View { var body: some View { NavigationStack { - ScrollView { - VStack(spacing: 40) { - self.avatarNavigationLink + VStack(spacing: 40) { + Form { + Section { + self.avatarPickerButton + .listRowBackground(Color.clear) + } - TextFieldDefault(label: String(l10n.CaregiverCreation.caregiverNameLabel.characters), - entry: self.$newCaregiver.name) - .frame(width: 400) + Section { + LabeledContent(String(l10n.CaregiverCreation.caregiverNameLabel.characters)) { + TextField("", text: self.$newCaregiver.name) + .multilineTextAlignment(.trailing) + } + } - self.professionNavigationLink + Section { + self.professionNavigationLink + } Button(String(l10n.CaregiverCreation.registerProfilButton.characters)) { withAnimation { @@ -38,43 +46,43 @@ struct CreateCaregiverView: View { } .disabled(self.newCaregiver.name.isEmpty) .buttonStyle(.borderedProminent) + .listRowBackground(Color.clear) + .frame(maxWidth: .infinity, alignment: .center) } - .padding() - .navigationTitle(String(l10n.CaregiverCreation.title.characters)) - .navigationBarTitleDisplayMode(.inline) } + .navigationTitle(String(l10n.CaregiverCreation.title.characters)) + .navigationBarTitleDisplayMode(.inline) } } // MARK: Private @ObservedObject private var rootOwnerViewModel = RootOwnerViewModel.shared + @State private var isAvatarPickerPresented: Bool = false - private var avatarNavigationLink: some View { - NavigationLink { - AvatarPicker(avatar: self.$newCaregiver.avatar) + private var avatarPickerButton: some View { + Button { + self.isAvatarPickerPresented = true } label: { - VStack(spacing: 15) { + VStack(alignment: .center, spacing: 15) { AvatarPicker.ButtonLabel(image: self.newCaregiver.avatar) Text(l10n.CaregiverCreation.avatarChoiceButton) .font(.headline) } } + .navigationDestination(isPresented: self.$isAvatarPickerPresented) { + AvatarPicker(avatar: self.$newCaregiver.avatar) + } + .frame(maxWidth: .infinity, alignment: .center) } private var professionNavigationLink: some View { VStack(alignment: .leading) { - HStack { + NavigationLink { + ProfessionPicker(caregiver: self.$newCaregiver) + } label: { Text(l10n.CaregiverCreation.professionLabel) .font(.body) - - Spacer() - - NavigationLink { - ProfessionPicker(caregiver: self.$newCaregiver) - } label: { - Label(String(l10n.CaregiverCreation.professionAddButton.characters), systemImage: "plus") - } } if !self.newCaregiver.professions.isEmpty { @@ -83,7 +91,6 @@ struct CreateCaregiverView: View { } } } - .frame(width: 400) } } @@ -97,7 +104,7 @@ extension l10n { static let avatarChoiceButton = LocalizedString("lekaapp.caregiver_creation.avatar_choice_button", value: "Choose an avatar", comment: "Caregiver creation avatar choice button label") - static let caregiverNameLabel = LocalizedString("lekaapp.caregiver_creation.caregiver_name_label", value: "Caregiver name", comment: "Caregiver creation caregiver name textfield label") + static let caregiverNameLabel = LocalizedString("lekaapp.caregiver_creation.caregiver_name_label", value: "Name", comment: "Caregiver creation caregiver name textfield label") static let professionLabel = LocalizedString("lekaapp.caregiver_creation.profession_label", value: "Profession(s)", comment: "Caregiver creation profession label above profession selection button") diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift index e73e3e483a..547d12c585 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift @@ -17,12 +17,19 @@ struct CreateCarereceiverView: View { var body: some View { NavigationStack { - ScrollView { - VStack(spacing: 40) { - self.avatarNavigationLink + VStack(spacing: 40) { + Form { + Section { + self.avatarPickerButton + .listRowBackground(Color.clear) + } - TextFieldDefault(label: String(l10n.CarereceiverCreation.carereceiverNameLabel.characters), - entry: self.$newCarereceiver.name) + Section { + LabeledContent(String(l10n.CarereceiverCreation.carereceiverNameLabel.characters)) { + TextField("", text: self.$newCarereceiver.name) + .multilineTextAlignment(.trailing) + } + } Button(String(l10n.CarereceiverCreation.registerProfilButton.characters)) { withAnimation { @@ -35,29 +42,34 @@ struct CreateCarereceiverView: View { } .disabled(self.newCarereceiver.name.isEmpty) .buttonStyle(.borderedProminent) + .listRowBackground(Color.clear) + .frame(maxWidth: .infinity, alignment: .center) } - .frame(width: 400) - .padding() - .navigationTitle(String(l10n.CarereceiverCreation.title.characters)) - .navigationBarTitleDisplayMode(.inline) } + .navigationTitle(String(l10n.CarereceiverCreation.title.characters)) + .navigationBarTitleDisplayMode(.inline) } } // MARK: Private @ObservedObject private var rootOwnerViewModel = RootOwnerViewModel.shared + @State private var isAvatarPickerPresented: Bool = false - private var avatarNavigationLink: some View { - NavigationLink { - AvatarPicker(avatar: self.$newCarereceiver.avatar) + private var avatarPickerButton: some View { + Button { + self.isAvatarPickerPresented = true } label: { - VStack(spacing: 15) { + VStack(alignment: .center, spacing: 15) { AvatarPicker.ButtonLabel(image: self.newCarereceiver.avatar) Text(l10n.CarereceiverCreation.avatarChoiceButton) .font(.headline) } } + .navigationDestination(isPresented: self.$isAvatarPickerPresented) { + AvatarPicker(avatar: self.$newCarereceiver.avatar) + } + .frame(maxWidth: .infinity, alignment: .center) } } @@ -71,7 +83,7 @@ extension l10n { static let avatarChoiceButton = LocalizedString("lekaapp.carereceiver_creation.avatar_choice_button", value: "Choose an avatar", comment: " Carereceiver creation avatar choice button label") - static let carereceiverNameLabel = LocalizedString("lekaapp.carereceiver_creation.carereceiver_name_label", value: "Carereceiver name", comment: " Carereceiver creation carereceiver name textfield label") + static let carereceiverNameLabel = LocalizedString("lekaapp.carereceiver_creation.carereceiver_name_label", value: "Name", comment: " Carereceiver creation carereceiver name textfield label") static let registerProfilButton = LocalizedString("lekaapp.carereceiver_creation.register_profil_button", value: "Register profile", comment: " Carereceiver creation register profil button label") } From 54bc084e596f04c92e45d4740c90ee22fc4dadf6 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Wed, 14 Feb 2024 15:22:33 +0100 Subject: [PATCH 3/3] :truck: (LekaApp): Rename ProfileSettings in EditProfiles --- Apps/LekaApp/Resources/Localizable.xcstrings | 28 +++++++++---------- .../CaregiverSettingsView+l10n.swift | 27 ------------------ .../CarereceiverSettingsView+l10n.swift | 19 ------------- .../EditCaregiverView+AccentColorRow.swift} | 8 +++--- .../EditCaregiverView+AppearanceRow.swift} | 8 +++--- .../EditCaregiverView+l10n.swift | 27 ++++++++++++++++++ .../EditCaregiverView.swift} | 18 ++++++------ .../EditCarereceiverView+l10n.swift | 19 +++++++++++++ .../EditCarereceiverView.swift} | 24 ++++++++-------- .../Views/MainView/CarereceiverView.swift | 6 ++-- ...gsLabel.swift => EditCaregiverLabel.swift} | 8 +++--- .../Views/MainView/MainView.swift | 6 ++-- .../Views/MainView/RootOwnerViewModel.swift | 4 +-- 13 files changed, 102 insertions(+), 100 deletions(-) delete mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+l10n.swift delete mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView+l10n.swift rename Apps/LekaApp/Sources/_NEWCodeBase/Views/{CaregiverSettingsView/CaregiverSettingsView+AccentColorRow.swift => EditCaregiverView/EditCaregiverView+AccentColorRow.swift} (88%) rename Apps/LekaApp/Sources/_NEWCodeBase/Views/{CaregiverSettingsView/CaregiverSettingsView+AppearanceRow.swift => EditCaregiverView/EditCaregiverView+AppearanceRow.swift} (78%) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+l10n.swift rename Apps/LekaApp/Sources/_NEWCodeBase/Views/{CaregiverSettingsView/CaregiverSettingsView.swift => EditCaregiverView/EditCaregiverView.swift} (81%) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView+l10n.swift rename Apps/LekaApp/Sources/_NEWCodeBase/Views/{CarereceiverSettingsView/CarereceiverSettingsView.swift => EditCarereceiverView/EditCarereceiverView.swift} (72%) rename Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/{CaregiverSettingsLabel.swift => EditCaregiverLabel.swift} (94%) diff --git a/Apps/LekaApp/Resources/Localizable.xcstrings b/Apps/LekaApp/Resources/Localizable.xcstrings index 927c218a1a..d13086b9a2 100644 --- a/Apps/LekaApp/Resources/Localizable.xcstrings +++ b/Apps/LekaApp/Resources/Localizable.xcstrings @@ -2,7 +2,7 @@ "version": "1.0", "sourceLanguage": "en", "strings": { - "caregiver_settings_view.appearance_section.accent_color_row.title": { + "edit_caregiver_view.appearance_section.accent_color_row.title": { "comment": "AccentColor Row title", "extractionState": "extracted_with_value", "localizations": { @@ -20,7 +20,7 @@ } } }, - "caregiver_settings_view.appearance_section.appearance_row.title": { + "edit_caregiver_view.appearance_section.appearance_row.title": { "comment": "Appearance Row title", "extractionState": "extracted_with_value", "localizations": { @@ -38,8 +38,8 @@ } } }, - "caregiver_settings_view.close_button_label": { - "comment": "Close button label of Caregiver Settings View", + "edit_caregiver_view.close_button_label": { + "comment": "Close button label of Edit Caregiver View", "extractionState": "extracted_with_value", "localizations": { "en": { @@ -56,8 +56,8 @@ } } }, - "caregiver_settings_view.navigation_title": { - "comment": "The navigation title of Caregiver Settings View", + "edit_caregiver_view.navigation_title": { + "comment": "The navigation title of Edit Caregiver View", "extractionState": "extracted_with_value", "localizations": { "en": { @@ -74,8 +74,8 @@ } } }, - "caregiver_settings_view.save_button_label": { - "comment": "Save button label of Caregiver Settings View", + "edit_caregiver_view.save_button_label": { + "comment": "Save button label of Edit Caregiver View", "extractionState": "extracted_with_value", "localizations": { "en": { @@ -92,8 +92,8 @@ } } }, - "carereceiver_settings_view.close_button_label": { - "comment": "Close button label of Carereceiver Settings View", + "edit_carereceiver_view.close_button_label": { + "comment": "Close button label of Edit Carereceiver View", "extractionState": "extracted_with_value", "localizations": { "en": { @@ -110,8 +110,8 @@ } } }, - "carereceiver_settings_view.navigation_title": { - "comment": "The navigation title of Carereceiver Settings View", + "edit_carereceiver_view.navigation_title": { + "comment": "The navigation title of Edit Carereceiver View", "extractionState": "extracted_with_value", "localizations": { "en": { @@ -128,8 +128,8 @@ } } }, - "carereceiver_settings_view.save_button_label": { - "comment": "Save button label of Carereceiver Settings View", + "edit_carereceiver_view.save_button_label": { + "comment": "Save button label of Edit Carereceiver View", "extractionState": "extracted_with_value", "localizations": { "en": { diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+l10n.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+l10n.swift deleted file mode 100644 index 8e3adc0050..0000000000 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+l10n.swift +++ /dev/null @@ -1,27 +0,0 @@ -// Leka - iOS Monorepo -// Copyright APF France handicap -// SPDX-License-Identifier: Apache-2.0 - -import LocalizationKit - -// swiftlint:disable line_length nesting - -extension l10n { - enum CaregiverSettingsView { - enum AppearanceRow { - static let title = LocalizedString("caregiver_settings_view.appearance_section.appearance_row.title", value: "Dark Mode", comment: "Appearance Row title") - } - - enum AccentColorRow { - static let title = LocalizedString("caregiver_settings_view.appearance_section.accent_color_row.title", value: "Color Theme", comment: "AccentColor Row title") - } - - static let navigationTitle = LocalizedString("caregiver_settings_view.navigation_title", value: "Profil of ", comment: "The navigation title of Caregiver Settings View") - - static let saveButtonLabel = LocalizedString("caregiver_settings_view.save_button_label", value: "Save", comment: "Save button label of Caregiver Settings View") - - static let closeButtonLabel = LocalizedString("caregiver_settings_view.close_button_label", value: "Close", comment: "Close button label of Caregiver Settings View") - } -} - -// swiftlint:enable line_length nesting diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView+l10n.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView+l10n.swift deleted file mode 100644 index 5f4ab6beb5..0000000000 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView+l10n.swift +++ /dev/null @@ -1,19 +0,0 @@ -// Leka - iOS Monorepo -// Copyright APF France handicap -// SPDX-License-Identifier: Apache-2.0 - -import LocalizationKit - -// swiftlint:disable line_length - -extension l10n { - enum CarereceiverSettingsView { - static let navigationTitle = LocalizedString("carereceiver_settings_view.navigation_title", value: "Profil of ", comment: "The navigation title of Carereceiver Settings View") - - static let saveButtonLabel = LocalizedString("carereceiver_settings_view.save_button_label", value: "Save", comment: "Save button label of Carereceiver Settings View") - - static let closeButtonLabel = LocalizedString("carereceiver_settings_view.close_button_label", value: "Close", comment: "Close button label of Carereceiver Settings View") - } -} - -// swiftlint:enable line_length diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AccentColorRow.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+AccentColorRow.swift similarity index 88% rename from Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AccentColorRow.swift rename to Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+AccentColorRow.swift index d52bb65625..57339e8b8f 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AccentColorRow.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+AccentColorRow.swift @@ -8,9 +8,9 @@ import SwiftUI // swiftlint:disable nesting -// MARK: - CaregiverSettingsView.AccentColorRow +// MARK: - EditCaregiverView.AccentColorRow -extension CaregiverSettingsView { +extension EditCaregiverView { struct AccentColorRow: View { // MARK: Internal @@ -18,7 +18,7 @@ extension CaregiverSettingsView { var body: some View { HStack { - Text(l10n.CaregiverSettingsView.AccentColorRow.title) + Text(l10n.EditCaregiverView.AccentColorRow.title) Spacer() @@ -66,6 +66,6 @@ extension CaregiverSettingsView { #Preview { Form { - CaregiverSettingsView.AccentColorRow(caregiver: .constant(Caregiver())) + EditCaregiverView.AccentColorRow(caregiver: .constant(Caregiver())) } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AppearanceRow.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+AppearanceRow.swift similarity index 78% rename from Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AppearanceRow.swift rename to Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+AppearanceRow.swift index 1f3efe97af..5bab7f695d 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AppearanceRow.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+AppearanceRow.swift @@ -6,9 +6,9 @@ import DesignKit import LocalizationKit import SwiftUI -// MARK: - CaregiverSettingsView.AppearanceRow +// MARK: - EditCaregiverView.AppearanceRow -extension CaregiverSettingsView { +extension EditCaregiverView { struct AppearanceRow: View { // MARK: Internal @@ -16,7 +16,7 @@ extension CaregiverSettingsView { var body: some View { HStack(spacing: 10) { - Text(l10n.CaregiverSettingsView.AppearanceRow.title) + Text(l10n.EditCaregiverView.AppearanceRow.title) Spacer() @@ -38,6 +38,6 @@ extension CaregiverSettingsView { #Preview { Form { - CaregiverSettingsView.AppearanceRow(caregiver: .constant(Caregiver())) + EditCaregiverView.AppearanceRow(caregiver: .constant(Caregiver())) } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+l10n.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+l10n.swift new file mode 100644 index 0000000000..a1884f89aa --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView+l10n.swift @@ -0,0 +1,27 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import LocalizationKit + +// swiftlint:disable line_length nesting + +extension l10n { + enum EditCaregiverView { + enum AppearanceRow { + static let title = LocalizedString("edit_caregiver_view.appearance_section.appearance_row.title", value: "Dark Mode", comment: "Appearance Row title") + } + + enum AccentColorRow { + static let title = LocalizedString("edit_caregiver_view.appearance_section.accent_color_row.title", value: "Color Theme", comment: "AccentColor Row title") + } + + static let navigationTitle = LocalizedString("edit_caregiver_view.navigation_title", value: "Profil of ", comment: "The navigation title of Edit Caregiver View") + + static let saveButtonLabel = LocalizedString("edit_caregiver_view.save_button_label", value: "Save", comment: "Save button label of Edit Caregiver View") + + static let closeButtonLabel = LocalizedString("edit_caregiver_view.close_button_label", value: "Close", comment: "Close button label of Edit Caregiver View") + } +} + +// swiftlint:enable line_length nesting diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift similarity index 81% rename from Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView.swift rename to Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift index 83a57b0e12..1548a19c71 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift @@ -6,9 +6,9 @@ import DesignKit import LocalizationKit import SwiftUI -// MARK: - CaregiverSettingsView +// MARK: - EditCaregiverView -struct CaregiverSettingsView: View { +struct EditCaregiverView: View { // MARK: Internal @State var modifiedCaregiver: Caregiver @@ -24,7 +24,7 @@ struct CaregiverSettingsView: View { Section { LabeledContent(String(l10n.CaregiverCreation.caregiverNameLabel.characters)) { - TextField("Nom", text: self.$modifiedCaregiver.name) + TextField("", text: self.$modifiedCaregiver.name) .multilineTextAlignment(.trailing) } } @@ -39,19 +39,19 @@ struct CaregiverSettingsView: View { } } } - .navigationTitle(String(l10n.CaregiverSettingsView.navigationTitle.characters) + self.modifiedCaregiver.name) + .navigationTitle(String(l10n.EditCaregiverView.navigationTitle.characters) + self.modifiedCaregiver.name) .navigationBarTitleDisplayMode(.inline) .interactiveDismissDisabled() .toolbar { ToolbarItem(placement: .topBarLeading) { - Button(String(l10n.CaregiverSettingsView.closeButtonLabel.characters)) { - self.rootOwnerViewModel.isCaregiverSettingsViewPresented = false + Button(String(l10n.EditCaregiverView.closeButtonLabel.characters)) { + self.rootOwnerViewModel.isEditCaregiverViewPresented = false } } ToolbarItem(placement: .topBarTrailing) { - Button(String(l10n.CaregiverSettingsView.saveButtonLabel.characters)) { + Button(String(l10n.EditCaregiverView.saveButtonLabel.characters)) { // TODO: (@mathieu) - Add Firestore logic - self.rootOwnerViewModel.isCaregiverSettingsViewPresented = false + self.rootOwnerViewModel.isEditCaregiverViewPresented = false self.rootOwnerViewModel.currentCaregiver = self.modifiedCaregiver } } @@ -101,5 +101,5 @@ struct CaregiverSettingsView: View { } #Preview { - CaregiverSettingsView(modifiedCaregiver: Caregiver()) + EditCaregiverView(modifiedCaregiver: Caregiver()) } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView+l10n.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView+l10n.swift new file mode 100644 index 0000000000..b593d754f0 --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView+l10n.swift @@ -0,0 +1,19 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import LocalizationKit + +// swiftlint:disable line_length + +extension l10n { + enum EditCarereceiverView { + static let navigationTitle = LocalizedString("edit_carereceiver_view.navigation_title", value: "Profil of ", comment: "The navigation title of Edit Carereceiver View") + + static let saveButtonLabel = LocalizedString("edit_carereceiver_view.save_button_label", value: "Save", comment: "Save button label of Edit Carereceiver View") + + static let closeButtonLabel = LocalizedString("edit_carereceiver_view.close_button_label", value: "Close", comment: "Close button label of Edit Carereceiver View") + } +} + +// swiftlint:enable line_length diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift similarity index 72% rename from Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView.swift rename to Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift index d207eb38b4..bc341fef93 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift @@ -6,9 +6,9 @@ import DesignKit import LocalizationKit import SwiftUI -// MARK: - CarereceiverSettingsView +// MARK: - EditCarereceiverView -struct CarereceiverSettingsView: View { +struct EditCarereceiverView: View { // MARK: Internal @Binding var modifiedCarereceiver: Carereceiver @@ -17,12 +17,14 @@ struct CarereceiverSettingsView: View { NavigationStack { VStack(spacing: 40) { Form { - self.avatarPickerButton - .listRowBackground(Color.clear) + Section { + self.avatarPickerButton + .listRowBackground(Color.clear) + } Section { LabeledContent(String(l10n.CarereceiverCreation.carereceiverNameLabel.characters)) { - TextField("Nom", text: self.$modifiedCarereceiver.name) + TextField("", text: self.$modifiedCarereceiver.name) .multilineTextAlignment(.trailing) } } @@ -36,19 +38,19 @@ struct CarereceiverSettingsView: View { } } } - .navigationTitle(String(l10n.CarereceiverSettingsView.navigationTitle.characters) + self.modifiedCarereceiver.name) + .navigationTitle(String(l10n.EditCarereceiverView.navigationTitle.characters) + self.modifiedCarereceiver.name) .navigationBarTitleDisplayMode(.inline) .interactiveDismissDisabled() .toolbar { ToolbarItem(placement: .topBarLeading) { - Button(String(l10n.CarereceiverSettingsView.closeButtonLabel.characters)) { - self.rootOwnerViewModel.isCarereceiverSettingsViewPresented = false + Button(String(l10n.EditCarereceiverView.closeButtonLabel.characters)) { + self.rootOwnerViewModel.isEditCarereceiverViewPresented = false } } ToolbarItem(placement: .topBarTrailing) { - Button(String(l10n.CarereceiverSettingsView.saveButtonLabel.characters)) { + Button(String(l10n.EditCarereceiverView.saveButtonLabel.characters)) { // TODO: (@mathieu) - Add Firestore logic - self.rootOwnerViewModel.isCarereceiverSettingsViewPresented = false + self.rootOwnerViewModel.isEditCarereceiverViewPresented = false self.rootOwnerViewModel.currentCarereceiver = self.modifiedCarereceiver } } @@ -79,5 +81,5 @@ struct CarereceiverSettingsView: View { } #Preview { - CarereceiverSettingsView(modifiedCarereceiver: .constant(Carereceiver())) + EditCarereceiverView(modifiedCarereceiver: .constant(Carereceiver())) } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift index 9124b608a3..05d90e9722 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CarereceiverView.swift @@ -14,12 +14,12 @@ struct CarereceiverView: View { var body: some View { Button { - self.rootOwnerViewModel.isCarereceiverSettingsViewPresented = true + self.rootOwnerViewModel.isEditCarereceiverViewPresented = true } label: { CarereceiverAvatarCell(carereceiver: self.carereceiver) } - .sheet(isPresented: self.$rootOwnerViewModel.isCarereceiverSettingsViewPresented) { - CarereceiverSettingsView(modifiedCarereceiver: self.$carereceiver) + .sheet(isPresented: self.$rootOwnerViewModel.isEditCarereceiverViewPresented) { + EditCarereceiverView(modifiedCarereceiver: self.$carereceiver) } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CaregiverSettingsLabel.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/EditCaregiverLabel.swift similarity index 94% rename from Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CaregiverSettingsLabel.swift rename to Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/EditCaregiverLabel.swift index f399e8387f..d8b6c41d77 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/CaregiverSettingsLabel.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/EditCaregiverLabel.swift @@ -7,16 +7,16 @@ import LocalizationKit import RobotKit import SwiftUI -// MARK: - CaregiverSettingsLabel +// MARK: - EditCaregiverLabel -struct CaregiverSettingsLabel: View { +struct EditCaregiverLabel: View { // MARK: Internal var body: some View { VStack(alignment: .center, spacing: 10) { if let caregiver = self.rootOwnerViewModel.currentCaregiver { Button { - self.rootOwnerViewModel.isCaregiverSettingsViewPresented = true + self.rootOwnerViewModel.isEditCaregiverViewPresented = true } label: { CaregiverAvatarCell(caregiver: caregiver) .frame(maxWidth: 80) @@ -89,7 +89,7 @@ extension l10n { #Preview { NavigationSplitView(sidebar: { List { - CaregiverSettingsLabel() + EditCaregiverLabel() Button {} label: { RobotConnectionLabel() diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift index 7fafced985..23eb14ef70 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift @@ -26,7 +26,7 @@ struct MainView: View { NavigationSplitView { List(selection: self.$navigation.selectedCategory) { if self.authManagerViewModel.userAuthenticationState == .loggedIn { - CaregiverSettingsLabel() + EditCaregiverLabel() } else { NoAccountConnectedLabel() } @@ -125,8 +125,8 @@ struct MainView: View { .sheet(isPresented: self.$rootOwnerViewModel.isSettingsViewPresented) { SettingsView() } - .sheet(isPresented: self.$rootOwnerViewModel.isCaregiverSettingsViewPresented) { - CaregiverSettingsView(modifiedCaregiver: self.rootOwnerViewModel.currentCaregiver!) + .sheet(isPresented: self.$rootOwnerViewModel.isEditCaregiverViewPresented) { + EditCaregiverView(modifiedCaregiver: self.rootOwnerViewModel.currentCaregiver!) } } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift index b05a8c1dfd..89fed653b3 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift @@ -22,8 +22,8 @@ class RootOwnerViewModel: ObservableObject { @Published var isSettingsViewPresented = false - @Published var isCaregiverSettingsViewPresented = false - @Published var isCarereceiverSettingsViewPresented = false + @Published var isEditCaregiverViewPresented = false + @Published var isEditCarereceiverViewPresented = false @Published var isCaregiverPickerViewPresented = false @Published var isCarereceiverPickerViewPresented = false