From 1f56fa1b9b8a0ab6ad06d876a0faa32b05ec861f Mon Sep 17 00:00:00 2001 From: Igor Camilo <11697241+igorcamilo@users.noreply.github.com> Date: Wed, 8 May 2024 10:38:27 +0200 Subject: [PATCH] Add tooltip to sidebar buttons. (#2040) --- IceCubesApp/App/SideBarView.swift | 11 ++ IceCubesApp/App/Tabs/Tabs.swift | 40 +++--- .../Localization/Localizable.xcstrings | 118 ++++++++++++++++++ 3 files changed, 152 insertions(+), 17 deletions(-) diff --git a/IceCubesApp/App/SideBarView.swift b/IceCubesApp/App/SideBarView.swift index 1d1934d8..d843c1e3 100644 --- a/IceCubesApp/App/SideBarView.swift +++ b/IceCubesApp/App/SideBarView.swift @@ -75,6 +75,7 @@ struct SideBarView: View { .offset(x: 2, y: -2) } .buttonStyle(.borderedProminent) + .help(Tab.post.title) } private func makeAccountButton(account: AppAccount, showBadge: Bool) -> some View { @@ -102,12 +103,21 @@ struct SideBarView: View { } } } + .help(accountButtonTitle(accountName: account.accountName)) .frame(width: .sidebarWidth, height: 50) .padding(.vertical, 8) .background(selectedTab == .profile && account.id == appAccounts.currentAccount.id ? theme.secondaryBackgroundColor : .clear) } + private func accountButtonTitle(accountName: String?) -> LocalizedStringKey { + if let accountName { + "tab.profile-account-\(accountName)" + } else { + Tab.profile.title + } + } + private var tabsView: some View { ForEach(tabs) { tab in if tab != .profile && sidebarTabs.isEnabled(tab) { @@ -132,6 +142,7 @@ struct SideBarView: View { } label: { makeIconForTab(tab: tab) } + .help(tab.title) } } } diff --git a/IceCubesApp/App/Tabs/Tabs.swift b/IceCubesApp/App/Tabs/Tabs.swift index d361115a..71823d0e 100644 --- a/IceCubesApp/App/Tabs/Tabs.swift +++ b/IceCubesApp/App/Tabs/Tabs.swift @@ -80,41 +80,47 @@ enum Tab: Int, Identifiable, Hashable, CaseIterable, Codable { @ViewBuilder var label: some View { + if self != .other { + Label(title, systemImage: iconName) + } + } + + var title: LocalizedStringKey { switch self { case .timeline: - Label("tab.timeline", systemImage: iconName) + "tab.timeline" case .trending: - Label("tab.trending", systemImage: iconName) + "tab.trending" case .local: - Label("tab.local", systemImage: iconName) + "tab.local" case .federated: - Label("tab.federated", systemImage: iconName) + "tab.federated" case .notifications: - Label("tab.notifications", systemImage: iconName) + "tab.notifications" case .mentions: - Label("tab.mentions", systemImage: iconName) + "tab.mentions" case .explore: - Label("tab.explore", systemImage: iconName) + "tab.explore" case .messages: - Label("tab.messages", systemImage: iconName) + "tab.messages" case .settings: - Label("tab.settings", systemImage: iconName) + "tab.settings" case .profile: - Label("tab.profile", systemImage: iconName) + "tab.profile" case .bookmarks: - Label("accessibility.tabs.profile.picker.bookmarks", systemImage: iconName) + "accessibility.tabs.profile.picker.bookmarks" case .favorites: - Label("accessibility.tabs.profile.picker.favorites", systemImage: iconName) + "accessibility.tabs.profile.picker.favorites" case .post: - Label("menu.new-post", systemImage: iconName) + "menu.new-post" case .followedTags: - Label("timeline.filter.tags", systemImage: iconName) + "timeline.filter.tags" case .lists: - Label("timeline.filter.lists", systemImage: iconName) + "timeline.filter.lists" case .links: - Label("explore.section.trending.links", systemImage: iconName) + "explore.section.trending.links" case .other: - EmptyView() + "" } } diff --git a/IceCubesApp/Resources/Localization/Localizable.xcstrings b/IceCubesApp/Resources/Localization/Localizable.xcstrings index 638421fd..727edab0 100644 --- a/IceCubesApp/Resources/Localization/Localizable.xcstrings +++ b/IceCubesApp/Resources/Localization/Localizable.xcstrings @@ -75763,6 +75763,124 @@ } } }, + "tab.profile-account-%@" : { + "localizations" : { + "be" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "ca" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "de" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Profile (%@)" + } + }, + "en-GB" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "es" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "eu" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "fr" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "it" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "ja" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "ko" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "nb" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "nl" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "pl" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "tr" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "uk" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Profile (%@)" + } + } + } + }, "tab.settings" : { "localizations" : { "be" : {