Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hugo/feature/Add Caregiver profile on sidebar #641

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "Color Theme"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Th\u00e8me de couleur"
}
}
}
},
"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
11 changes: 10 additions & 1 deletion Apps/LekaApp/Sources/_NEWCodeBase/Models/CompanyModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ protocol Profile: Identifiable, Hashable {
struct Caregiver: Profile {
// MARK: Lifecycle

init(name: String = "", avatar: String = "", professions: [Profession] = []) {
init(name: String = "",
avatar: String = "",
professions: [Profession] = [],
colorScheme: ColorScheme = .light,
accentColor: Color = DesignKitAsset.Colors.lekaDarkBlue.swiftUIColor)
{
self.name = name
self.avatar = avatar
self.professions = professions
self.preferredColorScheme = colorScheme
self.preferredAccentColor = accentColor
}

// MARK: Internal
Expand All @@ -39,6 +46,8 @@ struct Caregiver: Profile {
var name: String
var avatar: String
var professions: [Profession]
var preferredColorScheme: ColorScheme
var preferredAccentColor: Color
}

// MARK: - Carereceiver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
var body: some View {
VStack(spacing: 30) {
Text(l10n.AccountCreationProcess.Step4.title)
// TODO: (@ui/ux) - Design System - replace with Leka font

Check warning on line 16 in Apps/LekaApp/Sources/_NEWCodeBase/Views/AccountCreation/Process/AccountCreationProcess+Step4.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@ui/ux) - Design System - rep...) (todo)
.font(.headline)
.foregroundColor(DesignKitAsset.Colors.lekaOrange.swiftUIColor)

Text(l10n.AccountCreationProcess.Step4.message)

Button(String(l10n.AccountCreationProcess.Step4.discoverContentButton.characters)) {
if !self.rootOwnerViewModel.mockCaregiversSet.isEmpty {
self.rootOwnerViewModel.currentCaregiver = self.rootOwnerViewModel.mockCaregiversSet.last
}
self.rootOwnerViewModel.isWelcomeViewPresented.toggle()
}
.buttonStyle(.bordered)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,35 @@ import SwiftUI

// swiftlint:disable nesting

// MARK: - SettingsView.AppearanceSection.AccentColorRow
// MARK: - CaregiverSettingsView.AccentColorRow

extension SettingsView.AppearanceSection {
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

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

Expand All @@ -32,24 +52,7 @@ extension SettingsView.AppearanceSection {
}
}

@ObservedObject var styleManager: StyleManager = .shared

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

Spacer()

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

// MARK: Private
@ObservedObject private var styleManager: StyleManager = .shared

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

Expand All @@ -63,6 +66,6 @@ extension SettingsView.AppearanceSection {

#Preview {
Form {
SettingsView.AppearanceSection.AccentColorRow()
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: "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
Loading
Loading