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