From ccd08bc0f03cb59b351c19d78ac0f937a5270368 Mon Sep 17 00:00:00 2001
From: Wolfboy248 <georgejvindkarlsen@gmail.com>
Date: Mon, 25 Aug 2025 11:13:20 +0200
Subject: Moved breadcrum navigation into its own component

---
 frontend/src/pages/Maps/Maps.tsx | 150 +++++++++++++++------------------------
 1 file changed, 59 insertions(+), 91 deletions(-)

(limited to 'frontend/src/pages/Maps/Maps.tsx')

diff --git a/frontend/src/pages/Maps/Maps.tsx b/frontend/src/pages/Maps/Maps.tsx
index 75e3635..03de289 100644
--- a/frontend/src/pages/Maps/Maps.tsx
+++ b/frontend/src/pages/Maps/Maps.tsx
@@ -9,6 +9,7 @@ import Discussions from "@components/Discussions.tsx";
 import ModMenu from "@components/ModMenu.tsx";
 import { MapDiscussions, MapLeaderboard, MapSummary } from "@customTypes/Map.ts";
 import { API } from "@api/Api.ts";
+import BreadcrumbNav from "@components/BreadcrumbNav/BreadcrumbNav.tsx";
 
 interface MapProps {
   token?: string;
@@ -64,37 +65,28 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => {
     // loading placeholder
     return (
       <>
-        <main className="*:text-foreground relative left-0 w-[calc(100%-20rem)] min-h-screen p-4 sm:p-8">
-          <section id="section1" className="summary1">
-            <div>
-              <Link to="/games">
-                <button
-                  className="nav-button rounded-[20px] h-10 bg-surface border-0 text-foreground text-lg font-[--font-barlow-semicondensed-regular] transition-colors duration-100 hover:bg-surface2 flex items-center px-2"
-                >
-                  <i className="triangle"></i>
-                  <span className="px-2">Games List</span>
-                </button>
-              </Link>
-            </div>
-          </section>
-
-          <section id="section2" className="summary1 mt-4 flex gap-2 flex-wrap">
-            <button className="nav-button">
-              <img src={PortalIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
-              <span>Summary</span>
-            </button>
-            <button className="nav-button">
-              <img src={FlagIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
-              <span>Leaderboards</span>
-            </button>
-            <button className="nav-button">
-              <img src={ChatIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
-              <span>Discussions</span>
-            </button>
-          </section>
+        <div className="">
+          <BreadcrumbNav />
+
+          <div className="px-12">
+            <section id="section2" className="summary1 mt-4 flex gap-2 flex-wrap">
+              <button className="nav-button">
+                <img src={PortalIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
+                <span>Summary</span>
+              </button>
+              <button className="nav-button">
+                <img src={FlagIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
+                <span>Leaderboards</span>
+              </button>
+              <button className="nav-button">
+                <img src={ChatIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
+                <span>Discussions</span>
+              </button>
+            </section>
 
-          <section id="section6" className="summary2 mt-4" />
-        </main>
+            <section id="section6" className="summary2 mt-4" />
+          </div>
+        </div>
       </>
     );
   }
@@ -117,67 +109,43 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => {
       <div id="background-image">
         <img src={mapSummaryData.map.image} alt="" />
       </div>
-      <main className="relative left-0 w-full sm:ml-80 sm:w-[calc(100%-20rem)] min-h-screen max-h-screen overflow-y-auto p-4 sm:p-8 scrollbar-thin scrollbar-track-surface scrollbar-thumb-muted hover:scrollbar-thumb-surface1">
-        <section id="section1" className="summary1">
-          <div>
-            <Link to="/games">
-              <button
-                className="nav-button rounded-[20px] h-10 bg-surface border-0 text-foreground text-lg font-[--font-barlow-semicondensed-regular] transition-colors duration-100 hover:bg-surface2 flex items-center px-2"
-              >
-                <i className="triangle"></i>
-                <span className="px-2">Games List</span>
-              </button>
-            </Link>
-            <Link
-              to={`/games/${mapSummaryData.map.is_coop ? "2" : "1"}?chapter=${mapSummaryData.map.chapter_name.split(" ")[1]}`}
-            >
-              <button
-                className="nav-button ml-2"
-              >
-                <i className="triangle"></i>
-                <span className="px-2">{mapSummaryData.map.chapter_name}</span>
-              </button>
-            </Link>
-            <br />
-            <span className="block mt-2 text-lg sm:text-xl text-foreground">
-              <b>{mapSummaryData.map.map_name}</b>
-            </span>
-          </div>
-        </section>
-
-        <section id="section2" className="summary1 mt-4 flex gap-2 flex-wrap">
-          <button className="nav-button" onClick={() => setNavState(0)}>
-            <img src={PortalIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
-            <span>Summary</span>
-          </button>
-          <button className="nav-button" onClick={() => setNavState(1)}>
-            <img src={FlagIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
-            <span>Leaderboards</span>
-          </button>
-          <button className="nav-button" onClick={() => setNavState(2)}>
-            <img src={ChatIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
-            <span>Discussions</span>
-          </button>
-        </section>
-
-        {navState === 0 && (
-          <Summary
-            selectedRun={selectedRun}
-            setSelectedRun={setSelectedRun}
-            data={mapSummaryData}
-          />
-        )}
-        {navState === 1 && <Leaderboards mapID={mapID} />}
-        {navState === 2 && (
-          <Discussions
-            data={mapDiscussionsData}
-            token={token}
-            isModerator={isModerator}
-            mapID={mapID}
-            onRefresh={() => _fetch_map_discussions()}
-          />
-        )}
-      </main>
+      <div className="">
+        <BreadcrumbNav chapter={{ label: mapSummaryData.map.chapter_name, to: `/games/${mapSummaryData.map.is_coop ? "2" : "1"}?chapter=${mapSummaryData.map.chapter_name.split(" ")[1]}` }} />
+        <div className="px-12">
+          <section id="section2" className="summary1 mt-4 flex gap-2 flex-wrap">
+            <button className="nav-button" onClick={() => setNavState(0)}>
+              <img src={PortalIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
+              <span>Summary</span>
+            </button>
+            <button className="nav-button" onClick={() => setNavState(1)}>
+              <img src={FlagIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
+              <span>Leaderboards</span>
+            </button>
+            <button className="nav-button" onClick={() => setNavState(2)}>
+              <img src={ChatIcon} alt="" className="w-5 h-5 sm:w-6 sm:h-6" />
+              <span>Discussions</span>
+            </button>
+          </section>
+
+          {navState === 0 && (
+            <Summary
+              selectedRun={selectedRun}
+              setSelectedRun={setSelectedRun}
+              data={mapSummaryData}
+            />
+          )}
+          {navState === 1 && <Leaderboards mapID={mapID} />}
+          {navState === 2 && (
+            <Discussions
+              data={mapDiscussionsData}
+              token={token}
+              isModerator={isModerator}
+              mapID={mapID}
+              onRefresh={() => _fetch_map_discussions()}
+            />
+          )}
+        </div>
+      </div>
     </>
   );
 };
-- 
cgit v1.2.3

