Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot] 2026-04-17 20:04:18 +00:00
parent 768ad880c6
commit 2cd206c7d5

View file

@ -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 (