Fix the frontend API calls and implement logins on frontend #7

Merged
dylan merged 24 commits from feat/update-frontend-api-calls into main 2026-03-04 20:20:50 +00:00
2 changed files with 19 additions and 7 deletions
Showing only changes of commit d11c5acb77 - Show all commits

View File

@@ -1,21 +1,17 @@
import { useEffect } from "react";
import { Navigate, Route, Routes, useLocation } from "react-router-dom";
import AppLayout from "./components/AppLayout";
import DatasetStatusPage from "./pages/DatasetStatus";
import LoginPage from "./pages/Login";
import UploadPage from "./pages/Upload";
import StatPage from "./pages/Stats";
import { getDocumentTitle } from "./utils/documentTitle";
function App() {
const location = useLocation();
useEffect(() => {
const routeTitles: Record<string, string> = {
"/login": "Sign In",
"/upload": "Upload Dataset",
"/stats": "Stats",
};
document.title = routeTitles[location.pathname];
document.title = getDocumentTitle(location.pathname);
}, [location.pathname]);
return (
@@ -24,6 +20,7 @@ function App() {
<Route path="/" element={<Navigate to="/login" replace />} />
<Route path="/login" element={<LoginPage />} />
<Route path="/upload" element={<UploadPage />} />
<Route path="/dataset/:datasetId/status" element={<DatasetStatusPage />} />
<Route path="/stats" element={<StatPage />} />
</Route>
</Routes>

View File

@@ -0,0 +1,15 @@
const DEFAULT_TITLE = "Ethnograph View";
const STATIC_TITLES: Record<string, string> = {
"/login": "Sign In",
"/upload": "Upload Dataset",
"/stats": "Stats",
};
export const getDocumentTitle = (pathname: string) => {
if (pathname.includes("status")) {
return "Processing Dataset";
}
return STATIC_TITLES[pathname] ?? DEFAULT_TITLE;
};