fix: standardize direct page scroll viewports

This commit is contained in:
2026-07-28 22:50:11 +02:00
parent 324c26da78
commit 53e947935a
6 changed files with 67 additions and 32 deletions

View File

@@ -0,0 +1,23 @@
import type { HTMLAttributes, ReactNode } from "react";
export type PageScrollViewportProps = Omit<
HTMLAttributes<HTMLDivElement>,
"children"
> & {
children: ReactNode;
};
export default function PageScrollViewport({
children,
className = "",
...props
}: PageScrollViewportProps) {
return (
<div
{...props}
className={["page-scroll-viewport", className].filter(Boolean).join(" ")}
>
{children}
</div>
);
}

View File

@@ -6,6 +6,7 @@ import { dispatchPlatformViewChanged } from "../platform/views";
import { useGuardedNavigate } from "./UnsavedChangesGuard";
import Button from "./Button";
import Card from "./Card";
import PageScrollViewport from "./PageScrollViewport";
export default function ViewSurfaceRouteBoundary({
surfaceId,
@@ -33,26 +34,28 @@ export default function ViewSurfaceRouteBoundary({
}
return (
<div className="content-pad">
<Card title="Outside the current view">
<div className="empty-state">
<EyeOff size={24} aria-hidden="true" />
<p>
This area is available to your account, but hidden by
{projection?.activeViewName
? ` the ${projection.activeViewName} view`
: " the current view"}.
</p>
<div className="button-row">
{!projection?.locked && runtime && (
<Button variant="primary" onClick={() => void exitView()}>
Exit view
</Button>
)}
<Button onClick={() => navigate(fallbackPath)}>Back to view</Button>
<PageScrollViewport>
<div className="content-pad">
<Card title="Outside the current view">
<div className="empty-state">
<EyeOff size={24} aria-hidden="true" />
<p>
This area is available to your account, but hidden by
{projection?.activeViewName
? ` the ${projection.activeViewName} view`
: " the current view"}.
</p>
<div className="button-row">
{!projection?.locked && runtime && (
<Button variant="primary" onClick={() => void exitView()}>
Exit view
</Button>
)}
<Button onClick={() => navigate(fallbackPath)}>Back to view</Button>
</div>
</div>
</div>
</Card>
</div>
</Card>
</div>
</PageScrollViewport>
);
}