-
Profile
+ {/* Profile Section */}
+
+
Profile
-
-
-
Name
-
{session.user.name}
-
+
+
+
Name
+
{session?.user?.name || 'User'}
+
-
-
Email
-
{session.user.email}
-
+
+
Email
+
{session?.user?.email}
+
-
-
Email Verified
-
- {session.user.emailVerified ? (
- Verified
- ) : (
- Not verified
- )}
-
-
+
+
Email Verified
+
+ {session?.user?.emailVerified ? (
+ Verified
+ ) : (
+ Not verified
+ )}
+
-
+
);
}
diff --git a/apps/web/src/app/dashboard/settings/api-keys/page.tsx b/apps/web/src/app/dashboard/settings/api-keys/page.tsx
index 64445a9..e2a0293 100644
--- a/apps/web/src/app/dashboard/settings/api-keys/page.tsx
+++ b/apps/web/src/app/dashboard/settings/api-keys/page.tsx
@@ -2,10 +2,18 @@
import { Button } from '@tpmjs/ui/Button/Button';
import { Icon } from '@tpmjs/ui/Icon/Icon';
-import Link from 'next/link';
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableEmpty,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@tpmjs/ui/Table/Table';
import { useRouter } from 'next/navigation';
import { useCallback, useEffect, useState } from 'react';
-import { AppHeader } from '~/components/AppHeader';
+import { DashboardLayout } from '~/components/dashboard/DashboardLayout';
interface ApiKeyInfo {
id: string;
@@ -15,6 +23,15 @@ interface ApiKeyInfo {
updatedAt: string;
}
+function formatDate(dateString: string): string {
+ const date = new Date(dateString);
+ return date.toLocaleDateString('en-US', {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ });
+}
+
export default function ApiKeysPage(): React.ReactElement {
const router = useRouter();
const [keys, setKeys] = useState
([]);
@@ -22,6 +39,7 @@ export default function ApiKeysPage(): React.ReactElement {
const [error, setError] = useState(null);
// Add new key form
+ const [showAddForm, setShowAddForm] = useState(false);
const [newKeyName, setNewKeyName] = useState('');
const [newKeyValue, setNewKeyValue] = useState('');
const [saving, setSaving] = useState(false);
@@ -80,6 +98,7 @@ export default function ApiKeysPage(): React.ReactElement {
if (result.success) {
setNewKeyName('');
setNewKeyValue('');
+ setShowAddForm(false);
fetchKeys();
} else {
setSaveError(result.error || 'Failed to save');
@@ -88,7 +107,8 @@ export default function ApiKeysPage(): React.ReactElement {
setSaving(false);
}, [newKeyName, newKeyValue, saveKey, fetchKeys]);
- const handleDelete = useCallback(async (keyName: string, id: string) => {
+ const handleDelete = useCallback(async (keyName: string, id: string, e: React.MouseEvent) => {
+ e.stopPropagation();
if (!confirm(`Delete ${keyName}?`)) return;
setDeletingId(id);
@@ -135,137 +155,188 @@ export default function ApiKeysPage(): React.ReactElement {
fetchKeys();
}, [envText, saveKey, fetchKeys]);
- if (isLoading) {
- return (
-
- );
- }
-
if (error) {
return (
-
-
-
-
{error}
-
+
+
+
+
Error
+
{error}
+
-
+
);
}
return (
-
-
-
-
-
-
-
-
-
Environment Variables
-
-
-
-
- {/* Import from .env */}
- {showImport && (
-