Open History to see the last commit
1import SwiftUI
2
3struct LabThread: Identifiable, Hashable {
4 let id = UUID()
5 let title: String
6 let subtitle: String
7 let time: String
8 let initials: String
9 let tint: Color
10 let preview: String
11}
12
13private let threads: [LabThread] = [
14 .init(title: "Markdown rendering test", subtitle: "t3code · Julius’s Mac mini", time: "14h", initials: "MD", tint: .blue, preview: "Renderer stress test, terminal snippets, code blocks, and a very long markdown transcript."),
15 .init(title: "iPad rectly text correction", subtitle: "Julius’s Mac mini · main", time: "16h", initials: "IP", tint: .purple, preview: "Fix iPad layout, search behavior, hardware keyboard, and trackpad scrolling."),
16 .init(title: "Preview Webview Persists Off Panel", subtitle: "codething-mvp · Julius’s MacBook Pro", time: "22m", initials: "PW", tint: .teal, preview: "The browser preview should not leak outside the active panel when switching threads."),
17 .init(title: "Add file preview action buttons", subtitle: "codex/connection-preview", time: "10d", initials: "FP", tint: .orange, preview: "Open files at exact lines and expose copy/open actions in the renderer."),
18 .init(title: "Investigate v2 pipeline slowdown", subtitle: "codex-turn-runner", time: "1d", initials: "V2", tint: .gray, preview: "Compare orchestration traces and find why streamed events are delayed under load."),
19 .init(title: "Fix dark-mode header glass", subtitle: "t3code/ipad-responsive-mobile-layout", time: "2h", initials: "DG", tint: .indigo, preview: "Compare dark scroll-edge material against Messages and Mail, then map the behavior back to React Native Screens."),
20 .init(title: "Magic Keyboard sidebar scroll", subtitle: "mobile/input-polish", time: "3h", initials: "MK", tint: .cyan, preview: "Trackpad scrolling should remain fluid while swipe actions still work for touch gestures."),
21 .init(title: "Terminal tab key routing", subtitle: "terminal/native-pty", time: "5h", initials: "⌘", tint: .green, preview: "Hardware Tab should go to the terminal session instead of escaping to the thread search field."),
22 .init(title: "Diff renderer split inspector", subtitle: "review-diff/native", time: "8h", initials: "Δ", tint: .red, preview: "Keep file navigation, sticky headers, and selected hunk state stable in a three-column iPad layout."),
23 .init(title: "Composer glass affordance", subtitle: "composer/liquid-glass", time: "9h", initials: "CG", tint: .pink, preview: "Prototype a bottom composer that feels native without covering too much content while scrolling."),
24 .init(title: "Search placement audit", subtitle: "navigation/native-search", time: "11h", initials: "SP", tint: .mint, preview: "Validate whether search belongs in the bottom toolbar on iPhone and the sidebar chrome on iPad."),
25 .init(title: "Thread row density pass", subtitle: "home/messages-list", time: "12h", initials: "TR", tint: .brown, preview: "Tune row height, separators, preview text, chevrons, and status glyphs to match native list rhythm."),
26 .init(title: "Files navigator polish", subtitle: "files/inspector", time: "1d", initials: "FN", tint: .yellow, preview: "Make the file explorer feel like an iPad side inspector instead of a cramped web sidebar."),
27 .init(title: "Toolbar grouping experiment", subtitle: "native-toolbar-glass", time: "2d", initials: "TB", tint: .blue.opacity(0.7), preview: "Compare separate glass buttons with merged toolbar groups and spacing behavior."),
28 .init(title: "Scroll-edge fade comparison", subtitle: "swiftui/messages-lab", time: "3d", initials: "SE", tint: .purple.opacity(0.8), preview: "Record scroll positions to see where native headers start becoming visible over content."),
29 .init(title: "iPad sidebar selection state", subtitle: "split-view/sidebar", time: "4d", initials: "SS", tint: .teal.opacity(0.75), preview: "Find the right selected-row treatment for dark and light mode in a persistent sidebar."),
30 .init(title: "Preview webview panel bug", subtitle: "preview/browser", time: "5d", initials: "WB", tint: .orange.opacity(0.8), preview: "Ensure preview browser surfaces stay clipped to the active detail pane during navigation."),
31 .init(title: "Keyboard shortcuts overlay", subtitle: "hardware-keyboard", time: "6d", initials: "KS", tint: .gray.opacity(0.9), preview: "Expose discoverable commands and keep focus behavior aligned with iPadOS keyboard conventions."),
32 .init(title: "Thread loading skeleton", subtitle: "mobile/perceived-performance", time: "1w", initials: "LS", tint: .green.opacity(0.75), preview: "Replace jarring empty states with native-feeling loading rows while snapshots hydrate."),
33 .init(title: "Connection recovery UX", subtitle: "lan-pairing", time: "2w", initials: "CR", tint: .red.opacity(0.75), preview: "Make reconnect banners and retry affordances less intrusive during scroll and composition."),
34]
35
36struct ContentView: View {
37 @Environment(\.horizontalSizeClass) private var horizontalSizeClass
38 @State private var searchText = ""
39 @State private var selectedThread: LabThread? = threads[0]
40
41 var body: some View {
42 if horizontalSizeClass == .regular {
43 NativeSplitLab(searchText: $searchText, selectedThread: $selectedThread)
44 } else {
45 NativePhoneLab(searchText: $searchText, selectedThread: $selectedThread)
46 }
47 }
48}
49
50private var filteredThreads: [LabThread] {
51 threads
52}
53
54private let glassDebugCodeLines: [String] = [
55 "# Native RNS glass debug route",
56 "",
57 "This screen intentionally avoids Expo Router headers.",
58 "The native header below is owned by react-native-screens.",
59 "",
60 "Expected iOS 26 behavior:",
61 "- At rest: header should feel like app background",
62 "- While scrolled: content should blur behind the header",
63 "- No gray custom overlay",
64 "- No JS blur view",
65 "",
66 "Scroll edge effect should sample actual content:",
67 "const header = { translucent: true }",
68 "const scrollEdgeEffects = { top: 'soft' }",
69 "",
70 "Bright rows below make sampling failures obvious.",
71 "",
72 "node_modules",
73 "/.pnp",
74 ".pnp.*",
75 ".yarn/*",
76 "!.yarn/patches",
77 "!.yarn/plugins",
78 "!.yarn/releases",
79 "!.yarn/versions",
80 "",
81 "# testing",
82 "/coverage",
83 ".convex",
84 "e2e/.local-dev.json",
85 "e2e/playwright-report",
86 "e2e/test-results",
87 "",
88 "# app surfaces",
89 "threads",
90 "terminal",
91 "diff renderer",
92 "file explorer",
93 "composer",
94 "native header",
95 "scroll edge",
96 "liquid glass",
97]
98
99private let glassDebugSwatches: [Color] = [
100 .blue,
101 .green,
102 .orange,
103 .purple,
104 .cyan,
105 .pink,
106]
107
108struct NativePhoneLab: View {
109 @Binding var searchText: String
110 @Binding var selectedThread: LabThread?
111
112 var body: some View {
113 NavigationStack {
114 NativeThreadLab(thread: selectedThread ?? threads[0])
115 }
116 }
117}
118
119struct NativeSplitLab: View {
120 @Binding var searchText: String
121 @Binding var selectedThread: LabThread?
122
123 var body: some View {
124 NavigationSplitView {
125 List(filteredThreads, selection: $selectedThread) { thread in
126 MessageSidebarRow(thread: thread)
127 .tag(thread)
128 }
129 .listStyle(.sidebar)
130 .navigationTitle("Threads")
131 .searchable(text: $searchText, placement: .sidebar, prompt: "Search")
132 .toolbar {
133 ToolbarItemGroup(placement: .topBarTrailing) {
134 Menu {
135 Button("All Threads", systemImage: "tray.full") {}
136 Button("Ready", systemImage: "checkmark.circle") {}
137 Button("Running", systemImage: "bolt.circle") {}
138 } label: {
139 Image(systemName: "line.3.horizontal.decrease")
140 }
141 .buttonStyle(.glass)
142
143 Button {} label: {
144 Image(systemName: "gearshape")
145 }
146 .buttonStyle(.glass)
147
148 Button {} label: {
149 Image(systemName: "square.and.pencil")
150 }
151 .buttonStyle(.glass)
152 }
153 }
154 } detail: {
155 if let selectedThread {
156 NativeThreadLab(thread: selectedThread)
157 } else {
158 ContentUnavailableView("Select a thread", systemImage: "sidebar.left")
159 }
160 }
161 }
162}
163
164struct MessageListRow: View {
165 let thread: LabThread
166
167 var body: some View {
168 HStack(alignment: .top, spacing: 14) {
169 Circle()
170 .fill(thread.tint.gradient)
171 .frame(width: 52, height: 52)
172 .overlay {
173 Text(thread.initials)
174 .font(.headline.weight(.bold))
175 .foregroundStyle(.white)
176 }
177
178 VStack(alignment: .leading, spacing: 4) {
179 HStack {
180 Text(thread.title)
181 .font(.headline.weight(.semibold))
182 .lineLimit(1)
183 Spacer(minLength: 8)
184 Text(thread.time)
185 .foregroundStyle(.secondary)
186 Image(systemName: "chevron.right")
187 .font(.caption.weight(.semibold))
188 .foregroundStyle(.tertiary)
189 }
190
191 Text(thread.preview)
192 .font(.subheadline)
193 .foregroundStyle(.secondary)
194 .lineLimit(2)
195 }
196 .padding(.vertical, 12)
197 }
198 }
199}
200
201struct MessageSidebarRow: View {
202 let thread: LabThread
203
204 var body: some View {
205 VStack(alignment: .leading, spacing: 4) {
206 HStack {
207 Text(thread.title)
208 .font(.headline.weight(.semibold))
209 .lineLimit(1)
210 Spacer()
211 Text(thread.time)
212 .font(.subheadline)
213 .foregroundStyle(.secondary)
214 }
215 Text(thread.subtitle)
216 .font(.subheadline)
217 .foregroundStyle(.secondary)
218 .lineLimit(1)
219 }
220 .padding(.vertical, 6)
221 }
222}
223
224struct NativeThreadLab: View {
225 let thread: LabThread
226 @State private var draft = "Ask the repo agent, or run a command..."
227 @State private var scrollStep = 0
228
229 private let scrollTimer = Timer.publish(every: 2.8, on: .main, in: .common).autoconnect()
230 private let scrollTargets = ["top", "swatches", "top", "code", "card"]
231
232 var body: some View {
233 ScrollViewReader { proxy in
234 ScrollView {
235 LazyVStack(alignment: .leading, spacing: 22) {
236 Color.clear
237 .frame(height: 0)
238 .id("top")
239
240 hero
241 .padding(.top, 8)
242
243 swatches
244 .id("swatches")
245
246 explanationCard
247 .id("card")
248
249 codeCard
250 .id("code")
251 }
252 .padding(.horizontal, 18)
253 .padding(.top, 8)
254 .padding(.bottom, 96)
255 }
256 .background(Color(uiColor: .systemBackground))
257 .onReceive(scrollTimer) { _ in
258 guard !scrollTargets.isEmpty else { return }
259
260 let target = scrollTargets[scrollStep % scrollTargets.count]
261 scrollStep += 1
262
263 withAnimation(.smooth(duration: 1.0)) {
264 proxy.scrollTo(target, anchor: .top)
265 }
266 }
267 }
268 .navigationTitle("RNS Glass")
269 .navigationSubtitle("plain react-native-screens")
270 .toolbar {
271 ToolbarItemGroup(placement: .topBarTrailing) {
272 Button {} label: { Image(systemName: "plus") }
273 .buttonStyle(.glass)
274 Button {} label: { Image(systemName: "magnifyingglass") }
275 .buttonStyle(.glass)
276 }
277 }
278 .safeAreaInset(edge: .bottom) {
279 composer
280 }
281 }
282
283 private var hero: some View {
284 VStack(alignment: .leading, spacing: 10) {
285 Text("plain react-native-screens")
286 .font(.subheadline.weight(.bold))
287 .textCase(.uppercase)
288 .tracking(0.5)
289 .foregroundStyle(.secondary)
290
291 Text("Native scroll-edge glass")
292 .font(.system(size: 48, weight: .heavy, design: .default))
293 .lineLimit(nil)
294 .minimumScaleFactor(0.72)
295
296 Text("This route uses RNS directly. The script scrolls automatically so the native header is captured both at rest and with bright content behind it.")
297 .font(.title3)
298 .foregroundStyle(.secondary)
299 }
300 }
301
302 private var swatches: some View {
303 LazyVGrid(
304 columns: [GridItem(.adaptive(minimum: 60), spacing: 12)],
305 alignment: .leading,
306 spacing: 12
307 ) {
308 ForEach(Array(glassDebugSwatches.enumerated()), id: \.offset) { index, color in
309 Circle()
310 .fill(color.gradient)
311 .frame(width: 60, height: 60)
312 .overlay {
313 Text("\(index + 1)")
314 .font(.title2.weight(.heavy))
315 .foregroundStyle(.white)
316 }
317 }
318 }
319 }
320
321 private var explanationCard: some View {
322 VStack(alignment: .leading, spacing: 10) {
323 Text("What this isolates")
324 .font(.title2.weight(.bold))
325
326 Text("Native transparent header + iOS 26 scroll edge effect. No Expo Router header config, no custom blur overlay, no large title requirement.")
327 .font(.title3)
328 .foregroundStyle(.secondary)
329 }
330 .padding(22)
331 .frame(maxWidth: .infinity, alignment: .leading)
332 .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 28, style: .continuous))
333 .overlay {
334 RoundedRectangle(cornerRadius: 28, style: .continuous)
335 .stroke(.separator.opacity(0.35), lineWidth: 0.5)
336 }
337 }
338
339 private var codeCard: some View {
340 VStack(alignment: .leading, spacing: 0) {
341 ForEach(Array((glassDebugCodeLines + glassDebugCodeLines).enumerated()), id: \.offset) { index, line in
342 HStack(alignment: .top, spacing: 16) {
343 Text("\(index + 1)")
344 .foregroundStyle(.secondary)
345 .frame(width: 34, alignment: .trailing)
346
347 Text(line.isEmpty ? " " : line)
348 .frame(maxWidth: .infinity, alignment: .leading)
349 }
350 .font(.system(size: 16, design: .monospaced))
351 .lineSpacing(4)
352 .padding(.horizontal, 16)
353 .padding(.vertical, 3)
354 }
355 }
356 .padding(.vertical, 14)
357 .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 24, style: .continuous))
358 .overlay {
359 RoundedRectangle(cornerRadius: 24, style: .continuous)
360 .stroke(.separator.opacity(0.35), lineWidth: 0.5)
361 }
362 }
363
364 private var composer: some View {
365 HStack(spacing: 10) {
366 Text(draft)
367 .foregroundStyle(.secondary)
368 .lineLimit(1)
369 Spacer()
370 Image(systemName: "arrow.up")
371 .font(.headline.weight(.bold))
372 .frame(width: 44, height: 44)
373 .glassEffect(.regular.interactive(), in: Circle())
374 }
375 .padding(.leading, 18)
376 .padding(.trailing, 6)
377 .frame(height: 56)
378 .glassEffect(.clear.interactive(), in: Capsule())
379 .padding(.horizontal)
380 .padding(.vertical, 8)
381 }
382}
383
384#Preview {
385 ContentView()
386}