Add NFC URL input field and copy button in WriteNFCModal.jsx
This commit is contained in:
parent
53ea81e8ca
commit
933ca9a085
1 changed files with 21 additions and 7 deletions
|
@ -1,7 +1,9 @@
|
||||||
|
import { CopyAll } from '@mui/icons-material'
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
Input,
|
||||||
ListItem,
|
ListItem,
|
||||||
Modal,
|
Modal,
|
||||||
ModalDialog,
|
ModalDialog,
|
||||||
|
@ -38,7 +40,9 @@ function WriteNFCModal({ config }) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setNfcStatus('error')
|
setNfcStatus('error')
|
||||||
setErrorMessage('NFC is not supported by this browser.')
|
setErrorMessage(
|
||||||
|
'NFC is not supported by this browser. You can still copy the URL and write it to an NFC tag using a compatible device.',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +77,22 @@ function WriteNFCModal({ config }) {
|
||||||
? errorMessage
|
? errorMessage
|
||||||
: 'Press the button below to write to NFC.'}
|
: 'Press the button below to write to NFC.'}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Input
|
||||||
|
value={getURL()}
|
||||||
|
fullWidth
|
||||||
|
readOnly
|
||||||
|
label='URL'
|
||||||
|
sx={{ mt: 1 }}
|
||||||
|
endDecorator={
|
||||||
|
<CopyAll
|
||||||
|
sx={{ cursor: 'pointer' }}
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(getURL())
|
||||||
|
alert('URL copied to clipboard!')
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={isAutoCompleteWhenScan}
|
checked={isAutoCompleteWhenScan}
|
||||||
|
@ -95,12 +115,6 @@ function WriteNFCModal({ config }) {
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box display={'flex'} justifyContent={'center'} mt={2}>
|
|
||||||
<Button onClick={handleClose} variant='outlined'>
|
|
||||||
Close
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue