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 RecuperarSenhaRouteImport } from './routes/recuperar-senha'
|
||||||
import { Route as PainelRouteImport } from './routes/painel'
|
import { Route as PainelRouteImport } from './routes/painel'
|
||||||
import { Route as LoginRouteImport } from './routes/login'
|
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 AdminRouteImport } from './routes/admin'
|
||||||
import { Route as IndexRouteImport } from './routes/index'
|
import { Route as IndexRouteImport } from './routes/index'
|
||||||
import { Route as PainelIndexRouteImport } from './routes/painel.index'
|
import { Route as PainelIndexRouteImport } from './routes/painel.index'
|
||||||
|
|
@ -59,6 +60,11 @@ const LoginRoute = LoginRouteImport.update({
|
||||||
path: '/login',
|
path: '/login',
|
||||||
getParentRoute: () => rootRouteImport,
|
getParentRoute: () => rootRouteImport,
|
||||||
} as any)
|
} as any)
|
||||||
|
const BemVindoRoute = BemVindoRouteImport.update({
|
||||||
|
id: '/bem-vindo',
|
||||||
|
path: '/bem-vindo',
|
||||||
|
getParentRoute: () => rootRouteImport,
|
||||||
|
} as any)
|
||||||
const AdminRoute = AdminRouteImport.update({
|
const AdminRoute = AdminRouteImport.update({
|
||||||
id: '/admin',
|
id: '/admin',
|
||||||
path: '/admin',
|
path: '/admin',
|
||||||
|
|
@ -158,6 +164,7 @@ const AdminAgenteIdRoute = AdminAgenteIdRouteImport.update({
|
||||||
export interface FileRoutesByFullPath {
|
export interface FileRoutesByFullPath {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/admin': typeof AdminRouteWithChildren
|
'/admin': typeof AdminRouteWithChildren
|
||||||
|
'/bem-vindo': typeof BemVindoRoute
|
||||||
'/login': typeof LoginRoute
|
'/login': typeof LoginRoute
|
||||||
'/painel': typeof PainelRouteWithChildren
|
'/painel': typeof PainelRouteWithChildren
|
||||||
'/recuperar-senha': typeof RecuperarSenhaRoute
|
'/recuperar-senha': typeof RecuperarSenhaRoute
|
||||||
|
|
@ -183,6 +190,7 @@ export interface FileRoutesByFullPath {
|
||||||
}
|
}
|
||||||
export interface FileRoutesByTo {
|
export interface FileRoutesByTo {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
|
'/bem-vindo': typeof BemVindoRoute
|
||||||
'/login': typeof LoginRoute
|
'/login': typeof LoginRoute
|
||||||
'/recuperar-senha': typeof RecuperarSenhaRoute
|
'/recuperar-senha': typeof RecuperarSenhaRoute
|
||||||
'/redefinir-senha': typeof RedefinirSenhaRoute
|
'/redefinir-senha': typeof RedefinirSenhaRoute
|
||||||
|
|
@ -208,6 +216,7 @@ export interface FileRoutesById {
|
||||||
__root__: typeof rootRouteImport
|
__root__: typeof rootRouteImport
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/admin': typeof AdminRouteWithChildren
|
'/admin': typeof AdminRouteWithChildren
|
||||||
|
'/bem-vindo': typeof BemVindoRoute
|
||||||
'/login': typeof LoginRoute
|
'/login': typeof LoginRoute
|
||||||
'/painel': typeof PainelRouteWithChildren
|
'/painel': typeof PainelRouteWithChildren
|
||||||
'/recuperar-senha': typeof RecuperarSenhaRoute
|
'/recuperar-senha': typeof RecuperarSenhaRoute
|
||||||
|
|
@ -236,6 +245,7 @@ export interface FileRouteTypes {
|
||||||
fullPaths:
|
fullPaths:
|
||||||
| '/'
|
| '/'
|
||||||
| '/admin'
|
| '/admin'
|
||||||
|
| '/bem-vindo'
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/painel'
|
| '/painel'
|
||||||
| '/recuperar-senha'
|
| '/recuperar-senha'
|
||||||
|
|
@ -261,6 +271,7 @@ export interface FileRouteTypes {
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to:
|
to:
|
||||||
| '/'
|
| '/'
|
||||||
|
| '/bem-vindo'
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/recuperar-senha'
|
| '/recuperar-senha'
|
||||||
| '/redefinir-senha'
|
| '/redefinir-senha'
|
||||||
|
|
@ -285,6 +296,7 @@ export interface FileRouteTypes {
|
||||||
| '__root__'
|
| '__root__'
|
||||||
| '/'
|
| '/'
|
||||||
| '/admin'
|
| '/admin'
|
||||||
|
| '/bem-vindo'
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/painel'
|
| '/painel'
|
||||||
| '/recuperar-senha'
|
| '/recuperar-senha'
|
||||||
|
|
@ -312,6 +324,7 @@ export interface FileRouteTypes {
|
||||||
export interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
AdminRoute: typeof AdminRouteWithChildren
|
AdminRoute: typeof AdminRouteWithChildren
|
||||||
|
BemVindoRoute: typeof BemVindoRoute
|
||||||
LoginRoute: typeof LoginRoute
|
LoginRoute: typeof LoginRoute
|
||||||
PainelRoute: typeof PainelRouteWithChildren
|
PainelRoute: typeof PainelRouteWithChildren
|
||||||
RecuperarSenhaRoute: typeof RecuperarSenhaRoute
|
RecuperarSenhaRoute: typeof RecuperarSenhaRoute
|
||||||
|
|
@ -357,6 +370,13 @@ declare module '@tanstack/react-router' {
|
||||||
preLoaderRoute: typeof LoginRouteImport
|
preLoaderRoute: typeof LoginRouteImport
|
||||||
parentRoute: typeof rootRouteImport
|
parentRoute: typeof rootRouteImport
|
||||||
}
|
}
|
||||||
|
'/bem-vindo': {
|
||||||
|
id: '/bem-vindo'
|
||||||
|
path: '/bem-vindo'
|
||||||
|
fullPath: '/bem-vindo'
|
||||||
|
preLoaderRoute: typeof BemVindoRouteImport
|
||||||
|
parentRoute: typeof rootRouteImport
|
||||||
|
}
|
||||||
'/admin': {
|
'/admin': {
|
||||||
id: '/admin'
|
id: '/admin'
|
||||||
path: '/admin'
|
path: '/admin'
|
||||||
|
|
@ -555,6 +575,7 @@ const PainelRouteWithChildren =
|
||||||
const rootRouteChildren: RootRouteChildren = {
|
const rootRouteChildren: RootRouteChildren = {
|
||||||
IndexRoute: IndexRoute,
|
IndexRoute: IndexRoute,
|
||||||
AdminRoute: AdminRouteWithChildren,
|
AdminRoute: AdminRouteWithChildren,
|
||||||
|
BemVindoRoute: BemVindoRoute,
|
||||||
LoginRoute: LoginRoute,
|
LoginRoute: LoginRoute,
|
||||||
PainelRoute: PainelRouteWithChildren,
|
PainelRoute: PainelRouteWithChildren,
|
||||||
RecuperarSenhaRoute: RecuperarSenhaRoute,
|
RecuperarSenhaRoute: RecuperarSenhaRoute,
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,17 @@ function DashboardPage() {
|
||||||
const [wizardOpen, setWizardOpen] = useState(false);
|
const [wizardOpen, setWizardOpen] = useState(false);
|
||||||
const previousStatusRef = useRef<string | null>(null);
|
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(() => {
|
useEffect(() => {
|
||||||
if (search.status !== "success" || !agent) return;
|
if (search.status !== "success" || !agent) return;
|
||||||
if (agent.status === "suspended" || agent.status === "error") {
|
if (agent.status === "suspended" || agent.status === "error") {
|
||||||
navigate({ search: { status: undefined }, replace: true });
|
navigate({ search: { status: undefined }, replace: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!agent.onboarding_completed) {
|
||||||
|
navigate({ to: "/bem-vindo", replace: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!agent.telegram_bot_username) setWizardOpen(true);
|
if (!agent.telegram_bot_username) setWizardOpen(true);
|
||||||
navigate({ search: { status: undefined }, replace: true });
|
navigate({ search: { status: undefined }, replace: true });
|
||||||
}, [search.status, agent, navigate]);
|
}, [search.status, agent, navigate]);
|
||||||
|
|
@ -74,6 +78,17 @@ function DashboardPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const firstName = (profile?.full_name || "").split(" ")[0] || "por aqui";
|
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 (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|
@ -83,7 +98,9 @@ function DashboardPage() {
|
||||||
<h1 className="text-3xl font-bold tracking-tight">Olá, {firstName} 👋</h1>
|
<h1 className="text-3xl font-bold tracking-tight">Olá, {firstName} 👋</h1>
|
||||||
<p className="mt-1 text-muted-foreground">
|
<p className="mt-1 text-muted-foreground">
|
||||||
{subscription
|
{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."}
|
: "Vamos colocar seu agente Mika no ar."}
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue