From 817a1efcdd30897c5f016c5c41f24e34893dc6d0 Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Mon, 18 Aug 2025 18:41:52 +0200 Subject: [PATCH] added final frontend with full responsive style but without any logic --- Mock/{App.tsx => AppMockup.tsx} | 0 Mock/frontendMockData.json | 20 ++++++++++ frontend/src/App.tsx | 45 +++++++++++++++++++-- frontend/src/components/Form1.tsx | 45 +++++++++++++++++++++ frontend/src/components/Form2.tsx | 61 +++++++++++++++++++++++++++++ frontend/src/components/Form3.tsx | 29 ++++++++++++++ frontend/src/components/Header.tsx | 9 ++++- frontend/src/components/Object.tsx | 20 ++++++++++ frontend/src/components/Sidebar.tsx | 47 ++++++++++++++++++++++ frontend/src/layout/Layout.tsx | 35 +++++++++++++---- frontend/src/utils/fetchData.ts | 0 frontend/src/utils/toastify.ts | 17 ++++++++ 12 files changed, 316 insertions(+), 12 deletions(-) rename Mock/{App.tsx => AppMockup.tsx} (100%) create mode 100644 Mock/frontendMockData.json create mode 100644 frontend/src/components/Form1.tsx create mode 100644 frontend/src/components/Form2.tsx create mode 100644 frontend/src/components/Form3.tsx create mode 100644 frontend/src/components/Object.tsx create mode 100644 frontend/src/components/Sidebar.tsx create mode 100644 frontend/src/utils/fetchData.ts create mode 100644 frontend/src/utils/toastify.ts diff --git a/Mock/App.tsx b/Mock/AppMockup.tsx similarity index 100% rename from Mock/App.tsx rename to Mock/AppMockup.tsx diff --git a/Mock/frontendMockData.json b/Mock/frontendMockData.json new file mode 100644 index 0000000..ad18127 --- /dev/null +++ b/Mock/frontendMockData.json @@ -0,0 +1,20 @@ +[ + { + "id": 1, + "title": "Mock Book 1", + "author": "Author 1", + "description": "Description for Mock Book 1" + }, + { + "id": 2, + "title": "Mock Book 2", + "author": "Author 2", + "description": "Description for Mock Book 2" + }, + { + "id": 3, + "title": "Mock Book 3", + "author": "Author 3", + "description": "Description for Mock Book 3" + } +] \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 0a07de3..feb840f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,10 +1,49 @@ import "./App.css"; +import Layout from "./layout/Layout"; +import { useEffect } from "react"; +import Form1 from "./components/Form1"; +import Form2 from "./components/Form2"; +import Form3 from "./components/Form3"; function App() { + const Items = [ + { + id: 1, + title: "Mock Book 1", + author: "Author 1", + description: "Description for Mock Book 1", + }, + { + id: 2, + title: "Mock Book 2", + author: "Author 2", + description: "Description for Mock Book 2", + }, + { + id: 3, + title: "Mock Book 3", + author: "Author 3", + description: "Description for Mock Book 3", + }, + ]; + + useEffect(() => { + localStorage.setItem("allItems", JSON.stringify(Items)); + localStorage.setItem("borrowableItems", JSON.stringify(Items)); + localStorage.setItem("borrowCode", "123456"); + }, []); + return ( - <> -

Hello world!

- + + {/* Mock flow without real logic: show the three sections stacked for design preview */} +
+ +
+ +
+ +
+ ); } diff --git a/frontend/src/components/Form1.tsx b/frontend/src/components/Form1.tsx new file mode 100644 index 0000000..0bb47fb --- /dev/null +++ b/frontend/src/components/Form1.tsx @@ -0,0 +1,45 @@ +import React from "react"; + +const Form1: React.FC = () => { + return ( +
+

1. Zeitraum wählen

+
+
+ + +
+
+ + +
+ +
+
+ ); +}; + +export default Form1; diff --git a/frontend/src/components/Form2.tsx b/frontend/src/components/Form2.tsx new file mode 100644 index 0000000..e5e155b --- /dev/null +++ b/frontend/src/components/Form2.tsx @@ -0,0 +1,61 @@ +import React from "react"; + +const Form2: React.FC = () => { + const items = JSON.parse(localStorage.getItem("borrowableItems") || "[]"); + return ( +
+

+ 2. Gegenstand auswählen +

+
+ {items.length === 0 ? ( +
+ Keine Gegenstände verfügbar für diesen Zeitraum. +
+ ) : ( +
+ {items.map((item: any) => ( + + ))} +
+ )} + +
+ + +
+
+
+ ); +}; + +export default Form2; diff --git a/frontend/src/components/Form3.tsx b/frontend/src/components/Form3.tsx new file mode 100644 index 0000000..ded9b69 --- /dev/null +++ b/frontend/src/components/Form3.tsx @@ -0,0 +1,29 @@ +import React from "react"; +import { myToast } from "../utils/toastify"; + +const Form3: React.FC = () => { + if (localStorage.getItem("borrowCode")) { + myToast("Ausleihe erfolgreich!", "success"); + } else { + myToast("Ausleihe fehlgeschlagen!", "error"); + } + + const code = localStorage.getItem("borrowCode") ?? "—"; + + return ( +
+

3. Ausleihe bestätigt

+
+

Ihr Ausleihcode lautet

+
+ {code} +
+

+ Bitte merken Sie sich diesen Code, um das Schließfach zu öffnen. +

+
+
+ ); +}; + +export default Form3; diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 20f4c90..319c3e6 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -2,8 +2,13 @@ import React from "react"; const Header: React.FC = () => { return ( -
-

Header

+
+

+ Gegenstand ausleihen +

+

+ Schnell und unkompliziert Equipment reservieren +

); }; diff --git a/frontend/src/components/Object.tsx b/frontend/src/components/Object.tsx new file mode 100644 index 0000000..cb42de5 --- /dev/null +++ b/frontend/src/components/Object.tsx @@ -0,0 +1,20 @@ +import React from "react"; + +type ObjectProps = { + title: string; + description: string; +}; + +const Object: React.FC = ({ title, description }) => { + return ( +
+
+
+

{title}

+

{description}

+
+
+ ); +}; + +export default Object; diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx new file mode 100644 index 0000000..cafb223 --- /dev/null +++ b/frontend/src/components/Sidebar.tsx @@ -0,0 +1,47 @@ +import React from "react"; +import Object from "./Object"; + +const Sidebar: React.FC = () => { + const items = JSON.parse(localStorage.getItem("allItems") || "[]"); + + return ( +