-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge branch 'hugo/feature/Add-Carereceiver-views'
- Loading branch information
Showing
18 changed files
with
608 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...p/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView+l10n.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
85 changes: 85 additions & 0 deletions
85
...ekaApp/Sources/_NEWCodeBase/Views/CarereceiverSettingsView/CarereceiverSettingsView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |
Oops, something went wrong.