refactored Authentication
This commit is contained in:
@@ -1,24 +1,12 @@
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router';
|
||||
import { BrowserRouter, Routes, Route, Navigate, Link } from 'react-router';
|
||||
import * as Authentication from './Screens/Authentication';
|
||||
// import { Home } from './Screens/Dashboard/Home';
|
||||
|
||||
// import { ChatList } from './Screens/Dashboard/Chat/ChatList';
|
||||
|
||||
import { useAuth } from 'hooks/useAuth';
|
||||
import { useServerSettings } from '@/state/useServerSettings';
|
||||
import { useInitialData } from '@/state/useInitialData';
|
||||
import { LandingPage, AuthLayout } from './Screens/LandingPage';
|
||||
import { Home } from './Screens/Dashboard/Home';
|
||||
import { ProfileSettings } from './Screens/Dashboard/Settings/ProfileSettings';
|
||||
import { ClaudeChat, OpenCodeChat, NewChat } from './Screens/Dashboard/Chat';
|
||||
import { Screen as ClaudeSessions } from 'plugins/ChatHistory/client';
|
||||
import { Plans } from './Screens/Dashboard/Plans';
|
||||
import { Skills } from './Screens/Dashboard/Skills';
|
||||
import { Tasks } from './Screens/Dashboard/Tasks';
|
||||
import { Processes } from './Screens/Dashboard/Processes';
|
||||
import { TaskLogs } from './Screens/Dashboard/TaskLogs';
|
||||
import { SignoutScreen } from './Screens/Dashboard/SignoutScreen';
|
||||
import { Screen as Files } from 'plugins/FileBrowser/client';
|
||||
import { Screen as Terminal } from 'plugins/Terminal/client';
|
||||
import { AISettings } from './Screens/Dashboard/Settings/AISettings';
|
||||
import { ServerSettings } from './Screens/Dashboard/Settings/ServerSettings';
|
||||
import { ResourceSettings } from './Screens/Dashboard/Settings/ResourceSettings';
|
||||
import { OnboardingAdmin } from './Screens/Dashboard/OnboardingAdmin';
|
||||
|
||||
export function App() {
|
||||
const { isLoading, isAuthenticated } = useAuth();
|
||||
@@ -30,42 +18,56 @@ export function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
{!isAuthenticated && (
|
||||
<Routes>
|
||||
<Route path="/" element={<LandingPage />} />
|
||||
<Route path="/auth/*" element={<AuthLayout />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
)}
|
||||
{isAuthenticated && !onboardingComplete && (
|
||||
<Routes>
|
||||
<Route path="/onboarding-admin" element={<OnboardingAdmin />} />
|
||||
<Route path="/auth/signout" element={<SignoutScreen />} />
|
||||
<Route path="*" element={<Navigate to="/onboarding-admin" replace />} />
|
||||
</Routes>
|
||||
<Authentication.AuthenticationLayout>
|
||||
<Routes>
|
||||
<Route path="/" element={<Authentication.LandingPage />} />
|
||||
<Route path="/auth/verify" element={<Authentication.VerifyScreen />} />
|
||||
<Route path="/auth/forgot-password" element={<Authentication.ForgotPassword />} />
|
||||
<Route path="/auth/reset-password" element={<Authentication.ResetPassword />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</Authentication.AuthenticationLayout>
|
||||
)}
|
||||
{/* {isAuthenticated && !onboardingComplete && ( */}
|
||||
{/* <Routes> */}
|
||||
{/* <Route path="/onboarding-admin" element={<OnboardingAdmin />} /> */}
|
||||
{/* <Route path="/auth/signout" element={<SignoutScreen />} /> */}
|
||||
{/* <Route path="*" element={<Navigate to="/onboarding-admin" replace />} /> */}
|
||||
{/* </Routes> */}
|
||||
{/* )} */}
|
||||
{isAuthenticated && onboardingComplete && (
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/settings/profile" element={<ProfileSettings />} />
|
||||
<Route path="/settings/ai" element={<AISettings />} />
|
||||
<Route path="/settings/server" element={<ServerSettings />} />
|
||||
<Route path="/settings/resources" element={<ResourceSettings />} />
|
||||
<Route path="/chat" element={<ClaudeSessions />} />
|
||||
<Route path="/chat/new" element={<NewChat />} />
|
||||
<Route path="/chat/:sessionId" element={<ClaudeChat />} />
|
||||
<Route path="/chat/opencode/new" element={<OpenCodeChat />} />
|
||||
<Route path="/chat/opencode/:sessionId" element={<OpenCodeChat />} />
|
||||
<Route path="/files" element={<Files />} />
|
||||
<Route path="/terminal" element={<Terminal />} />
|
||||
<Route path="/plans" element={<Plans />} />
|
||||
<Route path="/skills" element={<Skills />} />
|
||||
<Route path="/tasks" element={<Tasks />} />
|
||||
<Route path="/processes" element={<Processes />} />
|
||||
<Route path="/task-logs" element={<TaskLogs />} />
|
||||
<Route path="/auth/signout" element={<SignoutScreen />} />
|
||||
<Route path="/" element={<HomeScreen />} />
|
||||
{/* <Route path="/settings/profile" element={<ProfileSettings />} /> */}
|
||||
{/* <Route path="/settings/ai" element={<AISettings />} /> */}
|
||||
{/* <Route path="/settings/server" element={<ServerSettings />} /> */}
|
||||
{/* <Route path="/settings/resources" element={<ResourceSettings />} /> */}
|
||||
{/* <Route path="/chat" element={<ChatList />} /> */}
|
||||
{/* <Route path="/chat/new" element={<NewChat />} /> */}
|
||||
{/* <Route path="/chat/:sessionId" element={<ClaudeChat />} /> */}
|
||||
{/* <Route path="/chat/opencode/new" element={<OpenCodeChat />} /> */}
|
||||
{/* <Route path="/chat/opencode/:sessionId" element={<OpenCodeChat />} /> */}
|
||||
{/* <Route path="/files" element={<Files />} /> */}
|
||||
{/* <Route path="/terminal" element={<Terminal />} /> */}
|
||||
{/* <Route path="/plans" element={<Plans />} /> */}
|
||||
{/* <Route path="/skills" element={<Skills />} /> */}
|
||||
{/* <Route path="/tasks" element={<Tasks />} /> */}
|
||||
{/* <Route path="/processes" element={<Processes />} /> */}
|
||||
{/* <Route path="/task-logs" element={<TaskLogs />} /> */}
|
||||
<Route path="/auth/signout" element={<Authentication.SignoutScreen />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
)}
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const HomeScreen = () => {
|
||||
return (
|
||||
<div>
|
||||
<h1>Home</h1>
|
||||
<Link to="/auth/signout">Signout</Link>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user