feat: add customer AR page layout

This commit is contained in:
rajun 2026-10-27 16:28:52 +05:30
parent 4934fc3f67
commit 118312d83f

View File

@ -0,0 +1,34 @@
import type { ReactNode } from 'react';
import { ArLaunchButton } from '~/components/ui/ar-launch-button';
import { ArPageHeader } from '~/components/ui/ar-page-header';
import { AR_PAGE_DEFAULTS } from '~/data/projects/constants';
import { cn } from '~/lib/utils';
import type { ArPageLayout, BrandIdentity, ButtonStyle } from '~/types/project';
// Over the model: placed at an edge, and only the button itself takes touches so the model can still be turned
const overlay = (edge: 'top-0' | 'bottom-0') => cn('pointer-events-none absolute inset-x-0 z-10', edge);
interface ArPageProps {
brand?: BrandIdentity;
modelName: string;
button?: ButtonStyle;
layout?: ArPageLayout;
launching?: boolean;
hint?: string | null;
onLaunch?: () => void;
className?: string;
children: ReactNode;
}
// The customer-facing AR page layout, shared by the live page and the admin previews.
// With the bars off, the model fills the page and the header and button sit over it.
export function ArPage({ brand, modelName, button, layout = AR_PAGE_DEFAULTS, launching, hint, onLaunch, className, children }: ArPageProps) {
const bars = layout.bars;
return (
<div className={cn('relative flex flex-col bg-viewer', className)}>
<ArPageHeader brand={brand} modelName={modelName} layout={layout} className={bars ? undefined : overlay('top-0')} />
<div className={bars ? 'relative min-h-0 flex-1' : 'absolute inset-0'}>{children}</div>
<ArLaunchButton style={button} launching={launching} hint={hint} onLaunch={onLaunch} className={bars ? undefined : overlay('bottom-0')} />
</div>
);
}