From 2cd206c7d58a9da01a8c437364a4902c711b16fd Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 20:04:18 +0000 Subject: [PATCH] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- src/routes/painel.index.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/routes/painel.index.tsx b/src/routes/painel.index.tsx index b5d61e0..1910b58 100644 --- a/src/routes/painel.index.tsx +++ b/src/routes/painel.index.tsx @@ -24,6 +24,27 @@ export const Route = createFileRoute("/painel/")({ function DashboardPage() { const { data: subscription, isLoading } = useSubscription(); const { data: profile } = useProfile(); + const { data: agent } = useAgentInstance(); + const search = Route.useSearch(); + const navigate = Route.useNavigate(); + const [wizardOpen, setWizardOpen] = useState(false); + + // Auto-open do wizard ao voltar com ?status=success + useEffect(() => { + if (search.status !== "success" || !agent) return; + if (agent.status === "suspended" || agent.status === "error") { + navigate({ search: {}, replace: true }); + return; + } + if (!agent.telegram_bot_username) setWizardOpen(true); + navigate({ search: {}, replace: true }); + }, [search.status, agent, navigate]); + + useEffect(() => { + if (search.status === "success" && !agent && !isLoading) { + toast.info("Seu agente ainda não está pronto. Aguarde o provisionamento."); + } + }, [search.status, agent, isLoading]); if (isLoading) { return (