From ec4a92e5553d158f457abb4323c175666af63c81 Mon Sep 17 00:00:00 2001 From: isra el Date: Sat, 13 Apr 2024 16:05:55 +0300 Subject: [PATCH] chore(web): display device id and copy feature in dashboard --- web/components/dashboard/DeviceList.tsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/web/components/dashboard/DeviceList.tsx b/web/components/dashboard/DeviceList.tsx index 61cf5c2..cabb9de 100644 --- a/web/components/dashboard/DeviceList.tsx +++ b/web/components/dashboard/DeviceList.tsx @@ -1,4 +1,4 @@ -import { DeleteIcon } from '@chakra-ui/icons' +import { CopyIcon, DeleteIcon } from '@chakra-ui/icons' import { IconButton, Spinner, @@ -10,6 +10,7 @@ import { Thead, Tooltip, Tr, + useToast, } from '@chakra-ui/react' import { useEffect } from 'react' import { useSelector } from 'react-redux' @@ -19,9 +20,28 @@ import { useAppDispatch } from '../../store/hooks' const DeviceRow = ({ device, onDelete }: any) => { const { enabled, model, brand, _id, createdAt } = device + + const toast = useToast(); + return ( {`${brand}/ ${model}`} + + {_id} + } + onClick={() => { + navigator.clipboard.writeText(_id) + toast({ + title: 'Copied to clipboard', + status: 'success', + }) + } } aria-label={''} > + Copy to Clipboard + + + {enabled ? 'enabled' : 'disabled'} {/* {}} /> */} @@ -60,6 +80,7 @@ const DeviceList = () => { Your Devices + Device ID Status Actions