diff --git a/src/App.tsx b/src/App.tsx index e28ffef..c7adacc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,9 +1,28 @@ -function App() { +import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom"; +import AppLayout from "./components/layout/AppLayout"; + +function EmptyState() { return ( -
-

Orchai

+
+

Select a project or create a new one

); } +function App() { + return ( + + + }> + } /> + Create project (coming next)
} /> + Project dashboard (coming next)} /> + Edit project (coming next)} /> + } /> + + + + ); +} + export default App; diff --git a/src/components/layout/AppLayout.tsx b/src/components/layout/AppLayout.tsx new file mode 100644 index 0000000..7703abd --- /dev/null +++ b/src/components/layout/AppLayout.tsx @@ -0,0 +1,13 @@ +import { Outlet } from "react-router-dom"; +import Sidebar from "./Sidebar"; + +export default function AppLayout() { + return ( +
+ +
+ +
+
+ ); +} diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx new file mode 100644 index 0000000..91d3773 --- /dev/null +++ b/src/components/layout/Sidebar.tsx @@ -0,0 +1,63 @@ +import { useEffect, useState } from "react"; +import { Link, useParams } from "react-router-dom"; +import { listProjects } from "../../lib/api"; +import type { Project } from "../../lib/types"; + +export default function Sidebar() { + const [projects, setProjects] = useState([]); + const { projectId } = useParams(); + + useEffect(() => { + listProjects().then(setProjects); + }, []); + + // Expose a refresh function via custom event + useEffect(() => { + const handler = () => { + listProjects().then(setProjects); + }; + window.addEventListener("orchai:refresh-projects", handler); + return () => window.removeEventListener("orchai:refresh-projects", handler); + }, []); + + return ( + + ); +}