This commit is contained in:
2025-10-23 15:30:48 -03:00
parent 235fb538e1
commit 8b5c940976
4 changed files with 77 additions and 16 deletions
+8 -1
View File
@@ -6,6 +6,7 @@ import { BrowserRouter, Routes, Route } from "react-router-dom";
import { ThemeProvider } from "next-themes";
import Index from "./pages/Index";
import NotFound from "./pages/NotFound";
import Redirect from "./pages/Redirect";
const queryClient = new QueryClient();
@@ -17,9 +18,15 @@ const App = () => (
<Sonner />
<BrowserRouter>
<Routes>
<Route path="/" element={<Index />} />
<Route
path="/redir/:gsikey"
element={<Redirect />}
/>
<Route path="/*" element={<Index />} />
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
<Route path="*" element={<NotFound />} />
<Route path="/404" element={<NotFound />} />
</Routes>
</BrowserRouter>
</TooltipProvider>
+35
View File
@@ -0,0 +1,35 @@
import { Loader2 } from "lucide-react";
import { useEffect, useState } from "react";
interface FullScreenLoaderProps {
show: boolean;
text?: string;
}
export default function FullScreenLoader({ show, text = "Carregando..." }: FullScreenLoaderProps) {
const [visible, setVisible] = useState(show);
useEffect(() => {
if (show) setVisible(true);
else {
// adiciona um pequeno atraso para suavizar o fade-out
const timeout = setTimeout(() => setVisible(false), 200);
return () => clearTimeout(timeout);
}
}, [show]);
if (!visible && !show) return null;
return (
<div
className={`fixed inset-0 z-[9999] flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200 ${
show ? "opacity-100" : "opacity-0 pointer-events-none"
}`}
>
<div className="flex flex-col items-center gap-3 p-6 rounded-2xl bg-card shadow-lg border border-border transition-all duration-200">
<Loader2 className="h-8 w-8 animate-spin text-primary" />
<p className="text-card-foreground text-sm font-medium">{text}</p>
</div>
</div>
);
}
+24 -15
View File
@@ -7,6 +7,7 @@ import { GenerationView } from "@/components/audio/GenerationView";
import { BotView } from "@/components/bots/BotView";
import { BotChat } from "@/components/bots/BotChat";
import { AgentView } from "@/components/agent/AgentView";
import { Navigate, Route, Routes } from "react-router-dom";
interface Bot {
id: string;
@@ -27,21 +28,29 @@ const Index = () => {
setActiveBotChat(null);
};
return (
<Layout activeTab={activeView} onTabChange={setActiveView}>
{activeView === "chat" && <ChatView />}
{activeView === "images" && <ImageView />}
{activeView === "transcription" && <TranscriptionView />}
{activeView === "generation" && <GenerationView />}
{activeView === "bots" && (
activeBotChat ? (
<BotChat bot={activeBotChat} onBack={handleBackFromBotChat} />
) : (
<BotView onStartChat={handleStartBotChat} />
)
)}
{activeView === "agent" && <AgentView />}
</Layout>
return (<Routes>
<Route path="" element={<Navigate to={`/404`} replace />} />
<Route path="codex">
<Route path="" element={
<Layout activeTab={activeView} onTabChange={setActiveView}>
{activeView === "chat" && <ChatView />}
{activeView === "images" && <ImageView />}
{activeView === "transcription" && <TranscriptionView />}
{activeView === "generation" && <GenerationView />}
{activeView === "bots" && (
activeBotChat ? (
<BotChat bot={activeBotChat} onBack={handleBackFromBotChat} />
) : (
<BotView onStartChat={handleStartBotChat} />
)
)}
{activeView === "agent" && <AgentView />}
</Layout>
} />
</Route>
</Routes>
);
};
+10
View File
@@ -0,0 +1,10 @@
import FullScreenLoader from "@/components/FullScreenLoader";
export default function Redirect() {
return (
<FullScreenLoader show={true} text="Carregando...Aguarde..." />
);
}