mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 14:56:51 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
781a5e31bc
commit
3f279f7167
2 changed files with 40 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import { Route as RedefinirSenhaRouteImport } from './routes/redefinir-senha'
|
|||
import { Route as RecuperarSenhaRouteImport } from './routes/recuperar-senha'
|
||||
import { Route as PainelRouteImport } from './routes/painel'
|
||||
import { Route as LoginRouteImport } from './routes/login'
|
||||
import { Route as BemVindoRouteImport } from './routes/bem-vindo'
|
||||
import { Route as AdminRouteImport } from './routes/admin'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as PainelIndexRouteImport } from './routes/painel.index'
|
||||
|
|
@ -59,6 +60,11 @@ const LoginRoute = LoginRouteImport.update({
|
|||
path: '/login',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const BemVindoRoute = BemVindoRouteImport.update({
|
||||
id: '/bem-vindo',
|
||||
path: '/bem-vindo',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const AdminRoute = AdminRouteImport.update({
|
||||
id: '/admin',
|
||||
path: '/admin',
|
||||
|
|
@ -158,6 +164,7 @@ const AdminAgenteIdRoute = AdminAgenteIdRouteImport.update({
|
|||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/admin': typeof AdminRouteWithChildren
|
||||
'/bem-vindo': typeof BemVindoRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/painel': typeof PainelRouteWithChildren
|
||||
'/recuperar-senha': typeof RecuperarSenhaRoute
|
||||
|
|
@ -183,6 +190,7 @@ export interface FileRoutesByFullPath {
|
|||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/bem-vindo': typeof BemVindoRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/recuperar-senha': typeof RecuperarSenhaRoute
|
||||
'/redefinir-senha': typeof RedefinirSenhaRoute
|
||||
|
|
@ -208,6 +216,7 @@ export interface FileRoutesById {
|
|||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/admin': typeof AdminRouteWithChildren
|
||||
'/bem-vindo': typeof BemVindoRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/painel': typeof PainelRouteWithChildren
|
||||
'/recuperar-senha': typeof RecuperarSenhaRoute
|
||||
|
|
@ -236,6 +245,7 @@ export interface FileRouteTypes {
|
|||
fullPaths:
|
||||
| '/'
|
||||
| '/admin'
|
||||
| '/bem-vindo'
|
||||
| '/login'
|
||||
| '/painel'
|
||||
| '/recuperar-senha'
|
||||
|
|
@ -261,6 +271,7 @@ export interface FileRouteTypes {
|
|||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/'
|
||||
| '/bem-vindo'
|
||||
| '/login'
|
||||
| '/recuperar-senha'
|
||||
| '/redefinir-senha'
|
||||
|
|
@ -285,6 +296,7 @@ export interface FileRouteTypes {
|
|||
| '__root__'
|
||||
| '/'
|
||||
| '/admin'
|
||||
| '/bem-vindo'
|
||||
| '/login'
|
||||
| '/painel'
|
||||
| '/recuperar-senha'
|
||||
|
|
@ -312,6 +324,7 @@ export interface FileRouteTypes {
|
|||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
AdminRoute: typeof AdminRouteWithChildren
|
||||
BemVindoRoute: typeof BemVindoRoute
|
||||
LoginRoute: typeof LoginRoute
|
||||
PainelRoute: typeof PainelRouteWithChildren
|
||||
RecuperarSenhaRoute: typeof RecuperarSenhaRoute
|
||||
|
|
@ -357,6 +370,13 @@ declare module '@tanstack/react-router' {
|
|||
preLoaderRoute: typeof LoginRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/bem-vindo': {
|
||||
id: '/bem-vindo'
|
||||
path: '/bem-vindo'
|
||||
fullPath: '/bem-vindo'
|
||||
preLoaderRoute: typeof BemVindoRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/admin': {
|
||||
id: '/admin'
|
||||
path: '/admin'
|
||||
|
|
@ -555,6 +575,7 @@ const PainelRouteWithChildren =
|
|||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
AdminRoute: AdminRouteWithChildren,
|
||||
BemVindoRoute: BemVindoRoute,
|
||||
LoginRoute: LoginRoute,
|
||||
PainelRoute: PainelRouteWithChildren,
|
||||
RecuperarSenhaRoute: RecuperarSenhaRoute,
|
||||
|
|
|
|||
|
|
@ -35,13 +35,17 @@ function DashboardPage() {
|
|||
const [wizardOpen, setWizardOpen] = useState(false);
|
||||
const previousStatusRef = useRef<string | null>(null);
|
||||
|
||||
// Auto-open do wizard ao voltar com ?status=success
|
||||
// Redireciona para /bem-vindo se cliente acabou de pagar e ainda não completou onboarding
|
||||
useEffect(() => {
|
||||
if (search.status !== "success" || !agent) return;
|
||||
if (agent.status === "suspended" || agent.status === "error") {
|
||||
navigate({ search: { status: undefined }, replace: true });
|
||||
return;
|
||||
}
|
||||
if (!agent.onboarding_completed) {
|
||||
navigate({ to: "/bem-vindo", replace: true });
|
||||
return;
|
||||
}
|
||||
if (!agent.telegram_bot_username) setWizardOpen(true);
|
||||
navigate({ search: { status: undefined }, replace: true });
|
||||
}, [search.status, agent, navigate]);
|
||||
|
|
@ -74,6 +78,17 @@ function DashboardPage() {
|
|||
}
|
||||
|
||||
const firstName = (profile?.full_name || "").split(" ")[0] || "por aqui";
|
||||
const agentName = agent?.agent_name?.trim() || "Mika";
|
||||
const statusLabel =
|
||||
agent?.status === "active"
|
||||
? "ativo"
|
||||
: agent?.status === "provisioning"
|
||||
? "sendo preparado"
|
||||
: agent?.status === "suspended"
|
||||
? "pausado"
|
||||
: agent?.status === "error"
|
||||
? "com erro"
|
||||
: "aguardando configuração";
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
|
|
@ -83,7 +98,9 @@ function DashboardPage() {
|
|||
<h1 className="text-3xl font-bold tracking-tight">Olá, {firstName} 👋</h1>
|
||||
<p className="mt-1 text-muted-foreground">
|
||||
{subscription
|
||||
? "Acompanhe abaixo o status do seu agente Mika."
|
||||
? agent
|
||||
? <>Seu agente <span className="font-semibold text-foreground">{agentName}</span> está {statusLabel}.</>
|
||||
: "Acompanhe abaixo o status do seu agente."
|
||||
: "Vamos colocar seu agente Mika no ar."}
|
||||
</p>
|
||||
</header>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue