ar-test/app/components/assets/detail/scan-qr-dialog.tsx
2026-10-27 16:28:55 +05:30

30 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { AssetQr } from '~/components/assets/asset-qr';
import { CopyField } from '~/components/ui/copy-field';
import { Dialog, DialogBody, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '~/components/ui/dialog';
import { getArUrl } from '~/lib/assets/qr';
import type { ArAsset } from '~/types/asset';
interface ScanQrDialogProps {
asset: ArAsset;
open: boolean;
onOpenChange: (open: boolean) => void;
}
// AR needs a phone camera, so "View in your space" in the admin preview offers the QR code to scan instead
export function ScanQrDialog({ asset, open, onOpenChange }: ScanQrDialogProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className='max-w-sm'>
<DialogHeader>
<DialogTitle>View in AR</DialogTitle>
<DialogDescription>Scan this QR code with your phone’s camera to open {asset.name} and place it in your room.</DialogDescription>
</DialogHeader>
<DialogBody>
<AssetQr asset={asset} size='panel' className='self-center' />
<CopyField value={getArUrl(asset.id)} label='AR link' />
</DialogBody>
</DialogContent>
</Dialog>
);
}