c9432a16ba
- SIWE auth flow: challenge/login/logout/me API routes + JWT middleware
- Fixed [...path] catch-all: Kubo proxy with matchRoute() + mapToKuboAPI()
- Fixed session_id → nonce field mismatch in AuthProvider
- Fixed dashboard pins crash: Kubo returns {Keys: {...}}, not array
- Added middleware route guard (307 redirect to /login)
- Added login, register, profile, usage, upload pages
- Added dashboard components (StorageGauge, FreeTierProgress)
- Added SWR hooks + AuthGuard + Providers + Toast/ErrorBoundary
- Added payment integration (smart contract ABI, tiers, tokens)
- Fixed IPNS key listing: Name/Id → name/id mapping
- Added PWA support (manifest, service worker, icons)
- Added tests for helpers, limits, search-index, wallet
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
'use client';
|
||
|
||
/* ════════════════════════════ StorageGauge ════════════════════════════ */
|
||
|
||
interface StorageGaugeProps {
|
||
usedGB: number;
|
||
maxGB: number;
|
||
label?: string;
|
||
}
|
||
|
||
export default function StorageGauge({ usedGB, maxGB, label = 'Storage' }: StorageGaugeProps) {
|
||
const pct = maxGB > 0 ? Math.min((usedGB / maxGB) * 100, 100) : 0;
|
||
const color =
|
||
pct > 90 ? 'bg-accent-rose' : pct > 70 ? 'bg-accent-amber' : 'bg-accent-cyan';
|
||
|
||
const textColor =
|
||
pct > 90 ? 'text-accent-rose' : pct > 70 ? 'text-accent-amber' : 'text-accent-cyan';
|
||
|
||
return (
|
||
<div className="glass rounded-xl p-5">
|
||
<div className="flex items-center justify-between mb-2">
|
||
<span className="text-xs text-surface-400">{label}</span>
|
||
<span className={`text-xs font-mono font-medium ${textColor}`}>
|
||
{usedGB.toFixed(1)} / {maxGB.toFixed(1)} GB
|
||
</span>
|
||
</div>
|
||
<div className="h-2.5 rounded-full bg-surface-700 overflow-hidden">
|
||
<div
|
||
className={`h-full rounded-full transition-all duration-700 ease-out ${color}`}
|
||
style={{ width: `${pct}%` }}
|
||
/>
|
||
</div>
|
||
<div className="flex justify-between mt-1.5">
|
||
<span className="text-[10px] text-surface-500">{pct.toFixed(0)}% gebruikt</span>
|
||
{pct > 80 && (
|
||
<span className="text-[10px] text-accent-rose flex items-center gap-1">
|
||
⚠️ Bijna vol
|
||
</span>
|
||
)}
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|