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