fix issues

This commit is contained in:
2026-01-01 15:17:09 +01:00
parent f001df3744
commit aee182b09e
17 changed files with 241 additions and 442 deletions

View File

@@ -78,6 +78,14 @@ export function AdminDashboardPage() {
return null;
}
// Temporary UI fields (not yet provided by API/ViewModel)
const adminCount = stats.systemAdmins;
const recentActivity: Array<{ description: string; timestamp: string; type: string }> = [];
const systemHealth = 'Healthy';
const totalSessions = 0;
const activeSessions = 0;
const avgSessionDuration = '—';
return (
<div className="container mx-auto p-6 space-y-6">
{/* Header */}
@@ -112,7 +120,7 @@ export function AdminDashboardPage() {
<div className="flex items-center justify-between">
<div>
<div className="text-sm text-gray-400 mb-1">Admins</div>
<div className="text-3xl font-bold text-white">{stats.adminCount}</div>
<div className="text-3xl font-bold text-white">{adminCount}</div>
</div>
<Shield className="w-8 h-8 text-purple-400" />
</div>
@@ -145,8 +153,8 @@ export function AdminDashboardPage() {
<Card>
<h3 className="text-lg font-semibold text-white mb-4">Recent Activity</h3>
<div className="space-y-3">
{stats.recentActivity.length > 0 ? (
stats.recentActivity.map((activity, index) => (
{recentActivity.length > 0 ? (
recentActivity.map((activity, index: number) => (
<div
key={index}
className="flex items-center justify-between p-3 bg-iron-gray/30 rounded-lg border border-charcoal-outline/50"
@@ -178,20 +186,20 @@ export function AdminDashboardPage() {
<div className="flex items-center justify-between">
<span className="text-sm text-gray-400">System Health</span>
<span className="px-2 py-1 text-xs rounded-full bg-performance-green/20 text-performance-green">
{stats.systemHealth}
{systemHealth}
</span>
</div>
<div className="flex items-center justify-between">
<span className="text-sm text-gray-400">Total Sessions</span>
<span className="text-white font-medium">{stats.totalSessions}</span>
<span className="text-white font-medium">{totalSessions}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-sm text-gray-400">Active Sessions</span>
<span className="text-white font-medium">{stats.activeSessions}</span>
<span className="text-white font-medium">{activeSessions}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-sm text-gray-400">Avg Session Duration</span>
<span className="text-white font-medium">{stats.avgSessionDuration}</span>
<span className="text-white font-medium">{avgSessionDuration}</span>
</div>
</div>
</Card>
@@ -214,4 +222,4 @@ export function AdminDashboardPage() {
</Card>
</div>
);
}
}

View File

@@ -70,6 +70,21 @@ export function AdminUsersPage() {
}
};
const toStatusBadgeProps = (
status: string,
): { status: 'success' | 'warning' | 'error' | 'neutral'; label: string } => {
switch (status) {
case 'active':
return { status: 'success', label: 'Active' };
case 'suspended':
return { status: 'warning', label: 'Suspended' };
case 'deleted':
return { status: 'error', label: 'Deleted' };
default:
return { status: 'neutral', label: status };
}
};
const handleDeleteUser = async (userId: string) => {
if (!confirm('Are you sure you want to delete this user? This action cannot be undone.')) {
return;
@@ -255,7 +270,10 @@ export function AdminUsersPage() {
</div>
</td>
<td className="py-3 px-4">
<StatusBadge status={user.statusBadge.label.toLowerCase()} />
{(() => {
const badge = toStatusBadgeProps(user.status);
return <StatusBadge status={badge.status} label={badge.label} />;
})()}
</td>
<td className="py-3 px-4">
<div className="text-sm text-gray-400">
@@ -338,4 +356,4 @@ export function AdminUsersPage() {
)}
</div>
);
}
}