mirror of
https://github.com/luxfi/mpc.git
synced 2026-09-24 00:26:24 +00:00
Complete MPC wallet management platform rivaling Fireblocks/Utila/Fordefi: Backend (Go): - REST API with 60+ endpoints on chi router (pkg/api/) - PostgreSQL schema with 13 tables (pkg/db/) - JWT + MFA auth, bcrypt passwords, API key management - Policy engine (deny/approve/require_approval) - Transaction signing flow with approval workflow - Subscription scheduler for recurring payments - Payment requests with public pay pages - Safe + ERC-4337 smart wallet integration (pkg/smart/) - Rate limiting, webhook delivery (HMAC-SHA256), audit logging - 27 passing tests (auth, policy engine, middleware) Frontend (Next.js 14): - 27 routes with monochrome dark theme (Tailwind + Geist fonts) - Full API client with JWT auto-refresh - React Query hooks for all resources - Pages: dashboard, vaults, wallets, transactions, policies, whitelist, team, settings, API keys, webhooks, audit, subscriptions, payments, smart wallets Infrastructure: - Dockerfiles for API (Go) and dashboard (Next.js standalone) - compose.yml for local development (PostgreSQL + API + dashboard) - K8s manifests for mpc.lux.network + cloud.lux.network - GitHub Actions deploy workflow (build → push GHCR → kubectl apply) - TLS via cert-manager, Traefik IngressRoute for both domains
74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
'use client'
|
|
|
|
export interface Column<T> {
|
|
key: string
|
|
header: string
|
|
render?: (row: T) => React.ReactNode
|
|
className?: string
|
|
}
|
|
|
|
interface DataTableProps<T> {
|
|
columns: Column<T>[]
|
|
data: T[]
|
|
keyField: string
|
|
emptyMessage?: string
|
|
onRowClick?: (row: T) => void
|
|
}
|
|
|
|
export function DataTable<T extends Record<string, any>>({
|
|
columns,
|
|
data,
|
|
keyField,
|
|
emptyMessage = 'No data found.',
|
|
onRowClick,
|
|
}: DataTableProps<T>) {
|
|
return (
|
|
<div className="overflow-x-auto rounded-md border border-border">
|
|
<table className="w-full text-sm">
|
|
<thead>
|
|
<tr className="border-b border-border bg-muted/50">
|
|
{columns.map((col) => (
|
|
<th
|
|
key={col.key}
|
|
className={`px-4 py-3 text-left font-medium text-muted-foreground ${col.className ?? ''}`}
|
|
>
|
|
{col.header}
|
|
</th>
|
|
))}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{data.length === 0 ? (
|
|
<tr>
|
|
<td
|
|
colSpan={columns.length}
|
|
className="px-4 py-8 text-center text-muted-foreground"
|
|
>
|
|
{emptyMessage}
|
|
</td>
|
|
</tr>
|
|
) : (
|
|
data.map((row) => (
|
|
<tr
|
|
key={String(row[keyField])}
|
|
onClick={onRowClick ? () => onRowClick(row) : undefined}
|
|
className={`border-b border-border transition-colors last:border-0 ${
|
|
onRowClick ? 'cursor-pointer hover:bg-muted/50' : ''
|
|
}`}
|
|
>
|
|
{columns.map((col) => (
|
|
<td key={col.key} className={`px-4 py-3 ${col.className ?? ''}`}>
|
|
{col.render
|
|
? col.render(row)
|
|
: String(row[col.key] ?? '')}
|
|
</td>
|
|
))}
|
|
</tr>
|
|
))
|
|
)}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
)
|
|
}
|