Add headers to active/inactive profile sections

Hide inactive section if empty.
This commit is contained in:
Davide De Rosa 2022-04-25 16:04:56 +02:00
parent 339183c156
commit ac1239daa8
3 changed files with 19 additions and 4 deletions

View File

@ -467,6 +467,8 @@ internal enum L10n {
internal static let port = L10n.tr("Localizable", "global.strings.port")
/// Private key
internal static let privateKey = L10n.tr("Localizable", "global.strings.private_key")
/// Profiles
internal static let profiles = L10n.tr("Localizable", "global.strings.profiles")
/// Protocol
internal static let `protocol` = L10n.tr("Localizable", "global.strings.protocol")
/// Protocols
@ -698,6 +700,10 @@ internal enum L10n {
/// No profiles
internal static let noProfiles = L10n.tr("Localizable", "organizer.empty.no_profiles")
}
internal enum Sections {
/// In use
internal static let active = L10n.tr("Localizable", "organizer.sections.active")
}
}
internal enum Paywall {

View File

@ -74,14 +74,21 @@ extension OrganizerView {
private var mainView: some View {
List {
activeHeaders.map { headers in
Section {
Section(
header: Text(L10n.Organizer.Sections.active)
) {
ForEach(headers, content: profileButton(forHeader:))
.onDelete(perform: removeActiveProfile)
}
}
Section {
ForEach(otherHeaders, content: profileButton(forHeader:))
.onDelete(perform: removeOtherProfiles)
let headers = otherHeaders
if !headers.isEmpty {
Section(
header: Text(L10n.Global.Strings.profiles)
) {
ForEach(headers, content: profileButton(forHeader:))
.onDelete(perform: removeOtherProfiles)
}
}
}.themeAnimation(on: profileManager.headers)
}

View File

@ -15,6 +15,7 @@
"global.strings.add" = "Add";
"global.strings.default" = "Default";
"global.strings.name" = "Name";
"global.strings.profiles" = "Profiles";
"global.strings.provider" = "Provider";
"global.strings.providers" = "Providers";
"global.strings.configuration" = "Configuration";
@ -113,6 +114,7 @@
/* MARK: OrganizerView */
"organizer.sections.active" = "In use";
"organizer.empty.no_profiles" = "No profiles";
"organizer.alerts.reddit.message" = "Did you know that Passepartout has a subreddit? Subscribe for updates or to discuss issues, features, new platforms or whatever you like.\n\nIt's also a great way to show you care about this project.";