Skip to content

Commit

Permalink
✨ (LekaApp): Add Caregiver Profile in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Feb 7, 2024
1 parent b4fae4c commit 9de72c1
Show file tree
Hide file tree
Showing 11 changed files with 526 additions and 69 deletions.
180 changes: 126 additions & 54 deletions Apps/LekaApp/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,96 @@
"version": "1.0",
"sourceLanguage": "en",
"strings": {
"caregiver_settings_view.appearance_section.accent_color_row.title": {
"comment": "AccentColor Row title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Accent Color"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Couleur accentu\u00e9e"
}
}
}
},
"caregiver_settings_view.appearance_section.appearance_row.title": {
"comment": "Appearance Row title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Dark mode"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Mode sombre"
}
}
}
},
"caregiver_settings_view.close_button_label": {
"comment": "Close button label of Caregiver Settings View",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Close"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Fermer"
}
}
}
},
"caregiver_settings_view.navigation_title": {
"comment": "The navigation title of Caregiver Settings View",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Profil of "
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Profil de "
}
}
}
},
"caregiver_settings_view.save_button_label": {
"comment": "Save button label of Caregiver 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 @@ -848,6 +938,42 @@
}
}
},
"lekapp.sidebar.change_caregiver_profile.button_label": {
"comment": "The button label of caregiver profile picker",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Change profile"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Changer de profil"
}
}
}
},
"lekapp.sidebar.select_caregiver_profile.button_label": {
"comment": "The button label of caregiver profile picker when no profile is selected",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Select profile"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "S\u00e9lectionnez un profil"
}
}
}
},
"main_view.sidebar.category_label.activities": {
"comment": "The title of the category 'Activities'",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -1136,60 +1262,6 @@
}
}
},
"settings_view.appearance_section.accent_color_row.title": {
"comment": "AccentColor Row title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Accent Color"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Couleur accentu\u00e9e"
}
}
}
},
"settings_view.appearance_section.appearance_row.title": {
"comment": "Appearance Row title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Dark mode"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Mode sombre"
}
}
}
},
"settings_view.appearance_section.header": {
"comment": "Appearance section header",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Appearance"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Apparence"
}
}
}
},
"settings_view.close_button_label": {
"comment": "Close button label of Settings View",
"extractionState": "extracted_with_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ extension AccountCreationProcess {
Text(l10n.AccountCreationProcess.Step4.message)

Button(String(l10n.AccountCreationProcess.Step4.discoverContentButton.characters)) {
if !self.rootOwnerViewModel.mockCaregiversSet.isEmpty {
self.rootOwnerViewModel.currentCaregiver = self.rootOwnerViewModel.mockCaregiversSet[0]
}
self.rootOwnerViewModel.isWelcomeViewPresented.toggle()
}
.buttonStyle(.bordered)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import DesignKit
import LocalizationKit
import SwiftUI

// swiftlint:disable nesting

// MARK: - CaregiverSettingsView.AccentColorRow

extension CaregiverSettingsView {
struct AccentColorRow: View {
// MARK: Internal

@Binding var caregiver: Caregiver

var body: some View {
HStack {
Text(l10n.CaregiverSettingsView.AccentColorRow.title)

Spacer()

ForEach(self.colors, id: \.self) { color in
ColorCircleView(color: color, isSelected: self.selectedColor == color)
.onTapGesture {
self.styleManager.accentColor = color
self.caregiver.preferredAccentColor = color
}
}
}
}

// MARK: Private

// MARK: - ColorCircleView

private struct ColorCircleView: View {
let color: Color
let isSelected: Bool

var body: some View {
VStack {
Circle()
.fill(self.color)
.frame(width: 25)
.overlay(Circle().fill(self.isSelected ? .white : .clear).frame(width: 8))
.overlay(Circle().stroke(.gray, lineWidth: 0.5))
}
.animation(.easeIn, value: self.isSelected)
}
}

@ObservedObject private var styleManager: StyleManager = .shared

private let colors: [Color] = [DesignKitAsset.Colors.lekaDarkBlue.swiftUIColor, .blue, .purple, .red, .orange, .yellow, .green, .gray]

private var selectedColor: Color {
self.styleManager.accentColor ?? .clear
}
}
}

// swiftlint:enable nesting

#Preview {
Form {
CaregiverSettingsView.AccentColorRow(caregiver: .constant(Caregiver()))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import DesignKit
import LocalizationKit
import SwiftUI

// MARK: - CaregiverSettingsView.AppearanceRow

extension CaregiverSettingsView {
struct AppearanceRow: View {
// MARK: Internal

@Binding var caregiver: Caregiver

var body: some View {
HStack(spacing: 10) {
Text(l10n.CaregiverSettingsView.AppearanceRow.title)

Spacer()

Toggle("", isOn: Binding(
get: { self.styleManager.colorScheme == .dark },
set: {
self.styleManager.colorScheme = $0 ? .dark : .light
self.caregiver.preferredColorScheme = $0 ? .dark : .light
}
))
}
}

// MARK: Private

@ObservedObject private var styleManager: StyleManager = .shared
}
}

#Preview {
Form {
CaregiverSettingsView.AppearanceRow(caregiver: .constant(Caregiver()))
}
}
Original file line number Diff line number Diff line change
@@ -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 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: "Accent Color", 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
Loading

0 comments on commit 9de72c1

Please sign in to comment.