Skip to content

Commit

Permalink
🔀️ Merge branch 'hugo/feature/Add-Caregiver-section'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Mar 21, 2024
2 parents 6c4a3da + 289aa4b commit 0205bd6
Show file tree
Hide file tree
Showing 13 changed files with 384 additions and 6 deletions.
146 changes: 145 additions & 1 deletion Apps/LekaApp/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,114 @@
}
}
},
"lekaapp.caregiver_list.add_button_label": {
"comment": "Caregiver list add button label",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Add profile"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Ajouter un profil"
}
}
}
},
"lekaapp.caregiver_list.add_first_caregiver.add_button_label": {
"comment": "Caregiver list add first caregiver button label",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Add your first caregiver profile"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Cr\u00e9er votre premier profil accompagnant"
}
}
}
},
"lekaapp.caregiver_list.add_first_caregiver.message": {
"comment": "Caregiver list add first caregiver message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "No caregiver profiles have been created yet."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Aucun profil d'accompagnant n'a \u00e9t\u00e9 cr\u00e9\u00e9 pour le moment."
}
}
}
},
"lekaapp.caregiver_list.description": {
"comment": "Caregiver list description",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
}
}
}
},
"lekaapp.caregiver_list.subtitle": {
"comment": "Caregiver list subtitle",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
}
}
}
},
"lekaapp.caregiver_list.title": {
"comment": "Caregiver list title",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Caregivers"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Accompagnants"
}
}
}
},
"lekaapp.caregiver_picker.add_button_label": {
"comment": "Caregiver picker add button label",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -1107,7 +1215,7 @@
"en": {
"stringUnit": {
"state": "new",
"value": "Go to care receiver section"
"value": "Go to Care Receivers section"
}
},
"fr": {
Expand Down Expand Up @@ -1694,6 +1802,24 @@
}
}
},
"lekapp.caregiver_view.available_soon_label": {
"comment": "Temporary content for caregiver monitoring",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Your usage history will soon be available here."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Votre historique d'utilisation sera bient\u00f4t disponible ici."
}
}
}
},
"lekapp.carereceiver_view.available_soon_label": {
"comment": "Temporary content for carereceiver monitoring",
"extractionState": "extracted_with_value",
Expand Down Expand Up @@ -1838,6 +1964,24 @@
}
}
},
"main_view.sidebar.category_label.caregivers": {
"comment": "The title of the category 'Caregivers'",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Caregivers"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Accompagnants"
}
}
}
},
"main_view.sidebar.category_label.carereceivers": {
"comment": "The title of the category 'Care Receivers'",
"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 sampleActivities
case caregivers
case carereceivers
case developerModeImageListPNG

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ extension MainView {
self.title = "Sample activites"
self.systemImage = "testtube.2"

case .caregivers:
self.title = String(l10n.MainView.Sidebar.CategoryLabel.caregivers.characters)
self.systemImage = "person.3.fill"

case .carereceivers:
self.title = String(l10n.MainView.Sidebar.CategoryLabel.carereceivers.characters)
self.systemImage = "figure.2.arms.open"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 caregivers = LocalizedString("main_view.sidebar.category_label.caregivers", value: "Caregivers", comment: "The title of the category 'Caregivers'")
static let carereceivers = LocalizedString("main_view.sidebar.category_label.carereceivers", value: "Care Receivers", comment: "The title of the category 'Care Receivers'")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct MainView: View {

if self.authManagerViewModel.userAuthenticationState == .loggedIn {
Section(String(l10n.MainView.Sidebar.sectionUsers.characters)) {
CategoryLabel(category: .caregivers)
CategoryLabel(category: .carereceivers)
}
}
Expand Down Expand Up @@ -103,6 +104,9 @@ struct MainView: View {
case .sampleActivities:
SampleActivityListView()

case .caregivers:
CaregiverList()

case .carereceivers:
CarereceiverList()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ struct CarereceiverList: View {
}
.padding(.top, 150)
} else {
LazyVGrid(columns: self.columns, spacing: 40) {
LazyVGrid(columns: self.columns) {
ForEach(self.carereceiverManagerViewModel.carereceivers) { carereceiver in
NavigationLink(value: carereceiver) {
CarereceiverAvatarCell(carereceiver: carereceiver)
}
}
}
.padding()
}
}
.toolbar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ extension l10n {
comment: "Carereceiver picker add first carereceiver message")

static let buttonLabel = LocalizedString("lekaapp.carereceiver_picker.add_first_carereceiver.add_button_label",
value: "Go to care receiver section",
value: "Go to Care Receivers section",
comment: "Carereceiver picker add first carereceiver button label")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct CaregiverAvatarCell: View {
Circle()
.stroke(self.styleManager.accentColor!, lineWidth: self.isSelected ? 5 : 0)
}
.frame(maxWidth: 120)

Text("\(self.caregiver.firstName) \(self.caregiver.lastName)")
.font(.headline)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import AccountKit
import DesignKit
import LocalizationKit
import SwiftUI

// MARK: - CaregiverList

struct CaregiverList: View {
// MARK: Internal

var body: some View {
VStack {
ScrollView(showsIndicators: true) {
HStack(alignment: .center, spacing: 30) {
Image(systemName: "person.3.fill")
.resizable()
.scaledToFit()
.frame(width: 80, height: 80)
.foregroundStyle(self.styleManager.accentColor!)

VStack(alignment: .leading) {
Text(l10n.CaregiverList.title)
.font(.largeTitle)
.fontWeight(.bold)

Text(l10n.CaregiverList.subtitle)
.font(.title2)

Text(l10n.CaregiverList.description)
.foregroundStyle(.secondary)

Divider()
.padding(.top)
}

Spacer()
}
.padding(.horizontal)
.padding()

if self.caregiverManagerViewModel.caregivers.isEmpty {
VStack {
Text(l10n.CaregiverList.AddFirstCaregiver.message)
.font(.title2)
.multilineTextAlignment(.center)

Button {
self.isCaregiverCreationPresented = true
} label: {
Text(l10n.CaregiverList.AddFirstCaregiver.addButtonLabel)
}
.buttonStyle(.borderedProminent)
}
.padding(.top, 150)
} else {
LazyVGrid(columns: self.columns) {
ForEach(self.caregiverManagerViewModel.caregivers) { caregiver in
NavigationLink(value: caregiver) {
CaregiverAvatarCell(caregiver: caregiver)
}
}
}
.padding()
}
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button {
self.isCaregiverCreationPresented = true
} label: {
Text(l10n.CaregiverList.addButtonLabel)
}
}
}
.sheet(isPresented: self.$isCaregiverCreationPresented) {
NavigationStack {
CreateCaregiverView()
.navigationBarTitleDisplayMode(.inline)
}
}
.navigationDestination(for: Caregiver.self) { caregiver in
CaregiverView(caregiver: caregiver)
}
}
}

// MARK: Private

private let columns = Array(repeating: GridItem(), count: 4)

@StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel()
@ObservedObject private var styleManager: StyleManager = .shared
@State private var isCaregiverCreationPresented: Bool = false
}

// MARK: - l10n.CaregiverList

extension l10n {
enum CaregiverList {
enum AddFirstCaregiver {
static let message = LocalizedString("lekaapp.caregiver_list.add_first_caregiver.message",
value: "No caregiver profiles have been created yet.",
comment: "Caregiver list add first caregiver message")

static let addButtonLabel = LocalizedString("lekaapp.caregiver_list.add_first_caregiver.add_button_label",
value: "Add your first caregiver profile",
comment: "Caregiver list add first caregiver button label")
}

static let title = LocalizedString("lekaapp.caregiver_list.title",
value: "Caregivers",
comment: "Caregiver list title")

static let subtitle = LocalizedString("lekaapp.caregiver_list.subtitle",
value: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
comment: "Caregiver list subtitle")

static let description = LocalizedString("lekaapp.caregiver_list.description",
value: "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
comment: "Caregiver list description")

static let addButtonLabel = LocalizedString("lekaapp.caregiver_list.add_button_label",
value: "Add profile",
comment: "Caregiver list add button label")
}
}

#Preview {
CaregiverList()
}
Loading

0 comments on commit 0205bd6

Please sign in to comment.