Skip to content

Commit

Permalink
Update App.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Oct 23, 2024
1 parent 0fd0f40 commit 3ebcd1b
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions packages/verifier/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Scanner } from '@yudiel/react-qr-scanner';
import './App.css';
import { Box, Container, Stack, Typography } from '@mui/material';
import { Box, Button, Container, Stack, Typography } from '@mui/material';
import { enqueueSnackbar } from 'notistack';
import { decodeJwt } from 'jose';
import { Resolver } from 'did-resolver';
Expand All @@ -11,6 +11,8 @@ import { WalrusDID } from '@zktx.io/walrus-did';
function App() {
const [disabled, setDisabled] = useState<boolean>(false);
const [randomNumber, setRandomNumber] = useState<string>('');
const [isNFC, setIsNFC] = useState<boolean>(false);
const [init, setInit] = useState<boolean>(false);

const handleReset = () => {
const generateRandomNumber = () => {
Expand Down Expand Up @@ -86,16 +88,40 @@ function App() {
>
<Typography variant="h3">Walrus Pass Verifier</Typography>
<Box sx={{ width: '400px' }}>
<Scanner
paused={disabled}
scanDelay={30000}
onScan={([result]) => {
handleVerification(result.rawValue);
}}
/>
;
{!init && (
<Box>
<Button
disabled={!('NDEFReader' in window)}
onClick={() => {
setIsNFC(true);
setInit(true);
}}
>
NFC
</Button>
<Button
onClick={() => {
setInit(true);
}}
>
QR
</Button>
</Box>
)}
{init && isNFC && <Typography variant="h4">NFC Scan</Typography>}
{init && !isNFC && (
<Scanner
paused={disabled}
scanDelay={30000}
onScan={([result]) => {
handleVerification(result.rawValue);
}}
/>
)}
</Box>
<Typography variant="h5">{`Security code : ${randomNumber}`}</Typography>
{init && (
<Typography variant="h5">{`Security code : ${randomNumber}`}</Typography>
)}
</Stack>
</Container>
</div>
Expand Down

0 comments on commit 3ebcd1b

Please sign in to comment.