Skip to content

Commit

Permalink
Merge pull request #63 from FRC2713/fix_qr_contents
Browse files Browse the repository at this point in the history
Fix QR data
  • Loading branch information
Owen-Morgan825 authored Jan 7, 2025
2 parents f4626aa + 09b0855 commit 8df78ca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/QR/QRModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ export interface QRModalProps {

export function QRModal(props: QRModalProps) {
const fieldValues = useQRScoutState(state => state.fieldValues);

const formData = useQRScoutState(state => state.formData);
const title = `${getFieldValue('robot')} - M${getFieldValue(
'matchNumber',
)}`.toUpperCase();

const qrCodeData = useMemo(
const qrCodePreview = useMemo(
() => fieldValues.map(f => f.value).join(','),
[fieldValues],
);
const qrCodeData = useMemo(
() => fieldValues.map(f => f.value).join(formData.delimiter),
[fieldValues],
);
//Two seperate values are required- qrCodePreview is what is shown to the user beneath the QR code, qrCodeData is the actual data.

return (
<Dialog>
Expand All @@ -44,7 +49,7 @@ export function QRModal(props: QRModalProps) {
<div className="bg-white p-4 rounded-md">
<QRCodeSVG className="m-2 mt-4" size={256} value={qrCodeData} />
</div>
<PreviewText data={qrCodeData} />
<PreviewText data={qrCodePreview} />
</div>
<DialogFooter>
<Button
Expand Down

0 comments on commit 8df78ca

Please sign in to comment.