-
-
+
diff --git a/frontend/src/components/Form2.tsx b/frontend/src/components/Form2.tsx
index 5583006..29a95bf 100644
--- a/frontend/src/components/Form2.tsx
+++ b/frontend/src/components/Form2.tsx
@@ -1,7 +1,6 @@
import React from "react";
import Cookies from "js-cookie";
-import { createLoan } from "../utils/userHandler";
-import { addToRemove, rmFromRemove } from "../utils/userHandler";
+import { createLoan, addToRemove, rmFromRemove } from "../utils/userHandler";
import { BORROWABLE_ITEMS_UPDATED_EVENT } from "../utils/fetchData";
interface BorrowItem {
@@ -59,16 +58,13 @@ function useBorrowableItems() {
}, []);
React.useEffect(() => {
- // Initial read
readFromStorage();
- // Cross-tab updates
const onStorage = (e: StorageEvent) => {
if (e.key === LOCAL_STORAGE_KEY) readFromStorage();
};
window.addEventListener("storage", onStorage);
- // Same-tab updates via Custom Event
const onBorrowableUpdated = () => readFromStorage();
window.addEventListener(
BORROWABLE_ITEMS_UPDATED_EVENT,
@@ -91,58 +87,85 @@ const Form2: React.FC = () => {
const items = useBorrowableItems();
return (
-
-
+
+
2. Gegenstand auswählen
{items.length === 0 ? (
-
+
Keine Gegenstände verfügbar für diesen Zeitraum.
) : (
-
+ >
)}
-
+
diff --git a/frontend/src/components/Form4.tsx b/frontend/src/components/Form4.tsx
index 2962d82..2c862c3 100644
--- a/frontend/src/components/Form4.tsx
+++ b/frontend/src/components/Form4.tsx
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from "react";
-import { Trash, ArrowLeftRight } from "lucide-react";
import { handleDeleteLoan } from "../utils/userHandler";
type Loan = {
@@ -33,12 +32,27 @@ const readUserLoansFromStorage = (): Loan[] => {
}
};
+const TrashIcon = (props: React.SVGProps
) => (
+
+);
+
const Form4: React.FC = () => {
const [userLoans, setUserLoans] = useState(() =>
readUserLoansFromStorage()
);
- // Keep in sync if localStorage changes (e.g., other tabs or parts of the app)
useEffect(() => {
const onStorage = (e: StorageEvent) => {
if (e.key === "userLoans") {
@@ -60,7 +74,7 @@ const Form4: React.FC = () => {
if (userLoans.length === 0) {
return (
-
+
Keine Ausleihen gefunden.
);
@@ -68,71 +82,117 @@ const Form4: React.FC = () => {
return (
-
+
Meine Ausleihen
-
- Wenn du eine Ausleihe ändern oder löschen möchtest, klicke auf das
- Papierkorb-Symbol.
+
+ Tippe auf das Papierkorb-Symbol, um eine Ausleihe zu löschen.
-
+ {/* Mobile: cards */}
+
+ {userLoans.map((loan) => (
+
+
+
+
+ Leihcode: {loan.loan_code}
+
+
+
+ Start:{" "}
+ {formatDate(loan.start_date)}
+
+
+ Ende:{" "}
+ {formatDate(loan.end_date)}
+
+
+ Abgeholt:{" "}
+ {formatDate(loan.take_date)}
+
+
+ Zurück:{" "}
+ {formatDate(loan.returned_date)}
+
+
+
+ Gegenstände:{" "}
+ {Array.isArray(loan.loaned_items_name)
+ ? loan.loaned_items_name.join(", ")
+ : "-"}
+
+
+
+
+
+ ))}
+
+
+ {/* Desktop: table */}
+
-
-
-
-
+
+
+
+
Leihcode
|
-
+ |
Start
|
-
+ |
Ende
|
-
+ |
Abgeholt
|
-
+ |
Zurückgegeben
|
-
+ |
Erstellt
|
-
+ |
Gegenstände
|
-
+ |
Aktionen
|
-
+
{userLoans.map((loan) => (
-
-
+ |
+
{loan.loan_code}
|
-
+ |
{formatDate(loan.start_date)}
|
-
+ |
{formatDate(loan.end_date)}
|
-
+ |
{formatDate(loan.take_date)}
|
-
+ |
{formatDate(loan.returned_date)}
|
-
+ |
{formatDate(loan.created_at)}
|
-
+
{Array.isArray(loan.loaned_items_name)
? loan.loaned_items_name.join(", ")
: "-"}
@@ -142,9 +202,9 @@ const Form4: React.FC = () => {
|
@@ -152,14 +212,6 @@ const Form4: React.FC = () => {
-
- {/* Scroll hint */}
-
-
-
- Hinweis: Horizontal scrollen, um alle Spalten zu sehen.
-
-
);
diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx
index e891823..a7e8454 100644
--- a/frontend/src/components/Header.tsx
+++ b/frontend/src/components/Header.tsx
@@ -6,20 +6,24 @@ type HeaderProps = {
const Header: React.FC = ({ onLogout }) => {
return (
- |