diff --git a/messages/en.json b/messages/en.json index 49cc745..cbe84b6 100644 --- a/messages/en.json +++ b/messages/en.json @@ -218,6 +218,7 @@ }, "admin": { "dashboard": "Admin Dashboard", + "dashboardDesc": "Manage users, prompts, and system settings", "totalUsers": "Total Users", "totalPrompts": "Total Prompts", "sharedPrompts": "Shared Prompts", @@ -238,7 +239,10 @@ "approve": "Approve", "reject": "Reject", "allPrompts": "All Prompts", - "allPromptsDesc": "Review all shared prompts" + "allPromptsDesc": "Review all shared prompts", + "loadingAdmin": "Loading admin panel...", + "loadingDashboard": "Loading dashboard statistics...", + "loadingPrompts": "Loading prompts for review..." }, "errors": { "generic": "Something went wrong. Please try again.", diff --git a/messages/zh.json b/messages/zh.json index 4c19c07..ff9232d 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -218,6 +218,7 @@ }, "admin": { "dashboard": "管理员后台", + "dashboardDesc": "管理用户、提示词和系统设置", "totalUsers": "用户总数", "totalPrompts": "提示词总数", "sharedPrompts": "用户共享提示词", @@ -238,7 +239,10 @@ "approve": "通过", "reject": "拒绝", "allPrompts": "所有提示词", - "allPromptsDesc": "审核所有共享提示词" + "allPromptsDesc": "审核所有共享提示词", + "loadingAdmin": "加载管理员后台中...", + "loadingDashboard": "加载统计数据中...", + "loadingPrompts": "加载审核提示词中..." }, "errors": { "generic": "出现错误,请重试。", diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx index 204f60c..8f7383b 100644 --- a/src/app/admin/layout.tsx +++ b/src/app/admin/layout.tsx @@ -4,6 +4,7 @@ import { useUser } from '@/hooks/useUser' import { useRouter } from 'next/navigation' import { useEffect } from 'react' import { useTranslations } from 'next-intl' +import { Header } from '@/components/layout/Header' export default function AdminLayout({ children, @@ -22,9 +23,15 @@ export default function AdminLayout({ if (loading) { return ( -
-
-
+
+
+
+
+
+
+

{t('loadingAdmin')}

+
+
) @@ -35,17 +42,9 @@ export default function AdminLayout({ } return ( -
-
-
-

- {t('dashboard')} -

-
-
-
- {children} -
+
+
+ {children}
) } \ No newline at end of file diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index ec83532..daa417f 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -38,15 +38,22 @@ export default function AdminDashboard() { if (loading) { return ( -
- {[...Array(4)].map((_, i) => ( - -
-
-
-
-
- ))} +
+ {/* Header */} +
+

{t('dashboard')}

+

+ {t('dashboardDesc') || 'Manage users, prompts, and system settings'} +

+
+ + {/* Loading State */} +
+
+
+

{t('loadingDashboard')}

+
+
) } @@ -79,78 +86,112 @@ export default function AdminDashboard() { ] return ( -
- {/* Stats Grid */} -
- {statCards.map((stat, index) => { - const Icon = stat.icon - return ( - -
-
-

- {stat.title} -

-

- {stat.value.toLocaleString()} -

-
- -
-
- ) - })} +
+ {/* Header */} +
+

{t('dashboard')}

+

+ {t('dashboardDesc') || 'Manage users, prompts, and system settings'} +

- {/* Quick Actions */} -
- -

- {t('quickActions')} -

-
- -
- -
-
- {t('allPrompts')} +
+ {/* Stats Grid */} +
+ {statCards.map((stat, index) => { + const Icon = stat.icon + return ( + +
+
+

+ {stat.title} +

+

+ {stat.value.toLocaleString()} +

-
- {t('allPromptsDesc')} +
+
+ +
-
- -
- + + ) + })} +
- -

- {t('systemStatus')} -

-
-
- - {t('databaseStatus')} - - - {t('healthy')} - + {/* Quick Actions and System Status */} +
+ {/* Quick Actions */} + +
+
+ +
+

+ {t('quickActions')} +

-
- - {t('authStatus')} - - - {t('healthy')} - +
+ +
+
+ +
+
+
+ {t('allPrompts')} +
+
+ {t('allPromptsDesc')} +
+
+
+
-
-
+ + + {/* System Status */} + +
+
+ +
+

+ {t('systemStatus')} +

+
+
+
+
+
+ + {t('databaseStatus')} + +
+ + {t('healthy')} + +
+
+
+
+ + {t('authStatus')} + +
+ + {t('healthy')} + +
+
+
+
) diff --git a/src/app/admin/review/page.tsx b/src/app/admin/review/page.tsx index cc3096b..bcb49a3 100644 --- a/src/app/admin/review/page.tsx +++ b/src/app/admin/review/page.tsx @@ -73,104 +73,123 @@ export default function AdminReviewPage() { if (loading) { return ( -
-
-

- {t('reviewPrompts') || 'Review Prompts'} -

+
+ {/* Header */} +
+
+
+

+ {t('allPrompts')} +

+

+ {t('reviewPromptsDesc')} +

+
+
-
- {[...Array(3)].map((_, i) => ( - -
-
-
-
-
-
-
-
-
- ))} + + {/* Loading State */} +
+
+
+

{t('loadingPrompts')}

+
) } return ( -
-
-

- {t('allPrompts')} -

-
- - {prompts.filter(p => !p.visibility || p.visibility === 'under_review').length} {t('pending')} - - - {prompts.filter(p => p.visibility === 'published').length} {t('published')} - +
+ {/* Header */} +
+
+
+

+ {t('allPrompts')} +

+

+ {t('reviewPromptsDesc')} +

+
+
+ + {prompts.filter(p => !p.visibility || p.visibility === 'under_review').length} {t('pending')} + + + {prompts.filter(p => p.visibility === 'published').length} {t('published')} + +
+ {/* Content */} {prompts.length === 0 ? ( - - -

- {t('noPromptsPending')} -

-

- {t('allPromptsReviewed')} -

+ +
+ +

+ {t('noPromptsPending')} +

+

+ {t('allPromptsReviewed')} +

+
) : ( -
+
{prompts.map((prompt) => ( - +
{/* Header */} -
-
-

+
+
+

{prompt.name}

{prompt.description && ( -

+

{prompt.description}

)}
- - {prompt.visibility === 'published' ? t('published') : t('underReview')} - +
+ + {prompt.visibility === 'published' ? t('published') : t('underReview')} + +
{/* Metadata */} -
+
- - {prompt.user.username || prompt.user.email} + + {prompt.user.username || prompt.user.email}
- - + + {formatDistanceToNow(new Date(prompt.createdAt), { addSuffix: true })}
{/* Content Preview */} -
+
- + {t('promptContent')}
-
+
{prompt.content.length > 500 ? `${prompt.content.slice(0, 500)}...` : prompt.content @@ -179,11 +198,11 @@ export default function AdminReviewPage() {
{/* Actions */} -
+
{prompt.visibility !== 'published' && (