fix: replace per-template delete buttons with single delete on selection

Show a delete button only when a template is selected, next to the
update button. Removes the confusing row of small X icons that could
be accidentally clicked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Le-King-Fu 2026-02-15 17:25:59 +00:00
parent 5bfab3175e
commit 13989dc0b8

View file

@ -101,27 +101,22 @@ export default function SourceConfigPanel({
))}
</select>
{selectedTemplateId && (
<button
onClick={onUpdateTemplate}
title={t("import.config.updateTemplate")}
className="p-1.5 rounded-lg text-[var(--primary)] hover:bg-[var(--muted)] transition-colors"
>
<RefreshCw size={16} />
</button>
)}
{configTemplates.length > 0 && (
<div className="flex gap-1">
{configTemplates.map((tpl) => (
<button
key={tpl.id}
onClick={() => onDeleteTemplate(tpl.id)}
title={`${t("import.config.deleteTemplate")}: ${tpl.name}`}
className="p-1 text-[var(--muted-foreground)] hover:text-[var(--negative)] transition-colors"
>
<X size={14} />
</button>
))}
</div>
<>
<button
onClick={onUpdateTemplate}
title={t("import.config.updateTemplate")}
className="p-1.5 rounded-lg text-[var(--primary)] hover:bg-[var(--muted)] transition-colors"
>
<RefreshCw size={16} />
</button>
<button
onClick={() => onDeleteTemplate(selectedTemplateId)}
title={t("import.config.deleteTemplate")}
className="p-1.5 rounded-lg text-[var(--muted-foreground)] hover:text-[var(--negative)] transition-colors"
>
<X size={16} />
</button>
</>
)}
</div>