48 lines
2.5 KiB
TypeScript
48 lines
2.5 KiB
TypeScript
import { ClientLogo } from '~/components/ui/client-logo';
|
|
import { Text } from '~/components/ui/text';
|
|
import { DEMO_CLIENT_MARK, DEMO_QR_CODE } from '~/data/auth/constants';
|
|
import { getFrontendHost } from '~/lib/assets/qr';
|
|
import { cn } from '~/lib/utils';
|
|
|
|
const CORNERS = [
|
|
'top-0 left-0 rounded-tl-card-sm border-t-3 border-l-3',
|
|
'top-0 right-0 rounded-tr-card-sm border-t-3 border-r-3',
|
|
'bottom-0 left-0 rounded-bl-card-sm border-b-3 border-l-3',
|
|
'bottom-0 right-0 rounded-br-card-sm border-b-3 border-r-3',
|
|
];
|
|
|
|
// Step 1: the camera finds the printed QR code (the phone's dark screen is the camera view)
|
|
export function ScanScreen() {
|
|
return (
|
|
<div className='relative flex flex-1 flex-col items-center'>
|
|
<Text as='span' variant='caption-strong' className='mt-5.5 rounded-full bg-shadow/55 px-3.5 py-1.75'>
|
|
Camera
|
|
</Text>
|
|
|
|
<div className='flex flex-1 items-center justify-center'>
|
|
<div className='relative flex size-49 items-center justify-center'>
|
|
{CORNERS.map((corner) => (
|
|
<span key={corner} className={cn('absolute size-7.5 border-primary', corner)} />
|
|
))}
|
|
{/* The code is 33 squares across: 132px keeps every square exactly 4px, so it renders sharp */}
|
|
<div className='relative rounded-group bg-qr-surface p-1.5'>
|
|
<img src={DEMO_QR_CODE} alt='' className='block size-33' />
|
|
<ClientLogo brand={DEMO_CLIENT_MARK} variant='mark' size='sm' className='absolute top-1/2 left-1/2 -translate-1/2' />
|
|
</div>
|
|
{/* Thin, softly lit scan line; moved with transform only, and hidden with reduced motion */}
|
|
<span className='absolute inset-x-3 top-0 h-full animate-scan motion-reduce:hidden'>
|
|
<span className='block h-0.5 rounded-full bg-linear-to-r from-transparent via-primary to-transparent shadow-[0_0_6px] shadow-primary/40' />
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div className='mb-5.5 flex items-center gap-2 rounded-card bg-qr-surface px-4 py-2.5 shadow-[0_10px_24px] shadow-shadow/35'>
|
|
<span className='size-2 rounded-full bg-primary' />
|
|
<Text as='span' variant='caption-strong' tone='ink'>
|
|
Open “{getFrontendHost()}” in Safari
|
|
</Text>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|