Skip to content

Commit bab41f6

Browse files
authored
Merge pull request #2711 from trycompai/fix/pentest-tablet-breakpoint
fix(pentest): tablet-friendly split-view (md → xl breakpoint)
2 parents 5627b12 + a87e1bf commit bab41f6

3 files changed

Lines changed: 29 additions & 25 deletions

File tree

apps/app/src/app/(app)/[orgId]/security/penetration-tests/_components/LoadingShell.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/**
22
* Shared loading skeleton for pentest routes. Mirrors the SplitView shell
3-
* one-to-one (full-bleed, 340px sidebar + main pane on desktop) so a hard
3+
* one-to-one (full-bleed, 340px sidebar + main pane at xl+) so a hard
44
* refresh transitions into the live page without a CLS jump.
55
*
6-
* On mobile (<md) only ONE pane is rendered, picked by `variant` to match
7-
* the route the user is hard-refreshing on:
6+
* Below xl (1280px) — phone, tablet, narrow laptop — only ONE pane is
7+
* rendered, picked by `variant` to match the route the user is
8+
* hard-refreshing on:
89
* - 'list' — only the sidebar shape
910
* - 'detail' — only the main pane shape
1011
* - 'create' — only the main pane shape
1112
*
12-
* Desktop always shows both. Pure JSX, no hooks — safe to consume from
13+
* xl+ always shows both. Pure JSX, no hooks — safe to consume from
1314
* server-component `loading.tsx` files.
1415
*/
1516
type Variant = 'list' | 'detail' | 'create';
@@ -28,8 +29,8 @@ export function LoadingShell({ variant, mainPane }: LoadingShellProps) {
2829
<div className="flex h-[calc(100vh-4rem)] min-h-0 -m-4 md:-m-6">
2930
<aside
3031
className={[
31-
'flex h-full min-h-0 w-full md:w-[340px] md:shrink-0 flex-col border-r border-border bg-background',
32-
showSidebarMobile ? 'flex' : 'hidden md:flex',
32+
'flex h-full min-h-0 w-full xl:w-[340px] xl:shrink-0 flex-col border-r border-border bg-background',
33+
showSidebarMobile ? 'flex' : 'hidden xl:flex',
3334
].join(' ')}
3435
aria-hidden
3536
>
@@ -59,16 +60,16 @@ export function LoadingShell({ variant, mainPane }: LoadingShellProps) {
5960
<main
6061
className={[
6162
'min-w-0 flex-1 flex-col',
62-
showMainMobile ? 'flex' : 'hidden md:flex',
63+
showMainMobile ? 'flex' : 'hidden xl:flex',
6364
].join(' ')}
6465
>
65-
{/* Mobile-only back-bar skeleton on non-list routes. Matches the
66-
"← Scans" bar that SplitView renders on detail/create URLs
67-
below md — without this placeholder, resolving the page
68-
shifts the main content down ~33px when the real bar mounts. */}
66+
{/* Back-bar skeleton on non-list routes. Matches the "← Scans"
67+
bar SplitView renders on detail/create URLs below xl —
68+
without this placeholder, resolving the page shifts the
69+
main content down ~33px when the real bar mounts. */}
6970
{variant !== 'list' && (
7071
<div
71-
className="md:hidden flex items-center border-b border-border bg-background px-3 py-2"
72+
className="xl:hidden flex items-center border-b border-border bg-background px-3 py-2"
7273
aria-hidden
7374
>
7475
<div className="h-4 w-16 rounded bg-muted animate-pulse" />

apps/app/src/app/(app)/[orgId]/security/penetration-tests/_components/RunList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function RunList({
3636
: 'No pentest runs remaining.'
3737
: 'Start a new scan';
3838
return (
39-
<aside className="flex h-full min-h-0 w-full md:w-[340px] md:shrink-0 flex-col border-r border-border bg-background">
39+
<aside className="flex h-full min-h-0 w-full xl:w-[340px] xl:shrink-0 flex-col border-r border-border bg-background">
4040
{/* Header — matches "Scans 6 Filter Sort" from the design */}
4141
<div className="flex items-center justify-between border-b border-border px-4 py-3">
4242
<button

apps/app/src/app/(app)/[orgId]/security/penetration-tests/_components/SplitView.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ export function SplitView({
133133
const goToList = () =>
134134
router.push(`/${orgId}/security/penetration-tests`);
135135

136-
// Mobile shows ONE pane at a time, picked from the URL. List on
137-
// `/pentests`, main pane on `/pentests/:id` and `/pentests/new`. Below
138-
// `md` we hide whichever isn't active so an IDE-style split doesn't
139-
// collapse into ~200px columns. On desktop both are always shown.
136+
// Below `xl` (1280px) we show ONE pane at a time, picked from the URL —
137+
// list on `/pentests`, main on `/pentests/:id` and `/pentests/new`.
138+
// The `xl` cutoff (not `md`) covers tablets and narrower laptops where
139+
// the global rail + section sub-nav already eat ~345px before the
140+
// SplitView even starts; below xl, the IDE-style split squeezes the
141+
// main pane to <600px and the SevTally / detail header overflow.
140142
const showListOnMobile = selectedRunId === null && !isCreateMode;
141143

142144
// Empty state only shown when there are no runs AND no selection AND not
@@ -163,8 +165,8 @@ export function SplitView({
163165
<div
164166
aria-hidden={isCreateMode}
165167
className={cn(
166-
'w-full md:w-auto md:shrink-0',
167-
showListOnMobile ? 'block' : 'hidden md:block',
168+
'w-full xl:w-auto xl:shrink-0',
169+
showListOnMobile ? 'block' : 'hidden xl:block',
168170
isCreateMode ? 'pointer-events-none opacity-45' : '',
169171
)}
170172
>
@@ -180,15 +182,16 @@ export function SplitView({
180182
<main
181183
className={cn(
182184
'min-w-0 flex-1 flex-col',
183-
showListOnMobile ? 'hidden md:flex' : 'flex',
185+
showListOnMobile ? 'hidden xl:flex' : 'flex',
184186
)}
185187
>
186-
{/* Mobile-only back bar. The sidebar is hidden on phones once a
187-
run is selected (or in create mode), so we surface a
188-
persistent path back to the list. md+ never sees this — the
189-
sidebar itself is the navigation. */}
188+
{/* Back-to-list bar shown below xl. The sidebar is hidden on
189+
phones / tablets / narrow laptops once a run is selected (or
190+
in create mode), so we surface a persistent path back to the
191+
list. xl+ never sees this — the sidebar itself is the
192+
navigation there. */}
190193
{!showListOnMobile && (
191-
<div className="md:hidden flex items-center border-b border-border bg-background px-3 py-2">
194+
<div className="xl:hidden flex items-center border-b border-border bg-background px-3 py-2">
192195
<button
193196
type="button"
194197
onClick={goToList}

0 commit comments

Comments
 (0)