mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 08:36:44 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
a1f95a4888
commit
8532faecec
2 changed files with 20 additions and 12 deletions
|
|
@ -1,6 +1,8 @@
|
|||
"use client";
|
||||
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import { zodValidator, fallback } from "@tanstack/zod-adapter";
|
||||
import { z } from "zod";
|
||||
import { useEffect, useState } from "react";
|
||||
import { ArrowRight, CheckCircle2, Loader2, Sparkles } from "lucide-react";
|
||||
import { useSubscription } from "@/hooks/use-profile";
|
||||
|
|
@ -17,10 +19,12 @@ import { TelegramOnboardingWizard } from "@/components/mika/telegram/TelegramOnb
|
|||
import { toast } from "sonner";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const dashboardSearchSchema = z.object({
|
||||
status: fallback(z.string().optional(), undefined),
|
||||
});
|
||||
|
||||
export const Route = createFileRoute("/painel/")({
|
||||
validateSearch: (search: Record<string, unknown>) => ({
|
||||
status: typeof search.status === "string" ? (search.status as string) : undefined,
|
||||
}),
|
||||
validateSearch: zodValidator(dashboardSearchSchema),
|
||||
component: DashboardPage,
|
||||
});
|
||||
|
||||
|
|
@ -36,11 +40,11 @@ function DashboardPage() {
|
|||
useEffect(() => {
|
||||
if (search.status !== "success" || !agent) return;
|
||||
if (agent.status === "suspended" || agent.status === "error") {
|
||||
navigate({ search: {}, replace: true });
|
||||
navigate({ search: { status: undefined }, replace: true });
|
||||
return;
|
||||
}
|
||||
if (!agent.telegram_bot_username) setWizardOpen(true);
|
||||
navigate({ search: {}, replace: true });
|
||||
navigate({ search: { status: undefined }, replace: true });
|
||||
}, [search.status, agent, navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue