Compare commits
4 Commits
070a390da8
...
hostALT
| Author | SHA1 | Date | |
|---|---|---|---|
| 2145e2722a | |||
| 3358c8f669 | |||
| d3f7a7570f | |||
| c502601a2f |
@@ -12,6 +12,8 @@ import { triggerLogoutAtom } from "@/states/Atoms";
|
|||||||
import { MyLoansPage } from "./pages/MyLoansPage";
|
import { MyLoansPage } from "./pages/MyLoansPage";
|
||||||
import Landingpage from "./pages/Landingpage";
|
import Landingpage from "./pages/Landingpage";
|
||||||
import { changeLanguage } from "i18next";
|
import { changeLanguage } from "i18next";
|
||||||
|
import { Box, Flex } from "@chakra-ui/react";
|
||||||
|
import { Footer } from "./components/Footer";
|
||||||
|
|
||||||
const API_BASE =
|
const API_BASE =
|
||||||
(import.meta as any).env?.VITE_BACKEND_URL ||
|
(import.meta as any).env?.VITE_BACKEND_URL ||
|
||||||
@@ -63,21 +65,24 @@ function App() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Flex direction="column" minH="100vh">
|
||||||
<UserContext.Provider value={user}>
|
<Box as="main" flex="1">
|
||||||
<BrowserRouter>
|
<UserContext.Provider value={user}>
|
||||||
<Routes>
|
<BrowserRouter>
|
||||||
<Route element={<ProtectedRoutes />}>
|
<Routes>
|
||||||
<Route path="/" element={<HomePage />} />
|
<Route element={<ProtectedRoutes />}>
|
||||||
<Route path="/my-loans" element={<MyLoansPage />} />
|
<Route path="/" element={<HomePage />} />
|
||||||
<Route path="/landing" element={<Landingpage />} />
|
<Route path="/my-loans" element={<MyLoansPage />} />
|
||||||
</Route>
|
<Route path="/landing" element={<Landingpage />} />
|
||||||
|
</Route>
|
||||||
|
|
||||||
<Route path="/login" element={<LoginPage />} />
|
<Route path="/login" element={<LoginPage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</UserContext.Provider>
|
</UserContext.Provider>
|
||||||
</>
|
</Box>
|
||||||
|
<Footer />
|
||||||
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
19
FrontendV2/src/components/Footer.tsx
Normal file
19
FrontendV2/src/components/Footer.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { Box } from "@chakra-ui/react";
|
||||||
|
|
||||||
|
export const Footer = () => {
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
as="footer"
|
||||||
|
py={4}
|
||||||
|
textAlign="center"
|
||||||
|
position="fixed"
|
||||||
|
bottom="0"
|
||||||
|
left="0"
|
||||||
|
right="0"
|
||||||
|
>
|
||||||
|
Made with ❤️ by Theis Gaedigk - Year 2019 at MCS-Bochum
|
||||||
|
<br />
|
||||||
|
v2.0
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
LogOut,
|
LogOut,
|
||||||
CalendarPlus,
|
CalendarPlus,
|
||||||
MoreVertical,
|
MoreVertical,
|
||||||
|
Flag,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useUserContext } from "@/states/Context";
|
import { useUserContext } from "@/states/Context";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -102,6 +103,7 @@ export const Header = () => {
|
|||||||
Cookies.remove("token");
|
Cookies.remove("token");
|
||||||
setIsLoggedIn(false);
|
setIsLoggedIn(false);
|
||||||
setTriggerLogout(true);
|
setTriggerLogout(true);
|
||||||
|
navigate("/login", { replace: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -166,6 +168,21 @@ export const Header = () => {
|
|||||||
</HStack>
|
</HStack>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<Menu.Item
|
||||||
|
value="change-language"
|
||||||
|
onSelect={() => {
|
||||||
|
const currentLang = Cookies.get("language") || "en";
|
||||||
|
const newLang = currentLang === "en" ? "de" : "en";
|
||||||
|
Cookies.set("language", newLang);
|
||||||
|
window.location.reload();
|
||||||
|
}}
|
||||||
|
children={
|
||||||
|
<HStack gap={3}>
|
||||||
|
<LifeBuoy size={16} />
|
||||||
|
<Text as="span">{t("change-language")}</Text>
|
||||||
|
</HStack>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
value="help"
|
value="help"
|
||||||
onSelect={() =>
|
onSelect={() =>
|
||||||
@@ -276,6 +293,21 @@ export const Header = () => {
|
|||||||
</HStack>
|
</HStack>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
onClick={() => {
|
||||||
|
const currentLang = Cookies.get("language") || "en";
|
||||||
|
const newLang = currentLang === "en" ? "de" : "en";
|
||||||
|
Cookies.set("language", newLang);
|
||||||
|
window.location.reload();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<HStack gap={2}>
|
||||||
|
<Flag size={18} />
|
||||||
|
<Text as="span">{t("change-language")}</Text>
|
||||||
|
</HStack>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
href="https://git.the1s.de/Matthias-Claudius-Schule/borrow-system/wiki"
|
href="https://git.the1s.de/Matthias-Claudius-Schule/borrow-system/wiki"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import "./index.css";
|
|||||||
import App from "./App.tsx";
|
import App from "./App.tsx";
|
||||||
import i18n from "./utils/i18n"; // import i18n configuration DO NOT REMOVE
|
import i18n from "./utils/i18n"; // import i18n configuration DO NOT REMOVE
|
||||||
|
|
||||||
|
// code below is to avoid linter error for unused import
|
||||||
|
let i18nUnused = i18n;
|
||||||
|
console.log(i18nUnused);
|
||||||
|
|
||||||
createRoot(document.getElementById("root")!).render(
|
createRoot(document.getElementById("root")!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<Provider>
|
<Provider>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Cookies from "js-cookie";
|
|||||||
import { Navigate, useNavigate } from "react-router-dom";
|
import { Navigate, useNavigate } from "react-router-dom";
|
||||||
import { PasswordInput } from "@/components/ui/password-input";
|
import { PasswordInput } from "@/components/ui/password-input";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Footer } from "@/components/Footer";
|
||||||
|
|
||||||
const API_BASE =
|
const API_BASE =
|
||||||
(import.meta as any).env?.VITE_BACKEND_URL ||
|
(import.meta as any).env?.VITE_BACKEND_URL ||
|
||||||
@@ -23,6 +24,7 @@ export const LoginPage = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
navigate("/", { replace: true });
|
navigate("/", { replace: true });
|
||||||
|
window.location.reload(); // Mit Tobais besprechen, ob das so bleiben soll
|
||||||
}
|
}
|
||||||
}, [isLoggedIn, navigate]);
|
}, [isLoggedIn, navigate]);
|
||||||
|
|
||||||
@@ -115,6 +117,7 @@ export const LoginPage = () => {
|
|||||||
</Card.Footer>
|
</Card.Footer>
|
||||||
</Card.Root>
|
</Card.Root>
|
||||||
</form>
|
</form>
|
||||||
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -58,5 +58,6 @@
|
|||||||
"sure-delete-loan-0": "Möchten Sie die Ausleihe mit dem ",
|
"sure-delete-loan-0": "Möchten Sie die Ausleihe mit dem ",
|
||||||
"sure-delete-loan-1": " Ausleihcode wirklich löschen?",
|
"sure-delete-loan-1": " Ausleihcode wirklich löschen?",
|
||||||
"sure-delete-loan-2": "Für den Admin bleibt sie weiterhin sichtbar.",
|
"sure-delete-loan-2": "Für den Admin bleibt sie weiterhin sichtbar.",
|
||||||
"delete": "Löschen"
|
"delete": "Löschen",
|
||||||
|
"change-language": "Sprache ändern"
|
||||||
}
|
}
|
||||||
@@ -58,5 +58,6 @@
|
|||||||
"sure-delete-loan-0": "Do you really want to delete the loan with the ",
|
"sure-delete-loan-0": "Do you really want to delete the loan with the ",
|
||||||
"sure-delete-loan-1": " loan code?",
|
"sure-delete-loan-1": " loan code?",
|
||||||
"sure-delete-loan-2": "It will remain visible to the admin.",
|
"sure-delete-loan-2": "It will remain visible to the admin.",
|
||||||
"delete": "Delete"
|
"delete": "Delete",
|
||||||
|
"change-language": "Change language"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user