diff --git a/FrontendV2/src/App.tsx b/FrontendV2/src/App.tsx index 1a5d28a..05c206c 100644 --- a/FrontendV2/src/App.tsx +++ b/FrontendV2/src/App.tsx @@ -79,7 +79,7 @@ function App() { }> } /> } /> - } /> + } /> } /> diff --git a/FrontendV2/src/components/Header.tsx b/FrontendV2/src/components/Header.tsx index f43e785..2ba22cb 100644 --- a/FrontendV2/src/components/Header.tsx +++ b/FrontendV2/src/components/Header.tsx @@ -1,5 +1,4 @@ import { - Badge, Button, Flex, Heading, @@ -14,6 +13,7 @@ import { Box, Avatar, Card, + Grid, } from "@chakra-ui/react"; import { PasswordInput } from "@/components/ui/password-input"; import Cookies from "js-cookie"; @@ -28,7 +28,8 @@ import { LogOut, CalendarPlus, MoreVertical, - Flag, + Languages, + Table, } from "lucide-react"; import { useUserContext } from "@/states/Context"; import { useState } from "react"; @@ -97,6 +98,18 @@ export const Header = () => { const username = userData.first_name ? userData.first_name : "N/A"; const fullname = userData.first_name + " " + userData.last_name; + const randomColor = [ + "gray", + "red", + "orange", + "yellow", + "green", + "teal", + "blue", + "cyan", + "purple", + "pink", + ]; const logout = () => { Cookies.remove("token"); @@ -158,12 +171,12 @@ export const Header = () => { } /> setPwOpen(true)} + value="landingpage" + onSelect={() => navigate("/landingpage", { replace: true })} children={ - - {t("change-password")} + + {t("landingpage")} } /> @@ -177,7 +190,7 @@ export const Header = () => { }} children={ - + {t("change-language")} } @@ -244,7 +257,7 @@ export const Header = () => { size="2xl" className="tracking-tight text-slate-900 dark:text-slate-100" > - Home + {t("app-title")} @@ -253,13 +266,11 @@ export const Header = () => { {t("greeting")} {username}! - - Rolle: {userData?.role ?? "—"} - - + {/* Avatar: visible on mobile, hidden on desktop (desktop version is in the actions bar) */} + + + -
+ {t("landingpage")} @@ -313,7 +336,7 @@ export const Header = () => { }} > - + {t("change-language")} @@ -351,48 +374,84 @@ export const Header = () => { + {/* User Info Dialoge */} {userDialog && ( - - - - {" "} - - - - - {t("user-info-desc")} - - - - - {t("first-name")}: {userData.first_name} - - - {t("last-name")}: {userData.last_name} - - - {t("username")}: {userData.username} - - - {t("role")}: {userData.role} - - - {t("admin-status")}:{" "} - {userData.is_admin ? t("yes") : t("no")} - - - - - - - + + + + + + + + + + + {t("user-info-desc")} + + + + + + + {t("first-name")}: + + {userData.first_name} + + + {t("last-name")}: + + {userData.last_name} + + + {t("username")}: + + {userData.username} + + + {t("role")}: + + {userData.role} + + + {t("admin-status")}: + + + {userData.is_admin ? t("yes") : t("no")} + + + + + + + + + + + + )} {/* Passwort-Dialog (kontrolliert) */} diff --git a/FrontendV2/src/pages/Landingpage.tsx b/FrontendV2/src/pages/Landingpage.tsx index adc49c2..a813a85 100644 --- a/FrontendV2/src/pages/Landingpage.tsx +++ b/FrontendV2/src/pages/Landingpage.tsx @@ -10,11 +10,11 @@ import { SimpleGrid, Button, } from "@chakra-ui/react"; -import { Lock, LockOpen } from "lucide-react"; import MyAlert from "@/components/myChakra/MyAlert"; import { useTranslation } from "react-i18next"; import { API_BASE } from "@/config/api.config"; import Cookies from "js-cookie"; +import { useNavigate } from "react-router-dom"; export const formatDateTime = (value: string | null | undefined) => { if (!value) return "N/A"; @@ -38,7 +38,7 @@ type Device = { id: number; item_name: string; can_borrow_role: string; - inSafe: number; + in_safe: number; entry_created_at: string; last_borrowed_person: string | null; currently_borrowing: string | null; @@ -46,6 +46,7 @@ type Device = { const Landingpage: React.FC = () => { const { t } = useTranslation(); + const navigate = useNavigate(); const [isLoading, setIsLoading] = useState(false); const [loans, setLoans] = useState([]); @@ -119,6 +120,10 @@ const Landingpage: React.FC = () => { Matthias-Claudius-Schule Technik + + {t("all-loans")} @@ -158,10 +163,10 @@ const Landingpage: React.FC = () => { {t("rented-items")} - {t("return-date")} + {t("take-date")} - {t("take-date")} + {t("return-date")} @@ -177,8 +182,8 @@ const Landingpage: React.FC = () => { ? loan.loaned_items_name.join(", ") : loan.loaned_items_name} - {formatDateTime(loan.returned_date)} {formatDateTime(loan.take_date)} + {formatDateTime(loan.returned_date)} ))} @@ -201,24 +206,25 @@ const Landingpage: React.FC = () => { - {device.inSafe ? : } - {device.item_name} + + {device.item_name} + - + - {t("rent-role")}: {device.can_borrow_role} + {t("role")}: {device.can_borrow_role} - {t("last-borrowed-person")}:{" "} + {t("last-borrowed-person")}:{" "} {device.last_borrowed_person || "N/A"} - {t("currently-borrowed-by")}:{" "} + {t("currently-borrowed-by")}:{" "} {device.currently_borrowing || "N/A"} @@ -238,7 +244,6 @@ const Landingpage: React.FC = () => { borderRadius="full" > - {t("in-locker")} @@ -251,7 +256,6 @@ const Landingpage: React.FC = () => { borderRadius="full" > - {t("not-in-locker")} diff --git a/FrontendV2/src/utils/i18n/locales/de/de.json b/FrontendV2/src/utils/i18n/locales/de/de.json index 158e37f..f9d361b 100644 --- a/FrontendV2/src/utils/i18n/locales/de/de.json +++ b/FrontendV2/src/utils/i18n/locales/de/de.json @@ -62,5 +62,15 @@ "change-language": "Sprache ändern", "timezone-info": "Die angezeigten Daten und Uhrzeiten werden in deutscher Zeitzone dargestellt und müssen auch so eingegeben werden.", "optional-note": "Optionale Notiz", - "note": "Notiz" + "note": "Notiz", + "user-info-desc": "Hier können Sie Ihre persönlichen Informationen einsehen und ändern.", + "role": "Rolle", + "admin-status": "Admin-Status", + "first-name": "Vorname", + "last-name": "Nachname", + "app-title": "Ausleihsystem", + "last-borrowed-person": "Zuletzt ausgeliehen von", + "currently-borrowed-by": "Derzeit ausgeliehen von", + "back": "Zurückgehen", + "landingpage": "Übersichtsseite" } \ No newline at end of file diff --git a/FrontendV2/src/utils/i18n/locales/en/en.json b/FrontendV2/src/utils/i18n/locales/en/en.json index dbd5be3..8d8f891 100644 --- a/FrontendV2/src/utils/i18n/locales/en/en.json +++ b/FrontendV2/src/utils/i18n/locales/en/en.json @@ -62,5 +62,15 @@ "change-language": "Change language", "timezone-info": "The displayed dates and times are shown in Berlin timezone and must also be entered as such.", "optional-note": "Optional note", - "note": "Note" + "note": "Note", + "user-info-desc": "Here you can view and edit your personal information.", + "role": "Role", + "admin-status": "Admin status", + "first-name": "First name", + "last-name": "Last name", + "app-title": "Borrow System", + "last-borrowed-person": "Last borrowed by", + "currently-borrowed-by": "Currently borrowed by", + "back": "Go back", + "landingpage": "Overview page" } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fa6b5f2..c20ef03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,19 +48,19 @@ services: - mysql_v2 restart: unless-stopped - mysql: - container_name: borrow_system-mysql - image: mysql:8.0 - restart: unless-stopped - environment: - MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} - MYSQL_DATABASE: borrow_system - TZ: Europe/Berlin - volumes: - - mysql-data:/var/lib/mysql - - ./mysql-timezone.cnf:/etc/mysql/conf.d/timezone.cnf:ro - ports: - - "3309:3306" + # mysql: + # container_name: borrow_system-mysql + # image: mysql:8.0 + # restart: unless-stopped + # environment: + # MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} + # MYSQL_DATABASE: borrow_system + # TZ: Europe/Berlin + # volumes: + # - mysql-data:/var/lib/mysql + # - ./mysql-timezone.cnf:/etc/mysql/conf.d/timezone.cnf:ro + # ports: + # - "3309:3306" mysql_v2: container_name: borrow_system-mysql-v2