@devries-cameron20 / t3code Mirror · read-only / commits / e846ad5505
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 09:15 UTC

refactor(mobile): expose app bar toolbar and FAB APIs (#19951)

Julius Marminge committed Oct 15, 2026 at 15:46 UTC e846ad5505b21efd7e7ded4c3e42340d5c45a481
74 files changed +313 -314
apps/mobile/src/components/AndroidScreenHeader.tsx
+2 -4
@@ -8,7 +8,7 @@ import { IconButton } from "./IconButton";
8 import { AndroidAnchoredMenu } from "./AndroidAnchoredMenu";
9 import { splitAndroidHeaderActions } from "./headerMenu.android";
10 import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
11 -import { useMaterialToolbarLayout } from "./useMaterialToolbarLayout";
11 +import { useToolbarLayout } from "./useToolbarLayout";
12
13 export interface AndroidHeaderAction {
14 readonly accessibilityLabel: string;
@@ -44,9 +44,7 @@ export function AndroidScreenHeader(props: {
44 }) {
45 const titleTypography = useScaledTextRole("title");
46 const subtitleTypography = useScaledTextRole("label");
47 - const { height: materialToolbarHeight, ...headerPadding } = useMaterialToolbarLayout(
48 - props.embedded,
49 - );
47 + const { height: materialToolbarHeight, ...headerPadding } = useToolbarLayout(props.embedded);
48 const [headerWidth, setHeaderWidth] = useState(0);
49 const { visibleActions, overflowActions } = splitAndroidHeaderActions(
50 props.actions ?? [],
apps/mobile/src/components/AppBar.android.tsx renamed
+4 -4
@@ -7,7 +7,7 @@ import {
7 type TextInputInstance,
8 View,
9 } from "react-native";
10 -import { useMaterialToolbarLayout } from "./useMaterialToolbarLayout";
10 +import { useToolbarLayout } from "./useToolbarLayout";
11 import { NativeStackScreenOptions } from "../native/StackHeader";
12 import { AndroidWorkspaceSidebarButton } from "../features/layout/workspace-sidebar-toolbar";
13 import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
@@ -17,12 +17,12 @@ import { SymbolView } from "./AppSymbol";
17 import { Menu } from "./Menu";
18 import { SearchField } from "./SearchField";
19 import { androidHeaderMenuActions, findHeaderMenuAction } from "./headerMenu.android";
20 -import type { ScreenHeaderProps } from "./ScreenHeader.types";
20 +import type { AppBarProps } from "./AppBar.types";
21 import { useAndroidControlSizing } from "./useAndroidControlSizing";
22
23 -export function ScreenHeader(props: ScreenHeaderProps) {
23 +export function AppBar(props: AppBarProps) {
24 const { search } = props;
25 - const { paddingTop, paddingBottom } = useMaterialToolbarLayout();
25 + const { paddingTop, paddingBottom } = useToolbarLayout();
26 const { scale, buttonSize, iconSize, smallIconSize } = useAndroidControlSizing();
27 const { themeVariables } = useAppearancePreferences();
28 const inputRef = useRef<TextInputInstance>(null);
apps/mobile/src/components/AppBar.tsx renamed
+9 -9
@@ -11,7 +11,7 @@ import {
11 NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
12 } from "../features/layout/native-mail-search-toolbar";
13 import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
14 -import type { ScreenHeaderMenuItem, ScreenHeaderProps } from "./ScreenHeader.types";
14 +import type { AppBarMenuItem, AppBarProps } from "./AppBar.types";
15 import type { AppSymbolName } from "./AppSymbol";
16 import { useNativeMailSearchToolbar } from "../native/use-native-mail-search-toolbar";
17
@@ -20,7 +20,7 @@ function iosIcon(icon: AppSymbolName) {
20 }
21
22 type MailMenu = NonNullable<HeaderBarButtonMailSearchToolbarItem["filterMenu"]>;
23 -function mailMenuItems(items: ReadonlyArray<ScreenHeaderMenuItem>): MailMenu["items"] {
23 +function mailMenuItems(items: ReadonlyArray<AppBarMenuItem>): MailMenu["items"] {
24 return items.map((item) =>
25 "items" in item
26 ? { type: "submenu", title: item.title ?? "", items: mailMenuItems(item.items) }
@@ -34,7 +34,7 @@ function mailMenuItems(items: ReadonlyArray<ScreenHeaderMenuItem>): MailMenu["it
34 );
35 }
36
37 -export function ScreenHeader(props: ScreenHeaderProps) {
37 +export function AppBar(props: AppBarProps) {
38 const usesNativeWorkspaceColumns = useNativeWorkspaceColumnsSupported();
39 const headerId = useId();
40 const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
@@ -184,9 +184,9 @@ export function ScreenHeader(props: ScreenHeaderProps) {
184 }
185
186 export type {
187 - ScreenHeaderAction,
188 - ScreenHeaderMenu,
189 - ScreenHeaderMenuItem,
190 - ScreenHeaderProps,
191 - ScreenHeaderSearch,
192 -} from "./ScreenHeader.types";
187 + AppBarAction,
188 + AppBarMenu,
189 + AppBarMenuItem,
190 + AppBarProps,
191 + AppBarSearch,
192 +} from "./AppBar.types";
apps/mobile/src/components/AppBar.types.ts renamed
+10 -10
@@ -3,7 +3,7 @@ import type { ColorValue } from "react-native";
3 import type { AppNativeStackNavigationOptions } from "../native/StackHeader";
4 import type { AppSymbolName } from "./AppSymbol";
5
6 -export interface ScreenHeaderAction {
6 +export interface AppBarAction {
7 readonly accessibilityLabel: string;
8 readonly icon: AppSymbolName;
9 readonly onPress: () => void;
@@ -14,7 +14,7 @@ export interface ScreenHeaderAction {
14 readonly tintColor?: ColorValue;
15 }
16
17 -export type ScreenHeaderMenuItem =
17 +export type AppBarMenuItem =
18 | {
19 readonly id: string;
20 readonly title: string;
@@ -29,18 +29,18 @@ export type ScreenHeaderMenuItem =
29 readonly title?: string;
30 readonly icon?: string;
31 readonly inline?: boolean;
32 - readonly items: ReadonlyArray<ScreenHeaderMenuItem>;
32 + readonly items: ReadonlyArray<AppBarMenuItem>;
33 };
34
35 -export interface ScreenHeaderMenu {
35 +export interface AppBarMenu {
36 readonly title: string;
37 readonly icon: AppSymbolName;
38 readonly status?: string;
39 readonly separateBackground?: boolean;
40 - readonly items: ReadonlyArray<ScreenHeaderMenuItem>;
40 + readonly items: ReadonlyArray<AppBarMenuItem>;
41 }
42
43 -export interface ScreenHeaderSearch {
43 +export interface AppBarSearch {
44 readonly value: string;
45 readonly onChangeText: (value: string) => void;
46 readonly placeholder: string;
@@ -54,12 +54,12 @@ export interface ScreenHeaderSearch {
54 readonly refreshInToolbar?: boolean;
55 }
56
57 -export interface ScreenHeaderProps {
57 +export interface AppBarProps {
58 readonly title: string;
59 readonly subtitle?: string;
60 - readonly actions?: ReadonlyArray<ScreenHeaderAction>;
61 - readonly menus?: ReadonlyArray<ScreenHeaderMenu>;
62 - readonly search?: ScreenHeaderSearch;
60 + readonly actions?: ReadonlyArray<AppBarAction>;
61 + readonly menus?: ReadonlyArray<AppBarMenu>;
62 + readonly search?: AppBarSearch;
63 readonly onBack?: () => void;
64 readonly sidebar?: boolean;
65 readonly backInSplitView?: {
apps/mobile/src/components/FloatingActionButton.android.tsx renamed
+6 -14
@@ -1,28 +1,20 @@
1 +import type { FloatingActionButtonProps } from "./FloatingActionButton.types";
2 import { NativeThemeHost } from "./NativeThemeHost.android";
3 import {
4 Box,
5 ExtendedFloatingActionButton,
5 - FloatingActionButton,
6 + FloatingActionButton as ComposeFloatingActionButton,
7 LargeFloatingActionButton,
8 Text,
9 } from "@expo/ui/jetpack-compose";
10 import { defaultMinSize, height, size, width } from "@expo/ui/jetpack-compose/modifiers";
10 -import { View, type StyleProp, type ViewStyle } from "react-native";
11 +import { View } from "react-native";
12 import { useAndroidControlSizing } from "./useAndroidControlSizing";
13 import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
14 import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
14 -import { SymbolView, type AppSymbolName } from "./AppSymbol";
15 +import { SymbolView } from "./AppSymbol";
16
16 -export function MaterialFloatingActionButton(props: {
17 - readonly onPress: () => void;
18 - readonly label: string;
19 - readonly icon: AppSymbolName;
20 - readonly variant?: "extended" | "large";
21 - readonly expanded?: boolean;
22 - readonly tone?: "primary" | "secondary";
23 - readonly className?: string;
24 - readonly style?: StyleProp<ViewStyle>;
25 -}) {
17 +export function FloatingActionButton(props: FloatingActionButtonProps) {
18 const { themeVariables: colors } = useAppearancePreferences();
19 const typography = useScaledTextRole("footnote");
20 const { scale, iconSize: standardIconSize, fabSize, largeFabSize } = useAndroidControlSizing();
@@ -36,7 +28,7 @@ export function MaterialFloatingActionButton(props: {
28 ? ExtendedFloatingActionButton
29 : props.variant === "large"
30 ? LargeFloatingActionButton
39 - : FloatingActionButton;
31 + : ComposeFloatingActionButton;
32 const iconSize = props.variant === "large" ? Math.round(36 * scale) : standardIconSize;
33 return (
34 <View
apps/mobile/src/components/FloatingActionButton.tsx renamed
+2 -5
@@ -1,13 +1,10 @@
1 -import type { ComponentProps } from "react";
1 import { Pressable } from "react-native";
3 -import type { MaterialFloatingActionButton as AndroidMaterialFloatingActionButton } from "./MaterialFloatingActionButton.android";
2 +import type { FloatingActionButtonProps } from "./FloatingActionButton.types";
3 import { AppText } from "./AppText";
4 import { SymbolView } from "./AppSymbol";
5 import { cn } from "../lib/cn";
6
8 -export function MaterialFloatingActionButton(
9 - props: ComponentProps<typeof AndroidMaterialFloatingActionButton>,
10 -) {
7 +export function FloatingActionButton(props: FloatingActionButtonProps) {
8 return (
9 <Pressable
10 accessibilityRole="button"
apps/mobile/src/components/FloatingActionButton.types.ts new
+13
@@ -0,0 +1,13 @@
1 +import type { StyleProp, ViewStyle } from "react-native";
2 +import type { AppSymbolName } from "./AppSymbol";
3 +
4 +export type FloatingActionButtonProps = {
5 + readonly onPress: () => void;
6 + readonly label: string;
7 + readonly icon: AppSymbolName;
8 + readonly variant?: "extended" | "large";
9 + readonly expanded?: boolean;
10 + readonly tone?: "primary" | "secondary";
11 + readonly className?: string;
12 + readonly style?: StyleProp<ViewStyle>;
13 +};
apps/mobile/src/components/ListChoiceRow.tsx
+2 -2
@@ -4,7 +4,7 @@ import { useResolveClassNames } from "uniwind";
4 import { cn } from "../lib/cn";
5 import { SymbolView } from "./AppSymbol";
6 import { ListRowLayout } from "./ListRowLayout";
7 -import { MaterialRadioIndicator } from "./MaterialRadioIndicator";
7 +import { RadioIndicator } from "./RadioIndicator";
8 import { RowPressable } from "./RowPressable";
9
10 export function ListChoiceRow(props: {
@@ -42,7 +42,7 @@ export function ListChoiceRow(props: {
42 className="size-6 items-center justify-center"
43 >
44 {Platform.OS === "android" ? (
45 - <MaterialRadioIndicator selected={props.selected} />
45 + <RadioIndicator selected={props.selected} />
46 ) : props.selected ? (
47 <SymbolView
48 name="checkmark"
apps/mobile/src/components/MaterialNewThreadButton.android.tsx deleted
-21
@@ -1,21 +0,0 @@
1 -import type { ComponentProps } from "react";
2 -import { MaterialFloatingActionButton } from "./MaterialFloatingActionButton.android";
3 -import { MaterialScrollComposeButton } from "./MaterialScrollComposeButton.android";
4 -import type { MaterialNewThreadButton as SharedMaterialNewThreadButton } from "./MaterialNewThreadButton.shared";
5 -
6 -export function MaterialNewThreadButton(
7 - props: ComponentProps<typeof SharedMaterialNewThreadButton>,
8 -) {
9 - if (props.extended && props.expanded !== undefined) {
10 - return <MaterialScrollComposeButton {...props} expanded={props.expanded} />;
11 - }
12 - return (
13 - <MaterialFloatingActionButton
14 - {...props}
15 - icon="square.and.pencil"
16 - label="New thread"
17 - tone="primary"
18 - variant={props.extended ? "extended" : "large"}
19 - />
20 - );
21 -}
apps/mobile/src/components/MaterialNewThreadButton.tsx deleted
-1
@@ -1 +0,0 @@
1 -export { MaterialNewThreadButton } from "./MaterialNewThreadButton.shared";
apps/mobile/src/components/MaterialSwitch.tsx deleted
-1
@@ -1 +0,0 @@
1 -export { Switch as MaterialSwitch } from "react-native";
apps/mobile/src/components/NativeSwitch.android.tsx renamed
+2 -2
@@ -1,12 +1,12 @@
1 import { NativeThemeHost } from "./NativeThemeHost.android";
2 import { Switch as ComposeSwitch } from "@expo/ui/jetpack-compose";
3 import { View } from "react-native";
4 -import type { ThemedSwitchProps } from "./MaterialSwitch.types";
4 +import type { ThemedSwitchProps } from "./NativeSwitch.types";
5
6 import { useControlTheme } from "./useControlTheme";
7
8 /** Material's native switch, with the same palette and accessibility contract as our RN controls. */
9 -export function MaterialSwitch(props: ThemedSwitchProps) {
9 +export function NativeSwitch(props: ThemedSwitchProps) {
10 const { colors } = useControlTheme();
11 const toggle = () => {
12 if (!props.disabled) props.onValueChange?.(!props.value);
apps/mobile/src/components/NativeSwitch.tsx new
+1
@@ -0,0 +1 @@
1 +export { Switch as NativeSwitch } from "react-native";
apps/mobile/src/components/NativeSwitch.types.ts renamed
apps/mobile/src/components/NavigationRow.tsx renamed
+1 -1
@@ -8,7 +8,7 @@ import { SymbolView } from "./AppSymbol";
8 import { useAndroidControlSizing } from "./useAndroidControlSizing";
9
10 /** Shared geometry for Material navigation and selection lists. Group rows in one card. */
11 -export function MaterialListRow({
11 +export function NavigationRow({
12 title,
13 titleClassName,
14 subtitle,
apps/mobile/src/components/NewThreadButton.android.tsx new
+19
@@ -0,0 +1,19 @@
1 +import type { ComponentProps } from "react";
2 +import { FloatingActionButton } from "./FloatingActionButton.android";
3 +import { ScrollComposeButton } from "./ScrollComposeButton.android";
4 +import type { NewThreadButton as SharedNewThreadButton } from "./NewThreadButton.shared";
5 +
6 +export function NewThreadButton(props: ComponentProps<typeof SharedNewThreadButton>) {
7 + if (props.extended && props.expanded !== undefined) {
8 + return <ScrollComposeButton {...props} expanded={props.expanded} />;
9 + }
10 + return (
11 + <FloatingActionButton
12 + {...props}
13 + icon="square.and.pencil"
14 + label="New thread"
15 + tone="primary"
16 + variant={props.extended ? "extended" : "large"}
17 + />
18 + );
19 +}
apps/mobile/src/components/NewThreadButton.shared.tsx renamed
+1 -1
@@ -5,7 +5,7 @@ import { AppText } from "./AppText";
5 import { SymbolView } from "./AppSymbol";
6
7 /** Shared compose action for the floating button and empty workspace. */
8 -export function MaterialNewThreadButton(props: {
8 +export function NewThreadButton(props: {
9 readonly onPress: () => void;
10 readonly extended?: boolean;
11 readonly expanded?: boolean;
apps/mobile/src/components/NewThreadButton.tsx new
+1
@@ -0,0 +1 @@
1 +export { NewThreadButton } from "./NewThreadButton.shared";
apps/mobile/src/components/RadioIndicator.android.tsx renamed
+1 -1
@@ -5,7 +5,7 @@ import { NativeThemeHost } from "./NativeThemeHost.android";
5 import { useControlTheme } from "./useControlTheme";
6
7 /** The enclosing radio row owns selection, touch and accessibility. */
8 -export function MaterialRadioIndicator({ selected }: { readonly selected: boolean }) {
8 +export function RadioIndicator({ selected }: { readonly selected: boolean }) {
9 const { colors, systemColorsActive } = useControlTheme();
10 return (
11 <View pointerEvents="none" importantForAccessibility="no-hide-descendants">
apps/mobile/src/components/RadioIndicator.tsx renamed
+1 -1
@@ -1,7 +1,7 @@
1 import { SymbolView } from "./AppSymbol";
2
3 /** The enclosing radio row owns selection, touch and accessibility. */
4 -export function MaterialRadioIndicator({ selected }: { readonly selected: boolean }) {
4 +export function RadioIndicator({ selected }: { readonly selected: boolean }) {
5 return selected ? (
6 <SymbolView name="checkmark" size={16} tintColorClassName="accent-icon" />
7 ) : null;
apps/mobile/src/components/ScreenContent.tsx renamed
+1 -1
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
2 import { Platform, View } from "react-native";
3
4 /** Keeps the header surface visible behind rounded Android content corners. */
5 -export function MaterialScreenContent({
5 +export function ScreenContent({
6 children,
7 insetHorizontal = false,
8 fitToContents = false,
apps/mobile/src/components/ScrollComposeButton.android.tsx renamed
+1 -1
@@ -15,7 +15,7 @@ import { useAppearancePreferences } from "../features/settings/appearance/Appear
15 import { resolveScaledTextRole } from "../lib/appearancePreferences";
16
17 /** Keep the animated width and icon positioning entirely inside Compose, not Yoga. */
18 -export function MaterialScrollComposeButton(props: {
18 +export function ScrollComposeButton(props: {
19 readonly expanded: boolean;
20 readonly onPress: () => void;
21 readonly className?: string;
apps/mobile/src/components/ThemedSwitch.tsx
+4 -4
@@ -1,13 +1,13 @@
1 import { Platform, Switch } from "react-native";
2
3 -import { MaterialSwitch } from "./MaterialSwitch";
4 -import type { ThemedSwitchProps } from "./MaterialSwitch.types";
3 +import { NativeSwitch } from "./NativeSwitch";
4 +import type { ThemedSwitchProps } from "./NativeSwitch.types";
5
6 -export type { ThemedSwitchProps } from "./MaterialSwitch.types";
6 +export type { ThemedSwitchProps } from "./NativeSwitch.types";
7
8 export function ThemedSwitch(props: ThemedSwitchProps) {
9 if (Platform.OS === "android") {
10 - return <MaterialSwitch {...props} />;
10 + return <NativeSwitch {...props} />;
11 }
12
13 return (
apps/mobile/src/components/Toolbar.android.tsx renamed
+8 -8
@@ -1,15 +1,15 @@
1 -import { HorizontalFloatingToolbar, Host, RNHostView } from "@expo/ui/jetpack-compose";
2 -import type { ReactElement } from "react";
1 +import { NativeThemeHost } from "./NativeThemeHost.android";
2 +import { HorizontalFloatingToolbar, RNHostView } from "@expo/ui/jetpack-compose";
3 +import type { ToolbarProps } from "./Toolbar.types";
4
4 -import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
5 +import { useControlTheme } from "./useControlTheme";
6
7 /** Native toolbar surface; hosted RN controls retain their existing menus and accessibility. */
7 -export function MaterialFloatingToolbar(props: { readonly children: ReactElement }) {
8 - const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
8 +export function Toolbar(props: ToolbarProps) {
9 + const { colors } = useControlTheme();
10 return (
10 - <Host
11 + <NativeThemeHost
12 matchContents
12 - colorScheme={themeAppearance}
13 ignoreSafeAreaKeyboardInsets
14 style={{ alignSelf: "center", maxWidth: "100%" }}
15 >
@@ -21,6 +21,6 @@ export function MaterialFloatingToolbar(props: { readonly children: ReactElement
21 >
22 <RNHostView matchContents>{props.children}</RNHostView>
23 </HorizontalFloatingToolbar>
24 - </Host>
24 + </NativeThemeHost>
25 );
26 }
apps/mobile/src/components/Toolbar.tsx new
+5
@@ -0,0 +1,5 @@
1 +import type { ToolbarProps } from "./Toolbar.types";
2 +
3 +export function Toolbar(props: ToolbarProps) {
4 + return props.children;
5 +}
apps/mobile/src/components/Toolbar.types.ts new
+6
@@ -0,0 +1,6 @@
1 +import type { ReactElement } from "react";
2 +
3 +/** Native floating action group. Its owner supplies placement and action content. */
4 +export interface ToolbarProps {
5 + readonly children: ReactElement;
6 +}
apps/mobile/src/components/headerMenu.android.ts
+4 -4
@@ -1,7 +1,7 @@
1 import type { MenuAction } from "@react-native-menu/menu";
2 -import type { ScreenHeaderMenuItem } from "./ScreenHeader.types";
2 +import type { AppBarMenuItem } from "./AppBar.types";
3
4 -export function androidHeaderMenuActions(items: ReadonlyArray<ScreenHeaderMenuItem>): MenuAction[] {
4 +export function androidHeaderMenuActions(items: ReadonlyArray<AppBarMenuItem>): MenuAction[] {
5 return items.flatMap((item): MenuAction[] =>
6 "items" in item
7 ? item.inline && !item.title
@@ -28,9 +28,9 @@ export function androidHeaderMenuActions(items: ReadonlyArray<ScreenHeaderMenuIt
28 }
29
30 export function findHeaderMenuAction(
31 - items: ReadonlyArray<ScreenHeaderMenuItem>,
31 + items: ReadonlyArray<AppBarMenuItem>,
32 id: string,
33 -): Extract<ScreenHeaderMenuItem, { readonly onPress: () => void }> | undefined {
33 +): Extract<AppBarMenuItem, { readonly onPress: () => void }> | undefined {
34 for (const item of items) {
35 if ("items" in item) {
36 const action = findHeaderMenuAction(item.items, id);
apps/mobile/src/components/headerMenu.test.ts
+2 -2
@@ -4,9 +4,9 @@ import {
4 findHeaderMenuAction,
5 splitAndroidHeaderActions,
6 } from "./headerMenu.android";
7 -import type { ScreenHeaderMenuItem } from "./ScreenHeader.types";
7 +import type { AppBarMenuItem } from "./AppBar.types";
8
9 -const items: ReadonlyArray<ScreenHeaderMenuItem> = [
9 +const items: ReadonlyArray<AppBarMenuItem> = [
10 {
11 id: "sessions",
12 title: "Sessions",
apps/mobile/src/components/nativeHeaderMenu.ios.tsx
+3 -3
@@ -1,7 +1,7 @@
1 import { NativeHeaderToolbar } from "../native/StackHeader";
2 -import type { ScreenHeaderMenu, ScreenHeaderMenuItem } from "./ScreenHeader.types";
2 +import type { AppBarMenu, AppBarMenuItem } from "./AppBar.types";
3
4 -function renderMenuItems(items: ReadonlyArray<ScreenHeaderMenuItem>) {
4 +function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
5 return items.map((item) =>
6 "items" in item ? (
7 <NativeHeaderToolbar.Menu
@@ -28,7 +28,7 @@ function renderMenuItems(items: ReadonlyArray<ScreenHeaderMenuItem>) {
28 }
29
30 /** Returns direct native items for toolbar serialization, including nested menu data. */
31 -export function createNativeHeaderMenu(menu: ScreenHeaderMenu) {
31 +export function createNativeHeaderMenu(menu: AppBarMenu) {
32 return (
33 <NativeHeaderToolbar.Menu
34 key={menu.title}
apps/mobile/src/components/useToolbarLayout.ts renamed
+1 -1
@@ -5,7 +5,7 @@ import { useScaledTextRole } from "../features/settings/appearance/useScaledText
5 import { useAndroidControlSizing } from "./useAndroidControlSizing";
6
7 /** Shared Android header geometry; class-based spacing uses the app's 14dp rem. */
8 -export function useMaterialToolbarLayout(embedded = false) {
8 +export function useToolbarLayout(embedded = false) {
9 const insets = useSafeAreaInsets();
10 const title = useScaledTextRole("title");
11 const subtitle = useScaledTextRole("label");
apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
+2 -2
@@ -11,7 +11,7 @@ import {
11 } from "@t3tools/contracts";
12 import { useNavigation } from "@react-navigation/native";
13 import { AppActivityIndicator } from "../../components/AppActivityIndicator";
14 -import { ScreenHeader } from "../../components/ScreenHeader";
14 +import { AppBar } from "../../components/AppBar";
15 import { SymbolView } from "../../components/AppSymbol";
16 import { useCallback, useMemo, useRef, type ComponentProps } from "react";
17 import { Platform, Pressable, RefreshControl, useWindowDimensions, View } from "react-native";
@@ -49,7 +49,7 @@ function ArchivedThreadsHeader(props: {
49 const { width } = useWindowDimensions();
50 const hasCustomFilter = props.selectedEnvironmentId !== null || props.sortOrder !== "newest";
51 return (
52 - <ScreenHeader
52 + <AppBar
53 title="Archived threads"
54 sidebar={false}
55 onBack={() => navigation.goBack()}
apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+2 -2
@@ -12,7 +12,7 @@ import { ActivityIndicator, Alert, AppState, Platform, TextInput, View } from "r
12 import { useSafeAreaInsets } from "react-native-safe-area-context";
13
14 import { ControlPill } from "../../components/ControlPill";
15 -import { ScreenHeader } from "../../components/ScreenHeader";
15 +import { AppBar } from "../../components/AppBar";
16 import { NativeHeaderToolbar } from "../../native/StackHeader";
17 import { useThreadServerBrowserTabs } from "../../state/preview";
18 import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -115,7 +115,7 @@ function BrowserPreviewScreen({
115
116 return (
117 <View className="flex-1 bg-sheet" style={{ paddingBottom: insets.bottom }}>
118 - <ScreenHeader
118 + <AppBar
119 title={tab ? browserTabTitle(tab) : "Browser"}
120 sidebar={false}
121 onBack={onClose}
apps/mobile/src/features/development/ComponentCatalogScreen.tsx
+4 -4
@@ -13,12 +13,12 @@ import { ListSection } from "../../components/ListSection";
13 import { ListToggleRow } from "../../components/ListToggleRow";
14 import { Button } from "../../components/Button";
15 import { IconButton } from "../../components/IconButton";
16 -import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
16 +import { FloatingActionButton } from "../../components/FloatingActionButton";
17 import { SearchField } from "../../components/SearchField";
18 import { LoadingStrip } from "../../components/LoadingStrip";
19 import { Notice } from "../../components/Notice";
20 import { NumberField } from "../../components/NumberField";
21 -import { ScreenHeader } from "../../components/ScreenHeader";
21 +import { AppBar } from "../../components/AppBar";
22 import { ScreenScrollView } from "../../components/ScreenScrollView";
23 import { SegmentedControl } from "../../components/SegmentedControl";
24 import { SliderRow } from "../../components/SliderRow";
@@ -56,7 +56,7 @@ export function ComponentCatalogScreen() {
56 };
57 return (
58 <View className="flex-1 bg-screen">
59 - <ScreenHeader title="UI components" onBack={() => navigation.goBack()} sidebar={false} />
59 + <AppBar title="UI components" onBack={() => navigation.goBack()} sidebar={false} />
60 <ScreenScrollView
61 contentInsetAdjustmentBehavior="automatic"
62 contentContainerStyle={{ padding: 16, gap: 20, paddingBottom: 40 }}
@@ -243,7 +243,7 @@ export function ComponentCatalogScreen() {
243 <LoadingStrip progress={0.6} />
244 </View>
245 <View className="items-start">
246 - <MaterialFloatingActionButton
246 + <FloatingActionButton
247 label="New thread"
248 icon="plus"
249 variant="extended"
apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+4 -4
@@ -23,7 +23,7 @@ import {
23 androidHeaderMenuActions,
24 findHeaderMenuAction,
25 } from "../../components/headerMenu.android";
26 -import type { ScreenHeaderMenuItem } from "../../components/ScreenHeader.types";
26 +import type { AppBarMenuItem } from "../../components/AppBar.types";
27 import { deviceEnvironment, refreshDeviceHubAccess, useDeviceHubAccess } from "../../state/device";
28 import { useEnvironmentQuery } from "../../state/query";
29 import { useAtomCommand } from "../../state/use-atom-command";
@@ -146,7 +146,7 @@ function DevicePreviewScreen({
146 }
147 };
148
149 - const controls: ScreenHeaderMenuItem[] = [
149 + const controls: AppBarMenuItem[] = [
150 ...(state.data?.hosts
151 .filter(
152 (host) =>
@@ -243,7 +243,7 @@ function DevicePreviewScreen({
243 },
244 ];
245 const pressHome = () => streamRef.current?.home();
246 - const menuItems: ScreenHeaderMenuItem[] = [
246 + const menuItems: AppBarMenuItem[] = [
247 ...(previews.length > 1
248 ? [
249 {
@@ -344,7 +344,7 @@ function DevicePreviewScreen({
344 );
345 }
346
347 -function DeviceOptionsMenu({ items }: { readonly items: ReadonlyArray<ScreenHeaderMenuItem> }) {
347 +function DeviceOptionsMenu({ items }: { readonly items: ReadonlyArray<AppBarMenuItem> }) {
348 return (
349 <Menu
350 actions={androidHeaderMenuActions(items)}
apps/mobile/src/features/files/FilesHeader.tsx renamed
+3 -3
@@ -4,10 +4,10 @@ import { BackHandler, Keyboard, type TextInputInstance, View } from "react-nativ
4 import { AndroidHeaderIconButton, AndroidScreenHeader } from "../../components/AndroidScreenHeader";
5 import { AndroidAnchoredMenu } from "../../components/AndroidAnchoredMenu";
6 import { SearchField } from "../../components/SearchField";
7 -import { useMaterialToolbarLayout } from "../../components/useMaterialToolbarLayout";
7 +import { useToolbarLayout } from "../../components/useToolbarLayout";
8
9 /** Keep Files search in the same header row on compact and expanded layouts. */
10 -export function MaterialFilesHeader(props: {
10 +export function FilesHeader(props: {
11 readonly projectName: string;
12 readonly searchQuery: string;
13 readonly onSearchQueryChange: (query: string) => void;
@@ -15,7 +15,7 @@ export function MaterialFilesHeader(props: {
15 readonly onBack?: () => void;
16 readonly leading?: ReactNode;
17 }) {
18 - const { paddingTop, paddingBottom } = useMaterialToolbarLayout();
18 + const { paddingTop, paddingBottom } = useToolbarLayout();
19 const searchRef = useRef<TextInputInstance>(null);
20 const [searchOpen, setSearchOpen] = useState(false);
21 const searching = searchOpen || props.searchQuery.length > 0;
apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
+8 -8
@@ -15,7 +15,7 @@ import {
15 } from "@t3tools/shared/filePreview";
16 import { mediaFileReference } from "@t3tools/client-runtime/media-reference";
17
18 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
18 +import { ScreenContent } from "../../components/ScreenContent";
19 import { AudioFilePreview } from "../../components/AudioFilePreview";
20 import { EmptyState } from "../../components/EmptyState";
21 import { FilePreviewModal, type FilePreviewSource } from "../../components/FilePreviewModal";
@@ -50,7 +50,7 @@ import { preloadWorkspaceFileContents } from "./preload-workspace-file";
50 import { SourceFileSurface } from "./SourceFileSurface";
51 import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
52 import { ThreadFileNavigatorPane } from "./thread-file-navigator-pane";
53 -import { ScreenHeader } from "../../components/ScreenHeader";
53 +import { AppBar } from "../../components/AppBar";
54 import { WorkspaceFileImagePreview } from "./WorkspaceFileImagePreview";
55 import { WorkspaceFilePreviewError } from "./WorkspaceFilePreviewError";
56 import { WorkspaceFileVideoPreview } from "./WorkspaceFileVideoPreview";
@@ -73,7 +73,7 @@ function FilesBrowserHeader(props: {
73 readonly onBack: () => void;
74 }) {
75 return (
76 - <ScreenHeader
76 + <AppBar
77 title="Files"
78 subtitle={props.projectName}
79 onBack={props.onBack}
@@ -120,7 +120,7 @@ function FileHeader(props: {
120 const { panes, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
121 const modes = props.actions.filter(({ inline }) => inline);
122 return (
123 - <ScreenHeader
123 + <AppBar
124 title={props.title}
125 subtitle={props.subtitle}
126 onBack={props.onBack}
@@ -563,7 +563,7 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
563 onRefresh={entriesQuery.refresh}
564 onBack={handleReturnToThread}
565 />
566 - <MaterialScreenContent insetHorizontal={layout.usesSplitView}>
566 + <ScreenContent insetHorizontal={layout.usesSplitView}>
567 <FileTreeBrowser
568 key={JSON.stringify([environmentId, cwd])}
569 entries={entriesQuery.entries}
@@ -580,7 +580,7 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
580 onSelectFile={handleSelectFile}
581 />
582 <FilesToolbarBottomFade />
583 - </MaterialScreenContent>
583 + </ScreenContent>
584 </>
585 );
586
@@ -949,7 +949,7 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
949 onReturnToThread={handleReturnToThread}
950 actions={fileMenuActions}
951 />
952 - <MaterialScreenContent>
952 + <ScreenContent>
953 <FileContent
954 key={previewKey}
955 activeMode={resolvedActiveMode}
@@ -969,7 +969,7 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
969 truncated={fileData?.truncated ?? false}
970 onRefresh={() => fileQuery.refresh()}
971 />
972 - </MaterialScreenContent>
972 + </ScreenContent>
973 <FilePreviewModal
974 source={fullScreenPreview}
975 onRequestClose={() => setFullScreenPreview(null)}
apps/mobile/src/features/files/thread-file-navigator-pane.tsx
+4 -4
@@ -2,7 +2,7 @@ import { resolveFilesystemReadAccess } from "@t3tools/client-runtime/state/files
2 import { environmentSession } from "../../state/session";
3 import type { EnvironmentId } from "@t3tools/contracts";
4 import { SymbolView } from "../../components/AppSymbol";
5 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
5 +import { ScreenContent } from "../../components/ScreenContent";
6 import { useCallback, useMemo, useState, type ComponentProps } from "react";
7 import { Platform, Pressable, View, type NativeSyntheticEvent } from "react-native";
8 import {
@@ -14,7 +14,7 @@ import {
14 } from "react-native-screens";
15
16 import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
17 -import { MaterialFilesHeader } from "./MaterialFilesHeader";
17 +import { FilesHeader } from "./FilesHeader";
18 import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
19 import { useUniwindTheme } from "../../lib/useUniwindTheme";
20 import { useEnvironmentQuery } from "../../state/query";
@@ -172,7 +172,7 @@ export function ThreadFileNavigatorPane(props: {
172 style={{ paddingTop: Platform.OS === "android" ? 0 : props.headerInset }}
173 >
174 {Platform.OS === "android" ? (
175 - <MaterialFilesHeader
175 + <FilesHeader
176 projectName={props.projectName}
177 searchQuery={searchQuery}
178 onSearchQueryChange={setSearchQuery}
@@ -223,7 +223,7 @@ export function ThreadFileNavigatorPane(props: {
223 </View>
224 ) : null}
225 </View>
226 - <MaterialScreenContent insetHorizontal>{fileTree}</MaterialScreenContent>
226 + <ScreenContent insetHorizontal>{fileTree}</ScreenContent>
227 </View>
228 );
229 }
apps/mobile/src/features/home/AndroidHomeFab.android.tsx
+6 -6
@@ -6,11 +6,11 @@ import {
6 type NativeSyntheticEvent,
7 } from "react-native";
8 import { useSafeAreaInsets } from "react-native-safe-area-context";
9 -import { MaterialNewThreadButton } from "../../components/MaterialNewThreadButton";
9 +import { NewThreadButton } from "../../components/NewThreadButton";
10 import type { AndroidHomeFabLayout as SharedAndroidHomeFabLayout } from "./AndroidHomeFab.shared";
11 import { useWorkspaceState } from "../../state/workspace";
12 -import { MaterialFabScrollContext } from "./MaterialFabScrollContext";
13 -import { updateMaterialFabScroll } from "./material-fab-scroll";
12 +import { FabScrollContext } from "./FabScrollContext";
13 +import { updateFabScroll } from "./fab-scroll";
14 import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
15
16 export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidHomeFabLayout>) {
@@ -23,7 +23,7 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
23 const scrollState = useRef({ anchor: 0, expanded: true });
24 const onScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
25 const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;
26 - const next = updateMaterialFabScroll(
26 + const next = updateFabScroll(
27 scrollState.current,
28 contentOffset.y,
29 contentSize.height - layoutMeasurement.height,
@@ -35,9 +35,9 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
35 // Remount only the FAB when its font or pane changes to clear the cached expanded width.
36 return (
37 <View className="flex-1" onLayout={(event) => setLayoutWidth(event.nativeEvent.layout.width)}>
38 - <MaterialFabScrollContext value={onScroll}>{props.children}</MaterialFabScrollContext>
38 + <FabScrollContext value={onScroll}>{props.children}</FabScrollContext>
39 {!props.disabled && state.hasConnections && layoutWidth !== null ? (
40 - <MaterialNewThreadButton
40 + <NewThreadButton
41 key={`${appearance.baseFontSize}:${fontScale}:${layoutWidth}`}
42 extended
43 expanded={expanded}
apps/mobile/src/features/home/FabScrollContext.ts renamed
+3 -3
@@ -1,10 +1,10 @@
1 import { createContext, useContext } from "react";
2 import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native";
3
4 -export const MaterialFabScrollContext = createContext<
4 +export const FabScrollContext = createContext<
5 ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined
6 >(undefined);
7
8 -export function useMaterialFabScroll() {
9 - return useContext(MaterialFabScrollContext);
8 +export function useFabScroll() {
9 + return useContext(FabScrollContext);
10 }
apps/mobile/src/features/home/HomeHeader.android.tsx
+2 -2
@@ -1,7 +1,7 @@
1 import type { MenuAction } from "@react-native-menu/menu";
2 import { useCallback, useMemo } from "react";
3 import { NativeStackScreenOptions } from "../../native/StackHeader";
4 -import { MaterialThreadListToolbar } from "./MaterialThreadListToolbar";
4 +import { ThreadListToolbar } from "./ThreadListToolbar";
5 import type { HomeHeaderProps } from "./HomeHeader.types";
6
7 export type { HomeHeaderEnvironment } from "./HomeHeader.types";
@@ -95,7 +95,7 @@ export function HomeHeader(props: HomeHeaderProps) {
95 return (
96 <>
97 <NativeStackScreenOptions options={{ headerShown: false }} />
98 - <MaterialThreadListToolbar
98 + <ThreadListToolbar
99 searchQuery={props.searchQuery}
100 onSearchQueryChange={props.onSearchQueryChange}
101 filterActions={menuActions}
apps/mobile/src/features/home/HomeScreen.tsx
+6 -6
@@ -31,7 +31,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
31
32 import { cn } from "../../lib/cn";
33 import { EmptyState } from "../../components/EmptyState";
34 -import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
34 +import { FloatingActionButton } from "../../components/FloatingActionButton";
35 import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
36 import type { SavedRemoteConnection } from "../../lib/connection";
37 import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
@@ -77,7 +77,7 @@ import {
77 } from "./homeThreadList";
78 import { createSwipeRowActivation } from "./swipe-row-activation";
79 import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions";
80 -import { useMaterialFabScroll } from "./MaterialFabScrollContext";
80 +import { useFabScroll } from "./FabScrollContext";
81 import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
82 import { ThreadListFilters } from "./ThreadListFilters";
83
@@ -344,7 +344,7 @@ export function HomeScreen(props: HomeScreenProps) {
344 const handleScrollBeginDrag = useCallback(() => {
345 openSwipeableRef.current?.close();
346 }, []);
347 - const onMaterialFabScroll = useMaterialFabScroll();
347 + const onFabScroll = useFabScroll();
348 const listRef = useRef<LegendListRef>(null);
349 const searchMode = workspace?.state.tabs.threads.searchMode;
350 const restoredOffset = workspace?.state.tabs.threads.scrollOffset;
@@ -372,7 +372,7 @@ export function HomeScreen(props: HomeScreenProps) {
372 useEffect(() => () => clearTimeout(activationTimerRef.current), []);
373 const handleListScroll = useCallback(
374 (event: NativeSyntheticEvent<NativeScrollEvent>) => {
375 - onMaterialFabScroll?.(event);
375 + onFabScroll?.(event);
376 if (workspace)
377 workspace.recordScrollOffset(
378 "threads",
@@ -384,7 +384,7 @@ export function HomeScreen(props: HomeScreenProps) {
384 200,
385 );
386 },
387 - [activateVisibleRows, onMaterialFabScroll, workspace, insets.top],
387 + [activateVisibleRows, onFabScroll, workspace, insets.top],
388 );
389 const trackListTouches = useCallback(
390 (event: GestureResponderEvent, started: boolean) => {
@@ -956,7 +956,7 @@ export function HomeScreen(props: HomeScreenProps) {
956 onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
957 action={
958 Platform.OS === "android" && !props.catalogState.hasReadyEnvironment ? (
959 - <MaterialFloatingActionButton
959 + <FloatingActionButton
960 label="Add environment"
961 icon="plus"
962 variant="extended"
apps/mobile/src/features/home/ThreadListToolbar.tsx renamed
+5 -9
@@ -13,7 +13,7 @@ import type { MenuAction } from "@react-native-menu/menu";
13
14 import { AndroidHeaderIconButton } from "../../components/AndroidScreenHeader";
15 import { CompactBrandTitle } from "../../components/CompactBrandTitle";
16 -import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
16 +import { FloatingActionButton } from "../../components/FloatingActionButton";
17 import { AndroidAnchoredMenu } from "../../components/AndroidAnchoredMenu";
18 import { Menu } from "../../components/Menu";
19 import { SearchField } from "../../components/SearchField";
@@ -21,10 +21,10 @@ import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands
21 import { WorkspaceConnectionTitle } from "./WorkspaceConnectionTitle";
22 import { useWorkspaceState } from "../../state/workspace";
23 import { useAndroidControlSizing } from "../../components/useAndroidControlSizing";
24 -import { useMaterialToolbarLayout } from "../../components/useMaterialToolbarLayout";
24 +import { useToolbarLayout } from "../../components/useToolbarLayout";
25
26 /** One toolbar height for the compact list and expanded sidebar, including search. */
27 -export function MaterialThreadListToolbar(props: {
27 +export function ThreadListToolbar(props: {
28 readonly searchQuery: string;
29 readonly onSearchQueryChange: (query: string) => void;
30 readonly filterActions: MenuAction[];
@@ -44,7 +44,7 @@ export function MaterialThreadListToolbar(props: {
44 const listFocused =
45 homeFocused && (workspace === null || workspace.state.selectedTab === "threads");
46 const { fabSize } = useAndroidControlSizing();
47 - const { height: toolbarHeight, ...headerPadding } = useMaterialToolbarLayout();
47 + const { height: toolbarHeight, ...headerPadding } = useToolbarLayout();
48 const { state } = useWorkspaceState();
49 const { onRequestVisibility, onSearchQueryChange } = props;
50 const searchRef = useRef<TextInputInstance>(null);
@@ -152,11 +152,7 @@ export function MaterialThreadListToolbar(props: {
152 >
153 <AndroidAnchoredMenu actions={props.filterActions} onPressAction={props.onFilterAction}>
154 {(open) => (
155 - <MaterialFloatingActionButton
156 - label="Filter threads"
157 - icon={filterIcon}
158 - onPress={open}
159 - />
155 + <FloatingActionButton label="Filter threads" icon={filterIcon} onPress={open} />
156 )}
157 </AndroidAnchoredMenu>
158 </View>
apps/mobile/src/features/home/fab-scroll.test.ts new
+40
@@ -0,0 +1,40 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { updateFabScroll, type FabScrollState } from "./fab-scroll";
4 +
5 +describe("Material FAB scroll direction", () => {
6 + const initial: FabScrollState = { anchor: 0, expanded: true };
7 +
8 + it("shrinks scrolling down and expands scrolling up without returning to the top", () => {
9 + const collapsed = updateFabScroll(initial, 80, 500);
10 + expect(collapsed.expanded).toBe(false);
11 + const lower = updateFabScroll(collapsed, 180, 500);
12 + expect(lower.expanded).toBe(false);
13 + expect(updateFabScroll(lower, 160, 500).expanded).toBe(true);
14 + });
15 +
16 + it("accumulates travel but ignores jitter around a direction change", () => {
17 + let state = updateFabScroll(initial, 10, 500);
18 + expect(state.expanded).toBe(true);
19 + state = updateFabScroll(state, 14, 500);
20 + expect(state.expanded).toBe(false);
21 + state = updateFabScroll(state, 100, 500);
22 + state = updateFabScroll(state, 95, 500);
23 + state = updateFabScroll(state, 98, 500);
24 + expect(state.expanded).toBe(false);
25 + expect(updateFabScroll(state, 88, 500).expanded).toBe(true);
26 + });
27 +
28 + it("does not expand from bottom bounce or collapse from top bounce", () => {
29 + const bottom = updateFabScroll(initial, 500, 500);
30 + const bounce = updateFabScroll(bottom, 560, 500);
31 + expect(updateFabScroll(bounce, 500, 500).expanded).toBe(false);
32 + expect(updateFabScroll(initial, -50, 500)).toEqual(initial);
33 + });
34 +
35 + it("expands near the top and when filtering leaves a non-scrollable list", () => {
36 + const collapsed = updateFabScroll(initial, 80, 500);
37 + expect(updateFabScroll(collapsed, 5, 500).expanded).toBe(true);
38 + expect(updateFabScroll(collapsed, 80, -20)).toEqual(initial);
39 + });
40 +});
apps/mobile/src/features/home/fab-scroll.ts renamed
+4 -4
@@ -1,14 +1,14 @@
1 -export interface MaterialFabScrollState {
1 +export interface FabScrollState {
2 readonly anchor: number;
3 readonly expanded: boolean;
4 }
5
6 /** Ignore small direction changes and overscroll; always show the label at the top. */
7 -export function updateMaterialFabScroll(
8 - state: MaterialFabScrollState,
7 +export function updateFabScroll(
8 + state: FabScrollState,
9 offset: number,
10 maxOffset: number,
11 -): MaterialFabScrollState {
11 +): FabScrollState {
12 const y = Math.max(0, Math.min(offset, Math.max(0, maxOffset)));
13 if (y <= 8) return { anchor: y, expanded: true };
14 const anchor = state.expanded ? Math.min(state.anchor, y) : Math.max(state.anchor, y);
apps/mobile/src/features/home/material-fab-scroll.test.ts deleted
-40
@@ -1,40 +0,0 @@
1 -import { describe, expect, it } from "vite-plus/test";
2 -
3 -import { updateMaterialFabScroll, type MaterialFabScrollState } from "./material-fab-scroll";
4 -
5 -describe("Material FAB scroll direction", () => {
6 - const initial: MaterialFabScrollState = { anchor: 0, expanded: true };
7 -
8 - it("shrinks scrolling down and expands scrolling up without returning to the top", () => {
9 - const collapsed = updateMaterialFabScroll(initial, 80, 500);
10 - expect(collapsed.expanded).toBe(false);
11 - const lower = updateMaterialFabScroll(collapsed, 180, 500);
12 - expect(lower.expanded).toBe(false);
13 - expect(updateMaterialFabScroll(lower, 160, 500).expanded).toBe(true);
14 - });
15 -
16 - it("accumulates travel but ignores jitter around a direction change", () => {
17 - let state = updateMaterialFabScroll(initial, 10, 500);
18 - expect(state.expanded).toBe(true);
19 - state = updateMaterialFabScroll(state, 14, 500);
20 - expect(state.expanded).toBe(false);
21 - state = updateMaterialFabScroll(state, 100, 500);
22 - state = updateMaterialFabScroll(state, 95, 500);
23 - state = updateMaterialFabScroll(state, 98, 500);
24 - expect(state.expanded).toBe(false);
25 - expect(updateMaterialFabScroll(state, 88, 500).expanded).toBe(true);
26 - });
27 -
28 - it("does not expand from bottom bounce or collapse from top bounce", () => {
29 - const bottom = updateMaterialFabScroll(initial, 500, 500);
30 - const bounce = updateMaterialFabScroll(bottom, 560, 500);
31 - expect(updateMaterialFabScroll(bounce, 500, 500).expanded).toBe(false);
32 - expect(updateMaterialFabScroll(initial, -50, 500)).toEqual(initial);
33 - });
34 -
35 - it("expands near the top and when filtering leaves a non-scrollable list", () => {
36 - const collapsed = updateMaterialFabScroll(initial, 80, 500);
37 - expect(updateMaterialFabScroll(collapsed, 5, 500).expanded).toBe(true);
38 - expect(updateMaterialFabScroll(collapsed, 80, -20)).toEqual(initial);
39 - });
40 -});
apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
+4 -4
@@ -2,8 +2,8 @@ import { SymbolView } from "../../components/AppSymbol";
2 import { Platform, Pressable, View } from "react-native";
3
4 import { AppText as Text } from "../../components/AppText";
5 -import { MaterialNewThreadButton } from "../../components/MaterialNewThreadButton";
6 -import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
5 +import { NewThreadButton } from "../../components/NewThreadButton";
6 +import { FloatingActionButton } from "../../components/FloatingActionButton";
7 import { EmptyState } from "../../components/EmptyState";
8
9 export function WorkspaceEmptyDetail(props: {
@@ -25,7 +25,7 @@ export function WorkspaceEmptyDetail(props: {
25 detail="Add an environment to load projects and start coding sessions."
26 variant="plain"
27 action={
28 - <MaterialFloatingActionButton
28 + <FloatingActionButton
29 label="Add environment"
30 icon="plus"
31 variant="extended"
@@ -51,7 +51,7 @@ export function WorkspaceEmptyDetail(props: {
51 </Text>
52 {props.onStartNewTask ? (
53 Platform.OS === "android" ? (
54 - <MaterialNewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
54 + <NewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
55 ) : (
56 <Pressable
57 accessibilityRole="button"
apps/mobile/src/features/projects/AddProjectScreen.test.ts
+1 -1
@@ -24,7 +24,7 @@ vi.mock("react", async (importOriginal) => ({
24 useRef: (current: unknown) => ({ current }),
25 useEffect: () => {},
26 }));
27 -vi.mock("../../components/MaterialListRow", () => ({ MaterialListRow: "MaterialListRow" }));
27 +vi.mock("../../components/NavigationRow", () => ({ NavigationRow: "NavigationRow" }));
28 vi.mock("../../components/Button", () => ({ Button: "Button" }));
29 vi.mock("../../components/ScreenScrollView", () => ({ ScreenScrollView: "ScrollView" }));
30 vi.mock("../settings/components/SettingsScreen", () => ({ SettingsScreen: "SettingsScreen" }));
apps/mobile/src/features/projects/AddProjectScreen.tsx
+2 -2
@@ -1,5 +1,5 @@
1 import { AppActivityIndicator } from "../../components/AppActivityIndicator";
2 -import { MaterialListRow } from "../../components/MaterialListRow";
2 +import { NavigationRow } from "../../components/NavigationRow";
3 import { SettingsScreen } from "../settings/components/SettingsScreen";
4 import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
5 import { Button } from "../../components/Button";
@@ -201,7 +201,7 @@ function ListRow(props: {
201 }) {
202 if (Platform.OS === "android") {
203 return (
204 - <MaterialListRow
204 + <NavigationRow
205 className="bg-grouped-card"
206 title={props.title}
207 subtitle={props.subtitle}
apps/mobile/src/features/pull-requests/MaterialFloatingToolbar.tsx deleted
-5
@@ -1,5 +0,0 @@
1 -import type { ReactElement } from "react";
2 -
3 -export function MaterialFloatingToolbar(props: { readonly children: ReactElement }) {
4 - return props.children;
5 -}
apps/mobile/src/features/pull-requests/PullRequestControls.tsx
+3 -3
@@ -9,7 +9,7 @@ import { AppText as Text } from "../../components/AppText";
9 import { SymbolView, type AppSymbolName } from "../../components/AppSymbol";
10 import { Button } from "../../components/Button";
11 import { IconButton } from "../../components/IconButton";
12 -import { MaterialFloatingToolbar } from "./MaterialFloatingToolbar";
12 +import { Toolbar } from "../../components/Toolbar";
13 import { Menu } from "../../components/Menu";
14 import { NativeHeaderToolbar } from "../../native/StackHeader";
15 import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
@@ -151,7 +151,7 @@ export function PullRequestActionToolbar(props: {
151 style={{ paddingBottom: insets.bottom + 16 }}
152 onLayout={(event) => props.onHeightChange?.(event.nativeEvent.layout.height)}
153 >
154 - <MaterialFloatingToolbar>
154 + <Toolbar>
155 <View className="flex-row items-center gap-2">
156 {showAgentControls ? (
157 <Menu
@@ -185,7 +185,7 @@ export function PullRequestActionToolbar(props: {
185 ) : null}
186 <IconButton icon="file.diff" accessibilityLabel="Changed files" onPress={openFiles} />
187 </View>
188 - </MaterialFloatingToolbar>
188 + </Toolbar>
189 </View>
190 );
191 }
apps/mobile/src/features/pull-requests/PullRequestSheetContent.tsx
+3 -3
@@ -6,7 +6,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
6 import { AppText as Text } from "../../components/AppText";
7 import { AndroidSheetHeader } from "../../components/AndroidScreenHeader";
8 import { IconButton } from "../../components/IconButton";
9 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
9 +import { ScreenContent } from "../../components/ScreenContent";
10 import { ControlPill } from "../../components/ControlPill";
11 import { NativeStackScreenOptions } from "../../native/StackHeader";
12
@@ -67,7 +67,7 @@ export function PullRequestSheetContent(props: {
67 <View className="w-11" />
68 </View>
69 )}
70 - <MaterialScreenContent fitToContents={fitToContents}>
70 + <ScreenContent fitToContents={fitToContents}>
71 {props.scrollable === false ? (
72 <View className="flex-1" pointerEvents={props.busy ? "none" : "auto"}>
73 {props.children}
@@ -92,7 +92,7 @@ export function PullRequestSheetContent(props: {
92 )}
93
94 {!android || props.scrollable === false ? footer : null}
95 - </MaterialScreenContent>
95 + </ScreenContent>
96 </>
97 );
98 return (
apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx renamed
+1 -1
@@ -9,7 +9,7 @@ import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands
9 import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
10
11 /** PR search shares the thread list's native Android header placement. */
12 -export function MaterialPullRequestToolbar(props: { readonly onRequestVisibility?: () => void }) {
12 +export function PullRequestToolbar(props: { readonly onRequestVisibility?: () => void }) {
13 const navigation = useNavigation();
14 const workspace = useWorkspaceTabs()!;
15 const { dispatch, getScrollOffset, recordScrollOffset, isTabActive } = workspace;
apps/mobile/src/features/review/ReviewSheet.tsx
+8 -11
@@ -3,8 +3,8 @@ import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
3 import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
4 import { AppActivityIndicator } from "../../components/AppActivityIndicator";
5 import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
6 -import { ScreenHeader } from "../../components/ScreenHeader";
7 -import type { ScreenHeaderMenuItem } from "../../components/ScreenHeader.types";
6 +import { AppBar } from "../../components/AppBar";
7 +import type { AppBarMenuItem } from "../../components/AppBar.types";
8 import type { ReviewSectionItem } from "./reviewModel";
9 import { useReviewHeaderPresentation } from "./useReviewHeaderPresentation";
10 import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
@@ -35,7 +35,7 @@ import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics
35 import { AppText as Text } from "../../components/AppText";
36 import { SymbolView } from "../../components/AppSymbol";
37 import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
38 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
38 +import { ScreenContent } from "../../components/ScreenContent";
39 import { cn } from "../../lib/cn";
40 import { environmentCatalog } from "../../connection/catalog";
41 import { useEnvironmentPresentation } from "../../state/presentation";
@@ -82,10 +82,7 @@ function ReviewHeader(
82 ) {
83 const { panes, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
84 const presentation = useReviewHeaderPresentation(props);
85 - const sectionAction = (
86 - section: ReviewSectionItem | null,
87 - title: string,
88 - ): ScreenHeaderMenuItem => ({
85 + const sectionAction = (section: ReviewSectionItem | null, title: string): AppBarMenuItem => ({
86 id: section ? `section:${section.id}` : `unavailable:${title}`,
87 title,
88 disabled: section === null,
@@ -95,7 +92,7 @@ function ReviewHeader(
92 },
93 });
94 return (
98 - <ScreenHeader
95 + <AppBar
96 title={presentation.title}
97 subtitle={presentation.subtitle}
98 onBack={props.onReturnToThread}
@@ -439,7 +436,7 @@ function ReviewFileNavigator({
436 </View>
437 </View>
438 )}
442 - <MaterialScreenContent insetHorizontal>{fileList}</MaterialScreenContent>
439 + <ScreenContent insetHorizontal>{fileList}</ScreenContent>
440 </View>
441 );
442 }
@@ -738,7 +735,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
735 onReturnToThread={handleReturnToThread}
736 />
737
741 - <MaterialScreenContent>
738 + <ScreenContent>
739 <View className="flex-1 bg-sheet android:bg-sheet-solid">
740 {showConnectionNotice ? (
741 <View className="flex-1" style={{ paddingTop: topContentInset }}>
@@ -920,7 +917,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
917 onClear={commentSelection.clearSelection}
918 />
919 </View>
923 - </MaterialScreenContent>
920 + </ScreenContent>
921 </>
922 );
923 }
apps/mobile/src/features/review/useReviewHeaderPresentation.tsx
+3 -3
@@ -6,15 +6,15 @@ import { vcsEnvironment } from "../../state/vcs";
6 import { useThreadGitMenuDefinition } from "../threads/ThreadGitControls";
7 import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
8 import type { ReviewSectionItem } from "./reviewModel";
9 -import type { ScreenHeaderMenuItem, ScreenHeaderMenu } from "../../components/ScreenHeader.types";
9 +import type { AppBarMenuItem, AppBarMenu } from "../../components/AppBar.types";
10 import type { AppSymbolName } from "../../components/AppSymbol";
11
12 interface ReviewHeaderPresentation {
13 readonly title: string;
14 readonly subtitle: string;
15 - readonly gitMenu: ScreenHeaderMenu | null;
15 + readonly gitMenu: AppBarMenu | null;
16 readonly menuIcon: AppSymbolName;
17 - readonly refreshAction?: ScreenHeaderMenuItem;
17 + readonly refreshAction?: AppBarMenuItem;
18 }
19
20 export function useReviewHeaderPresentation(props: {
apps/mobile/src/features/settings/components/SettingsScreen.tsx
+5 -5
@@ -2,14 +2,14 @@ import { useNavigation } from "@react-navigation/native";
2 import type { ReactNode } from "react";
3 import { Platform, View } from "react-native";
4
5 -import type { ScreenHeaderProps } from "../../../components/ScreenHeader.types";
6 -import { ScreenHeader } from "../../../components/ScreenHeader";
7 -import { MaterialScreenContent as SettingsScreenContent } from "../../../components/MaterialScreenContent";
5 +import type { AppBarProps } from "../../../components/AppBar.types";
6 +import { AppBar } from "../../../components/AppBar";
7 +import { ScreenContent as SettingsScreenContent } from "../../../components/ScreenContent";
8
9 export { SettingsScreenContent };
10
11 export function SettingsScreen(
12 - props: Pick<ScreenHeaderProps, "title" | "actions" | "trailing"> & {
12 + props: Pick<AppBarProps, "title" | "actions" | "trailing"> & {
13 readonly children: ReactNode;
14 /** A native form sheet already owns its rounded outer frame. */
15 readonly formSheet?: boolean;
@@ -19,7 +19,7 @@ export function SettingsScreen(
19
20 return (
21 <View collapsable={false} className="flex-1 bg-sheet">
22 - <ScreenHeader
22 + <AppBar
23 title={props.title}
24 actions={props.actions}
25 trailing={Platform.OS === "android" ? props.trailing : undefined}
apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+5 -5
@@ -8,7 +8,7 @@ import {
8 } from "@t3tools/contracts";
9 import { type KnownTerminalSession } from "@t3tools/client-runtime/state/terminal";
10 import { SymbolView } from "../../components/AppSymbol";
11 -import { ScreenHeader } from "../../components/ScreenHeader";
11 +import { AppBar } from "../../components/AppBar";
12 import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
13 import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
14 import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -34,7 +34,7 @@ import {
34 import { EmptyState } from "../../components/EmptyState";
35 import { GlassSurface } from "../../components/GlassSurface";
36 import { LoadingScreen } from "../../components/LoadingScreen";
37 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
37 +import { ScreenContent } from "../../components/ScreenContent";
38 import { Button } from "../../components/Button";
39 import { IconButton } from "../../components/IconButton";
40 import { environmentCatalog } from "../../connection/catalog";
@@ -109,7 +109,7 @@ function TerminalHeader(props: {
109 readonly onSelectTerminal: (terminalId: string) => void;
110 }) {
111 return (
112 - <ScreenHeader
112 + <AppBar
113 title="Terminal"
114 subtitle={props.subtitle}
115 onBack={props.onCloseTerminal}
@@ -1196,7 +1196,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
1196 onSelectTerminal={handleSelectTerminal}
1197 />
1198
1199 - <MaterialScreenContent>
1199 + <ScreenContent>
1200 <View
1201 className="flex-1"
1202 style={{
@@ -1411,7 +1411,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
1411 </>
1412 )}
1413 </View>
1414 - </MaterialScreenContent>
1414 + </ScreenContent>
1415 </>
1416 );
1417 }
apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
+6 -6
@@ -1,5 +1,5 @@
1 import { AppActivityIndicator } from "../../components/AppActivityIndicator";
2 -import { MaterialListRow } from "../../components/MaterialListRow";
2 +import { NavigationRow } from "../../components/NavigationRow";
3 import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
4 import { shouldCheckoutNewTaskBranch } from "./new-task-context-presentation";
5 import type { VcsRef } from "@t3tools/client-runtime/state/vcs";
@@ -16,7 +16,7 @@ import { Alert, Platform, Pressable, ScrollView, TextInput, View } from "react-n
16 import { useSafeAreaInsets } from "react-native-safe-area-context";
17
18 import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
19 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
19 +import { ScreenContent } from "../../components/ScreenContent";
20 import { SymbolView } from "../../components/AppSymbol";
21 import { AppText as Text } from "../../components/AppText";
22 import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
@@ -46,7 +46,7 @@ function SelectionRow(props: {
46 }) {
47 if (Platform.OS === "android") {
48 return (
49 - <MaterialListRow
49 + <NavigationRow
50 className="bg-grouped-card"
51 title={props.title}
52 subtitle={props.subtitle}
@@ -215,7 +215,7 @@ export function NewTaskEnvironmentPickerRouteScreen() {
215 onBack={() => navigation.goBack()}
216 />
217 ) : null}
218 - <MaterialScreenContent>
218 + <ScreenContent>
219 <ScrollView
220 contentInsetAdjustmentBehavior="automatic"
221 contentContainerStyle={{
@@ -252,7 +252,7 @@ export function NewTaskEnvironmentPickerRouteScreen() {
252 ))}
253 </PickerSurface>
254 </ScrollView>
255 - </MaterialScreenContent>
255 + </ScreenContent>
256 </View>
257 );
258 }
@@ -553,7 +553,7 @@ export function BranchPickerScreen(props: {
553 value={props.query}
554 />
555 </View>
556 - <MaterialScreenContent>{branchContent}</MaterialScreenContent>
556 + <ScreenContent>{branchContent}</ScreenContent>
557 </View>
558 );
559 }
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+3 -3
@@ -51,7 +51,7 @@ import {
51 ComposerToolbarRow,
52 } from "../../components/ComposerToolbar";
53 import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
54 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
54 +import { ScreenContent } from "../../components/ScreenContent";
55 import { ComposerAttachmentButton } from "../../components/ComposerAttachmentButton";
56 import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
57 import { composerStripAttachments } from "../../lib/composerImages";
@@ -1872,7 +1872,7 @@ export function NewTaskDraftScreen(props: {
1872 <View className="flex-1 bg-sheet" collapsable={false}>
1873 <NativeStackScreenOptions options={{ headerShown: false }} />
1874 <AndroidScreenHeader title="New thread" hideBottomBorder onBack={closeNewTask} />
1875 - <MaterialScreenContent>
1875 + <ScreenContent>
1876 {heroViewport}
1877
1878 <KeyboardStickyView
@@ -1881,7 +1881,7 @@ export function NewTaskDraftScreen(props: {
1881 >
1882 {composerDock}
1883 </KeyboardStickyView>
1884 - </MaterialScreenContent>
1884 + </ScreenContent>
1885 </View>
1886 );
1887 }
apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+8 -8
@@ -1,6 +1,6 @@
1 import { AppActivityIndicator } from "../../components/AppActivityIndicator";
2 -import { MaterialListRow } from "../../components/MaterialListRow";
3 -import { ScreenHeader } from "../../components/ScreenHeader";
2 +import { NavigationRow } from "../../components/NavigationRow";
3 +import { AppBar } from "../../components/AppBar";
4 import {
5 StackActions,
6 useIsFocused,
@@ -19,7 +19,7 @@ import { useEffect, useRef, useState } from "react";
19 import { Alert, Platform, Pressable, View } from "react-native";
20 import { useSafeAreaInsets } from "react-native-safe-area-context";
21 import { cn } from "../../lib/cn";
22 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
22 +import { ScreenContent } from "../../components/ScreenContent";
23 import { Button } from "../../components/Button";
24 import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
25 import { AppText as Text } from "../../components/AppText";
@@ -111,7 +111,7 @@ function NewTaskHeader(props: {
111 const navigation = useNavigation();
112 const { layout } = useAdaptiveWorkspaceLayout();
113 return (
114 - <ScreenHeader
114 + <AppBar
115 title={props.title}
116 subtitle={props.subtitle ?? undefined}
117 sidebar={false}
@@ -302,7 +302,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
302 onSearchTextChange={setSearchText}
303 />
304
305 - <MaterialScreenContent>
305 + <ScreenContent>
306 <ScrollView
307 contentInsetAdjustmentBehavior="automatic"
308 showsVerticalScrollIndicator={false}
@@ -322,7 +322,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
322 {canStartScratch && listScopes.length > 0 ? (
323 Platform.OS === "android" ? (
324 <View collapsable={false} className="overflow-hidden rounded-[28px] bg-grouped-card">
325 - <MaterialListRow
325 + <NavigationRow
326 className="bg-grouped-card"
327 title="No project"
328 subtitle="Start a task without a project"
@@ -463,7 +463,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
463 );
464 if (Platform.OS === "android") {
465 return (
466 - <MaterialListRow
466 + <NavigationRow
467 className="bg-grouped-card"
468 key={scope.key}
469 title={scope.title}
@@ -538,7 +538,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
538 </View>
539 )}
540 </ScrollView>
541 - </MaterialScreenContent>
541 + </ScreenContent>
542 </View>
543 );
544 }
apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
+2 -4
@@ -22,7 +22,7 @@ import { useUniwindTheme } from "../../lib/useUniwindTheme";
22 import { environmentThreadDetails } from "../../state/threads";
23 import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
24 import { SubagentRow } from "./SubagentRow";
25 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
25 +import { ScreenContent } from "../../components/ScreenContent";
26 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
27
28 const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
@@ -127,9 +127,7 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
127 <View collapsable={false} className="flex-1 bg-sheet">
128 <NativeStackScreenOptions options={{ sheetCornerRadius: 28 }} />
129 <AndroidSheetHeader title="Agents" onBack={() => navigation.goBack()} />
130 - <MaterialScreenContent insetHorizontal={layout.usesSplitView}>
131 - {content}
132 - </MaterialScreenContent>
130 + <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
131 </View>
132 );
133 }
apps/mobile/src/features/threads/ThreadGitControls.tsx
+3 -3
@@ -1,6 +1,6 @@
1 import { useOpenPullRequest } from "../../native/useOpenPullRequest";
2 import { createNativeHeaderMenu } from "../../components/nativeHeaderMenu.ios";
3 -import type { ScreenHeaderMenu } from "../../components/ScreenHeader.types";
3 +import type { AppBarMenu } from "../../components/AppBar.types";
4 import {
5 AuthSourceControlWriteScope,
6 EnvironmentId,
@@ -551,14 +551,14 @@ export function ThreadGitMenu(props: ThreadGitMenuProps) {
551 }
552
553 /** Returns menu data because native toolbars serialize direct items rather than rendering component children. */
554 -export function useThreadGitMenuDefinition(props: ThreadGitMenuProps): ScreenHeaderMenu | null {
554 +export function useThreadGitMenuDefinition(props: ThreadGitMenuProps): AppBarMenu | null {
555 return threadGitMenuDefinition(props, useThreadGitControlModel(props));
556 }
557
558 function threadGitMenuDefinition(
559 props: ThreadGitMenuProps,
560 model: ReturnType<typeof useThreadGitControlModel>,
561 -): ScreenHeaderMenu {
561 +): AppBarMenu {
562 return {
563 title: "Git controls",
564 icon: "point.topleft.down.curvedto.point.bottomright.up",
apps/mobile/src/features/threads/ThreadHeader.tsx
+5 -5
@@ -1,7 +1,7 @@
1 import { useMemo } from "react";
2 -import { ScreenHeader } from "../../components/ScreenHeader";
2 +import { AppBar } from "../../components/AppBar";
3 import { ScreenHeaderButton } from "../../components/ScreenHeaderButton";
4 -import type { ScreenHeaderAction } from "../../components/ScreenHeader.types";
4 +import type { AppBarAction } from "../../components/AppBar.types";
5 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
6 import type { ThreadInspectorMode } from "./thread-inspector-content-stack";
7 import { useThreadHeaderOptions } from "./useThreadHeaderOptions";
@@ -22,8 +22,8 @@ export function ThreadHeader(
22 const { layout, panes, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
23 const { onOpenTerminal, onMergeBack } = props.gitControls;
24 const native = useThreadHeaderOptions(props);
25 - const androidHeaderActions = useMemo<ReadonlyArray<ScreenHeaderAction>>(() => {
26 - const actions: ScreenHeaderAction[] = [];
25 + const androidHeaderActions = useMemo<ReadonlyArray<AppBarAction>>(() => {
26 + const actions: AppBarAction[] = [];
27 if (props.onReturnToThread) {
28 actions.push({
29 accessibilityLabel: "Return to chat",
@@ -76,7 +76,7 @@ export function ThreadHeader(
76
77 return (
78 <>
79 - <ScreenHeader
79 + <AppBar
80 title={props.title}
81 subtitle={props.subtitle}
82 sidebar={native.sidebar}
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+7 -7
@@ -50,9 +50,9 @@ import {
50 WorkspaceConnectionTitle,
51 } from "../home/WorkspaceConnectionTitle";
52 import { SidebarHeaderActions } from "./sidebar-header-actions";
53 -import { MaterialThreadListToolbar } from "../home/MaterialThreadListToolbar";
54 -import { useMaterialToolbarLayout } from "../../components/useMaterialToolbarLayout";
55 -import { useMaterialFabScroll } from "../home/MaterialFabScrollContext";
53 +import { ThreadListToolbar } from "../home/ThreadListToolbar";
54 +import { useToolbarLayout } from "../../components/useToolbarLayout";
55 +import { useFabScroll } from "../home/FabScrollContext";
56 import { SidebarFilterButton } from "./sidebar-filter-button";
57 import { createSidebarHeaderItems } from "./sidebar-native-header-items";
58 import { SidebarNavigationShell } from "./sidebar-navigation-shell";
@@ -556,7 +556,7 @@ function ThreadNavigationSidebarPane(
556 );
557
558 const [measuredHeaderHeight, setMeasuredHeaderHeight] = useState<number | null>(null);
559 - const { height, paddingTop, paddingBottom } = useMaterialToolbarLayout();
559 + const { height, paddingTop, paddingBottom } = useToolbarLayout();
560 // The sticky header (title row, search field, optional connection status)
561 // is measured so the list inset always matches its real height — no
562 // hardcoded per-variant constants.
@@ -591,9 +591,9 @@ function ThreadNavigationSidebarPane(
591 const handleScrollBeginDrag = useCallback(() => {
592 openSwipeableRef.current?.close();
593 }, []);
594 - const onMaterialFabScroll = useMaterialFabScroll();
594 + const onFabScroll = useFabScroll();
595 const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({
596 - onScroll: onMaterialFabScroll,
596 + onScroll: onFabScroll,
597 onScrollBeginDrag: handleScrollBeginDrag,
598 });
599 // The sticky header's project shells and search maps feed row props, so
@@ -1036,7 +1036,7 @@ function ThreadNavigationSidebarPane(
1036 </View>
1037
1038 {Platform.OS === "android" ? (
1039 - <MaterialThreadListToolbar
1039 + <ThreadListToolbar
1040 sidebar
1041 onLayout={handleStickyHeaderLayout}
1042 searchQuery={props.searchQuery}
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+2 -4
@@ -19,7 +19,7 @@ import { AndroidSheetHeader } from "../../components/AndroidScreenHeader";
19 import { AppText as Text } from "../../components/AppText";
20 import { SymbolView } from "../../components/AppSymbol";
21 import { Menu } from "../../components/Menu";
22 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
22 +import { ScreenContent } from "../../components/ScreenContent";
23 import { scopedThreadKey } from "../../lib/scopedEntities";
24 import { useUniwindTheme } from "../../lib/useUniwindTheme";
25 import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
@@ -459,9 +459,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
459 <View collapsable={false} className="flex-1 bg-sheet">
460 <NativeStackScreenOptions options={{ sheetCornerRadius: 28 }} />
461 <AndroidSheetHeader title="Queued" onBack={() => navigation.goBack()} />
462 - <MaterialScreenContent insetHorizontal={layout.usesSplitView}>
463 - {content}
464 - </MaterialScreenContent>
462 + <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
463 </View>
464 </GestureHandlerRootView>
465 );
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+2 -2
@@ -3,7 +3,7 @@ import { makeTurnCommandMetadata } from "../../lib/commandMetadata";
3 import { buildProjectThreadStartTurnInput } from "../../lib/projectThreadStartTurn";
4 import { useWorktreeSetup } from "./use-worktree-setup";
5 import { worktreeSetupAgentStarted } from "@t3tools/client-runtime/worktree-setup";
6 -import { ScreenHeader } from "../../components/ScreenHeader";
6 +import { AppBar } from "../../components/AppBar";
7 import {
8 StackActions,
9 useFocusEffect,
@@ -126,7 +126,7 @@ function ThreadRouteFallbackLayout(props: { readonly children: ReactNode }) {
126
127 return (
128 <>
129 - <ScreenHeader
129 + <AppBar
130 title="Thread"
131 options={{ contentStyle: { backgroundColor: themeVariables["--color-header"] } }}
132 onBack={layout.usesSplitView ? undefined : returnToList}
apps/mobile/src/features/threads/ThreadSettingsRows.android.tsx
+3 -3
@@ -1,4 +1,4 @@
1 -import { MaterialRadioIndicator } from "../../components/MaterialRadioIndicator";
1 +import { RadioIndicator } from "../../components/RadioIndicator";
2 import {
3 ModelRowContent,
4 ChoiceRowContent,
@@ -13,7 +13,7 @@ export function ModelRow(props: ModelRowProps) {
13 labelNumberOfLines={2}
14 minimumHeight={56}
15 selectedClassName={props.selected ? "bg-secondary" : undefined}
16 - leadingSelection={<MaterialRadioIndicator selected={props.selected} />}
16 + leadingSelection={<RadioIndicator selected={props.selected} />}
17 />
18 );
19 }
@@ -23,7 +23,7 @@ export function ChoiceRow(props: ChoiceRowProps) {
23 <ChoiceRowContent
24 {...props}
25 minimumHeight={56}
26 - leadingSelection={<MaterialRadioIndicator selected={props.selected} />}
26 + leadingSelection={<RadioIndicator selected={props.selected} />}
27 />
28 );
29 }
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+5 -5
@@ -78,7 +78,7 @@ import { environmentServerConfigsAtom, serverEnvironment } from "../../state/ser
78 import { mobilePreferencesAtom } from "../../state/preferences";
79 import { useAtomCommand } from "../../state/use-atom-command";
80 import { useNewTaskFlow } from "./new-task-flow-provider";
81 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
81 +import { ScreenContent } from "../../components/ScreenContent";
82 import {
83 createProviderCatalogRefreshRunner,
84 providerCatalogRefreshError,
@@ -1409,7 +1409,7 @@ function ThreadSettingsModelsScreen() {
1409 : undefined,
1410 }}
1411 />
1412 - <MaterialScreenContent>
1412 + <ScreenContent>
1413 <ThreadSettingsMainContent
1414 onOpenSubmenu={(submenu) => {
1415 const title =
@@ -1421,7 +1421,7 @@ function ThreadSettingsModelsScreen() {
1421 navigation.navigate("ThreadSettingsChoice", { ...submenu, title });
1422 }}
1423 />
1424 - </MaterialScreenContent>
1424 + </ScreenContent>
1425 <NativeHeaderToolbar placement="left">
1426 <NativeHeaderToolbar.Button
1427 accessibilityLabel="Cancel thread settings"
@@ -1501,12 +1501,12 @@ function ThreadSettingsChoiceScreen() {
1501 hideBottomBorder
1502 />
1503 ) : null}
1504 - <MaterialScreenContent>
1504 + <ScreenContent>
1505 <ThreadSettingsChoiceContent
1506 submenu={route.params}
1507 onSelected={() => navigation.goBack()}
1508 />
1509 - </MaterialScreenContent>
1509 + </ScreenContent>
1510 </>
1511 );
1512 }
apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
+3 -3
@@ -5,7 +5,7 @@ import { Platform, Pressable, ScrollView, useWindowDimensions, View } from "reac
5 import { useSafeAreaInsets } from "react-native-safe-area-context";
6
7 import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
8 -import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
8 +import { ScreenContent } from "../../../components/ScreenContent";
9 import { NativeStackScreenOptions } from "../../../native/StackHeader";
10 import { AppText as Text, AppTextInput as TextInput } from "../../../components/AppText";
11 import { cn } from "../../../lib/cn";
@@ -82,7 +82,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
82 hideBottomBorder
83 />
84 ) : null}
85 - <MaterialScreenContent fitToContents>
85 + <ScreenContent fitToContents>
86 <ScrollView
87 nestedScrollEnabled
88 className="android:shrink android:grow-0 ios:flex-1"
@@ -228,7 +228,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
228 })}
229 </View>
230 </ScrollView>
231 - </MaterialScreenContent>
231 + </ScreenContent>
232 </View>
233 );
234 }
apps/mobile/src/features/threads/git/GitCommitSheet.tsx
+3 -3
@@ -6,7 +6,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
6
7 import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
8 import { SymbolView } from "../../../components/AppSymbol";
9 -import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
9 +import { ScreenContent } from "../../../components/ScreenContent";
10 import { NativeStackScreenOptions } from "../../../native/StackHeader";
11 import { AppText as Text, AppTextInput as TextInput } from "../../../components/AppText";
12 import { cn } from "../../../lib/cn";
@@ -101,7 +101,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
101 hideBottomBorder
102 />
103 ) : null}
104 - <MaterialScreenContent fitToContents>
104 + <ScreenContent fitToContents>
105 <ScrollView
106 nestedScrollEnabled
107 className="android:shrink android:grow-0 ios:flex-1"
@@ -302,7 +302,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
302 </View>
303 </View>
304 </ScrollView>
305 - </MaterialScreenContent>
305 + </ScreenContent>
306 </View>
307 );
308 }
apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
+3 -3
@@ -9,7 +9,7 @@ import { Platform, ScrollView, useWindowDimensions, View } from "react-native";
9 import { useSafeAreaInsets } from "react-native-safe-area-context";
10
11 import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
12 -import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
12 +import { ScreenContent } from "../../../components/ScreenContent";
13 import { NativeStackScreenOptions } from "../../../native/StackHeader";
14 import { AppText as Text } from "../../../components/AppText";
15 import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions";
@@ -139,7 +139,7 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {
139 <View className="min-h-4 pt-2" />
140 )}
141
142 - <MaterialScreenContent fitToContents>
142 + <ScreenContent fitToContents>
143 <ScrollView
144 nestedScrollEnabled
145 className="android:shrink android:grow-0 ios:flex-1"
@@ -188,7 +188,7 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {
188 />
189 </View>
190 </ScrollView>
191 - </MaterialScreenContent>
191 + </ScreenContent>
192 </View>
193 );
194 }
apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+2 -4
@@ -29,7 +29,7 @@ import {
29 AndroidSheetHeader,
30 } from "../../../components/AndroidScreenHeader";
31 import { AndroidAnchoredMenu } from "../../../components/AndroidAnchoredMenu";
32 -import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
32 +import { ScreenContent } from "../../../components/ScreenContent";
33 import { useAdaptiveWorkspaceLayout } from "../../layout/AdaptiveWorkspaceLayout";
34 import { AppText as Text } from "../../../components/AppText";
35 import {
@@ -573,9 +573,7 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
573 />
574 )}
575
576 - <MaterialScreenContent insetHorizontal={layout.usesSplitView}>
577 - {content}
578 - </MaterialScreenContent>
576 + <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
577 </View>
578 );
579 }
apps/mobile/src/features/threads/useThreadHeaderOptions.test.tsx
+8
@@ -34,6 +34,14 @@ vi.mock("@react-navigation/native", () => {
34 vi.mock("../../native/useOpenPullRequest", () => ({ useOpenPullRequest: () => () => {} }));
35
36 vi.mock("../../state/session", () => ({ useEnvironmentScope: () => true }));
37 +vi.mock("../../components/AppBar", async () => {
38 + const { NativeStackScreenOptions } = await import("../../native/StackHeader");
39 + return {
40 + AppBar: (props: import("../../components/AppBar.types").AppBarProps) => (
41 + <NativeStackScreenOptions options={props.options} optionsVersion={props.optionsVersion} />
42 + ),
43 + };
44 +});
45 vi.mock("react-native", () => ({ Alert: { alert: () => {} }, Linking: {}, Platform: {} }));
46 vi.mock("../layout/AdaptiveWorkspaceLayout", () => ({
47 useAdaptiveWorkspaceLayout: () => ({
apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx
+5 -5
@@ -1,8 +1,8 @@
1 import { useMemo, type ReactNode } from "react";
2 import { View } from "react-native";
3 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
3 +import { ScreenContent } from "../../components/ScreenContent";
4 import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
5 -import { MaterialPullRequestToolbar } from "../pull-requests/MaterialPullRequestToolbar.android";
5 +import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
6 import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
7
8 export function AndroidWorkspaceSidebar(props: {
@@ -17,10 +17,10 @@ export function AndroidWorkspaceSidebar(props: {
17 ) : (
18 <WorkspaceTabsContext value={context}>
19 <View className="flex-1 bg-header">
20 - <MaterialPullRequestToolbar onRequestVisibility={props.onRequestVisibility} />
21 - <MaterialScreenContent insetHorizontal>
20 + <PullRequestToolbar onRequestVisibility={props.onRequestVisibility} />
21 + <ScreenContent insetHorizontal>
22 <PullRequestsScreen sidebar selectedPullRequestKey={props.selectedPullRequestKey} />
23 - </MaterialScreenContent>
23 + </ScreenContent>
24 </View>
25 </WorkspaceTabsContext>
26 );
apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx
+5 -5
@@ -4,11 +4,11 @@ import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area
4 import { NativeStackScreenOptions } from "../../native/StackHeader";
5 import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
6 import { EmptyState } from "../../components/EmptyState";
7 -import { MaterialScreenContent } from "../../components/MaterialScreenContent";
7 +import { ScreenContent } from "../../components/ScreenContent";
8 import { useAndroidControlSizing } from "../../components/useAndroidControlSizing";
9 import { HomeRouteScreen } from "../home/HomeRouteScreen";
10 import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
11 -import { MaterialPullRequestToolbar } from "../pull-requests/MaterialPullRequestToolbar.android";
11 +import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
12 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
13 import { AndroidWorkspaceNavigation } from "./AndroidWorkspaceNavigation";
14 import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
@@ -55,10 +55,10 @@ export function WorkspaceRootScreen() {
55 <HomeRouteScreen />
56 ) : (
57 <>
58 - <MaterialPullRequestToolbar />
59 - <MaterialScreenContent>
58 + <PullRequestToolbar />
59 + <ScreenContent>
60 <PullRequestsScreen />
61 - </MaterialScreenContent>
61 + </ScreenContent>
62 </>
63 )}
64 </View>