Skip to content

Commit 705a80e

Browse files
gcmsgclaude
andcommitted
fix(admin): replace raw health badge with proper status indicator, add back-to-console nav
- Replace confusing "ok" badge on admin dashboard with CircleCheck/CircleAlert icons and translated healthy/unhealthy text - Add "Back to Console" navigation link to admin sidebar - Add i18n keys: backToConsole, backToPublicSite, healthy, unhealthy (all 8 locales) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2697fef commit 705a80e

File tree

10 files changed

+62
-20
lines changed

10 files changed

+62
-20
lines changed

web/app/src/components/layout/Sidebar.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
BarChart3,
99
Activity,
1010
Github,
11+
ArrowLeft,
1112
} from "lucide-react"
1213
import { useAuth } from "@/hooks/use-auth"
1314
import { useTranslation } from "react-i18next"
@@ -62,17 +63,24 @@ export function Sidebar() {
6263
</nav>
6364

6465
<div className="border-t border-border p-3 space-y-2">
66+
<NavLink
67+
to="/console"
68+
className="flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors"
69+
>
70+
<ArrowLeft className="size-3.5" />
71+
{t('nav.backToConsole')}
72+
</NavLink>
6573
{user && (
6674
<UserMenu user={user} onLogout={handleLogout} />
6775
)}
68-
<div className="flex items-center justify-between px-3">
76+
<div className="flex items-center justify-between px-3 py-1">
6977
<NavLink
7078
to="/"
7179
className="text-xs text-muted-foreground hover:text-foreground transition-colors"
7280
>
7381
{t('nav.backToPublicSite')}
7482
</NavLink>
75-
<div className="flex items-center gap-2">
83+
<div className="flex items-center gap-1.5">
7684
<a
7785
href="https://github.com/peerclaw/peerclaw"
7886
target="_blank"

web/app/src/i18n/locales/ar.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "تسجيل الخروج",
3737
"adminPanel": "لوحة الإدارة",
3838
"backToPublicSite": "الرئيسية",
39+
"backToConsole": "العودة إلى لوحة التحكم",
3940
"backToHome": "الرئيسية",
4041
"peerclawConsole": "لوحة تحكم PeerClaw",
4142
"peerclawAdmin": "إدارة PeerClaw",
@@ -355,7 +356,9 @@
355356
"pendingReports": "البلاغات المعلّقة",
356357
"systemHealth": "صحة النظام",
357358
"database": "قاعدة البيانات",
358-
"overallStatus": "الحالة العامة"
359+
"overallStatus": "الحالة العامة",
360+
"healthy": "سليم",
361+
"unhealthy": "غير سليم"
359362
},
360363
"adminAgents": {
361364
"title": "الوكلاء",

web/app/src/i18n/locales/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "Sign Out",
3737
"adminPanel": "Admin Panel",
3838
"backToPublicSite": "Back to Public Site",
39+
"backToConsole": "Back to Console",
3940
"backToHome": "Home",
4041
"peerclawConsole": "PeerClaw Console",
4142
"peerclawAdmin": "PeerClaw Admin",
@@ -355,7 +356,9 @@
355356
"pendingReports": "Pending Reports",
356357
"systemHealth": "System Health",
357358
"database": "Database",
358-
"overallStatus": "Overall Status"
359+
"overallStatus": "Overall Status",
360+
"healthy": "Healthy",
361+
"unhealthy": "Unhealthy"
359362
},
360363
"adminAgents": {
361364
"title": "Agents",

web/app/src/i18n/locales/es.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "Cerrar sesión",
3737
"adminPanel": "Panel de administración",
3838
"backToPublicSite": "Inicio",
39+
"backToConsole": "Volver a la Consola",
3940
"backToHome": "Inicio",
4041
"peerclawConsole": "Consola PeerClaw",
4142
"peerclawAdmin": "Administración PeerClaw",
@@ -355,7 +356,9 @@
355356
"pendingReports": "Reportes pendientes",
356357
"systemHealth": "Estado del sistema",
357358
"database": "Base de datos",
358-
"overallStatus": "Estado general"
359+
"overallStatus": "Estado general",
360+
"healthy": "Saludable",
361+
"unhealthy": "No saludable"
359362
},
360363
"adminAgents": {
361364
"title": "Agentes",

web/app/src/i18n/locales/fr.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "Se déconnecter",
3737
"adminPanel": "Panneau d'administration",
3838
"backToPublicSite": "Accueil",
39+
"backToConsole": "Retour à la Console",
3940
"backToHome": "Accueil",
4041
"peerclawConsole": "Console PeerClaw",
4142
"peerclawAdmin": "Admin PeerClaw",
@@ -355,7 +356,9 @@
355356
"pendingReports": "Signalements en attente",
356357
"systemHealth": "Santé du système",
357358
"database": "Base de données",
358-
"overallStatus": "Statut général"
359+
"overallStatus": "Statut général",
360+
"healthy": "Sain",
361+
"unhealthy": "Défaillant"
359362
},
360363
"adminAgents": {
361364
"title": "Agents",

web/app/src/i18n/locales/ja.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "サインアウト",
3737
"adminPanel": "管理パネル",
3838
"backToPublicSite": "ホームへ戻る",
39+
"backToConsole": "コンソールに戻る",
3940
"backToHome": "ホーム",
4041
"peerclawConsole": "PeerClaw コンソール",
4142
"peerclawAdmin": "PeerClaw 管理",
@@ -355,7 +356,9 @@
355356
"pendingReports": "保留中の報告",
356357
"systemHealth": "システムヘルス",
357358
"database": "データベース",
358-
"overallStatus": "全体ステータス"
359+
"overallStatus": "全体ステータス",
360+
"healthy": "正常",
361+
"unhealthy": "異常"
359362
},
360363
"adminAgents": {
361364
"title": "Agent 一覧",

web/app/src/i18n/locales/pt.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "Sair",
3737
"adminPanel": "Painel Admin",
3838
"backToPublicSite": "Início",
39+
"backToConsole": "Voltar ao Console",
3940
"backToHome": "Início",
4041
"peerclawConsole": "Console PeerClaw",
4142
"peerclawAdmin": "Admin PeerClaw",
@@ -355,7 +356,9 @@
355356
"pendingReports": "Denúncias Pendentes",
356357
"systemHealth": "Saúde do Sistema",
357358
"database": "Banco de Dados",
358-
"overallStatus": "Status Geral"
359+
"overallStatus": "Status Geral",
360+
"healthy": "Saudável",
361+
"unhealthy": "Não saudável"
359362
},
360363
"adminAgents": {
361364
"title": "Agentes",

web/app/src/i18n/locales/ru.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "Выйти",
3737
"adminPanel": "Панель администратора",
3838
"backToPublicSite": "Главная",
39+
"backToConsole": "Вернуться в консоль",
3940
"backToHome": "Главная",
4041
"peerclawConsole": "Консоль PeerClaw",
4142
"peerclawAdmin": "Администрирование PeerClaw",
@@ -355,7 +356,9 @@
355356
"pendingReports": "Ожидающие жалобы",
356357
"systemHealth": "Состояние системы",
357358
"database": "База данных",
358-
"overallStatus": "Общий статус"
359+
"overallStatus": "Общий статус",
360+
"healthy": "Исправно",
361+
"unhealthy": "Неисправно"
359362
},
360363
"adminAgents": {
361364
"title": "Агенты",

web/app/src/i18n/locales/zh.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"signOut": "退出",
3737
"adminPanel": "管理面板",
3838
"backToPublicSite": "返回首页",
39+
"backToConsole": "返回控制台",
3940
"backToHome": "首页",
4041
"peerclawConsole": "PeerClaw 控制台",
4142
"peerclawAdmin": "PeerClaw 管理",
@@ -355,7 +356,9 @@
355356
"pendingReports": "待处理举报",
356357
"systemHealth": "系统健康",
357358
"database": "数据库",
358-
"overallStatus": "总体状态"
359+
"overallStatus": "总体状态",
360+
"healthy": "正常",
361+
"unhealthy": "异常"
359362
},
360363
"adminAgents": {
361364
"title": "Agent",

web/app/src/pages/OverviewPage.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
CardHeader,
77
CardTitle,
88
} from "@/components/ui/card"
9-
import { Badge } from "@/components/ui/badge"
9+
import { CircleCheck, CircleAlert } from "lucide-react"
1010

1111
export function OverviewPage() {
1212
const { t } = useTranslation()
@@ -48,9 +48,17 @@ export function OverviewPage() {
4848
{t('admin.systemOverview')}
4949
</p>
5050
</div>
51-
<Badge variant={data.health?.status === "ok" ? "default" : "destructive"}>
52-
{data.health?.status ?? "unknown"}
53-
</Badge>
51+
{data.health?.status === "ok" ? (
52+
<span className="inline-flex items-center gap-1.5 text-sm text-emerald-500">
53+
<CircleCheck className="size-4" />
54+
{t('admin.healthy')}
55+
</span>
56+
) : (
57+
<span className="inline-flex items-center gap-1.5 text-sm text-destructive">
58+
<CircleAlert className="size-4" />
59+
{t('admin.unhealthy')}
60+
</span>
61+
)}
5462
</div>
5563

5664
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
@@ -76,15 +84,17 @@ export function OverviewPage() {
7684
<div className="space-y-2">
7785
<div className="flex items-center justify-between">
7886
<span className="text-sm text-muted-foreground">{t('admin.database')}</span>
79-
<Badge variant={data.health?.database === "ok" ? "default" : "destructive"}>
80-
{data.health?.database ?? "n/a"}
81-
</Badge>
87+
<span className={`inline-flex items-center gap-1.5 text-sm ${data.health?.database === "ok" ? "text-emerald-500" : "text-destructive"}`}>
88+
<span className={`size-2 rounded-full ${data.health?.database === "ok" ? "bg-emerald-500" : "bg-destructive"}`} />
89+
{data.health?.database === "ok" ? t('admin.healthy') : (data.health?.database ?? "n/a")}
90+
</span>
8291
</div>
8392
<div className="flex items-center justify-between">
8493
<span className="text-sm text-muted-foreground">{t('admin.overallStatus')}</span>
85-
<Badge variant={data.health?.status === "ok" ? "default" : "destructive"}>
86-
{data.health?.status ?? "unknown"}
87-
</Badge>
94+
<span className={`inline-flex items-center gap-1.5 text-sm ${data.health?.status === "ok" ? "text-emerald-500" : "text-destructive"}`}>
95+
<span className={`size-2 rounded-full ${data.health?.status === "ok" ? "bg-emerald-500" : "bg-destructive"}`} />
96+
{data.health?.status === "ok" ? t('admin.healthy') : (data.health?.status ?? "unknown")}
97+
</span>
8898
</div>
8999
</div>
90100
</CardContent>

0 commit comments

Comments
 (0)