forked from rajun/ar-test
feat: add scan QR dialog
This commit is contained in:
parent
907170a152
commit
96439b5367
29
app/components/assets/detail/scan-qr-dialog.tsx
Normal file
29
app/components/assets/detail/scan-qr-dialog.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user