-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Igor Stadnyk
committed
Jul 13, 2024
1 parent
0ab8bca
commit d2ceb93
Showing
11 changed files
with
1,443 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const columns = [ | ||
{ name: 'name', uid: 'name' }, | ||
{ name: 'receiver', uid: 'receiver' }, | ||
{ name: 'value', uid: 'value' }, | ||
{ name: 'initiation Date', uid: 'date' }, | ||
{ name: 'actions', uid: 'actions' }, | ||
]; | ||
|
||
const users = [ | ||
{ | ||
id: 1, | ||
name: 'Preventing risks on trip to EthCC', | ||
receiver: '00xa9....ab4bd', | ||
value: '75%', | ||
date: '13 Jul 2024', | ||
}, | ||
{ | ||
id: 2, | ||
name: 'If lost while climbing on Everest', | ||
receiver: '00xa9....ab432', | ||
value: '50%', | ||
date: '27 Oct 2024', | ||
}, | ||
{ | ||
id: 3, | ||
name: 'In case of a racetrack accident', | ||
receiver: '00xa9....ab4d1', | ||
value: '51,8.6 ETH', | ||
date: '17 Nov 2024', | ||
}, | ||
{ | ||
id: 4, | ||
name: 'Digital inheritance', | ||
receiver: ['00xa9....ab1d7', '00xa9....ab3d4', '00xa9....ab2d5'], | ||
value: ['15%', '40%', '45%'], | ||
date: '01 Jan 2025', | ||
}, | ||
{ | ||
id: 5, | ||
name: 'Heart surgery, June 2025', | ||
receiver: '00xa9....ab42a', | ||
value: '100%', | ||
date: '31 June 2025', | ||
}, | ||
]; | ||
|
||
export { columns, users }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
'use client'; | ||
|
||
import { useCallback } from 'react'; | ||
import Image from 'next/image'; | ||
import { Button } from '@nextui-org/button'; | ||
import { Link } from '@nextui-org/link'; | ||
import { | ||
Table, | ||
TableHeader, | ||
TableColumn, | ||
TableBody, | ||
TableRow, | ||
TableCell, | ||
} from '@nextui-org/table'; | ||
import { Tooltip } from '@nextui-org/tooltip'; | ||
|
||
import { columns, users } from './data'; | ||
|
||
import deleteIcon from '@/images/delete.svg'; | ||
import editIcon from '@/images/edit.svg'; | ||
import ghostIcon from '@/images/ghost.svg'; | ||
|
||
export default function BackUpsPage() { | ||
const renderCell = useCallback((user: any, columnKey: any) => { | ||
const cellValue = user[columnKey]; | ||
|
||
switch (columnKey) { | ||
case 'name': | ||
return <div className="font-semibold">{user.name}</div>; | ||
case 'receiver': | ||
return ( | ||
<div className="flex flex-col"> | ||
<p className="font-semibold">Receiver</p> | ||
<div className=""> | ||
{Array.isArray(user.receiver) | ||
? user.receiver.map((item: any) => <p key="item">{item}</p>) | ||
: user.receiver} | ||
</div> | ||
</div> | ||
); | ||
case 'value': | ||
return ( | ||
<div className="flex flex-col"> | ||
<p className="font-semibold">Value</p> | ||
<div className=""> | ||
{Array.isArray(user.value) | ||
? user.value.map((item: any) => <p key="item">{item}</p>) | ||
: user.value} | ||
</div> | ||
</div> | ||
); | ||
case 'date': | ||
return ( | ||
<div className="flex flex-col"> | ||
<p className="font-semibold">Initiation Date</p> | ||
<p className="">{user.value}</p> | ||
</div> | ||
); | ||
case 'actions': | ||
return ( | ||
<div className="relative flex justify-end gap-2"> | ||
<Tooltip content="Edit Backup"> | ||
<span className="text-lg text-default-400 cursor-pointer active:opacity-50"> | ||
<Image alt="edit icon" src={editIcon} /> | ||
</span> | ||
</Tooltip> | ||
<Tooltip color="danger" content="Delete Backup"> | ||
<span className="text-lg text-danger cursor-pointer active:opacity-50"> | ||
<Image alt="edit icon" src={deleteIcon} /> | ||
</span> | ||
</Tooltip> | ||
</div> | ||
); | ||
default: | ||
return <>{user[columnKey]}</>; | ||
} | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<div className="flex justify-between pb-8"> | ||
<h1 className=" content-center text-lg font-semibold">Your Backups</h1> | ||
<Button | ||
className="font-semibold" | ||
color="primary" | ||
size="lg" | ||
as={Link} | ||
// TODO add link to add page | ||
href={'/'} | ||
> | ||
Create Backup | ||
</Button> | ||
</div> | ||
<div className="text-[#AFB8CE] flex justify-center p-6 bg-white rounded-xl mb-2"> | ||
<Image alt="ghost icon" src={ghostIcon} /> Start with creating a new | ||
Backup! | ||
</div> | ||
<Table | ||
fullWidth | ||
hideHeader | ||
isStriped | ||
removeWrapper | ||
aria-label="Backup table" | ||
> | ||
<TableHeader columns={columns}> | ||
{(column: any) => ( | ||
<TableColumn key={column.uid}>{column.name}</TableColumn> | ||
)} | ||
</TableHeader> | ||
<TableBody items={users}> | ||
{(item: any) => ( | ||
<TableRow | ||
key={item.id} | ||
className=" border-b-[12px] border-transparent bg-white" | ||
> | ||
{(columnKey: any) => ( | ||
<TableCell className="py-4 text-sm align-top"> | ||
{renderCell(item, columnKey)} | ||
</TableCell> | ||
)} | ||
</TableRow> | ||
)} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.