fix(mobile): add close controls to tablet files and terminal (#11115)
This commit is contained in:
1 parent
32b6909340
commit
47dbb06c3b
2 files changed
+42
-2
No files matched your search
@@ -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;
|
||||
@@ -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"];
|
||||
@@ -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 = (
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
@@ -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 ? (
|
||||
@@ -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={
|
||||
|
||||
Reference in new issue
Block a user