import { formatDistance } from 'date-fns'; import { useState } from 'react'; import { Button, Icon, Modal, PasswordField, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, Text, } from 'react-basics'; import ApiKeyDeleteForm from 'components/pages/settings/account/ApiKeyDeleteForm'; import Trash from 'assets/trash.svg'; import styles from './ApiKeysTable.module.css'; const columns = [ { name: 'apiKey', label: 'Key', style: { flex: 3 } }, { name: 'created', label: 'Created', style: { flex: 1 } }, { name: 'action', label: ' ', style: { flex: 1 } }, ]; export default function ApiKeysTable({ data = [], onSave }) { const [apiKeyId, setApiKeyId] = useState(null); const handleSave = () => { setApiKeyId(null); onSave(); }; const handleClose = () => { setApiKeyId(null); }; const handleDelete = id => { setApiKeyId(id); }; return ( <> {(column, index) => { return ( {column.label} ); }} {(row, keys, rowIndex) => { row.apiKey = ; row.created = formatDistance(new Date(row.createdAt), new Date(), { addSuffix: true, }); row.action = (
); return ( {(data, key, colIndex) => { return ( {data[key]} ); }} ); }}
{apiKeyId && ( {close => } )} ); }