feat(frontend): 控制台 next-intl 中英双语

接入无 URL 前缀的 zh-CN/en,顶栏与外观设置可切换语言;选择写入 cookie 后刷新生效。
This commit is contained in:
ryan
2026-08-16 16:49:16 +08:00
parent 64fbaa7ef1
commit 5a8722ff07
219 changed files with 21437 additions and 5212 deletions
@@ -2,6 +2,7 @@
import Link from 'next/link';
import { ChevronRight } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { Badge } from '@/components/ui/badge';
import type { PagesProject } from '@/lib/services/openflare';
@@ -12,6 +13,7 @@ interface ProjectListItemProps {
}
export function ProjectListItem({ project }: ProjectListItemProps) {
const t = useTranslations('pages');
return (
<Link
href={`/pages/detail?id=${project.id}`}
@@ -22,10 +24,10 @@ export function ProjectListItem({ project }: ProjectListItemProps) {
<div className='flex flex-wrap items-center gap-2'>
<h2 className='text-base font-semibold'>{project.name}</h2>
<Badge variant='outline' className='text-[10px]'>
{project.enabled ? '已启用' : '已停用'}
{project.enabled ? t('enabled') : t('disabled')}
</Badge>
<Badge variant='outline' className='text-[10px]'>
{project.spa_fallback_enabled ? 'SPA fallback' : '严格 404'}
{project.spa_fallback_enabled ? t('spaFallback') : t('strict404')}
</Badge>
</div>
<p className='text-sm text-muted-foreground'>{project.slug}</p>
@@ -37,24 +39,24 @@ export function ProjectListItem({ project }: ProjectListItemProps) {
</div>
<div className='rounded-lg border border-dashed px-4 py-3 text-sm md:min-w-36'>
<p className='text-xs text-muted-foreground'>当前激活</p>
<p className='text-xs text-muted-foreground'>{t('currentActive')}</p>
<p className='mt-1 font-semibold'>
{project.active_deployment
? `#${project.active_deployment.deployment_number}`
: '暂无'}
: t('none')}
</p>
</div>
</div>
<div className='mt-4 flex items-center justify-between border-t border-dashed pt-3 text-xs text-muted-foreground'>
<span>
激活时间:
{t('activatedAt')}
{project.active_deployment?.activated_at
? formatDateTime(project.active_deployment.activated_at)
: '未激活'}
: t('notActivated')}
</span>
<span className='inline-flex items-center text-primary group-hover:translate-x-0.5 transition-transform'>
查看详情
{t('viewDetail')}
<ChevronRight className='size-3.5 ml-0.5' />
</span>
</div>