chore: refine vless qr copy handling (#583)

This commit is contained in:
shenlan 2025-10-26 21:25:46 +08:00 committed by GitHub
parent f5b03bdc77
commit f927e502f5
2 changed files with 16 additions and 19 deletions

View File

@ -308,6 +308,7 @@ type UserCenterOverviewTranslation = {
label: string
description: string
linkLabel: string
linkHelper: string
copyLink: string
copied: string
downloadQr: string
@ -315,6 +316,7 @@ type UserCenterOverviewTranslation = {
generating: string
error: string
missingUuid: string
downloadTooltip: string
warning: string
macPath: string
linuxPath: string
@ -789,9 +791,10 @@ export const translations: Record<'en' | 'zh', Translation> = {
action: 'Manage MFA',
},
vless: {
label: 'VLESS access',
description: 'Scan to connect instantly with the Tokyo Vision node over TLS.',
label: 'VLESS QR code',
description: 'Scan to import the accelerator configuration instantly.',
linkLabel: 'VLESS URI',
linkHelper: 'Click “Copy link” to copy your private VLESS URI.',
copyLink: 'Copy link',
copied: 'Link copied',
downloadQr: 'Download QR',
@ -799,9 +802,8 @@ export const translations: Record<'en' | 'zh', Translation> = {
generating: 'Generating QR code…',
error: 'We could not generate the QR code. Try again later.',
missingUuid: 'We could not locate your UUID. Refresh the page or sign in again.',
warning: 'Your UUID is the only credential required to access this node. Keep it private and do not share it.',
macPath: 'macOS: /opt/homebrew/etc/config.json',
linuxPath: 'Linux: /usr/local/etc/config.json',
downloadTooltip:
'Your UUID is the only credential required to access this node. Keep it private and do not share it.\nmacOS: /opt/homebrew/etc/config.json\nLinux: /usr/local/etc/config.json',
qrAlt: 'VLESS connection QR code',
},
},
@ -1378,8 +1380,9 @@ export const translations: Record<'en' | 'zh', Translation> = {
},
vless: {
label: 'VLESS 二维码',
description: '扫码即可连接东京 Vision 节点TLS',
description: 'VLESS 二维码 - 扫码即可导入加速器配置',
linkLabel: 'VLESS 链接',
linkHelper: '点击「复制链接」即可获取专属 VLESS 链接。',
copyLink: '复制链接',
copied: '链接已复制',
downloadQr: '下载二维码',
@ -1387,9 +1390,8 @@ export const translations: Record<'en' | 'zh', Translation> = {
generating: '二维码生成中…',
error: '二维码生成失败,请稍后重试。',
missingUuid: '无法获取您的 UUID请刷新页面或重新登录。',
warning: 'UUID 是访问节点的唯一凭证,请谨慎保存,勿随意分发。',
macPath: 'macOS/opt/homebrew/etc/config.json',
linuxPath: 'Linux/usr/local/etc/config.json',
downloadTooltip:
'UUID 是访问节点的唯一凭证,请谨慎保存,勿随意分发。\nmacOS/opt/homebrew/etc/config.json\nLinux/usr/local/etc/config.json',
qrAlt: 'VLESS 连接二维码',
},
},

View File

@ -17,6 +17,7 @@ export type VlessQrCopy = {
label: string
description: string
linkLabel: string
linkHelper: string
copyLink: string
copied: string
downloadQr: string
@ -24,9 +25,7 @@ export type VlessQrCopy = {
generating: string
error: string
missingUuid: string
warning: string
macPath: string
linuxPath: string
downloadTooltip: string
qrAlt: string
}
@ -185,14 +184,8 @@ export default function VlessQrCard({ uuid, copy }: VlessQrCardProps) {
<div className="flex flex-1 flex-col gap-2 text-xs text-[var(--color-text-subtle)]">
<div className="rounded-[var(--radius-lg)] border border-[color:var(--color-surface-border)] bg-[var(--color-surface-muted)] p-3 text-[11px] text-[var(--color-text)]">
<p className="mb-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--color-text-subtle)]">{copy.linkLabel}</p>
<p className="break-all font-mono text-xs">{vlessUri}</p>
<p className="font-mono text-xs text-[var(--color-text-subtle)]">{copy.linkHelper}</p>
</div>
<p className="flex items-start gap-2 text-[var(--color-warning-foreground)]">
<span aria-hidden className="mt-[2px] inline-flex h-2 w-2 rounded-full bg-[var(--color-warning-foreground)]" />
<span>{copy.warning}</span>
</p>
<p>{copy.macPath}</p>
<p>{copy.linuxPath}</p>
</div>
</div>
@ -220,6 +213,8 @@ export default function VlessQrCard({ uuid, copy }: VlessQrCardProps) {
onClick={handleDownloadConfig}
disabled={isDisabled}
className="inline-flex items-center gap-2 rounded-md border border-[color:var(--color-surface-border)] px-3 py-2 text-xs font-medium text-[var(--color-text)] transition-colors hover:border-[color:var(--color-primary-border)] hover:text-[var(--color-primary)] disabled:cursor-not-allowed disabled:opacity-60"
title={copy.downloadTooltip}
aria-label={copy.downloadTooltip}
>
<Download className="h-3.5 w-3.5" />
{copy.downloadConfig}