fix: 更新中文提示信息格式以提升可读性

在多个组件中移除模板字符串,直接使用普通字符串格式化中文提示信息,增强了代码的可读性和一致性。
This commit is contained in:
2026-06-30 21:06:39 +08:00
parent d0825c5ec0
commit ece5c6135e
6 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ export default function RouterContainer() {
</div>
<h3 className="text-sm font-semibold text-foreground"></h3>
<p className="text-xs text-muted-foreground mt-1 max-w-[240px]">
{`该功能在当前运行环境(${entryPointType})下不可用或已被移除。`}
{entryPointType.toUpperCase()}
</p>
</div>
)}
@@ -22,7 +22,9 @@ vi.mock('../components/TextMode', () => ({
}));
vi.mock('../components/Base64ConverterSection', () => ({
default: ({ mode }: { mode: string }) => <div data-testid={`${mode}-mode`}>{mode}</div>,
default: ({ mode }: { mode: 'file' | 'image' }) => (
<div data-testid={`${mode}-mode`}>{mode.toUpperCase()} Mode</div>
),
}));
const waitForStorageInit = () =>
@@ -286,7 +286,7 @@ export default function FieldList({
onClick={handleUpdateRule}
disabled={fields.length === 0}
className="h-8 gap-1.5 px-2.5"
title={`编辑中: ${editingRule.name}`}
title={editingRule ? `编辑中: ${editingRule.name}` : ''}
>
<Save className="h-3.5 w-3.5" />
@@ -33,7 +33,10 @@ export default function GenerateButton({
{progress && (
<div className="space-y-2">
<div className="flex items-center justify-between text-xs text-muted-foreground">
<span>{`已生成 ${progress.generated.toLocaleString()} / ${progress.total.toLocaleString()}`}</span>
<span>
{progress.generated.toLocaleString()} / {progress.total.toLocaleString()}{' '}
</span>
<span>{progress.progress}%</span>
</div>
<div className="h-2 bg-muted rounded-full overflow-hidden">
@@ -44,7 +47,7 @@ export default function GenerateButton({
</div>
{progress.estimatedTimeLeft !== undefined && (
<p className="text-xs text-muted-foreground text-center">
{`预计剩余 ${Math.ceil(progress.estimatedTimeLeft / 1000)}`}
{Math.ceil(progress.estimatedTimeLeft / 1000)}
</p>
)}
</div>
@@ -82,7 +82,7 @@ export default function ResultPanel({ result }: ResultPanelProps) {
))}
{result.warnings.length > 5 && (
<li className="text-xs text-yellow-500/80">
{`... 还有 ${result.warnings.length - 5} 条警告`}
... {result.warnings.length - 5}
</li>
)}
</ul>
@@ -227,7 +227,7 @@ export default function RuleManager({ onLoad, onEdit, onRulesChanged }: RuleMana
maxLength={20}
/>
<span className="absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted-foreground pointer-events-none tabular-nums">
{`已保存 ${rules.length}/${ruleStorage.MAX_RULES}`}
{rules.length}/{ruleStorage.MAX_RULES}
</span>
</div>
@@ -260,7 +260,7 @@ export default function RuleManager({ onLoad, onEdit, onRulesChanged }: RuleMana
<Clock className="h-3 w-3" />
{formatDate(rule.updatedAt)}
</span>
<span>{`使用 ${rule.useCount}`}</span>
<span>使 {rule.useCount} </span>
</div>
</div>