From 3dea672661477aa66b8387d59e70e777c8be20ed Mon Sep 17 00:00:00 2001 From: olejacobmellgren <115150917+olejacobmellgren@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:39:19 +0100 Subject: [PATCH] Vf 109 lag teammedlemmer side (#257) * VF-109 setup teammedlemmer side * VF-109 update teammedemmer * VF-109 finish teammedlemmer * VF-109 legg til medlem knapp * VF-109 fix lint errors --- .../controlpanel/components/Teammedlemmer.tsx | 141 ++++++++++++++++++ src/pages/controlpanel/routes.tsx | 2 + 2 files changed, 143 insertions(+) create mode 100644 src/pages/controlpanel/components/Teammedlemmer.tsx diff --git a/src/pages/controlpanel/components/Teammedlemmer.tsx b/src/pages/controlpanel/components/Teammedlemmer.tsx new file mode 100644 index 00000000..b191963f --- /dev/null +++ b/src/pages/controlpanel/components/Teammedlemmer.tsx @@ -0,0 +1,141 @@ +import React, { useState } from "react"; +import { useNavigate, useParams } from "react-router-dom"; +import Navbar from "./Navbar"; + +const Teammedlemmer = (): JSX.Element => { + const select = ["Aktive medlemmer", "Inaktive medlemmer", "Søkere"]; + const [selected, setSelected] = useState(select[0]); + + const { id } = useParams(); + const navigate = useNavigate(); + + const mapToTable = (person: Person[]) => { + return person.map((member, index) => ( + + {member.name} + {member.position} + {member.start} + + )); + }; + + const mapToTableSoker = (soker: Soker[]) => { + return soker.map((person, index) => ( + + {person.name} + {person.epost} + + )); + }; + + interface Person { + name: string; + position: string; + start: string; + } + + interface Soker { + name: string; + epost: string; + } + + const itListe: Person[] = [ + { + name: "Aaryan Potet", + position: "IT-leder", + start: "Vår 2022", + }, + { + name: "Filipicus Manus", + position: "Utvikler", + start: "Vår 2023", + }, + { + name: "OJ Spiderman", + position: "Utvikler", + start: "Vår 2023", + }, + ]; + + const inactiveitListe: Person[] = [ + { + name: "Kaja Potet", + position: "Utvikler", + start: "Vår 2023", + }, + ]; + + const sokere: Soker[] = [ + { + name: "Donald Duck", + epost: "donald.duck@gmail.com", + }, + ]; + + return ( +
+
+

{id}

+
+ +
+
+
+
+ + + {selected === select[2] + ? ( + + + + + ) + : ( + + + + + + )} + + + {mapToTable( + (selected === select[0] + && itListe) + || (selected === select[1] + && inactiveitListe) || ([]), + )} + {mapToTableSoker( + (selected === select[2] + && sokere) || ([]), + )} + +
+ Navn + + Epost +
+ Navn + + Stilling + + Start +
+
+ {selected === select[0] + ? ( + + ) : null} +
+
+ ); +}; + +export default Teammedlemmer; diff --git a/src/pages/controlpanel/routes.tsx b/src/pages/controlpanel/routes.tsx index 04bdb167..b67866b1 100644 --- a/src/pages/controlpanel/routes.tsx +++ b/src/pages/controlpanel/routes.tsx @@ -3,11 +3,13 @@ import Kontrollpanel from "pages/controlpanel/components/Kontrollpanel"; import { AppRoute } from "App"; import Skoler from "pages/controlpanel/components/Skoler"; import Teaminteresse from "pages/controlpanel/components/Teaminteresse"; +import Teammedlemmer from "./components/Teammedlemmer"; // The route with the corresponding component to render in the route const routes: AppRoute[] = [ { path: "", element: , name: "Kontrollpanel" }, { path: "/kontrollpanel/skoler", element: , name: "Skoler" }, + { path: "/kontrollpanel/teams/:id", element: , name: "Teammedlemmer" }, { path: "/kontrollpanel/teaminteresse", element: , name: "Teaminteresse" }, ];