1+ import type { ThreadMoveDestination } from "../threads/threadOrder" ;
12import { createThreadMovePlanner } from "../threads/threadOrder" ;
23import {
34 LegendList ,
@@ -26,6 +27,7 @@ import { ActivityIndicator, FlatList, Platform, Pressable, View } from "react-na
2627import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable" ;
2728import { useSafeAreaInsets } from "react-native-safe-area-context" ;
2829
30+ import { cn } from "../../lib/cn" ;
2931import { AppText as Text } from "../../components/AppText" ;
3032import { EmptyState } from "../../components/EmptyState" ;
3133import type { WorkspaceEnvironment , WorkspaceState } from "../../state/workspaceModel" ;
@@ -34,6 +36,7 @@ import { scopedProjectKey } from "../../lib/scopedEntities";
3436import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass" ;
3537import { mobilePreferencesAtom , updateMobilePreferencesAtom } from "../../state/preferences" ;
3638import { useThreadSearch } from "../../state/queries" ;
39+ import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider" ;
3740import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled" ;
3841import { usePendingThreadOrder } from "../../state/thread-order" ;
3942import { environmentServerConfigsAtom } from "../../state/server" ;
@@ -121,7 +124,7 @@ interface HomeScreenProps {
121124 readonly onUnpinThread : ( thread : EnvironmentThreadShell ) => Promise < boolean > ;
122125 readonly onMoveThread : (
123126 thread : EnvironmentThreadShell ,
124- direction : "up" | "down" ,
127+ direction : ThreadMoveDestination ,
125128 ) => Promise < boolean > ;
126129 readonly onRegenerateThreadTitle : ( thread : EnvironmentThreadShell ) => Promise < boolean > ;
127130 readonly onSelectPendingTask : ( pendingTask : PendingNewTask ) => void ;
@@ -211,6 +214,7 @@ function HomeTopContentSpacer() {
211214/* ─── Main screen ────────────────────────────────────────────────────── */
212215
213216export function HomeScreen ( props : HomeScreenProps ) {
217+ const { materialYouStyleLayoutActive } = useAppearancePreferences ( ) ;
214218 const [ groupDisplayStates , setGroupDisplayStates ] = useState <
215219 ReadonlyMap < string , HomeGroupDisplayState >
216220 > ( ( ) => new Map ( ) ) ;
@@ -517,7 +521,7 @@ export function HomeScreen(props: HomeScreenProps) {
517521 [ props . onPinThread ] ,
518522 ) ;
519523 const handleMoveThread = useCallback (
520- ( thread : EnvironmentThreadShell , direction : "up" | "down" ) => {
524+ ( thread : EnvironmentThreadShell , direction : ThreadMoveDestination ) => {
521525 void props . onMoveThread ( thread , direction ) ;
522526 } ,
523527 [ props . onMoveThread ] ,
@@ -1086,26 +1090,31 @@ export function HomeScreen(props: HomeScreenProps) {
10861090
10871091 if ( ! hasAnyThreads ) {
10881092 return (
1089- < View
1090- className = "flex-1 items-center justify-center bg-screen px-8"
1091- style = { {
1092- paddingBottom : Math . max ( insets . bottom , 24 ) + iosBottomToolbarClearance ,
1093- paddingTop : NATIVE_LIQUID_GLASS_SUPPORTED ? insets . top + 72 : 0 ,
1094- } }
1095- >
1096- < View className = "w-full max-w-[430px]" >
1097- < EmptyState
1098- title = { emptyState . title }
1099- detail = { emptyState . detail }
1100- actionLabel = { ! props . catalogState . hasReadyEnvironment ? "Add environment" : undefined }
1101- onAction = { ! props . catalogState . hasReadyEnvironment ? props . onAddConnection : undefined }
1102- variant = "plain"
1103- />
1104- { emptyState . loading ? (
1105- < View className = "mt-4 items-center" >
1106- < ActivityIndicator colorClassName = { "accent-icon-muted" } />
1107- </ View >
1108- ) : null }
1093+ < View className = { materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen" } >
1094+ < View
1095+ className = { cn (
1096+ "flex-1 items-center justify-center bg-screen px-8" ,
1097+ materialYouStyleLayoutActive && "overflow-hidden rounded-t-[28px]" ,
1098+ ) }
1099+ style = { {
1100+ paddingBottom : Math . max ( insets . bottom , 24 ) + iosBottomToolbarClearance ,
1101+ paddingTop : NATIVE_LIQUID_GLASS_SUPPORTED ? insets . top + 72 : 0 ,
1102+ } }
1103+ >
1104+ < View className = "w-full max-w-[430px]" >
1105+ < EmptyState
1106+ title = { emptyState . title }
1107+ detail = { emptyState . detail }
1108+ actionLabel = { ! props . catalogState . hasReadyEnvironment ? "Add environment" : undefined }
1109+ onAction = { ! props . catalogState . hasReadyEnvironment ? props . onAddConnection : undefined }
1110+ variant = "plain"
1111+ />
1112+ { emptyState . loading ? (
1113+ < View className = "mt-4 items-center" >
1114+ < ActivityIndicator colorClassName = { "accent-icon-muted" } />
1115+ </ View >
1116+ ) : null }
1117+ </ View >
11091118 </ View >
11101119 </ View >
11111120 ) ;
@@ -1150,100 +1159,116 @@ export function HomeScreen(props: HomeScreenProps) {
11501159
11511160 if ( threadListV2Enabled ) {
11521161 return (
1153- < View className = "flex-1 bg-screen" >
1162+ < View className = { materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen" } >
1163+ < View
1164+ className = {
1165+ materialYouStyleLayoutActive
1166+ ? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
1167+ : "flex-1 bg-screen"
1168+ }
1169+ >
1170+ < SwipeableScrollGateProvider enabled = { swipeEnabled } >
1171+ < FlatList
1172+ data = { threadListV2Items }
1173+ renderItem = { renderV2Item }
1174+ keyExtractor = { v2KeyExtractor }
1175+ extraData = { v2ExtraData }
1176+ ListHeaderComponent = { v2ListHeader }
1177+ ListFooterComponent = {
1178+ settledShelfExpanded && threadListV2Layout . hiddenSettledCount > 0 ? (
1179+ < Pressable
1180+ accessibilityRole = "button"
1181+ accessibilityLabel = { `Show ${ Math . min ( threadListV2Layout . hiddenSettledCount , THREAD_LIST_V2_SETTLED_PAGE_COUNT ) } more settled threads` }
1182+ onPress = { showMoreSettled }
1183+ className = "mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
1184+ style = { ( { pressed } ) => ( { opacity : pressed ? 0.6 : 1 } ) }
1185+ >
1186+ < Text className = "text-xs font-t3-medium text-foreground-muted" >
1187+ Show more ({ threadListV2Layout . hiddenSettledCount } settled hidden)
1188+ </ Text >
1189+ </ Pressable >
1190+ ) : null
1191+ }
1192+ ListEmptyComponent = { v2ListEmpty }
1193+ style = { { flex : 1 } }
1194+ automaticallyAdjustsScrollIndicatorInsets = { Platform . OS === "ios" }
1195+ contentInsetAdjustmentBehavior = { Platform . OS === "ios" ? "automatic" : "never" }
1196+ showsVerticalScrollIndicator = { false }
1197+ keyboardDismissMode = "on-drag"
1198+ keyboardShouldPersistTaps = "handled"
1199+ { ...scrollGateHandlers }
1200+ scrollEventThrottle = { 16 }
1201+ contentContainerStyle = { {
1202+ paddingBottom :
1203+ Platform . OS === "ios"
1204+ ? Math . max ( insets . bottom , 24 ) + 96 + iosBottomToolbarClearance
1205+ : Math . max ( insets . bottom , 16 ) + 88 ,
1206+ } }
1207+ />
1208+ </ SwipeableScrollGateProvider >
1209+ </ View >
1210+ </ View >
1211+ ) ;
1212+ }
1213+
1214+ return (
1215+ < View className = { materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen" } >
1216+ < View
1217+ className = {
1218+ materialYouStyleLayoutActive
1219+ ? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
1220+ : "flex-1 bg-screen"
1221+ }
1222+ >
1223+ { /* Sticky headers are deliberately not wired up: LegendList's JS sticky
1224+ implementation mispositions pinned headers at mount under iOS
1225+ automatic content insets (headers render one nav-inset too low until
1226+ the first scroll event) and blanks non-pinned headers after
1227+ collapse/expand data changes. The flattened layout still exposes
1228+ `stickyHeaderIndices` if this gets revisited. */ }
11541229 < SwipeableScrollGateProvider enabled = { swipeEnabled } >
1155- < FlatList
1156- data = { threadListV2Items }
1157- renderItem = { renderV2Item }
1158- keyExtractor = { v2KeyExtractor }
1159- extraData = { v2ExtraData }
1160- ListHeaderComponent = { v2ListHeader }
1161- ListFooterComponent = {
1162- settledShelfExpanded && threadListV2Layout . hiddenSettledCount > 0 ? (
1163- < Pressable
1164- accessibilityRole = "button"
1165- accessibilityLabel = { `Show ${ Math . min ( threadListV2Layout . hiddenSettledCount , THREAD_LIST_V2_SETTLED_PAGE_COUNT ) } more settled threads` }
1166- onPress = { showMoreSettled }
1167- className = "mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
1168- style = { ( { pressed } ) => ( { opacity : pressed ? 0.6 : 1 } ) }
1169- >
1170- < Text className = "text-xs font-t3-medium text-foreground-muted" >
1171- Show more ({ threadListV2Layout . hiddenSettledCount } settled hidden)
1172- </ Text >
1173- </ Pressable >
1174- ) : null
1175- }
1176- ListEmptyComponent = { v2ListEmpty }
1230+ < LegendList
1231+ ref = { listRef }
1232+ data = { listLayout . items }
1233+ renderItem = { renderItem }
1234+ keyExtractor = { keyExtractor }
1235+ itemsAreEqual = { homeListItemsAreEqual }
1236+ drawDistance = { 500 }
1237+ estimatedItemSize = { ESTIMATED_THREAD_ROW_HEIGHT }
1238+ extraData = { extraData }
1239+ ListHeaderComponent = { listHeader }
1240+ ListEmptyComponent = { listEmpty }
11771241 style = { { flex : 1 } }
1178- automaticallyAdjustsScrollIndicatorInsets = { Platform . OS === "ios" }
1179- contentInsetAdjustmentBehavior = { Platform . OS === "ios" ? "automatic" : "never" }
1242+ automaticallyAdjustsScrollIndicatorInsets = { NATIVE_LIQUID_GLASS_SUPPORTED }
1243+ contentInsetAdjustmentBehavior = { NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never" }
11801244 showsVerticalScrollIndicator = { false }
11811245 keyboardDismissMode = "on-drag"
11821246 keyboardShouldPersistTaps = "handled"
11831247 { ...scrollGateHandlers }
1248+ recycleItems
11841249 scrollEventThrottle = { 16 }
11851250 contentContainerStyle = { {
1251+ // Android reserves room for the floating new-task FAB
1252+ // (56 button + 16 gap + bottom inset). Pre-glass iOS shows a
1253+ // standard 44pt bottom toolbar that overlays the list and is not
1254+ // reflected in insets while contentInsetAdjustmentBehavior is
1255+ // "never".
11861256 paddingBottom :
11871257 Platform . OS === "ios"
1188- ? Math . max ( insets . bottom , 24 ) + 96 + iosBottomToolbarClearance
1258+ ? Math . max ( insets . bottom , 24 ) + 24 + iosBottomToolbarClearance
11891259 : Math . max ( insets . bottom , 16 ) + 88 ,
11901260 } }
1261+ scrollIndicatorInsets = {
1262+ Platform . OS === "ios"
1263+ ? {
1264+ bottom : Math . max ( insets . bottom , 16 ) + 24 + iosBottomToolbarClearance ,
1265+ top : 0 ,
1266+ }
1267+ : undefined
1268+ }
11911269 />
11921270 </ SwipeableScrollGateProvider >
11931271 </ View >
1194- ) ;
1195- }
1196-
1197- return (
1198- < View className = "flex-1 bg-screen" >
1199- { /* Sticky headers are deliberately not wired up: LegendList's JS sticky
1200- implementation mispositions pinned headers at mount under iOS
1201- automatic content insets (headers render one nav-inset too low until
1202- the first scroll event) and blanks non-pinned headers after
1203- collapse/expand data changes. The flattened layout still exposes
1204- `stickyHeaderIndices` if this gets revisited. */ }
1205- < SwipeableScrollGateProvider enabled = { swipeEnabled } >
1206- < LegendList
1207- ref = { listRef }
1208- data = { listLayout . items }
1209- renderItem = { renderItem }
1210- keyExtractor = { keyExtractor }
1211- itemsAreEqual = { homeListItemsAreEqual }
1212- drawDistance = { 500 }
1213- estimatedItemSize = { ESTIMATED_THREAD_ROW_HEIGHT }
1214- extraData = { extraData }
1215- ListHeaderComponent = { listHeader }
1216- ListEmptyComponent = { listEmpty }
1217- style = { { flex : 1 } }
1218- automaticallyAdjustsScrollIndicatorInsets = { NATIVE_LIQUID_GLASS_SUPPORTED }
1219- contentInsetAdjustmentBehavior = { NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never" }
1220- showsVerticalScrollIndicator = { false }
1221- keyboardDismissMode = "on-drag"
1222- keyboardShouldPersistTaps = "handled"
1223- { ...scrollGateHandlers }
1224- recycleItems
1225- scrollEventThrottle = { 16 }
1226- contentContainerStyle = { {
1227- // Android reserves room for the floating new-task FAB
1228- // (56 button + 16 gap + bottom inset). Pre-glass iOS shows a
1229- // standard 44pt bottom toolbar that overlays the list and is not
1230- // reflected in insets while contentInsetAdjustmentBehavior is
1231- // "never".
1232- paddingBottom :
1233- Platform . OS === "ios"
1234- ? Math . max ( insets . bottom , 24 ) + 24 + iosBottomToolbarClearance
1235- : Math . max ( insets . bottom , 16 ) + 88 ,
1236- } }
1237- scrollIndicatorInsets = {
1238- Platform . OS === "ios"
1239- ? {
1240- bottom : Math . max ( insets . bottom , 16 ) + 24 + iosBottomToolbarClearance ,
1241- top : 0 ,
1242- }
1243- : undefined
1244- }
1245- />
1246- </ SwipeableScrollGateProvider >
12471272 </ View >
12481273 ) ;
12491274}
0 commit comments