From 00ba67f135c79e433c84d19fda33f9db3f142f35 Mon Sep 17 00:00:00 2001 From: Davide Date: Sun, 17 Nov 2024 18:42:19 +0100 Subject: [PATCH] Refactor buttons/menus - Add divider in add profile menu - Reuse trailing dots --- .../Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift | 5 +++-- .../Sources/AppUIMain/Views/App/ProfileContextMenu.swift | 2 +- .../Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift | 2 +- .../Sources/CommonUtils/Extensions/String+Extensions.swift | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Passepartout/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift b/Passepartout/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift index 48b2f278..0bbf976b 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift @@ -41,6 +41,7 @@ struct AddProfileMenu: View { Menu { newProfileButton importProfileButton + Divider() migrateProfilesButton } label: { ThemeImage(.add) @@ -62,13 +63,13 @@ private extension AddProfileMenu { Button { isImporting = true } label: { - ThemeImageLabel(Strings.Views.Profiles.Toolbar.importProfile, .profileImport) + ThemeImageLabel(Strings.Views.Profiles.Toolbar.importProfile.withTrailingDots, .profileImport) } } var migrateProfilesButton: some View { Button(action: onMigrateProfiles) { - ThemeImageLabel(Strings.Views.Profiles.Toolbar.migrateProfiles, .profileMigrate) + ThemeImageLabel(Strings.Views.Profiles.Toolbar.migrateProfiles.withTrailingDots, .profileMigrate) } } } diff --git a/Passepartout/Library/Sources/AppUIMain/Views/App/ProfileContextMenu.swift b/Passepartout/Library/Sources/AppUIMain/Views/App/ProfileContextMenu.swift index bdfb1c9f..34d08e90 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/App/ProfileContextMenu.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/App/ProfileContextMenu.swift @@ -102,7 +102,7 @@ private extension ProfileContextMenu { Button { flow?.onEditProfile(header) } label: { - ThemeImageLabel("\(Strings.Global.edit)...", .profileEdit) + ThemeImageLabel(Strings.Global.edit.withTrailingDots, .profileEdit) } } diff --git a/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift b/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift index c0410c48..6d740815 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift @@ -109,7 +109,7 @@ private extension AppMenu { } var aboutButton: some View { - Button("\(Strings.Global.about)...") { + Button(Strings.Global.about.withTrailingDots) { NSApp.activate(ignoringOtherApps: true) NSApp.orderFrontStandardAboutPanel(self) } diff --git a/Passepartout/Library/Sources/CommonUtils/Extensions/String+Extensions.swift b/Passepartout/Library/Sources/CommonUtils/Extensions/String+Extensions.swift index ae09afe8..ebe79760 100644 --- a/Passepartout/Library/Sources/CommonUtils/Extensions/String+Extensions.swift +++ b/Passepartout/Library/Sources/CommonUtils/Extensions/String+Extensions.swift @@ -29,6 +29,10 @@ extension String { public var nilIfEmpty: String? { !isEmpty ? self : nil } + + public var withTrailingDots: String { + "\(self)..." + } } extension String {