mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 11:56:45 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
768ad880c6
commit
2cd206c7d5
1 changed files with 21 additions and 0 deletions
|
|
@ -24,6 +24,27 @@ export const Route = createFileRoute("/painel/")({
|
||||||
function DashboardPage() {
|
function DashboardPage() {
|
||||||
const { data: subscription, isLoading } = useSubscription();
|
const { data: subscription, isLoading } = useSubscription();
|
||||||
const { data: profile } = useProfile();
|
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) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue