Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/web/src/components/setup-migrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export function SetupMigrationsResult({

if (migrations.length === 0) {
return (
<p className="text-sm text-muted-foreground">{t('setup.noMigrations')}</p>
<p className="text-body text-muted-foreground">
{t('setup.noMigrations')}
</p>
);
}

Expand All @@ -25,13 +27,15 @@ export function SetupMigrationsResult({
{migrations.map((m) => (
<li key={m.name} className="rounded-md border p-3">
<div className="flex items-center justify-between gap-2">
<span className="font-mono text-sm">{m.name}</span>
<span className="font-mono text-body">{m.name}</span>
<Badge variant={MIGRATION_STATUS_VARIANT[m.status]}>
{t(migrationStatusLabel(m.status))}
</Badge>
</div>
{m.status === 'error' && m.error && (
<p className="mt-1 break-all text-xs text-destructive">{m.error}</p>
<p className="mt-1 break-all text-caption text-destructive">
{m.error}
</p>
)}
</li>
))}
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export function CardTitle({
}: React.HTMLAttributes<HTMLHeadingElement>) {
return (
<h3
className={cn(
'text-h2 font-semibold tracking-tight',
className,
)}
className={cn('text-h2 font-semibold tracking-tight', className)}
{...props}
/>
);
Expand All @@ -48,7 +45,10 @@ export function CardDescription({
...props
}: React.HTMLAttributes<HTMLParagraphElement>) {
return (
<p className={cn('text-sm text-muted-foreground', className)} {...props} />
<p
className={cn('text-body text-muted-foreground', className)}
{...props}
/>
);
}

Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export function DialogTitle({
...props
}: React.HTMLAttributes<HTMLHeadingElement>) {
return (
<h2 className={cn('text-h3 font-semibold tracking-tight', className)} {...props} />
<h2
className={cn('text-h3 font-semibold tracking-tight', className)}
{...props}
/>
);
}

Expand Down
6 changes: 6 additions & 0 deletions apps/web/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const en = {
},
links: {
title: 'My Links',
titleDesc: 'Create and manage your short links.',
createLink: 'Create Link',
shortLink: 'Short Link',
destination: 'Destination',
Expand Down Expand Up @@ -115,6 +116,7 @@ export const en = {
},
analytics: {
title: 'Analytics',
titleDesc: 'Traffic insights for your links.',
linkSearchPlaceholder: 'Search by slug...',
allLinks: 'All Links',
selectLink: 'Select a link to view its analytics',
Expand All @@ -137,6 +139,7 @@ export const en = {
},
settings: {
title: 'Account Settings',
titleDesc: 'Manage your preferences and sign-in security.',
changePassword: 'Change Password',
currentPassword: 'Current Password',
newPassword: 'New Password',
Expand Down Expand Up @@ -209,8 +212,11 @@ export const en = {
admin: {
adminPanel: 'Admin Panel',
users: 'Users',
usersDesc: 'Manage accounts, roles and access.',
allLinks: 'All Links',
allLinksDesc: 'Every short link across all users.',
globalSettings: 'Global Settings',
globalSettingsDesc: 'Instance-wide configuration.',
createUser: 'Create User',
createUserTitle: 'Create New User',
createUserDesc: 'Create a new user account',
Expand Down
6 changes: 6 additions & 0 deletions apps/web/src/i18n/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const zhCN: Translations = {
},
links: {
title: '我的链接',
titleDesc: '创建并管理你的短链接。',
createLink: '创建链接',
shortLink: '短链接',
destination: '目标地址',
Expand Down Expand Up @@ -112,6 +113,7 @@ export const zhCN: Translations = {
},
analytics: {
title: '统计分析',
titleDesc: '查看你的链接流量洞察。',
linkSearchPlaceholder: '按别名搜索...',
allLinks: '所有链接',
selectLink: '选择链接查看其统计数据',
Expand All @@ -134,6 +136,7 @@ export const zhCN: Translations = {
},
settings: {
title: '账户设置',
titleDesc: '管理偏好设置与登录安全。',
changePassword: '修改密码',
currentPassword: '当前密码',
newPassword: '新密码',
Expand Down Expand Up @@ -202,8 +205,11 @@ export const zhCN: Translations = {
admin: {
adminPanel: '管理面板',
users: '用户',
usersDesc: '管理账户、角色与访问权限。',
allLinks: '所有链接',
allLinksDesc: '全站所有用户的短链接。',
globalSettings: '全局设置',
globalSettingsDesc: '实例级配置。',
createUser: '创建用户',
createUserTitle: '创建新用户',
createUserDesc: '创建一个新的用户账户',
Expand Down
22 changes: 13 additions & 9 deletions apps/web/src/pages/SetupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,28 @@ export default function SetupPage() {
return (
<AuthCard>
<CardHeader>
<CardTitle className="text-2xl">{t('setup.title')}</CardTitle>
<CardTitle>{t('setup.title')}</CardTitle>
<CardDescription>{t('setup.titleDesc')}</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
{stateLoading ? (
<p className="text-sm text-muted-foreground">{t('common.loading')}</p>
<p className="text-body text-muted-foreground">
{t('common.loading')}
</p>
) : stateError ? (
<p className="text-sm text-destructive" role="alert">
<p className="text-body text-destructive" role="alert">
{formatSetupError(stateError, t)}
</p>
) : !enabled ? (
<div className="space-y-1">
<p className="text-sm font-medium">{t('setup.disabledTitle')}</p>
<p className="text-sm text-muted-foreground">
<div className="space-y-2">
<p className="text-body font-medium">{t('setup.disabledTitle')}</p>
<p className="text-body text-muted-foreground">
{t('setup.disabledDesc')}
</p>
</div>
) : (
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-1">
<div className="space-y-2">
<Label htmlFor="setup-secret">{t('setup.secretLabel')}</Label>
<Input
id="setup-secret"
Expand All @@ -99,14 +101,16 @@ export default function SetupPage() {
)}

{runError && (
<p className="text-sm text-destructive" role="alert">
<p className="text-body text-destructive" role="alert">
{formatSetupError(runError, t)}
</p>
)}

{result && (
<div className="space-y-2">
<p className="text-sm font-medium">{t('setup.migrationsTitle')}</p>
<p className="text-body font-medium">
{t('setup.migrationsTitle')}
</p>
<SetupMigrationsResult migrations={result.migrations} />
</div>
)}
Expand Down
51 changes: 30 additions & 21 deletions apps/web/src/pages/admin/AdminLinksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ export default function AdminLinksPage() {
});

return (
<div className="p-6">
<h1 className="text-2xl font-semibold mb-6">{t('admin.allLinks')}</h1>
<div className="relative mb-4">
<Search className="absolute left-3 top-2.5 h-4 w-4 text-muted-foreground" />
<div className="space-y-6 p-6">
<div className="space-y-1">
<h1 className="text-h1 font-bold tracking-tight">
{t('admin.allLinks')}
</h1>
<p className="text-body text-muted-foreground">
{t('admin.allLinksDesc')}
</p>
</div>
<div className="relative max-w-sm">
<Search className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
<Input
placeholder={t('admin.searchLinksPlaceholder')}
value={search}
Expand All @@ -63,37 +70,39 @@ export default function AdminLinksPage() {
</div>

{isLoading ? (
<div className="text-center py-12 text-muted-foreground">
<div className="py-16 text-center text-body text-muted-foreground">
{t('common.loading')}
</div>
) : (
<div className="rounded-md border overflow-x-auto">
<table className="w-full text-sm">
<div className="overflow-x-auto rounded-lg border bg-card">
<table className="w-full text-body">
<thead>
<tr className="border-b bg-muted/50">
<th className="px-4 py-3 text-left font-medium w-12">#</th>
<th className="px-4 py-3 text-left font-medium">
<th className="w-12 px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
#
</th>
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('links.shortLink')}
</th>
<th className="px-4 py-3 text-left font-medium">
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('links.destination')}
</th>
<th className="px-4 py-3 text-left font-medium">
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('common.user')}
</th>
<th className="px-4 py-3 text-left font-medium">
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('links.clicks')}
</th>
<th className="px-4 py-3 text-left font-medium">
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('links.expiry')}
</th>
<th className="px-4 py-3 text-left font-medium">
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('common.status')}
</th>
<th className="px-4 py-3 text-left font-medium">
<th className="px-4 py-3 text-left text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('common.created')}
</th>
<th className="px-4 py-3 text-right font-medium">
<th className="px-4 py-3 text-right text-caption font-medium tracking-caps text-muted-foreground uppercase">
{t('common.actions')}
</th>
</tr>
Expand All @@ -102,17 +111,17 @@ export default function AdminLinksPage() {
{data?.links.map((link) => (
<tr
key={link.id}
className="border-b last:border-0 hover:bg-muted/20"
className="border-b last:border-0 transition-colors duration-(--duration-fast) ease-(--ease-out) hover:bg-muted/20"
>
<td className="px-4 py-3 text-muted-foreground text-xs">
<td className="px-4 py-3 text-micro text-muted-foreground">
{link.seq}
</td>
<LinkSlugCell slug={link.slug} />
<LinkDestinationCell url={link.destination_url} />
<td className="px-4 py-3 text-muted-foreground">
{link.user_username}
</td>
<td className="px-4 py-3 text-muted-foreground">
<td className="px-4 py-3 font-mono font-semibold tabular-nums">
{link.click_count ?? 0}
</td>
<LinkExpiryCell expiresAt={link.expires_at} />
Expand All @@ -136,8 +145,8 @@ export default function AdminLinksPage() {
)}

{data && data.pagination.pages > 1 && (
<div className="flex justify-between items-center mt-4">
<span className="text-sm text-muted-foreground">
<div className="flex items-center justify-between">
<span className="text-body text-muted-foreground">
{t('admin.totalLinks', { count: data.pagination.total })}
</span>
<div className="flex gap-2">
Expand Down
Loading