mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Move Home shortcut style picker to its own page with live preview
Replace the inline Plain/Accent/Colorful picker in Home customization with a navigation row that opens a dedicated page. The new page keeps the style selector and renders a non-interactive preview of every shortcut type so the chosen style is visible before committing. - Add an optional styleOverride to HomeShortcutCardView so the preview can reflect the not-yet-saved selection. - On macOS, navigate via navigationDestination(isPresented:) instead of a List-embedded NavigationLink, which otherwise stays stuck in its selected state after popping back and can't be reopened.
This commit is contained in:
@@ -27,6 +27,9 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
||||
var showsCount: Bool
|
||||
/// Fixed color used when the "colorful" card style is active.
|
||||
var colorfulColor: Color
|
||||
/// Explicit style override. When set, takes precedence over the global
|
||||
/// setting — used to render live previews of a not-yet-saved style.
|
||||
var styleOverride: HomeShortcutCardStyle?
|
||||
var statusIndicator: StatusIndicator?
|
||||
|
||||
init(
|
||||
@@ -36,6 +39,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
||||
subtitle: String,
|
||||
showsCount: Bool = true,
|
||||
colorfulColor: Color = .accentColor,
|
||||
styleOverride: HomeShortcutCardStyle? = nil,
|
||||
statusIndicator: StatusIndicator?
|
||||
) {
|
||||
self.icon = icon
|
||||
@@ -44,6 +48,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
||||
self.subtitle = subtitle
|
||||
self.showsCount = showsCount
|
||||
self.colorfulColor = colorfulColor
|
||||
self.styleOverride = styleOverride
|
||||
self.statusIndicator = statusIndicator
|
||||
}
|
||||
|
||||
@@ -53,7 +58,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
||||
#if os(tvOS)
|
||||
return .plain
|
||||
#else
|
||||
return appEnvironment?.settingsManager.homeShortcutCardStyle ?? .plain
|
||||
return styleOverride ?? (appEnvironment?.settingsManager.homeShortcutCardStyle ?? .plain)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -296,7 +301,8 @@ extension HomeShortcutCardView where StatusIndicator == EmptyView {
|
||||
count: Int,
|
||||
subtitle: String,
|
||||
showsCount: Bool = true,
|
||||
colorfulColor: Color = .accentColor
|
||||
colorfulColor: Color = .accentColor,
|
||||
styleOverride: HomeShortcutCardStyle? = nil
|
||||
) {
|
||||
self.icon = icon
|
||||
self.title = title
|
||||
@@ -304,6 +310,7 @@ extension HomeShortcutCardView where StatusIndicator == EmptyView {
|
||||
self.subtitle = subtitle
|
||||
self.showsCount = showsCount
|
||||
self.colorfulColor = colorfulColor
|
||||
self.styleOverride = styleOverride
|
||||
self.statusIndicator = nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user