Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion apps/mobile/src/features/files/thread-file-navigator-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useEnvironmentQuery } from "../../state/query";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { FileTreeBrowser } from "./FileTreeBrowser";
import { preloadWorkspaceFileContents } from "./preload-workspace-file";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";

export function ThreadFileNavigatorPane(props: {
readonly cwd: string;
Expand All @@ -28,6 +29,7 @@ export function ThreadFileNavigatorPane(props: {
readonly onSelectFile: (path: string) => void;
}) {
const [searchQuery, setSearchQuery] = useState("");
const { toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
const { themeAppearance: highlightTheme } = useAppearancePreferences();
const theme = useUniwindTheme();
const foregroundColor = theme["--color-foreground"];
Expand Down Expand Up @@ -64,8 +66,18 @@ export function ThreadFileNavigatorPane(props: {
type: "button" as const,
width: 44,
},
{
accessibilityLabel: "Close files",
icon: { name: "xmark", type: "sfSymbol" as const },
identifier: "thread-file-navigator-close",
onPress: toggleAuxiliaryPane,
sharesBackground: false,
tintColor: foregroundColor,
type: "button" as const,
width: 44,
},
] as ComponentProps<typeof ScreenStackHeaderConfig>["headerRightBarButtonItems"],
[entriesQuery.refresh, foregroundColor],
[entriesQuery.refresh, foregroundColor, toggleAuxiliaryPane],
);

const fileTree = (
Expand Down Expand Up @@ -159,6 +171,15 @@ export function ThreadFileNavigatorPane(props: {
type="monochrome"
/>
</Pressable>
<Pressable
accessibilityRole="button"
accessibilityLabel="Close files"
hitSlop={8}
className="h-8 w-8 items-center justify-center rounded-full active:bg-subtle"
onPress={toggleAuxiliaryPane}
>
<SymbolView name="xmark" size={14} tintColorClassName="accent-icon-muted" />
</Pressable>
</View>
<View className="flex-row items-center gap-2 border-t border-border px-3 py-2">
<SymbolView
Expand Down
21 changes: 20 additions & 1 deletion apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,19 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
[navigation, selectedThread, terminalId],
);

const handleCloseTerminal = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack();
return;
}
navigation.dispatch(
StackActions.replace("Thread", {
environmentId: params.environmentId,
threadId: params.threadId,
}),
);
}, [navigation, params.environmentId, params.threadId]);

const navigateAwayAfterExit = useCallback(() => {
// With other shells still live, fall through to the previous one instead
// of dropping the user back on the thread.
Expand Down Expand Up @@ -1143,7 +1156,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
<AndroidScreenHeader
title="Terminal"
subtitle={headerSubtitle}
onBack={navigation.canGoBack() ? () => navigation.goBack() : undefined}
onBack={handleCloseTerminal}
trailing={
<>
{layout.usesSplitView ? (
Expand Down Expand Up @@ -1179,6 +1192,12 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)

{layout.usesSplitView ? (
<NativeHeaderToolbar placement="left">
<NativeHeaderToolbar.Button
accessibilityLabel="Close terminal"
icon="xmark"
onPress={handleCloseTerminal}
separateBackground
/>
<NativeHeaderToolbar.Button
accessibilityLabel={panes.primarySidebarVisible ? "Maximize terminal" : "Show threads"}
icon={
Expand Down
Loading