feat: add JSON edit mode to Admin standards list for full CRUD

This commit is contained in:
2026-06-23 20:16:19 +00:00
parent 7f52e3e8ed
commit 7c2c3071cb
+22 -7
View File
@@ -123,6 +123,12 @@ export const AdminStandards: React.FC<AdminStandardsProps> = ({ apiKey, provider
if (isLoadingCats) return <div className="p-8 text-center">Carregando categorias...</div>; if (isLoadingCats) return <div className="p-8 text-center">Carregando categorias...</div>;
const handleEdit = (s: any) => {
setStandardName(s.codigo);
setGeneratedJson(JSON.stringify(s, null, 2));
window.scrollTo({ top: 0, behavior: 'smooth' });
};
return ( return (
<div className="animate-fade-in space-y-8"> <div className="animate-fade-in space-y-8">
{/* Admin Engine Config */} {/* Admin Engine Config */}
@@ -262,13 +268,22 @@ export const AdminStandards: React.FC<AdminStandardsProps> = ({ apiKey, provider
))} ))}
</div> </div>
</div> </div>
<button <div className="flex gap-2">
onClick={() => handleDelete(s.id)} <button
className="text-red-500 hover:text-red-700 p-2" onClick={() => handleEdit(s)}
title="Excluir" className="text-indigo-500 hover:text-indigo-700 p-2"
> title="Editar JSON"
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg> >
</button> <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" /></svg>
</button>
<button
onClick={() => handleDelete(s.id)}
className="text-red-500 hover:text-red-700 p-2"
title="Excluir"
>
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
</button>
</div>
</div> </div>
)) ))
)} )}