Skip to content

Commit

Permalink
🔀 Merge branch 'hugo/feature/Add-Carereceiver-views'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Feb 11, 2024
2 parents 669da71 + e2f1f36 commit eb12dc9
Show file tree
Hide file tree
Showing 18 changed files with 608 additions and 73 deletions.
162 changes: 162 additions & 0 deletions Apps/LekaApp/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,60 @@
}
}
},
"carereceiver_settings_view.close_button_label": {
"comment": "Close button label of Carereceiver Settings View",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Close"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Fermer"
}
}
}
},
"carereceiver_settings_view.navigation_title": {
"comment": "The navigation title of Carereceiver Settings View",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Profil of "
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Profil de "
}
}
}
},
"carereceiver_settings_view.save_button_label": {
"comment": "Save button label of Carereceiver Settings View",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Save"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Enregistrer"
}
}
}
},
"lekaapp.TextFieldEmail.invalidEmailErrorLabel": {
"comment": "TextFieldEmail invalid Email Error Label",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -686,6 +740,42 @@
}
}
},
"lekaapp.carereceiver_picker.addButtonLabel": {
"comment": "Carereceiver picker add button label",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Add profile"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Ajouter un profil"
}
}
}
},
"lekaapp.carereceiver_picker.title": {
"comment": "Carereceiver picker title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Care receivers list"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Liste des personnes accompagn\u00e9es"
}
}
}
},
"lekaapp.connection_view.connection_button": {
"comment": "ConnectionView connection button",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -794,6 +884,42 @@
}
}
},
"lekaapp.reinforcer_picker.avatar_choice_button": {
"comment": " Reinforcer picker description",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Reinforcer is a repetitive light effect from the robot that you can activate to reward the user's behavior.\nIf your robot is connected, you can test the reinforcers before choosing one."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Le renfor\u00e7ateur est un effet lumineux r\u00e9p\u00e9titif du robot que vous pourrez actionner pour r\u00e9compenser le comportement de l'utilisateur. \u2028Si votre robot est connect\u00e9, vous pouvez tester les renfor\u00e7ateurs avant d'en choisir un."
}
}
}
},
"lekaapp.reinforcer_picker.header": {
"comment": "Reinforcer picker header",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Reinforcer choice"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Choix du renfor\u00e7ateur"
}
}
}
},
"lekaapp.robot_connection_label.text_connected_to": {
"comment": "Connected to xxx robot label",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -992,6 +1118,24 @@
}
}
},
"main_view.sidebar.category_label.carereceivers": {
"comment": "The title of the category 'Care Receivers'",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Care Receivers"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Personnes accompagn\u00e9es"
}
}
}
},
"main_view.sidebar.category_label.curriculums": {
"comment": "The title of the category 'Curriculums'",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -1136,6 +1280,24 @@
}
}
},
"main_view.sidebar.section.tracking": {
"comment": "The title of the section 'Tracking'",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Tracking"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Suivi"
}
}
}
},
"settings_view.account_section.delete_account.alert_message": {
"comment": "Delete account alert message",
"extractionState": "extracted_with_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extension Navigation {
case activities
case remotes
case stories
case carereceivers

// MARK: Internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,29 @@ struct CaregiverSettingsView: View {
var body: some View {
NavigationStack {
VStack(spacing: 40) {
self.avatarNavigationLink
Form {
Section {
self.avatarPickerButton
.listRowBackground(Color.clear)
}

TextFieldDefault(label: String(l10n.CaregiverCreation.caregiverNameLabel.characters),
entry: self.$modifiedCaregiver.name)
Section {
LabeledContent(String(l10n.CaregiverCreation.caregiverNameLabel.characters)) {
TextField("Nom", text: self.$modifiedCaregiver.name)
.multilineTextAlignment(.trailing)
}
}

self.professionNavigationLink
Section {
self.professionNavigationLink
}

AppearanceRow(caregiver: self.$modifiedCaregiver)
AccentColorRow(caregiver: self.$modifiedCaregiver)
Section {
AppearanceRow(caregiver: self.$modifiedCaregiver)
AccentColorRow(caregiver: self.$modifiedCaregiver)
}
}
}
.frame(maxWidth: 500)
.navigationTitle(String(l10n.CaregiverSettingsView.navigationTitle.characters) + self.modifiedCaregiver.name)
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled()
Expand All @@ -52,32 +64,31 @@ struct CaregiverSettingsView: View {

@ObservedObject private var rootOwnerViewModel: RootOwnerViewModel = .shared
@ObservedObject private var styleManager: StyleManager = .shared
@State private var isAvatarPickerPresented: Bool = false

private var avatarNavigationLink: some View {
NavigationLink {
AvatarPicker(avatar: self.$modifiedCaregiver.avatar)
private var avatarPickerButton: some View {
Button {
self.isAvatarPickerPresented = true
} label: {
VStack(spacing: 15) {
VStack(alignment: .center, spacing: 15) {
AvatarPicker.ButtonLabel(image: self.modifiedCaregiver.avatar)
Text(l10n.CaregiverCreation.avatarChoiceButton)
.font(.headline)
}
}
.navigationDestination(isPresented: self.$isAvatarPickerPresented) {
AvatarPicker(avatar: self.$modifiedCaregiver.avatar)
}
.frame(maxWidth: .infinity, alignment: .center)
}

private var professionNavigationLink: some View {
VStack(alignment: .leading) {
HStack {
NavigationLink {
ProfessionPicker(caregiver: self.$modifiedCaregiver)
} label: {
Text(l10n.CaregiverCreation.professionLabel)
.font(.body)

Spacer()

NavigationLink {
ProfessionPicker(caregiver: self.$modifiedCaregiver)
} label: {
Label(String(l10n.CaregiverCreation.professionAddButton.characters), systemImage: "plus")
}
}

if !self.modifiedCaregiver.professions.isEmpty {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import DesignKit
import LocalizationKit
import SwiftUI

// MARK: - CarereceiverSettingsView

struct CarereceiverSettingsView: View {
// MARK: Internal

@State var modifiedCarereceiver: Carereceiver

var body: some View {
NavigationStack {
VStack(spacing: 40) {
Form {
self.avatarPickerButton
.listRowBackground(Color.clear)

Section {
LabeledContent(String(l10n.CarereceiverCreation.carereceiverNameLabel.characters)) {
TextField("Nom", text: self.$modifiedCarereceiver.name)
.multilineTextAlignment(.trailing)
}
}

Section {
LabeledContent(String(l10n.ReinforcerPicker.header.characters)) {
ReinforcerPicker(carereceiver: self.$modifiedCarereceiver)
}
} footer: {
Text(l10n.ReinforcerPicker.description)
}
}
}
.navigationTitle(String(l10n.CarereceiverSettingsView.navigationTitle.characters) + self.modifiedCarereceiver.name)
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled()
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button(String(l10n.CarereceiverSettingsView.closeButtonLabel.characters)) {
self.rootOwnerViewModel.isCarereceiverSettingsViewPresented = false
}
}
ToolbarItem(placement: .topBarTrailing) {
Button(String(l10n.CarereceiverSettingsView.saveButtonLabel.characters)) {
// TODO: (@mathieu) - Add Firestore logic
self.rootOwnerViewModel.isCarereceiverSettingsViewPresented = false
self.rootOwnerViewModel.currentCarereceiver = self.modifiedCarereceiver
}
}
}
}
.preferredColorScheme(self.styleManager.colorScheme)
}

// MARK: Private

@ObservedObject private var rootOwnerViewModel: RootOwnerViewModel = .shared
@ObservedObject private var styleManager: StyleManager = .shared
@State private var isAvatarPickerPresented: Bool = false

private var avatarPickerButton: some View {
Button {
self.isAvatarPickerPresented = true
} label: {
VStack(alignment: .center, spacing: 15) {
AvatarPicker.ButtonLabel(image: self.modifiedCarereceiver.avatar)
Text(l10n.CarereceiverCreation.avatarChoiceButton)
.font(.headline)
}
}
.navigationDestination(isPresented: self.$isAvatarPickerPresented) {
AvatarPicker(avatar: self.$modifiedCarereceiver.avatar)
}
.frame(maxWidth: .infinity, alignment: .center)
}
}

#Preview {
CarereceiverSettingsView(modifiedCarereceiver: Carereceiver())
}
Loading

0 comments on commit eb12dc9

Please sign in to comment.