diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift index a258f12a49..745dc67e9f 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCaregiverView/EditCaregiverView.swift @@ -35,7 +35,7 @@ struct EditCaregiverView: View { } Section { - self.professionNavigationLink + self.professionPickerButton } Section { @@ -72,6 +72,7 @@ struct EditCaregiverView: View { @ObservedObject private var rootOwnerViewModel: RootOwnerViewModel = .shared @ObservedObject private var styleManager: StyleManager = .shared @State private var isAvatarPickerPresented: Bool = false + @State private var isProfessionPickerPresented: Bool = false private var avatarPickerButton: some View { Button { @@ -83,19 +84,26 @@ struct EditCaregiverView: View { .font(.headline) } } - .navigationDestination(isPresented: self.$isAvatarPickerPresented) { + .sheet(isPresented: self.$isAvatarPickerPresented) { AvatarPicker(avatar: self.$modifiedCaregiver.avatar) } .frame(maxWidth: .infinity, alignment: .center) } - private var professionNavigationLink: some View { + private var professionPickerButton: some View { VStack(alignment: .leading) { - NavigationLink { - ProfessionPicker(caregiver: self.$modifiedCaregiver) - } label: { - Text(l10n.CaregiverCreation.professionLabel) - .font(.body) + LabeledContent(String(l10n.CaregiverCreation.professionLabel.characters)) { + Button { + self.isProfessionPickerPresented = true + } label: { + Image(systemName: "plus") + } + .sheet(isPresented: self.$isProfessionPickerPresented) { + NavigationStack { + ProfessionPicker(caregiver: self.$modifiedCaregiver) + .navigationBarTitleDisplayMode(.inline) + } + } } if !self.modifiedCaregiver.professions.isEmpty { diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift index b9762da73f..e2828803ed 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/EditCarereceiverView/EditCarereceiverView.swift @@ -74,7 +74,7 @@ struct EditCarereceiverView: View { .font(.headline) } } - .navigationDestination(isPresented: self.$isAvatarPickerPresented) { + .sheet(isPresented: self.$isAvatarPickerPresented) { AvatarPicker(avatar: self.$modifiedCarereceiver.avatar) } .frame(maxWidth: .infinity, alignment: .center) diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/ProfessionPicker/ProfessionPicker.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/ProfessionPicker/ProfessionPicker.swift index 6054257057..c0275b1807 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/ProfessionPicker/ProfessionPicker.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/ProfessionPicker/ProfessionPicker.swift @@ -60,7 +60,6 @@ struct ProfessionPicker: View { // MARK: Private - @State private var otherProfessionText: String = "" @State private var selectedProfessions: Set = [] @State private var selectedProfessionForDetails: Profession? } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift index 295664b538..e4d14c21c5 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCaregiverView.swift @@ -37,7 +37,7 @@ struct CreateCaregiverView: View { } Section { - self.professionNavigationLink + self.professionPickerButton } Button(String(l10n.CaregiverCreation.registerProfilButton.characters)) { @@ -67,6 +67,7 @@ struct CreateCaregiverView: View { @ObservedObject private var rootOwnerViewModel = RootOwnerViewModel.shared @State private var isAvatarPickerPresented: Bool = false + @State private var isProfessionPickerPresented: Bool = false private var avatarPickerButton: some View { Button { @@ -78,20 +79,27 @@ struct CreateCaregiverView: View { .font(.headline) } } - .navigationDestination(isPresented: self.$isAvatarPickerPresented) { - AvatarPicker(avatar: self.$newCaregiver.avatar) + .sheet(isPresented: self.$isAvatarPickerPresented) { + NavigationStack { + AvatarPicker(avatar: self.$newCaregiver.avatar) + } } .frame(maxWidth: .infinity, alignment: .center) } - private var professionNavigationLink: some View { + private var professionPickerButton: some View { VStack(alignment: .leading) { - NavigationLink { - ProfessionPicker(caregiver: self.$newCaregiver) + Button { + self.isProfessionPickerPresented = true } label: { Text(l10n.CaregiverCreation.professionLabel) .font(.body) } + .sheet(isPresented: self.$isProfessionPickerPresented) { + NavigationStack { + ProfessionPicker(caregiver: self.$newCaregiver) + } + } if !self.newCaregiver.professions.isEmpty { ForEach(self.newCaregiver.professions, id: \.self) { id in diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift index d07013d3aa..786d7daa7e 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Profiles/CreateCarereceiverView.swift @@ -70,8 +70,11 @@ struct CreateCarereceiverView: View { .font(.headline) } } - .navigationDestination(isPresented: self.$isAvatarPickerPresented) { - AvatarPicker(avatar: self.$newCarereceiver.avatar) + + .sheet(isPresented: self.$isAvatarPickerPresented) { + NavigationStack { + AvatarPicker(avatar: self.$newCarereceiver.avatar) + } } .frame(maxWidth: .infinity, alignment: .center) } diff --git a/Tools/Hooks/check_yaml_content_activities.py b/Tools/Hooks/check_yaml_content_activities.py index 3f654adb0f..a9228c7287 100755 --- a/Tools/Hooks/check_yaml_content_activities.py +++ b/Tools/Hooks/check_yaml_content_activities.py @@ -110,6 +110,29 @@ def check_strings_for_newline(data, path=None): return keys_with_newlines +def check_empty_strings(data, path=None): + """Check for empty strings in the data structure""" + if path is None: + path = [] + violations = [] + + if isinstance(data, dict): + for key, value in data.items(): + sub_path = path + [key] # Build the path for nested dictionaries + if isinstance(value, str) and (value == "" or value.isspace()): + violations.append("/".join(map(str, sub_path))) + else: + # Recurse into the value if it's a dict or list + violations += check_empty_strings(value, sub_path) + elif isinstance(data, list): + for index, item in enumerate(data): + sub_path = path + [str(index)] # Handle list indexing in the path + # Recurse into the item if it's a dict or list + violations += check_empty_strings(item, sub_path) + + return violations + + def create_yaml_object(): """Create a YAML object""" yaml = ruamel.yaml.YAML(typ="rt") @@ -177,9 +200,10 @@ def check_content_activity(filename): minutes=1 ) if last_edited_at < one_minute_ago: - print(f"\nāŒ last_edited_at in {filename} is not up to date") - print(f"last_edited_at: {last_edited_at}") - print(f"Update last_edited_at: {DATE_NOW_TIMESTAMP}") + print( + f"\nāŒ last_edited_at {last_edited_at} is not up to date in {filename}" + ) + print(f"Update last_edited_at: {DATE_NOW_TIMESTAMP}\n") data["last_edited_at"] = DATE_NOW_TIMESTAMP with open(filename, "w", encoding="utf8") as file: yaml.dump(data, file) @@ -229,6 +253,13 @@ def check_content_activity(filename): print(f"āŒ String staring with newline for key: {string} \nin {filename}\n") file_is_valid = False + # ? Check for empty strings according to the JTD schema + # schema = load_jtd_schema(JTD_SCHEMA) + empty_strings = check_empty_strings(data) + for string in empty_strings: + print(f"āŒ Empty string for key: {string} \nin {filename}\n") + file_is_valid = False + return file_is_valid