Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot] 2026-04-23 21:47:11 +00:00
parent 04b34f9217
commit adba16e1a7

View file

@ -259,7 +259,7 @@ function AgentDetailPage() {
isAdmin, hasUser: !!user, hasAgent: !!agent, agentError,
});
if (authLoading || roleLoading) {
if (authLoading || (user && roleLoading) || (isAdmin === true && agentLoading)) {
return (
<div className="min-h-screen flex items-center justify-center bg-background">
<Loader2 className="h-6 w-6 animate-spin text-primary" />
@ -267,7 +267,11 @@ function AgentDetailPage() {
);
}
if (!isAdmin) {
if (!user) {
return null;
}
if (isAdmin === false) {
return (
<div className="min-h-screen flex items-center justify-center bg-background px-4">
<div className="max-w-md text-center space-y-4">
@ -285,6 +289,22 @@ function AgentDetailPage() {
);
}
if (agentError) {
return (
<div className="min-h-screen flex items-center justify-center bg-background px-4">
<div className="max-w-md text-center space-y-4">
<h1 className="text-2xl font-bold">Erro ao carregar agente</h1>
<p className="text-sm text-muted-foreground">{agentError.message}</p>
<Button asChild variant="outline">
<Link to="/admin">
<ArrowLeft className="h-4 w-4 mr-2" /> Voltar ao admin
</Link>
</Button>
</div>
</div>
);
}
if (!agent) {
return (
<div className="min-h-screen flex items-center justify-center bg-background px-4">