mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 10:25:02 +00:00
Show grid columns option in view options on tvOS
Expose the grid columns picker in SubscriptionsView and ManageChannelsView inline sheets, and track viewWidth in ChannelView's tvOS GeometryReaders so the shared ViewOptionsSheet can compute a meaningful column range.
This commit is contained in:
@@ -525,6 +525,9 @@ struct ChannelView: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal, 60)
|
.padding(.horizontal, 60)
|
||||||
.padding(.vertical, 40)
|
.padding(.vertical, 40)
|
||||||
|
.onChange(of: geometry.size.width, initial: true) { _, newWidth in
|
||||||
|
viewWidth = newWidth
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.confirmationDialog(
|
.confirmationDialog(
|
||||||
String(localized: "channel.unsubscribe.confirmation.title"),
|
String(localized: "channel.unsubscribe.confirmation.title"),
|
||||||
@@ -732,6 +735,9 @@ struct ChannelView: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal, 60)
|
.padding(.horizontal, 60)
|
||||||
.padding(.vertical, 40)
|
.padding(.vertical, 40)
|
||||||
|
.onChange(of: geometry.size.width, initial: true) { _, newWidth in
|
||||||
|
viewWidth = newWidth
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -143,15 +143,21 @@ struct ManageChannelsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Grid-specific options
|
// Grid-specific options
|
||||||
#if !os(tvOS)
|
|
||||||
if layout == .grid {
|
if layout == .grid {
|
||||||
|
#if os(tvOS)
|
||||||
|
Picker("viewOptions.columns.header", selection: $gridColumns) {
|
||||||
|
ForEach(1...max(1, gridConfig.maxColumns), id: \.self) { count in
|
||||||
|
Text("\(count)").tag(count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
Stepper(
|
Stepper(
|
||||||
"viewOptions.columns \(min(max(1, gridColumns), gridConfig.maxColumns))",
|
"viewOptions.columns \(min(max(1, gridColumns), gridConfig.maxColumns))",
|
||||||
value: $gridColumns,
|
value: $gridColumns,
|
||||||
in: 1...gridConfig.maxColumns
|
in: 1...gridConfig.maxColumns
|
||||||
)
|
)
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
Picker("manageChannels.sortBy", selection: $sortOrder) {
|
Picker("manageChannels.sortBy", selection: $sortOrder) {
|
||||||
Text("manageChannels.sortBy.name").tag(SidebarChannelSort.alphabetical)
|
Text("manageChannels.sortBy.name").tag(SidebarChannelSort.alphabetical)
|
||||||
|
|||||||
@@ -292,15 +292,21 @@ struct SubscriptionsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Grid-specific options
|
// Grid-specific options
|
||||||
#if !os(tvOS)
|
|
||||||
if layout == .grid {
|
if layout == .grid {
|
||||||
|
#if os(tvOS)
|
||||||
|
Picker("viewOptions.columns.header", selection: $gridColumns) {
|
||||||
|
ForEach(1...max(1, gridConfig.maxColumns), id: \.self) { count in
|
||||||
|
Text("\(count)").tag(count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
Stepper(
|
Stepper(
|
||||||
"viewOptions.columns \(min(max(1, gridColumns), gridConfig.maxColumns))",
|
"viewOptions.columns \(min(max(1, gridColumns), gridConfig.maxColumns))",
|
||||||
value: $gridColumns,
|
value: $gridColumns,
|
||||||
in: 1...gridConfig.maxColumns
|
in: 1...gridConfig.maxColumns
|
||||||
)
|
)
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
Toggle("viewOptions.hideWatched", isOn: $hideWatched)
|
Toggle("viewOptions.hideWatched", isOn: $hideWatched)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user