mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 13:12:53 +00:00
Slim the iPad sidebar switcher pill to icon and account name
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user