feat(mobile): add optional Material You layout (#10692)

Co-authored-by: Pixel Perfect <[email protected]>
This commit is contained in:
Julius MarmingeandPixel Perfect authored and GitHub committed 2026-09-08 09:27:29 -07:00
1 parent 579266caa8
commit 4664c572a7
26 files changed
+692 -176

No files matched your search

@@ -6,6 +6,13 @@
"--color-card": "#ffffff",
"--color-card-alt": "#f5f5f5",
"--color-card-translucent": "rgba(255, 255, 255, 0.8)",
"--color-thread-canvas": "#f5f5f5",
"--color-thread-selected": "#ffffff",
"--color-thread-selected-foreground": "#262626",
"--color-thread-selected-foreground-muted": "#737373",
"--color-composer-panel": "rgba(245, 245, 245, 0.88)",
"--color-composer-surface": "rgba(255, 255, 255, 0.94)",
"--color-composer-border": "rgba(0, 0, 0, 0.1)",
"--color-foreground": "#262626",
"--color-foreground-secondary": "#525252",
"--color-foreground-muted": "#737373",
@@ -76,6 +83,13 @@
"--color-card": "#171717",
"--color-card-alt": "#1c1c1c",
"--color-card-translucent": "rgba(17, 17, 17, 0.8)",
"--color-thread-canvas": "#1c1c1c",
"--color-thread-selected": "#171717",
"--color-thread-selected-foreground": "#f5f5f5",
"--color-thread-selected-foreground-muted": "#8e8e93",
"--color-composer-panel": "rgba(28, 28, 28, 0.92)",
"--color-composer-surface": "rgba(23, 23, 23, 0.9)",
"--color-composer-border": "rgba(255, 255, 255, 0.08)",
"--color-foreground": "#f5f5f5",
"--color-foreground-secondary": "#a3a3a3",
"--color-foreground-muted": "#8e8e93",
+70
View File
@@ -128,6 +128,13 @@
--color-card: #fdfafd;
--color-card-alt: #faf3fb;
--color-card-translucent: rgba(253, 250, 253, 0.8);
--color-thread-canvas: #faf3fb;
--color-thread-selected: #fdfafd;
--color-thread-selected-foreground: #501854;
--color-thread-selected-foreground-muted: #ac1668;
--color-composer-panel: rgba(250, 243, 251, 0.88);
--color-composer-surface: rgba(253, 250, 253, 0.94);
--color-composer-border: rgba(238, 225, 237, 0.54);
--color-foreground: #501854;
--color-foreground-secondary: #ac1668;
--color-foreground-muted: #8d1255;
@@ -256,6 +263,13 @@
--color-card: #2c2631;
--color-card-alt: #29232d;
--color-card-translucent: rgba(44, 38, 49, 0.8);
--color-thread-canvas: #29232d;
--color-thread-selected: #2c2631;
--color-thread-selected-foreground: #f9f8fb;
--color-thread-selected-foreground-muted: #e7d0dd;
--color-composer-panel: rgba(41, 35, 45, 0.92);
--color-composer-surface: rgba(44, 38, 49, 0.9);
--color-composer-border: rgba(39, 36, 44, 0.46);
--color-foreground: #f9f8fb;
--color-foreground-secondary: #e7d0dd;
--color-foreground-muted: #e7d0dd;
@@ -384,6 +398,13 @@
--color-card: #ecefed;
--color-card-alt: #f3f7f4;
--color-card-translucent: rgba(236, 239, 237, 0.8);
--color-thread-canvas: #f3f7f4;
--color-thread-selected: #ecefed;
--color-thread-selected-foreground: #241523;
--color-thread-selected-foreground-muted: #746c73;
--color-composer-panel: rgba(243, 247, 244, 0.88);
--color-composer-surface: rgba(236, 239, 237, 0.94);
--color-composer-border: rgba(203, 213, 209, 0.54);
--color-foreground: #241523;
--color-foreground-secondary: #746c73;
--color-foreground-muted: #6e696f;
@@ -512,6 +533,13 @@
--color-card: #36413c;
--color-card-alt: #1b2821;
--color-card-translucent: rgba(54, 65, 60, 0.8);
--color-thread-canvas: #1b2821;
--color-thread-selected: #36413c;
--color-thread-selected-foreground: #fffaff;
--color-thread-selected-foreground-muted: #919595;
--color-composer-panel: rgba(27, 40, 33, 0.92);
--color-composer-surface: rgba(54, 65, 60, 0.9);
--color-composer-border: rgba(65, 95, 79, 0.46);
--color-foreground: #fffaff;
--color-foreground-secondary: #919595;
--color-foreground-muted: #9da5a2;
@@ -640,6 +668,13 @@
--color-card: #edeff1;
--color-card-alt: #f5f7f8;
--color-card-translucent: rgba(237, 239, 241, 0.8);
--color-thread-canvas: #f5f7f8;
--color-thread-selected: #edeff1;
--color-thread-selected-foreground: #241523;
--color-thread-selected-foreground-muted: #746c75;
--color-composer-panel: rgba(245, 247, 248, 0.88);
--color-composer-surface: rgba(237, 239, 241, 0.94);
--color-composer-border: rgba(205, 212, 220, 0.54);
--color-foreground: #241523;
--color-foreground-secondary: #746c75;
--color-foreground-muted: #6f6873;
@@ -768,6 +803,13 @@
--color-card: #333b45;
--color-card-alt: #17212b;
--color-card-translucent: rgba(51, 59, 69, 0.8);
--color-thread-canvas: #17212b;
--color-thread-selected: #333b45;
--color-thread-selected-foreground: #fffaff;
--color-thread-selected-foreground-muted: #8d8f97;
--color-composer-panel: rgba(23, 33, 43, 0.92);
--color-composer-surface: rgba(51, 59, 69, 0.9);
--color-composer-border: rgba(64, 85, 103, 0.46);
--color-foreground: #fffaff;
--color-foreground-secondary: #8d8f97;
--color-foreground-muted: #969ca6;
@@ -896,6 +938,13 @@
--color-card: #f1efee;
--color-card-alt: #f9f7f5;
--color-card-translucent: rgba(241, 239, 238, 0.8);
--color-thread-canvas: #f9f7f5;
--color-thread-selected: #f1efee;
--color-thread-selected-foreground: #241523;
--color-thread-selected-foreground-muted: #766c74;
--color-composer-panel: rgba(249, 247, 245, 0.88);
--color-composer-surface: rgba(241, 239, 238, 0.94);
--color-composer-border: rgba(221, 210, 206, 0.54);
--color-foreground: #241523;
--color-foreground-secondary: #766c74;
--color-foreground-muted: #74686f;
@@ -1024,6 +1073,13 @@
--color-card: #433835;
--color-card-alt: #291e1a;
--color-card-translucent: rgba(67, 56, 53, 0.8);
--color-thread-canvas: #291e1a;
--color-thread-selected: #433835;
--color-thread-selected-foreground: #fffaff;
--color-thread-selected-foreground-muted: #968e8f;
--color-composer-panel: rgba(41, 30, 26, 0.92);
--color-composer-surface: rgba(67, 56, 53, 0.9);
--color-composer-border: rgba(102, 76, 63, 0.46);
--color-foreground: #fffaff;
--color-foreground-secondary: #968e8f;
--color-foreground-muted: #a59996;
@@ -1152,6 +1208,13 @@
--color-card: #f0eff2;
--color-card-alt: #f8f7f9;
--color-card-translucent: rgba(240, 239, 242, 0.8);
--color-thread-canvas: #f8f7f9;
--color-thread-selected: #f0eff2;
--color-thread-selected-foreground: #241523;
--color-thread-selected-foreground-muted: #766c76;
--color-composer-panel: rgba(248, 247, 249, 0.88);
--color-composer-surface: rgba(240, 239, 242, 0.94);
--color-composer-border: rgba(214, 209, 222, 0.54);
--color-foreground: #241523;
--color-foreground-secondary: #766c76;
--color-foreground-muted: #726874;
@@ -1280,6 +1343,13 @@
--color-card: #383443;
--color-card-alt: #1d1929;
--color-card-translucent: rgba(56, 52, 67, 0.8);
--color-thread-canvas: #1d1929;
--color-thread-selected: #383443;
--color-thread-selected-foreground: #fffaff;
--color-thread-selected-foreground-muted: #8e8a95;
--color-composer-panel: rgba(29, 25, 41, 0.92);
--color-composer-surface: rgba(56, 52, 67, 0.9);
--color-composer-border: rgba(77, 67, 102, 0.46);
--color-foreground: #fffaff;
--color-foreground-secondary: #8e8a95;
--color-foreground-muted: #9690a1;
+14
View File
@@ -19,6 +19,13 @@
--color-card: #ffffff;
--color-card-alt: #f5f5f5;
--color-card-translucent: rgba(255, 255, 255, 0.8);
--color-thread-canvas: #f5f5f5;
--color-thread-selected: #ffffff;
--color-thread-selected-foreground: #262626;
--color-thread-selected-foreground-muted: #737373;
--color-composer-panel: rgba(245, 245, 245, 0.88);
--color-composer-surface: rgba(255, 255, 255, 0.94);
--color-composer-border: rgba(0, 0, 0, 0.1);
/* Text */
--color-foreground: #262626;
@@ -123,6 +130,13 @@
--color-card: #171717;
--color-card-alt: #1c1c1c;
--color-card-translucent: rgba(17, 17, 17, 0.8);
--color-thread-canvas: #1c1c1c;
--color-thread-selected: #171717;
--color-thread-selected-foreground: #f5f5f5;
--color-thread-selected-foreground-muted: #8e8e93;
--color-composer-panel: rgba(28, 28, 28, 0.92);
--color-composer-surface: rgba(23, 23, 23, 0.9);
--color-composer-border: rgba(255, 255, 255, 0.08);
/* Text */
--color-foreground: #f5f5f5;
@@ -48,6 +48,7 @@ export function AndroidScreenHeader(props: {
readonly trailing?: ReactNode;
readonly onBack?: () => void;
readonly embedded?: boolean;
readonly hideBottomBorder?: boolean;
}) {
const insets = useSafeAreaInsets();
@@ -56,6 +57,7 @@ export function AndroidScreenHeader(props: {
className="border-b border-header-border bg-header px-3 pb-2.5"
style={{
paddingTop: props.embedded ? 8 : Math.max(insets.top, 12),
borderBottomWidth: props.hideBottomBorder ? 0 : undefined,
}}
>
<View className="min-h-12 flex-row items-center gap-2">
+47 -1
View File
@@ -1,6 +1,52 @@
import { Platform, Switch, type SwitchProps } from "react-native";
import { Platform, Pressable, Switch, View, type SwitchProps } from "react-native";
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
import { SymbolView } from "./AppSymbol";
export function ThemedSwitch(props: SwitchProps) {
const { materialYouStyleLayoutActive } = useAppearancePreferences();
if (materialYouStyleLayoutActive) {
return (
<Pressable
accessibilityHint={props.accessibilityHint}
accessibilityLabel={props.accessibilityLabel}
accessibilityRole="switch"
accessibilityState={{ checked: Boolean(props.value), disabled: props.disabled }}
disabled={props.disabled}
hitSlop={8}
onPress={() => props.onValueChange?.(!props.value)}
style={props.style}
testID={props.testID}
className={props.disabled ? "opacity-40" : "active:opacity-70"}
>
<View
className={
props.value
? "h-8 w-[52px] items-end justify-center rounded-full border-2 border-switch-active-track bg-switch-active-track px-0.5"
: "h-8 w-[52px] items-start justify-center rounded-full border-2 border-switch-inactive-thumb bg-switch-inactive-track px-0.5"
}
>
<View
className={
props.value
? "size-6 items-center justify-center rounded-full bg-switch-active-thumb"
: "size-6 items-center justify-center rounded-full bg-switch-inactive-thumb"
}
>
<SymbolView
name={props.value ? "checkmark" : "xmark"}
size={13}
tintColorClassName={
props.value ? "accent-switch-active-track" : "accent-switch-inactive-track"
}
type="monochrome"
/>
</View>
</View>
</Pressable>
);
}
return (
<Switch
{...props}
@@ -306,8 +306,10 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
useAdaptiveWorkspaceLayout();
const [searchQuery, setSearchQuery] = useState("");
const isAndroid = Platform.OS === "android";
const { themeAppearance: highlightTheme } = useAppearancePreferences();
const { themeAppearance: highlightTheme, materialYouStyleLayoutActive } =
useAppearancePreferences();
const theme = useUniwindTheme();
const screenColor = theme["--color-screen"];
const sheetSurfaceColor = theme["--color-sheet-solid"];
const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace(
props.route.params,
@@ -423,14 +425,16 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
const usesCompactMailToolbar =
Platform.OS === "ios" && !layout.usesSplitView && NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED;
return (
const content = (
<>
{/* Static header config (glass preset and title) lives in Stack.tsx. The
live sheet color stays dynamic here so the FlatList can remain the
direct scene child for native scroll-edge sampling. */}
<NativeStackScreenOptions
options={{
contentStyle: { backgroundColor: sheetSurfaceColor },
contentStyle: {
backgroundColor: materialYouStyleLayoutActive ? screenColor : sheetSurfaceColor,
},
headerShown: !isAndroid,
unstable_headerSubtitle:
Platform.OS === "ios" && projectName.length > 0 ? projectName : undefined,
@@ -466,6 +470,7 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
title="Files"
subtitle={projectName}
onBack={handleReturnToThread}
hideBottomBorder={materialYouStyleLayoutActive}
actions={[
{
accessibilityLabel: "Refresh files",
@@ -474,7 +479,13 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
},
]}
/>
<View className="flex-row items-center gap-2 border-b border-border px-3 py-2">
<View
className={
materialYouStyleLayoutActive
? "mx-4 my-2 min-h-12 flex-row items-center gap-2 rounded-full border border-input-border bg-input px-3.5"
: "flex-row items-center gap-2 border-b border-border px-3 py-2"
}
>
<SymbolView
name="magnifyingglass"
size={17}
@@ -485,7 +496,11 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
accessibilityLabel="Search files"
autoCapitalize="none"
autoCorrect={false}
className="min-h-10 flex-1 rounded-xl py-2 text-sm"
className={
materialYouStyleLayoutActive
? "min-h-10 flex-1 py-2 text-sm text-foreground"
: "min-h-10 flex-1 rounded-xl py-2 text-sm"
}
placeholder="Search files"
value={searchQuery}
onChangeText={setSearchQuery}
@@ -528,6 +543,14 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
<FilesToolbarBottomFade />
</>
);
return materialYouStyleLayoutActive ? (
<View className="flex-1" style={{ backgroundColor: screenColor }}>
{content}
</View>
) : (
content
);
}
export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
+14 -2
View File
@@ -1,3 +1,4 @@
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import type { EnvironmentId, SidebarThreadSortOrder } from "@t3tools/contracts";
import type { MenuAction } from "@react-native-menu/menu";
import Constants from "expo-constants";
@@ -66,6 +67,7 @@ function checkedMenuState(checked: boolean) {
}
function AndroidHomeHeader(props: HomeHeaderProps) {
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const insets = useSafeAreaInsets();
const stageLabel = resolveMobileStageLabel(Constants.expoConfig?.extra?.appVariant);
// Thread List v2 lays the list out in fixed creation order, so the
@@ -199,7 +201,11 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
<>
<NativeStackScreenOptions options={{ headerShown: false }} />
<View
className="border-b border-header-border bg-header pb-3"
className={
materialYouStyleLayoutActive
? "bg-header pb-3"
: "border-b border-header-border bg-header pb-3"
}
style={{
paddingHorizontal: HOME_HORIZONTAL_INSET,
paddingTop: Math.max(insets.top, 12),
@@ -269,7 +275,13 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
</Pressable>
</View>
<View className="min-h-12 flex-row items-center gap-2.5 rounded-2xl border border-input-border bg-input px-3.5">
<View
className={
materialYouStyleLayoutActive
? "min-h-12 flex-row items-center gap-2.5 rounded-full border border-input-border bg-input px-3.5"
: "min-h-12 flex-row items-center gap-2.5 rounded-2xl border border-input-border bg-input px-3.5"
}
>
<SymbolView
name="magnifyingglass"
size={17}
+127 -103
View File
@@ -26,6 +26,7 @@ import { ActivityIndicator, FlatList, Platform, Pressable, View } from "react-na
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { cn } from "../../lib/cn";
import { AppText as Text } from "../../components/AppText";
import { EmptyState } from "../../components/EmptyState";
import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
@@ -34,6 +35,7 @@ import { scopedProjectKey } from "../../lib/scopedEntities";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
import { useThreadSearch } from "../../state/queries";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
import { usePendingThreadOrder } from "../../state/thread-order";
import { environmentServerConfigsAtom } from "../../state/server";
@@ -210,6 +212,7 @@ function HomeTopContentSpacer() {
/* ─── Main screen ────────────────────────────────────────────────────── */
export function HomeScreen(props: HomeScreenProps) {
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const [groupDisplayStates, setGroupDisplayStates] = useState<
ReadonlyMap<string, HomeGroupDisplayState>
>(() => new Map());
@@ -1081,26 +1084,31 @@ export function HomeScreen(props: HomeScreenProps) {
if (!hasAnyThreads) {
return (
<View
className="flex-1 items-center justify-center bg-screen px-8"
style={{
paddingBottom: Math.max(insets.bottom, 24) + iosBottomToolbarClearance,
paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
}}
>
<View className="w-full max-w-[430px]">
<EmptyState
title={emptyState.title}
detail={emptyState.detail}
actionLabel={!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined}
onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
variant="plain"
/>
{emptyState.loading ? (
<View className="mt-4 items-center">
<ActivityIndicator colorClassName={"accent-icon-muted"} />
</View>
) : null}
<View className={materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View
className={cn(
"flex-1 items-center justify-center bg-screen px-8",
materialYouStyleLayoutActive && "overflow-hidden rounded-t-[28px]",
)}
style={{
paddingBottom: Math.max(insets.bottom, 24) + iosBottomToolbarClearance,
paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
}}
>
<View className="w-full max-w-[430px]">
<EmptyState
title={emptyState.title}
detail={emptyState.detail}
actionLabel={!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined}
onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
variant="plain"
/>
{emptyState.loading ? (
<View className="mt-4 items-center">
<ActivityIndicator colorClassName={"accent-icon-muted"} />
</View>
) : null}
</View>
</View>
</View>
);
@@ -1145,100 +1153,116 @@ export function HomeScreen(props: HomeScreenProps) {
if (threadListV2Enabled) {
return (
<View className="flex-1 bg-screen">
<SwipeableScrollGateProvider enabled={swipeEnabled}>
<FlatList
data={threadListV2Items}
renderItem={renderV2Item}
keyExtractor={v2KeyExtractor}
extraData={v2ExtraData}
ListHeaderComponent={v2ListHeader}
ListFooterComponent={
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
<Pressable
accessibilityRole="button"
accessibilityLabel={`Show ${Math.min(threadListV2Layout.hiddenSettledCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
onPress={showMoreSettled}
className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
>
<Text className="text-xs font-t3-medium text-foreground-muted">
Show more ({threadListV2Layout.hiddenSettledCount} settled hidden)
</Text>
</Pressable>
) : null
}
ListEmptyComponent={v2ListEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
showsVerticalScrollIndicator={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
{...scrollGateHandlers}
scrollEventThrottle={16}
contentContainerStyle={{
paddingBottom:
Platform.OS === "ios"
? Math.max(insets.bottom, 24) + 96 + iosBottomToolbarClearance
: Math.max(insets.bottom, 16) + 88,
}}
/>
</SwipeableScrollGateProvider>
<View className={materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View
className={
materialYouStyleLayoutActive
? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
: "flex-1 bg-screen"
}
>
<SwipeableScrollGateProvider enabled={swipeEnabled}>
<FlatList
data={threadListV2Items}
renderItem={renderV2Item}
keyExtractor={v2KeyExtractor}
extraData={v2ExtraData}
ListHeaderComponent={v2ListHeader}
ListFooterComponent={
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
<Pressable
accessibilityRole="button"
accessibilityLabel={`Show ${Math.min(threadListV2Layout.hiddenSettledCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
onPress={showMoreSettled}
className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
>
<Text className="text-xs font-t3-medium text-foreground-muted">
Show more ({threadListV2Layout.hiddenSettledCount} settled hidden)
</Text>
</Pressable>
) : null
}
ListEmptyComponent={v2ListEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
showsVerticalScrollIndicator={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
{...scrollGateHandlers}
scrollEventThrottle={16}
contentContainerStyle={{
paddingBottom:
Platform.OS === "ios"
? Math.max(insets.bottom, 24) + 96 + iosBottomToolbarClearance
: Math.max(insets.bottom, 16) + 88,
}}
/>
</SwipeableScrollGateProvider>
</View>
</View>
);
}
return (
<View className="flex-1 bg-screen">
{/* Sticky headers are deliberately not wired up: LegendList's JS sticky
<View className={materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View
className={
materialYouStyleLayoutActive
? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
: "flex-1 bg-screen"
}
>
{/* Sticky headers are deliberately not wired up: LegendList's JS sticky
implementation mispositions pinned headers at mount under iOS
automatic content insets (headers render one nav-inset too low until
the first scroll event) and blanks non-pinned headers after
collapse/expand data changes. The flattened layout still exposes
`stickyHeaderIndices` if this gets revisited. */}
<SwipeableScrollGateProvider enabled={swipeEnabled}>
<LegendList
ref={listRef}
data={listLayout.items}
renderItem={renderItem}
keyExtractor={keyExtractor}
itemsAreEqual={homeListItemsAreEqual}
drawDistance={500}
estimatedItemSize={ESTIMATED_THREAD_ROW_HEIGHT}
extraData={extraData}
ListHeaderComponent={listHeader}
ListEmptyComponent={listEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
contentInsetAdjustmentBehavior={NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"}
showsVerticalScrollIndicator={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
{...scrollGateHandlers}
recycleItems
scrollEventThrottle={16}
contentContainerStyle={{
// Android reserves room for the floating new-task FAB
// (56 button + 16 gap + bottom inset). Pre-glass iOS shows a
// standard 44pt bottom toolbar that overlays the list and is not
// reflected in insets while contentInsetAdjustmentBehavior is
// "never".
paddingBottom:
<SwipeableScrollGateProvider enabled={swipeEnabled}>
<LegendList
ref={listRef}
data={listLayout.items}
renderItem={renderItem}
keyExtractor={keyExtractor}
itemsAreEqual={homeListItemsAreEqual}
drawDistance={500}
estimatedItemSize={ESTIMATED_THREAD_ROW_HEIGHT}
extraData={extraData}
ListHeaderComponent={listHeader}
ListEmptyComponent={listEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
contentInsetAdjustmentBehavior={NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"}
showsVerticalScrollIndicator={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
{...scrollGateHandlers}
recycleItems
scrollEventThrottle={16}
contentContainerStyle={{
// Android reserves room for the floating new-task FAB
// (56 button + 16 gap + bottom inset). Pre-glass iOS shows a
// standard 44pt bottom toolbar that overlays the list and is not
// reflected in insets while contentInsetAdjustmentBehavior is
// "never".
paddingBottom:
Platform.OS === "ios"
? Math.max(insets.bottom, 24) + 24 + iosBottomToolbarClearance
: Math.max(insets.bottom, 16) + 88,
}}
scrollIndicatorInsets={
Platform.OS === "ios"
? Math.max(insets.bottom, 24) + 24 + iosBottomToolbarClearance
: Math.max(insets.bottom, 16) + 88,
}}
scrollIndicatorInsets={
Platform.OS === "ios"
? {
bottom: Math.max(insets.bottom, 16) + 24 + iosBottomToolbarClearance,
top: 0,
}
: undefined
}
/>
</SwipeableScrollGateProvider>
? {
bottom: Math.max(insets.bottom, 16) + 24 + iosBottomToolbarClearance,
top: 0,
}
: undefined
}
/>
</SwipeableScrollGateProvider>
</View>
</View>
);
}
@@ -47,6 +47,7 @@ import {
} from "../keyboard/hardwareKeyboardCommands";
import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
import { HomeListOptionsProvider } from "../home/home-list-options";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
import { WorkspaceInspectorPane } from "./workspace-inspector-pane";
@@ -219,6 +220,7 @@ function AdaptiveWorkspaceLayoutContent(
},
) {
const projectGroupingMode = props.projectGroupingMode;
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const { width, height } = useWindowDimensions();
const pathname = props.pathname;
const navigation = useNavigation();
@@ -567,7 +569,14 @@ function AdaptiveWorkspaceLayoutContent(
</View>
</Animated.View>
) : null}
<View className="flex-1 overflow-hidden bg-screen" collapsable={false}>
<View
className={
materialYouStyleLayoutActive
? "flex-1 overflow-hidden bg-header"
: "flex-1 overflow-hidden bg-screen"
}
collapsable={false}
>
<View
collapsable={false}
style={
@@ -1,11 +1,19 @@
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { SymbolView } from "../../components/AppSymbol";
import { Pressable, View } from "react-native";
import { AppText as Text } from "../../components/AppText";
export function WorkspaceEmptyDetail(props: { readonly onStartNewTask?: () => void }) {
const { materialYouStyleLayoutActive } = useAppearancePreferences();
return (
<View className="flex-1 items-center justify-center bg-screen px-10">
<View
className={
materialYouStyleLayoutActive
? "flex-1 items-center justify-center px-10"
: "flex-1 items-center justify-center bg-screen px-10"
}
>
<View className="max-w-[360px] items-center gap-3">
<SymbolView
name="sidebar.left"
@@ -10,7 +10,7 @@ import {
useRef,
type ReactNode,
} from "react";
import { AppState, Appearance, useColorScheme } from "react-native";
import { AppState, Appearance, Platform, useColorScheme } from "react-native";
import { useAtomSet, useAtomValue } from "@effect/atom-react";
import { AsyncResult } from "effect/unstable/reactivity";
@@ -51,6 +51,9 @@ interface AppearancePreferencesContextValue {
readonly themeIds: MobileThemeIds;
readonly themeMode: MobileThemeMode;
readonly themeAppearance: MobileThemeAppearance;
readonly materialYouStyleLayoutEnabled: boolean;
readonly materialYouStyleLayoutActive: boolean;
readonly setMaterialYouStyleLayoutEnabled: (value: boolean) => void;
readonly systemColorsAvailable: boolean;
readonly systemColorsActive: boolean;
readonly themeVariables: MobileThemeVariables;
@@ -94,6 +97,8 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
[resolvedThemeIds.dark, resolvedThemeIds.light],
);
const themeId = themeIds[themeAppearance];
const materialYouStyleLayoutEnabled = storedPreferences?.materialYouStyleLayoutEnabled ?? false;
const materialYouStyleLayoutActive = Platform.OS === "android" && materialYouStyleLayoutEnabled;
const systemColorsActive = themeId === "material-you" && isSystemColorsAvailable;
const [systemColorPalettes, setSystemColorPalettes] = useState(readSystemColorPalettes);
useEffect(() => {
@@ -242,6 +247,13 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
[runtimeState, syncThemeRuntime, updateThemePreferences],
);
const setMaterialYouStyleLayoutEnabled = useCallback(
(value: boolean) => {
updatePreferences({ materialYouStyleLayoutEnabled: value });
},
[updatePreferences],
);
const setBaseFontSize = useCallback(
(value: number) => {
const current = appliedRuntimeStateRef.current ?? runtimeState;
@@ -281,6 +293,9 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
themeAppearance,
systemColorsAvailable: isSystemColorsAvailable,
systemColorsActive,
materialYouStyleLayoutEnabled,
materialYouStyleLayoutActive,
setMaterialYouStyleLayoutEnabled,
themeVariables,
themeVariablesByAppearance,
systemColorPalettes,
@@ -300,6 +315,9 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
themeMode,
themeAppearance,
systemColorsActive,
materialYouStyleLayoutEnabled,
materialYouStyleLayoutActive,
setMaterialYouStyleLayoutEnabled,
themeVariables,
themeVariablesByAppearance,
systemColorPalettes,
@@ -1,5 +1,5 @@
import { memo, useId } from "react";
import { Pressable, View } from "react-native";
import { Platform, Pressable, View } from "react-native";
import Svg, { Circle, Defs, RadialGradient, Stop } from "react-native-svg";
import { ScopedTheme, ScopedVariables } from "uniwind";
@@ -19,6 +19,9 @@ import { getMobileUniwindThemeName } from "../../../../lib/mobileThemeRuntime";
import { cn } from "../../../../lib/cn";
import { useAppearancePreferences } from "../AppearancePreferencesProvider";
import { SettingsSection } from "../../components/SettingsSection";
import { SettingsSwitchRow } from "../../components/SettingsSwitchRow";
const APPEARANCE_MODES: ReadonlyArray<{
readonly id: MobileThemeMode;
readonly label: string;
@@ -290,11 +293,25 @@ export function ThemeAppearanceSection() {
setThemeMode,
themeIds,
themeMode,
materialYouStyleLayoutEnabled,
setMaterialYouStyleLayoutEnabled,
systemColorsAvailable,
} = useAppearancePreferences();
return (
<View className="gap-6">
{Platform.OS === "android" ? (
<SettingsSection card title="Android">
<SettingsSwitchRow
disabled={!isReady}
icon="square.grid.2x2"
label="Material You Layout"
onValueChange={setMaterialYouStyleLayoutEnabled}
subtitle="Use Material You surfaces, shapes, and component styling."
value={materialYouStyleLayoutEnabled}
/>
</SettingsSection>
) : null}
<View className="gap-2">
<SectionLabel>Color scheme</SectionLabel>
<View accessibilityRole="radiogroup" className="flex-row gap-2">
@@ -1,3 +1,4 @@
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { useAtomValue } from "@effect/atom-react";
import type {
EnvironmentId,
@@ -170,6 +171,7 @@ export function ComposerSurface(props: {
/** Morphs between the compact and expanded composer layouts. */
readonly animateLayout?: boolean;
}) {
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const targetBorderRadius =
typeof props.style.borderRadius === "number" ? props.style.borderRadius : 0;
const animatedBorderRadius = useSharedValue(targetBorderRadius);
@@ -191,7 +193,11 @@ export function ComposerSurface(props: {
// clip leaves the glass and content at their final height on the first frame.
return (
<Animated.View
className="shadow-[0_6px_28px] shadow-adaptive-black-a15-a35"
className={
materialYouStyleLayoutActive
? undefined
: "shadow-[0_6px_28px] shadow-adaptive-black-a15-a35"
}
layout={layoutTransition}
style={[
animatedShapeStyle,
@@ -204,7 +210,11 @@ export function ComposerSurface(props: {
>
<AnimatedGlassSurface
chrome="none"
fallbackClassName="border border-border bg-card-translucent"
fallbackClassName={
materialYouStyleLayoutActive
? "border border-composer-border bg-composer-surface"
: "border border-border bg-card-translucent"
}
glassEffectStyle="regular"
// The composer is a passive material containing interactive controls.
// Keep native glass out of the interactive content's layout path.
@@ -227,6 +237,9 @@ export function ComposerSurface(props: {
}
export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerProps) {
const { materialYouStyleLayoutActive, themeVariables: materialTheme } =
useAppearancePreferences();
const composerPanel = materialTheme["--color-composer-panel"];
const navigation = useNavigation();
const foregroundColor = useUniwindTheme()["--color-foreground"];
const bodyText = useScaledTextRole("body");
@@ -543,13 +556,18 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
style={{
paddingTop: isExpanded ? 8 : 6,
paddingBottom: (props.bottomInset ?? 0) + (isExpanded ? 8 : 6),
backgroundColor: materialYouStyleLayoutActive ? composerPanel : undefined,
}}
>
{/* The backdrop gradient lives on a plain View: Reanimated's Animated.View
silently drops experimental_backgroundImage on Android, which left this
strip fully transparent and the feed text legible through the composer. */}
<View
className="absolute inset-0 bg-linear-to-b from-screen/0 via-screen/60 to-screen/90"
className={
materialYouStyleLayoutActive
? "hidden"
: "absolute inset-0 bg-linear-to-b from-screen/0 via-screen/60 to-screen/90"
}
pointerEvents="none"
/>
<Animated.View
@@ -1,3 +1,4 @@
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { createThreadMovePlanner } from "./threadOrder";
import type {
EnvironmentProject,
@@ -145,6 +146,11 @@ function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
function ThreadNavigationSidebarPane(
props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
) {
const { materialYouStyleLayoutActive, themeVariables: materialTheme } =
useAppearancePreferences();
const screenColor = materialTheme["--color-screen"];
const mutedColor = materialTheme["--color-foreground-muted"];
const insets = useSafeAreaInsets();
const projects = useProjects();
const threads = useThreadShells();
@@ -916,7 +922,7 @@ function ThreadNavigationSidebarPane(
}),
)}
searchQuery={props.searchQuery}
pane="sidebar"
pane={materialYouStyleLayoutActive ? "screen" : "sidebar"}
selected={
scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
}
@@ -956,7 +962,7 @@ function ThreadNavigationSidebarPane(
disabled={!shelfPreferencesLoaded}
expanded={item.expanded}
onToggle={toggleSnoozedShelf}
pane="sidebar"
pane={materialYouStyleLayoutActive ? "screen" : "sidebar"}
/>
);
case "v2-settled-shelf":
@@ -966,7 +972,7 @@ function ThreadNavigationSidebarPane(
disabled={!shelfPreferencesLoaded}
expanded={item.expanded}
onToggle={toggleSettledShelf}
pane="sidebar"
pane={materialYouStyleLayoutActive ? "screen" : "sidebar"}
/>
);
case "v2-show-more":
@@ -986,7 +992,7 @@ function ThreadNavigationSidebarPane(
case "header":
return (
<ThreadListGroupHeader
variant="sidebar"
variant={materialYouStyleLayoutActive ? "compact" : "sidebar"}
collapsed={item.collapsed}
isFirst={item.isFirst}
groupKey={item.group.key}
@@ -1004,7 +1010,7 @@ function ThreadNavigationSidebarPane(
case "pending-task":
return (
<PendingTaskListRow
variant="sidebar"
variant={materialYouStyleLayoutActive ? "compact" : "sidebar"}
pendingTask={item.pendingTask}
environmentLabel={
savedConnectionsById[item.pendingTask.environmentId]?.environmentLabel ?? null
@@ -1053,7 +1059,7 @@ function ThreadNavigationSidebarPane(
case "show-more":
return (
<ThreadListShowMoreRow
variant="sidebar"
variant={materialYouStyleLayoutActive ? "compact" : "sidebar"}
hiddenCount={item.hiddenCount}
canShowLess={item.canShowLess}
groupKey={item.groupKey}
@@ -1063,6 +1069,7 @@ function ThreadNavigationSidebarPane(
}
},
[
materialYouStyleLayoutActive,
archiveThread,
activeReorderEnvironmentIds,
threadMovePlanners,
@@ -1219,6 +1226,7 @@ function ThreadNavigationSidebarPane(
}
contentContainerStyle={[
styles.threadListContent,
materialYouStyleLayoutActive ? { paddingHorizontal: 0 } : null,
{
paddingBottom: Math.max(insets.bottom, 16) + 16,
paddingTop: 6,
@@ -1246,7 +1254,21 @@ function ThreadNavigationSidebarPane(
className="flex-1 border-r border-border bg-drawer"
style={{ width: props.width }}
>
<View className="flex-1" style={{ paddingBottom: insets.bottom }}>
<View
className="flex-1"
style={
materialYouStyleLayoutActive
? {
marginTop: stickyHeaderHeight,
paddingBottom: insets.bottom,
backgroundColor: screenColor,
borderTopLeftRadius: 28,
borderTopRightRadius: 28,
overflow: "hidden",
}
: { paddingBottom: insets.bottom }
}
>
<SwipeableScrollGateProvider enabled={swipeEnabled}>
<GestureDetector gesture={sidebarScrollGesture}>
<LegendList
@@ -1260,12 +1282,13 @@ function ThreadNavigationSidebarPane(
renderItem={renderListItem}
contentContainerStyle={[
styles.threadListContent,
materialYouStyleLayoutActive ? { paddingHorizontal: 0 } : null,
{
paddingBottom:
Platform.OS === "android"
? Math.max(insets.bottom, 16) + 88 - insets.bottom
: 16 + insets.bottom,
paddingTop: topListInset,
paddingTop: materialYouStyleLayoutActive ? 6 : topListInset,
},
]}
keyboardDismissMode="on-drag"
@@ -1310,7 +1333,13 @@ function ThreadNavigationSidebarPane(
</View>
</View>
<View className="mx-4 mt-[9px] h-[38px] flex-row items-center gap-1.5 rounded-xl bg-sidebar-search pr-2.5 pl-[11px]">
<View
className={
materialYouStyleLayoutActive
? "mx-4 mt-[9px] min-h-12 flex-row items-center gap-2.5 rounded-full border border-input-border bg-input px-3.5"
: "mx-4 mt-[9px] h-[38px] flex-row items-center gap-1.5 rounded-xl bg-sidebar-search pr-2.5 pl-[11px]"
}
>
<SymbolView
name="magnifyingglass"
size={15}
@@ -1322,14 +1351,32 @@ function ThreadNavigationSidebarPane(
accessibilityLabel="Search threads"
autoCapitalize="none"
autoCorrect={false}
clearButtonMode="while-editing"
clearButtonMode={materialYouStyleLayoutActive ? "never" : "while-editing"}
onChangeText={props.onSearchQueryChange}
placeholder="Search"
placeholderTextColorClassName={"accent-placeholder"}
returnKeyType="search"
className="h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
className={
materialYouStyleLayoutActive
? "flex-1 px-0 py-2.5 font-sans text-base text-foreground"
: "h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
}
value={props.searchQuery}
/>
{materialYouStyleLayoutActive && props.searchQuery.length > 0 ? (
<Pressable
accessibilityLabel="Clear search"
hitSlop={10}
onPress={() => props.onSearchQueryChange("")}
>
<SymbolView
name="xmark.circle.fill"
size={17}
tintColor={mutedColor}
type="monochrome"
/>
</Pressable>
) : null}
</View>
</View>
</View>
@@ -76,6 +76,7 @@ import { useSelectedThreadWorktree } from "../../state/use-selected-thread-workt
import { useThreadComposerState } from "../../state/use-thread-composer-state";
import { threadEnvironment } from "../../state/threads";
import { projectThreadContentPresentation } from "./threadContentPresentation";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import {
useAdaptiveWorkspaceLayout,
useAdaptiveWorkspacePaneRole,
@@ -193,6 +194,8 @@ function ThreadRouteContent(
readonly selectedThreadDetailState: ReturnType<typeof useSelectedThreadDetailState>;
},
) {
const { materialYouStyleLayoutActive, themeVariables } = useAppearancePreferences();
const headerColor = themeVariables["--color-header"];
const {
fileInspector,
layout,
@@ -839,7 +842,19 @@ function ThreadRouteContent(
<GitActionProgressOverlay progress={gitActionProgress} onDismiss={dismissGitActionResult} />
<View className="flex-1 bg-screen">
<View
className={materialYouStyleLayoutActive ? "flex-1 bg-thread-canvas" : "flex-1 bg-screen"}
style={
materialYouStyleLayoutActive
? {
borderTopLeftRadius: 28,
borderTopRightRadius: 28,
marginRight: layout.usesSplitView ? 8 : 0,
overflow: "hidden",
}
: undefined
}
>
<ThreadDetailScreen
selectedThread={selectedThreadWithDraftSettings ?? selectedThread}
contentPresentation={contentPresentation}
@@ -931,6 +946,10 @@ function ThreadRouteContent(
? () => (layout.usesSplitView ? threadCenterHeaderItems : compactRightHeaderItems)
: undefined,
unstable_headerSubtitle: usesNativeHeaderGlass ? headerSubtitle : undefined,
contentStyle:
Platform.OS === "android" && materialYouStyleLayoutActive
? { backgroundColor: headerColor }
: undefined,
}}
/>
@@ -940,6 +959,7 @@ function ThreadRouteContent(
subtitle={headerSubtitle}
onBack={layout.usesSplitView ? undefined : () => navigation.goBack()}
actions={androidHeaderActions}
hideBottomBorder={materialYouStyleLayoutActive}
/>
) : null}
@@ -52,6 +52,7 @@ import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { serverEnvironment } from "../../state/server";
import { useAtomCommand } from "../../state/use-atom-command";
import { useNewTaskFlow } from "./new-task-flow-provider";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import {
createProviderCatalogRefreshRunner,
providerCatalogRefreshError,
@@ -104,6 +105,8 @@ function ModelRow(props: {
readonly isFirst: boolean;
readonly isLast: boolean;
}) {
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const selectedMaterialRow = materialYouStyleLayoutActive && props.selected;
return (
<Pressable
accessibilityLabel={[props.option.label, props.option.subtitle].filter(Boolean).join(", ")}
@@ -116,6 +119,7 @@ function ModelRow(props: {
onPress={props.onPress}
className={cn(
"mx-4 min-h-11 flex-row items-center gap-2 bg-card px-4 py-2 active:bg-subtle",
selectedMaterialRow && "bg-thread-selected",
props.isFirst && "rounded-t-2xl",
props.isLast ? "rounded-b-2xl" : "border-b border-border-subtle",
)}
@@ -463,9 +463,10 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
>["simultaneousWithExternalGesture"];
}) {
const { width: windowWidth } = useWindowDimensions();
const { themeAppearance: colorScheme } = useAppearancePreferences();
const { themeAppearance: colorScheme, materialYouStyleLayoutActive } = useAppearancePreferences();
const compact = props.variant === "compact";
const selected = props.selected === true;
const visuallySelected = selected && (!compact || materialYouStyleLayoutActive);
// Recycling-safe: resets when the list container is reused for another
// thread, so a hover highlight can't leak across rows.
const [hovered, setHovered] = useRecyclingState(false);
@@ -475,6 +476,8 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
const drawerColor = theme["--color-drawer"];
const pressedBackgroundColor = theme["--color-subtle"];
const selectedBackgroundColor = theme["--color-user-bubble"];
const materialSelectedBackgroundColor = theme["--color-thread-selected"];
const materialSelectedForegroundColor = theme["--color-thread-selected-foreground"];
const selectedForegroundColor = theme["--color-user-bubble-foreground"];
const {
@@ -502,15 +505,25 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
);
const backgroundColor = compact ? screenColor : drawerColor;
const effectivePressedBackground = selected
? themeColorWithAlpha(String(selectedForegroundColor), 0.16)
const effectiveSelectedBackground = materialYouStyleLayoutActive
? materialSelectedBackgroundColor
: selectedBackgroundColor;
const effectiveSelectedForeground = materialYouStyleLayoutActive
? materialSelectedForegroundColor
: selectedForegroundColor;
const effectivePressedBackground = visuallySelected
? themeColorWithAlpha(String(effectiveSelectedForeground), 0.16)
: pressedBackgroundColor;
const effectiveStatus =
selected && status
visuallySelected && status
? {
...status,
pillClassName: "bg-user-bubble-foreground/20",
textClassName: "text-user-bubble-foreground",
pillClassName: materialYouStyleLayoutActive
? "bg-thread-selected-foreground/20"
: "bg-user-bubble-foreground/20",
textClassName: materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground",
}
: status;
@@ -581,7 +594,9 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
compact
? "accent-icon-subtle"
: selected
? "accent-user-bubble-foreground-muted"
? materialYouStyleLayoutActive
? "accent-thread-selected-foreground-muted"
: "accent-user-bubble-foreground-muted"
: "accent-foreground-muted"
}
/>
@@ -589,9 +604,12 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<Text
className={cn(
"shrink",
compact ? "text-sm text-foreground-muted" : "text-xs",
!compact &&
(selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted"),
compact ? "text-sm" : "text-xs",
visuallySelected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
)}
numberOfLines={1}
>
@@ -604,12 +622,18 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<PullRequestIcon
size={compact ? 13 : 11}
color={
selected ? String(selectedForegroundColor) : pullRequestTintColor(pr, colorScheme)
visuallySelected
? String(effectiveSelectedForeground)
: pullRequestTintColor(pr, colorScheme)
}
/>
<Text
className={`${compact ? "text-sm" : "text-xs"} font-t3-medium ${
selected ? "text-user-bubble-foreground" : pr.textClassName
visuallySelected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: pr.textClassName
}`}
>
{pr.label}
@@ -626,6 +650,14 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
accessibilityLabel={threadAccessibilityLabel}
accessibilityRole="button"
className="bg-screen active:opacity-70"
style={
materialYouStyleLayoutActive
? {
backgroundColor: visuallySelected ? effectiveSelectedBackground : backgroundColor,
borderRadius: SIDEBAR_ROW_RADIUS,
}
: undefined
}
onPress={() => {
close();
onSelectThread(thread);
@@ -634,13 +666,36 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<View className="pr-[18px] pt-[10px]" style={{ paddingLeft: THREAD_LIST_COMPACT_INSET }}>
<View className={cn("gap-[3px] pb-[10px]", !props.isLast && "border-b border-separator")}>
<View className="flex-row items-center justify-between gap-2">
<Text className="flex-1 text-lg font-t3-bold text-foreground" numberOfLines={1}>
<Text
className={cn(
"flex-1 text-lg font-t3-bold",
visuallySelected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground",
)}
numberOfLines={1}
>
{thread.title}
</Text>
<View className="flex-row items-center gap-2">
{props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}
{props.hasQueuedMessages ? (
<QueuedMessageIcon selected={visuallySelected && !materialYouStyleLayoutActive} />
) : null}
{statusPill}
<Text className="text-base tabular-nums text-foreground-tertiary">{timestamp}</Text>
<Text
className={cn(
"text-base tabular-nums",
visuallySelected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-tertiary",
)}
>
{timestamp}
</Text>
<SymbolView
name="chevron.right"
size={13}
@@ -654,6 +709,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
compact
match={props.searchMatch}
query={props.searchQuery ?? ""}
selected={visuallySelected}
/>
) : null}
{subtitleRow}
@@ -673,8 +729,8 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
onSelectThread(thread);
}}
style={({ pressed }) => ({
backgroundColor: selected
? selectedBackgroundColor
backgroundColor: visuallySelected
? effectiveSelectedBackground
: pressed || hovered
? effectivePressedBackground
: backgroundColor,
@@ -691,19 +747,29 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<Text
className={cn(
"flex-1 text-base font-t3-medium",
selected ? "text-user-bubble-foreground" : "text-foreground",
visuallySelected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground",
)}
numberOfLines={1}
>
{thread.title}
</Text>
<View className="flex-row items-center gap-2">
{props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}
{props.hasQueuedMessages ? (
<QueuedMessageIcon selected={visuallySelected && !materialYouStyleLayoutActive} />
) : null}
{statusPill}
<Text
className={cn(
"text-xs tabular-nums",
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
visuallySelected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
)}
numberOfLines={1}
>
@@ -715,7 +781,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<ThreadSearchMatchExcerpt
match={props.searchMatch}
query={props.searchQuery ?? ""}
selected={selected}
selected={visuallySelected}
/>
) : null}
{subtitleRow}
@@ -728,7 +794,9 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
threadKey={`${thread.environmentId}:${thread.id}`}
backgroundColor={backgroundColor}
containerStyle={
compact ? undefined : { borderRadius: SIDEBAR_ROW_RADIUS, overflow: "hidden" }
compact && !materialYouStyleLayoutActive
? undefined
: { borderRadius: SIDEBAR_ROW_RADIUS, overflow: "hidden" }
}
enableTrackpadSwipe
fullSwipeWidth={props.fullSwipeWidth ?? windowWidth - 32}
@@ -1,3 +1,4 @@
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import type {
EnvironmentProject,
EnvironmentThreadShell,
@@ -429,11 +430,13 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
const pr = useThreadPr(thread);
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const theme = useUniwindTheme();
const screenColor = theme["--color-screen"];
const drawerColor = theme["--color-drawer"];
const pressedBackgroundColor = theme["--color-subtle"];
const selectedBackgroundColor = theme["--color-user-bubble"];
const selectedBackgroundColor =
theme[materialYouStyleLayoutActive ? "--color-thread-selected" : "--color-user-bubble"];
const sidebarPane = props.pane === "sidebar";
const selected = props.selected === true;
// The provider badge's border blends into the row's own surface, which
@@ -720,7 +723,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"flex-1 text-sm font-t3-medium",
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
)}
numberOfLines={1}
>
@@ -739,7 +746,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-xs tabular-nums",
selected
? "text-user-bubble-foreground"
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: (statusLabel?.className ?? "text-foreground-tertiary"),
)}
>
@@ -749,7 +758,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"mt-1 text-base font-t3-medium",
selected ? "text-user-bubble-foreground" : "text-foreground",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground",
)}
numberOfLines={2}
>
@@ -769,7 +782,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"flex-1 text-xs",
selected ? "text-user-bubble-foreground-muted" : "text-danger-foreground",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-danger-foreground",
)}
numberOfLines={1}
>
@@ -786,7 +803,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"shrink text-xs",
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
)}
numberOfLines={1}
>
@@ -794,7 +815,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"text-xs",
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
)}
style={{ fontFamily: MONO_FONT }}
>
@@ -806,7 +831,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"text-xs",
selected ? "text-user-bubble-foreground-muted" : "text-foreground-tertiary",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-tertiary",
)}
>
{props.environmentLabel}
@@ -818,7 +847,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
kind={props.environmentMachine}
size={11}
tintColorClassName={
selected ? "accent-user-bubble-foreground-muted" : "accent-foreground-tertiary"
selected
? materialYouStyleLayoutActive
? "accent-thread-selected-foreground-muted"
: "accent-user-bubble-foreground-muted"
: "accent-foreground-tertiary"
}
/>
) : null}
@@ -829,7 +862,14 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
{pr ? (
<Text
accessibilityLabel={pr.accessibilityLabel}
className={cn("text-xs", selected ? "text-user-bubble-foreground" : pr.textClassName)}
className={cn(
"text-xs",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: pr.textClassName,
)}
style={{ fontFamily: MONO_FONT }}
>
#{pr.label}
@@ -863,16 +903,17 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
onSelectThread(thread);
}}
style={
sidebarPane
sidebarPane || materialYouStyleLayoutActive
? ({ pressed }) => ({
backgroundColor: selected
? selectedBackgroundColor
: pressed
? pressedBackgroundColor
: drawerColor,
: sidebarPane
? drawerColor
: screenColor,
borderRadius: SIDEBAR_V2_ROW_RADIUS,
paddingHorizontal: 12,
paddingVertical: 10,
...(sidebarPane ? { paddingHorizontal: 12, paddingVertical: 10 } : null),
})
: ({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })
}
@@ -884,7 +925,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
labels and text hierarchy carry state, an inset hairline
separates rows. The opaque screen background stays so swipe
actions reveal behind the row. */
<View className="bg-screen">
<View className={materialYouStyleLayoutActive ? undefined : "bg-screen"}>
<View className="px-5 py-2.5">{cardContent}</View>
{props.showTrailingDivider !== false ? (
<View className="ml-5 h-px bg-border-subtle" />
@@ -900,19 +941,21 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
}
accessibilityRole="button"
accessibilityState={{ selected }}
className={sidebarPane ? undefined : "bg-screen"}
className={sidebarPane || materialYouStyleLayoutActive ? undefined : "bg-screen"}
onPress={() => {
close();
onSelectThread(thread);
}}
style={
sidebarPane
sidebarPane || materialYouStyleLayoutActive
? ({ pressed }) => ({
backgroundColor: selected
? selectedBackgroundColor
: pressed
? pressedBackgroundColor
: drawerColor,
: sidebarPane
? drawerColor
: screenColor,
borderRadius: SIDEBAR_V2_ROW_RADIUS,
})
: ({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })
@@ -940,7 +983,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<Text
className={cn(
"text-base",
selected ? "text-user-bubble-foreground" : "text-foreground-muted",
selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground-muted",
)}
numberOfLines={1}
>
@@ -959,7 +1006,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-sm tabular-nums",
selected
? "text-user-bubble-foreground-muted"
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: snoozedRow
? "text-foreground-secondary"
: "text-foreground-tertiary",
@@ -2,6 +2,7 @@ import type { EnvironmentThreadSearchMatch } from "@t3tools/client-runtime/state
import { AppText as Text } from "../../components/AppText";
import { cn } from "../../lib/cn";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
function foldAsciiCase(value: string): string {
return value.replace(/[A-Z]/g, (character) => character.toLowerCase());
@@ -50,12 +51,17 @@ export function ThreadSearchMatchExcerpt(props: {
readonly compact?: boolean;
}) {
const isUser = props.match.source === "user";
const { materialYouStyleLayoutActive } = useAppearancePreferences();
const parts = splitHighlightParts(props.match.snippet, props.query);
return (
<Text
className={cn(
props.compact ? "text-sm" : "text-xs",
props.selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
props.selected
? materialYouStyleLayoutActive
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
)}
numberOfLines={1}
>
@@ -63,7 +69,9 @@ export function ThreadSearchMatchExcerpt(props: {
className={cn(
props.compact ? "text-sm font-t3-medium" : "text-xs font-t3-medium",
props.selected
? "text-user-bubble-foreground"
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: isUser
? "text-foreground-secondary"
: "text-adaptive-emerald-600-400",
@@ -77,7 +85,9 @@ export function ThreadSearchMatchExcerpt(props: {
props.compact ? "text-sm" : "text-xs",
part.highlighted && "font-t3-bold",
props.selected
? "text-user-bubble-foreground"
? materialYouStyleLayoutActive
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: part.highlighted
? "text-foreground"
: "text-foreground-muted",
@@ -39,6 +39,8 @@ describe("Material You system colors", () => {
expect(base).toEqual(snapshot);
expect(variables["--color-screen"]).toBe(palette.surface);
expect(variables["--color-thread-canvas"]).toBe(palette.surfaceContainerLow);
expect(variables["--color-thread-selected"]).toBe(palette.surfaceContainer);
expect(variables["--color-header"]).toBe(palette.surfaceContainerHigh);
expect(variables["--color-primary"]).toBe(palette.primary);
expect(variables["--color-placeholder"]).toBe("#1C1B1F9E");
+7
View File
@@ -38,6 +38,13 @@ export function materialYouPaletteToMobileThemeVariables(
"--color-card": palette.surfaceContainer,
"--color-card-alt": palette.surfaceContainerHigh,
"--color-card-translucent": withAlpha(palette.surfaceContainer, 0.8),
"--color-thread-canvas": palette.surfaceContainerLow,
"--color-thread-selected": palette.surfaceContainer,
"--color-thread-selected-foreground": palette.onSurface,
"--color-thread-selected-foreground-muted": palette.onSurfaceVariant,
"--color-composer-panel": withAlpha(palette.surfaceContainerLow, dark ? 0.92 : 0.88),
"--color-composer-surface": withAlpha(palette.surfaceContainerHigh, dark ? 0.9 : 0.94),
"--color-composer-border": withAlpha(palette.outlineVariant, dark ? 0.34 : 0.46),
"--color-foreground": palette.onSurface,
"--color-foreground-secondary": palette.onSurfaceVariant,
"--color-foreground-muted": palette.onSurfaceVariant,
+1 -1
View File
@@ -153,7 +153,7 @@ describe("mobile themes", () => {
it("maps semantic palette roles onto every mobile color variable", () => {
const variables = createMobileThemeVariables(BUILT_IN_THEMES[0].colors, "light");
expect(Object.keys(variables)).toHaveLength(68);
expect(Object.keys(variables)).toHaveLength(75);
expect(variables["--color-sheet-solid"]).toBe(
themeColorToNativeColor(BUILT_IN_THEMES[0].colors.chrome),
);
+10
View File
@@ -218,6 +218,16 @@ export function createMobileThemeVariables(
"--color-card": c.surfaceRaised,
"--color-card-alt": c.surface,
"--color-card-translucent": withAlpha(c.surfaceRaised, 0.8),
"--color-thread-canvas": c.surface,
"--color-thread-selected": c.surfaceRaised,
"--color-thread-selected-foreground": c.text,
"--color-thread-selected-foreground-muted": c.textMuted,
"--color-composer-panel": themeColorWithAlpha(c.surface, appearance === "dark" ? 0.92 : 0.88),
"--color-composer-surface": themeColorWithAlpha(
c.surfaceRaised,
appearance === "dark" ? 0.9 : 0.94,
),
"--color-composer-border": themeColorWithAlpha(c.border, appearance === "dark" ? 0.46 : 0.54),
"--color-foreground": c.text,
"--color-foreground-secondary": c.textMuted,
"--color-foreground-muted": c.mutedForeground,
+17
View File
@@ -204,6 +204,23 @@ describe("mobile connection storage", () => {
await expect(loadPreferences()).resolves.toEqual({ ...themes, lightThemeId: "t3-chat" });
});
it("persists the Material You layout independently of the selected theme", async () => {
await savePreferencesPatch({
lightThemeId: "material-you",
materialYouStyleLayoutEnabled: true,
});
await savePreferencesPatch({ lightThemeId: "t3-chat" });
await expect(loadPreferences()).resolves.toEqual({
lightThemeId: "t3-chat",
materialYouStyleLayoutEnabled: true,
});
await savePreferencesPatch({ materialYouStyleLayoutEnabled: false });
await expect(loadPreferences()).resolves.toEqual({
lightThemeId: "t3-chat",
materialYouStyleLayoutEnabled: false,
});
});
it("drops the removed theme transition preference", async () => {
mocks.setPreferencesJson(JSON.stringify({ themeTransition: "circle-bottom-left" }), 10);
@@ -21,6 +21,7 @@ export interface Preferences {
readonly lightThemeId?: MobileThemeId;
readonly darkThemeId?: MobileThemeId;
readonly themeMode?: MobileThemeMode;
readonly materialYouStyleLayoutEnabled?: boolean;
readonly baseFontSize?: number;
readonly terminalFontSize?: number | null;
readonly markdownFontSize?: number;
@@ -90,6 +91,7 @@ function sanitizePreferences(parsed: Preferences): Preferences {
lightThemeId?: MobileThemeId;
darkThemeId?: MobileThemeId;
themeMode?: MobileThemeMode;
materialYouStyleLayoutEnabled?: boolean;
baseFontSize?: number;
terminalFontSize?: number | null;
markdownFontSize?: number;
@@ -133,6 +135,9 @@ function sanitizePreferences(parsed: Preferences): Preferences {
) {
preferences.themeMode = parsed.themeMode;
}
if (typeof parsed.materialYouStyleLayoutEnabled === "boolean") {
preferences.materialYouStyleLayoutEnabled = parsed.materialYouStyleLayoutEnabled;
}
if (typeof parsed.baseFontSize === "number") preferences.baseFontSize = parsed.baseFontSize;
if (typeof parsed.terminalFontSize === "number" || parsed.terminalFontSize === null) {
preferences.terminalFontSize = parsed.terminalFontSize;
+2
View File
@@ -10,6 +10,8 @@ themes or defaults.
On Android 12 or newer, choose the **Material You** theme in Appearance to use colors from
your wallpaper. Selecting another theme replaces those colors. Like other themes, Material You
can be selected separately for light and dark appearances.
Android also offers **Material You Layout**, which changes shapes and spacing independently
of the selected theme.
## Motion