feat(mobile): tablet layout pass and foldable-ready size class (#2569)

The tablet ran the phone layout with a half-finished iPad draft on top: two
custom sidebars, a leftover overflow menu, split Files/Changes header buttons,
and phone-width sheets stretched across a 13" screen. This brings it onto the
phone's navigation model and keeps only the differences a large screen earns.

- Sessions are a persistent resizable left sidebar; the overflow menu is gone
  and its destinations moved into that sidebar's footer (connected instance,
  settings, pending web update) and into the workspace drawer.
- The workspace (Changes / Files / Terminal / Notes / MCP) is the phone's
  drawer everywhere: a resizable right sidebar where the screen can host one
  (up to 900px) and the full-cover drawer otherwise, with its mounted panes —
  an open diff, an edited file, an attached terminal — surviving rotation.
- Header dropdowns are anchored popovers: the recents switcher mirrors the
  usage overlay on the left, and its trigger is sized to the title rather than
  to the free width.
- App-level pages (settings, instances, update, an opened plan) render as
  centered dialogs instead of covering the screen.
- Overlays center on the chat column through published insets, so the model
  and directory pickers no longer sit off-centre; the directory picker also
  stops overriding the shared width clamp.
- Wide chat layout applies to mobile surfaces, where a tablet chat column is
  finally wide enough for the setting to mean anything.

The layout gate is a live size class rather than a device check, so Android
tablets and foldables are covered by the same code:

- `enabled` when the shortest viewport side is at le
  sw600dp). The short side is what makes this a size question instead of a
  device question — a phone reports ~360-430 whichev
  unfolded book foldable ~600+, and folding shut drops back under it. iPads
  also answer on identity, since iPadOS hands out od
- `roomyForPanels` when landscape and at least 1000px wide, which is what it
  takes to host the sidebar, the panel and a readabl
  foldables miss it in BOTH orientations — their long side is barely wider
  than a tablet's short one — so they keep the portr

Every consumer re-decides instead of remembering wha
open sidebar closes if the device folds shut under it. iPad behaviour is
unchanged: its landscape widths all clear the panel
ones do not, exactly as the previous orientation check did.

Hardware keyboards are read natively. iOS reports them through GCKeyboard,
published to the web layer at document start and kep
disconnect and foregrounding; the layer stops inferring once that answers. A
single early publish was not enough — the connect no
already-attached keyboard fires before the page exists, and GameController can
populate late — so the state is re-published across
resume. With a keyboard attached the draft screen keeps its starter chips and
the composer never collapses; tablets skip the colla
Runtimes with no native answer fall back to inferring it from the keyboard
bridge, and only ever conclude "hardware" from silen

Also: sidebar rows no longer sit on a differently ti
footer is no longer clipped by an over-tall content box, the resize handles
moved above the panes' own overlays so they can actu
now-unreachable overflow menu, fullscreen terminal/MCP/notes surfaces and their
locale key are deleted.

Device behaviour is unverified — the tablet layout,
keyboard bridge and the foldable size class have not been exercised on
hardware, and the 600/1000 thresholds are derived fr
rather than measured on a foldable.
This commit is contained in:
Bohdan Triapitsyn
2026-08-02 16:25:16 +03:00
committed by GitHub
parent 34d0ff7383
commit 96c011a8ef
32 changed files with 863 additions and 592 deletions
@@ -35,6 +35,18 @@ export type MobileFullscreenSurfaceProps = {
/** Drop the header's bottom divider (quiet single-page surfaces). */
noHeaderBorder?: boolean;
ariaLabel?: string;
/**
* `dialog` packs the same surface into a centered card over a scrim instead
* of covering the app. Tablets use it: a settings or instances page stretched
* across a 13" screen is mostly empty space, and losing the chat entirely for
* an app-level page is a heavier context switch than the content deserves.
*/
variant?: 'fullscreen' | 'dialog';
/**
* What the dialog centers on. App-level pages (settings, instances) belong to
* the whole window; content that came out of the chat column stays with it.
*/
dialogAlign?: 'chat' | 'app';
children: React.ReactNode;
};
@@ -51,6 +63,8 @@ export const MobileFullscreenSurface: React.FC<MobileFullscreenSurfaceProps> = (
headerless = false,
noHeaderBorder = false,
ariaLabel,
variant = 'fullscreen',
dialogAlign = 'chat',
children,
}) => {
const { t } = useI18n();
@@ -148,15 +162,29 @@ export const MobileFullscreenSurface: React.FC<MobileFullscreenSurfaceProps> = (
if (!open || !rootRef.current) return null;
return createPortal(
const isDialog = variant === 'dialog';
const surface = (
<section
ref={surfaceRef}
role="dialog"
aria-modal="true"
aria-label={ariaLabel}
tabIndex={-1}
className="oc-keyboard-inset-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground"
style={{
className={cn(
'flex flex-col bg-background text-foreground',
isDialog
? 'h-[min(88dvh,860px)] w-full max-w-[720px] overflow-hidden rounded-2xl border border-border/70 shadow-[0_24px_64px_rgb(0_0_0_/_0.32)]'
: 'oc-keyboard-inset-surface fixed inset-0 z-50',
)}
style={isDialog ? {
// Scale/fade instead of the push slide: the card is not a navigation
// step, and a settled `transform: none` keeps it off its own
// compositing layer (iOS clips those to the safe-area viewport).
opacity: entered ? 1 : 0,
transform: entered ? 'none' : 'scale(0.97)',
transition: `opacity ${ENTER_DURATION_MS}ms ease-out, transform ${ENTER_DURATION_MS}ms cubic-bezier(0.32, 0.72, 0, 1)`,
} : {
paddingTop: 'var(--oc-safe-area-top, 0px)',
// Push-style enter: slide in from the right edge; settled state drops
// the transform entirely so the surface isn't kept on a compositing
@@ -165,7 +193,7 @@ export const MobileFullscreenSurface: React.FC<MobileFullscreenSurfaceProps> = (
transition: `transform ${ENTER_DURATION_MS}ms cubic-bezier(0.32, 0.72, 0, 1)`,
}}
onTransitionEnd={(event) => {
// Reveal content exactly when the enter slide ends — not on a fixed timer.
// Reveal content exactly when the enter transition ends — not on a fixed timer.
if (entered && event.target === event.currentTarget && event.propertyName === 'transform') {
setContentReady(true);
}
@@ -214,7 +242,29 @@ export const MobileFullscreenSurface: React.FC<MobileFullscreenSurfaceProps> = (
) : null}
</div>
<style>{'@keyframes oc-surface-content-in { from { opacity: 0 } to { opacity: 1 } }'}</style>
</section>,
</section>
);
if (!isDialog) return createPortal(surface, rootRef.current);
return createPortal(
<div
className="oc-keyboard-inset-surface fixed inset-0 z-50 flex items-center justify-center p-4 transition-opacity duration-200 ease-out"
style={{
background: 'rgb(0 0 0 / 0.45)',
opacity: entered ? 1 : 0,
// 'chat' matches every other mobile overlay (the sessions sidebar keeps
// its width); 'app' ignores the panels and centers on the window.
paddingLeft: dialogAlign === 'chat' ? 'max(1rem, var(--oc-chat-inset-left, 0px))' : '1rem',
paddingRight: dialogAlign === 'chat' ? 'max(1rem, var(--oc-chat-inset-right, 0px))' : '1rem',
paddingTop: 'max(1rem, var(--oc-safe-area-top, 0px))',
}}
onClick={onClose}
>
<div className="flex w-full max-w-[720px] justify-center" onClick={(event) => event.stopPropagation()}>
{surface}
</div>
</div>,
rootRef.current,
);
};