eleven / ocho Public

Clone
git clone https://amadan.net/eleven/ocho

Plain git — no account needed to clone.

Download

Download this file

1import SwiftUI
2import LChatCore
3
4// 🤖 The Threads list, as an iOS sheet: this chat's threads, freshest first,
5// one row per thread root. The list itself is LChatCore's ReplyThreadListView
6// (shared with the Mac's docked column, so the rows and their accessible names
7// are word for word the same); this file is only the sheet chrome around it —
8// the title, the Done button, and the dismissal a tapped row rides out on.
9//
10// Why a sheet rather than a column: the iPhone has no room for a second one,
11// and a tapped row lands in the thread pane (iPad) or the lifted thread
12// overlay (iPhone) — so the list is a transient index you come out of, exactly
13// like Media, Links & Docs. That also matches the web's single-right-dock
14// rule: finding the thread and reading it are never both on screen.
15struct ThreadListSheet: View {
16 @ObservedObject var model: ChatFeedModel
17 /// Open this thread. The screen dismisses the sheet first, then opens the
18 /// thread the same way a "N Replies" tally tap does.
19 let onOpen: (Int64) -> Void
20 @Environment(\.dismiss) private var dismiss
21 // The reader's chosen colour theme, so a row highlights in the same
22 // bubble tint the feed behind the sheet uses.
23 @AppStorage("nativeTheme") private var themeName = "classic"
24
25 var body: some View {
26 NavigationStack {
27 // The sheet's navigation bar carries the title and Done, so the
28 // shared view draws no header of its own.
29 ReplyThreadListView(model: model, theme: .named(themeName), showsHeader: false,
30 onOpen: onOpen,
31 onClose: { dismiss() })
32 .navigationTitle("Threads")
33 .navigationBarTitleDisplayMode(.inline)
34 .toolbar {
35 ToolbarItem(placement: .confirmationAction) {
36 Button("Done") { dismiss() }
37 }
38 }
39 }
40 }
41}
42