Slim the iPad sidebar switcher pill to icon and account name

This commit is contained in:
Arkadiusz Fal
2026-09-16 18:27:17 +02:00
parent 5d33e4a558
commit 59c4f27bc7
2 changed files with 35 additions and 1 deletions

View File

@@ -395,6 +395,39 @@ struct DataContextSwitcherMenu: View {
#endif
#if os(iOS)
/// The iPad sidebar pill's presentation: just the icon and the current
/// account's name, centered. The pill's placement already says what the
/// control is, so the "Account" caption the settings rows carry is dropped;
/// assistive technology still gets it as the label.
struct DataContextSwitcherSidebarRow: View {
@Environment(\.appEnvironment) private var appEnvironment
var body: some View {
Menu {
DataContextSwitcherRows()
} label: {
HStack(spacing: 6) {
DataContextSwitcherIcon()
Text(contextTitle)
.lineLimit(1)
.truncationMode(.tail)
}
}
.accessibilityLabel(Text(String(localized: "accounts.switcher.title")))
.accessibilityValue(Text(contextTitle))
}
private var contextTitle: String {
DataContextSwitcherLabels.title(for: currentContext, in: appEnvironment)
}
private var currentContext: DataContext {
appEnvironment?.accountsManager.currentContext ?? .local
}
}
#endif
/// A settings row naming the current context, with the switcher attached.
struct DataContextSwitcherSettingsRow: View {
@Environment(\.appEnvironment) private var appEnvironment

View File

@@ -76,10 +76,11 @@ struct UnifiedTabView: View {
// The bottom bar pins over the list without a background of its
// own, so sidebar rows scrolled to the end show through the
// switcher. A pill of its own keeps what's beneath it blurred.
DataContextSwitcherSettingsRow()
DataContextSwitcherSidebarRow()
.padding(.horizontal, 14)
.padding(.vertical, 10)
.sidebarBottomBarPill()
.frame(maxWidth: .infinity)
}
}
.iOS26TabFeatures(shouldShowAccessory: shouldShowAccessory, settingsManager: appEnvironment?.settingsManager)