Address iPad layout review feedback

This commit is contained in:
Julius Marminge committed 2026-06-27 11:23:12 -07:00
1 parent 7f81813feb
commit ea8339ec90
6 files changed
+54 -10

No files matched your search

@@ -12,6 +12,7 @@ import { requireNativeView } from "expo";
import { NativeViewResolutionError } from "../../native/nativeViewResolutionError";
const NATIVE_REVIEW_DIFF_MODULE_NAME = "T3ReviewDiffSurface";
const NATIVE_REVIEW_DIFF_PAYLOAD_RETRY_FRAMES = 60;
interface ExpoGlobalWithViewConfig {
readonly expo?: {
@@ -195,7 +196,7 @@ function useNativeReviewDiffPayload(
const view = nativeRef.current;
const command = view?.[method];
if (!view || !command) {
if (attempts < 4) {
if (attempts < NATIVE_REVIEW_DIFF_PAYLOAD_RETRY_FRAMES) {
attempts += 1;
frame = requestAnimationFrame(dispatch);
}
@@ -203,7 +204,11 @@ function useNativeReviewDiffPayload(
}
void command.call(view, payload).catch((error: unknown) => {
if (!cancelled && attempts < 4 && isPendingNativeViewRegistration(error)) {
if (
!cancelled &&
attempts < NATIVE_REVIEW_DIFF_PAYLOAD_RETRY_FRAMES &&
isPendingNativeViewRegistration(error)
) {
attempts += 1;
frame = requestAnimationFrame(dispatch);
return;
@@ -3,6 +3,7 @@ import type { WorkspaceState } from "../../state/workspaceModel";
export function shouldShowWorkspaceConnectionStatus(state: WorkspaceState): boolean {
return (
state.networkStatus === "offline" ||
state.connectionError !== null ||
state.hasConnectingEnvironment ||
(state.hasLoadedShellSnapshot && !state.hasReadyEnvironment)
);
@@ -32,7 +32,10 @@ import {
import { resolveThreadSelectionNavigationAction } from "../../lib/adaptive-navigation";
import { buildThreadRoutePath } from "../../lib/routes";
import { scopedThreadKey } from "../../lib/scopedEntities";
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
import {
parseActiveThreadPath,
useHardwareKeyboardCommand,
} from "../keyboard/hardwareKeyboardCommands";
import { HomeListOptionsProvider } from "../home/home-list-options";
import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
@@ -113,8 +116,10 @@ export function AdaptiveWorkspaceLayout(props: { readonly children: ReactNode })
layout,
viewportWidth: width,
preferredWidth: fileInspectorPreferredWidth ?? undefined,
reservedLeadingWidth:
layout.usesSplitView && primarySidebarPreferredVisible ? (layout.listPaneWidth ?? 0) : 0,
}),
[fileInspectorPreferredWidth, layout, width],
[fileInspectorPreferredWidth, layout, primarySidebarPreferredVisible, width],
);
const auxiliaryPaneRole: WorkspaceAuxiliaryPaneRole =
focusedAuxiliaryPaneRole ?? (/\/files(?:\/|$)/.test(pathname) ? "inspector" : "supplementary");
@@ -190,6 +195,14 @@ export function AdaptiveWorkspaceLayout(props: { readonly children: ReactNode })
}
setSupplementaryPanePreferredVisible(true);
}, []);
const handleOpenFilesCommand = useCallback(() => {
if (!layout.usesSplitView || !fileInspector.supported || !parseActiveThreadPath(pathname)) {
return false;
}
showAuxiliaryPane("inspector");
return true;
}, [fileInspector.supported, layout.usesSplitView, pathname, showAuxiliaryPane]);
useHardwareKeyboardCommand("files", handleOpenFilesCommand);
const toggleAuxiliaryPane = useCallback(() => {
if (auxiliaryPaneRole === "inspector") {
setFileInspectorPreferredVisible((current) => !current);
@@ -59,9 +59,9 @@ export function WorkspacePaneDivider(props: WorkspacePaneDividerProps) {
const handleAccessibilityAction = (event: AccessibilityActionEvent) => {
props.onResizeStart?.();
if (event.nativeEvent.actionName === "increment") {
props.onResizeBy(ACCESSIBILITY_RESIZE_STEP);
props.onResizeBy(ACCESSIBILITY_RESIZE_STEP * props.resizeDirection);
} else if (event.nativeEvent.actionName === "decrement") {
props.onResizeBy(-ACCESSIBILITY_RESIZE_STEP);
props.onResizeBy(-ACCESSIBILITY_RESIZE_STEP * props.resizeDirection);
}
props.onResizeEnd?.();
};
+20 -2
View File
@@ -164,7 +164,7 @@ describe("deriveWorkspacePaneLayout", () => {
contentPaneWidth: 1_024,
supportsAuxiliaryPane: true,
auxiliaryPaneVisible: true,
auxiliaryPaneWidth: 287,
auxiliaryPaneWidth: 260,
});
});
@@ -185,7 +185,25 @@ describe("deriveWorkspacePaneLayout", () => {
contentPaneWidth: 986,
supportsAuxiliaryPane: true,
auxiliaryPaneVisible: true,
auxiliaryPaneWidth: 320,
auxiliaryPaneWidth: 276,
});
});
it("keeps an explicitly hidden thread sidebar hidden when the file inspector is visible", () => {
const layout = deriveLayout({ width: 1_024, height: 1_366 });
expect(
deriveWorkspacePaneLayout({
layout,
viewportWidth: 1_024,
primarySidebarPreferredVisible: false,
auxiliaryPanePreferredVisible: true,
auxiliaryPaneRole: "inspector",
}),
).toMatchObject({
primarySidebarVisible: false,
primarySidebarSuppressedByAuxiliary: false,
auxiliaryPaneVisible: true,
});
});
+9 -2
View File
@@ -100,9 +100,11 @@ export function deriveWorkspacePaneLayout(input: {
layout: input.layout,
viewportWidth,
preferredWidth: input.auxiliaryPanePreferredWidth,
reservedLeadingWidth: preferredPrimarySidebarWidth,
});
const auxiliaryPaneVisible = fileInspector.supported && input.auxiliaryPanePreferredVisible;
const primarySidebarSuppressedByAuxiliary =
preferredPrimarySidebarVisible &&
auxiliaryPaneVisible &&
fileInspector.width !== null &&
input.layout.listPaneWidth !== null &&
@@ -151,8 +153,13 @@ export function deriveFileInspectorPaneLayout(input: {
readonly layout: Layout;
readonly viewportWidth: number;
readonly preferredWidth?: number;
readonly reservedLeadingWidth?: number;
}): FileInspectorPaneLayout {
const viewportWidth = Math.max(0, input.viewportWidth);
const reservedLeadingWidth = Number.isFinite(input.reservedLeadingWidth)
? Math.max(0, input.reservedLeadingWidth ?? 0)
: 0;
const availableContentWidth = Math.max(0, viewportWidth - reservedLeadingWidth);
const supported =
input.layout.usesSplitView && viewportWidth >= FILE_INSPECTOR_MIN_VIEWPORT_WIDTH;
@@ -163,11 +170,11 @@ export function deriveFileInspectorPaneLayout(input: {
preferredWidth:
input.preferredWidth ??
clamp(
Math.round(viewportWidth * 0.28),
Math.round(availableContentWidth * 0.28),
AUXILIARY_PANE_MIN_WIDTH,
AUXILIARY_PANE_DEFAULT_MAX_WIDTH,
),
availableWidth: viewportWidth,
availableWidth: availableContentWidth,
})
: null,
};