The sort control leaves the list — three pickers settle into the bottom bar
Same segments, same persistence; the picker now rides each screen's toolbar as a bottom-bar item shown only when there are rows to reorder, instead of masquerading as the first row of the list it sorts. Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
@@ -6,7 +6,7 @@ import SwiftUI
|
||||
/// Renders both of `BoardIndexStore.Phase`'s live states and, above the list, the iCloud notice —
|
||||
/// which is a row, not a wall (softened 2026-08-08). A phone with no account still has a device home
|
||||
/// and therefore still has boards, so the missing half of the app is reported next to the half that
|
||||
/// works rather than in place of it. A segmented control above the rows lets the list be sorted by
|
||||
/// works rather than in place of it. A segmented control in the toolbar lets the list be sorted by
|
||||
/// name or by most recent change, remembered across launches.
|
||||
struct BoardsTabView: View {
|
||||
@Environment(BoardIndexStore.self) private var index
|
||||
@@ -32,6 +32,9 @@ struct BoardsTabView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.toolbar {
|
||||
sortToolbarItem
|
||||
}
|
||||
.navigationDestination(for: BoardRoute.self) { route in
|
||||
switch route {
|
||||
case let .lanes(boardRoot):
|
||||
@@ -73,6 +76,21 @@ struct BoardsTabView: View {
|
||||
sortOrder.wrappedValue.sorted(index.boards)
|
||||
}
|
||||
|
||||
/// Shown only once there is something to sort — an empty or not-yet-loaded list has no rows
|
||||
/// for the segments to reorder.
|
||||
@ToolbarContentBuilder
|
||||
private var sortToolbarItem: some ToolbarContent {
|
||||
if case .ready = index.phase, !index.boards.isEmpty {
|
||||
ToolbarItem(placement: .bottomBar) {
|
||||
Picker("Sort", selection: sortOrder) {
|
||||
Text("Name").tag(BoardSortOrder.name)
|
||||
Text("Recent").tag(BoardSortOrder.recent)
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var content: some View {
|
||||
switch index.phase {
|
||||
@@ -93,14 +111,6 @@ struct BoardsTabView: View {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Picker("Sort", selection: sortOrder) {
|
||||
Text("Name").tag(BoardSortOrder.name)
|
||||
Text("Recent").tag(BoardSortOrder.recent)
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
|
||||
ForEach(sortedBoards) { board in
|
||||
NavigationLink(value: BoardRoute.lanes(boardRoot: board.rootURL)) {
|
||||
BoardSummaryRow(board: board)
|
||||
|
||||
Reference in New Issue
Block a user