From 4d59b7a133340e9c2cb17a82d0ce87df4e9f82fa Mon Sep 17 00:00:00 2001 From: Ella Hagen Date: Tue, 4 Mar 2025 17:05:04 -0800 Subject: [PATCH] Fixes: Some updates --- src/app/adminDashboard/page.tsx | 267 +++++++++------------------- src/app/layout.tsx | 5 +- src/app/map/page.tsx | 37 +--- src/app/userProfile/page.tsx | 22 --- src/app/volunteerDashboard/page.tsx | 14 +- src/components/Map.tsx | 4 +- src/components/ProfileCard.tsx | 4 +- 7 files changed, 104 insertions(+), 249 deletions(-) diff --git a/src/app/adminDashboard/page.tsx b/src/app/adminDashboard/page.tsx index a6dad7b..7ddf2f4 100644 --- a/src/app/adminDashboard/page.tsx +++ b/src/app/adminDashboard/page.tsx @@ -1,3 +1,4 @@ +"use client"; import { ArrowUpRight, NotebookPen, SquarePen } from "lucide-react"; import { Grid, @@ -16,45 +17,34 @@ import { Thead, Tr, } from "@chakra-ui/react"; +import Map from "@/components/Map"; +import { useUser } from "@clerk/nextjs"; function AdminDashboard() { + const user = useUser(); return ( - + - - - Welcome back, Jane! + {/* Welcome Message */} + + + Welcome back, {user.user?.firstName}! - - + + {/* Trees Logged This Year */} + + Trees Logged This Year - + @@ -63,192 +53,101 @@ function AdminDashboard() { % incr from December - - + + {/* Trees in Poor Condition */} + + Trees in Poor Condition - + - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + {[1, 2, 3].map((item) => ( + + + + + + + + ))}
#SpeciesConditionDate RecordedVolunteer
#SpeciesConditionDate RecordedVolunteer
1 - - VO - - - - 10 - - 12/24/2024 - -
1 - - VO - - - - 8 - - 1/3/2025 - -
1 - - VO - - - - 9 - - 2/6/2025 - -
{item} + + VO + + + + {item === 1 ? 10 : item === 2 ? 8 : 9} + + {item === 1 ? "12/24/2024" : item === 2 ? "1/3/2025" : "2/6/2025"} + +
- + + {/* Create New Announcement Button */} + - - Map not Appearing + + {/* Map */} + +
diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e0124df..43af428 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -22,7 +22,10 @@ export default function RootLayout({ children }: { children: React.ReactNode }) style={{ backgroundColor: "#F4F1E8", flexGrow: 1, - marginLeft: pathName !== "/login" && pathName !== "/signup" ? "15rem" : "0", + paddingLeft: pathName !== "/login" && pathName !== "/signup" ? "15rem" : "0", + width: "100%", + height: "100%", + minHeight: "100vh", }} > diff --git a/src/app/map/page.tsx b/src/app/map/page.tsx index b7735be..c876c37 100644 --- a/src/app/map/page.tsx +++ b/src/app/map/page.tsx @@ -3,43 +3,16 @@ import { useRef, useEffect } from "react"; import { Tree, treeData } from "./tree_data"; import styles from "@/styles/map.module.css"; import dynamic from "next/dynamic"; +import MapComponent from "@/components/Map"; +import { Box } from "@chakra-ui/react"; //import leaflet in client const L = dynamic(() => import("leaflet") as any, { ssr: false, }); export default function Map() { - const mapRef = useRef(null); - useEffect(() => { - require("leaflet/dist/leaflet.css"); - const L = require("leaflet"); - const DefaultIcon = L.icon({ - iconUrl: "https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon.png", - shadowUrl: "https://unpkg.com/leaflet@1.7.1/dist/images/marker-shadow.png", - }); - L.Marker.prototype.options.icon = DefaultIcon; - //initilize the map - if (!mapRef.current) { - mapRef.current = L.map("map").setView([35.270378, -120.680656], 14.5); - L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(mapRef.current); - //add marker to map - treeData.map((tree: Tree) => { - const marker = L.marker([tree.gpsCoords[0], tree.gpsCoords[1]]).addTo(mapRef.current); - marker.bindPopup(` - ${tree.species}
- Collected by: ${tree.collectorName}
- Date Collected: ${tree.dateCollected.toISOString().split("T")[0]}
- Notes: ${tree.notes || "No additional notes"} - `); - }); - } - }, []); - return ( -
-
- Map with 5 points -
-
-
+ + + ); } diff --git a/src/app/userProfile/page.tsx b/src/app/userProfile/page.tsx index f2b4d95..4f38dd7 100644 --- a/src/app/userProfile/page.tsx +++ b/src/app/userProfile/page.tsx @@ -25,28 +25,6 @@ function UserProfile() { return (
- - - Small Profile Picture Not Appearing - - - User Name - Volunteer - - - - - - -
diff --git a/src/app/volunteerDashboard/page.tsx b/src/app/volunteerDashboard/page.tsx index 3e5767e..a3ca251 100644 --- a/src/app/volunteerDashboard/page.tsx +++ b/src/app/volunteerDashboard/page.tsx @@ -3,9 +3,11 @@ import { Box, Grid, GridItem, Text, Button, HStack, VStack, Link, IconButton, Fl import { Plus, ArrowUpRight, EllipsisVertical } from "lucide-react"; import Map from "@/components/Map"; import { useRouter } from "next/navigation"; +import { useUser } from "@clerk/nextjs"; export default function VolunteerDashboard() { const router = useRouter(); + const user = useUser(); return ( - + - Hello Jane 👋 + Hello {user.user?.firstName} 👋 Thank you so much for your effort, let's do this! @@ -57,7 +59,7 @@ export default function VolunteerDashboard() { Add Tree - + @@ -117,14 +119,14 @@ export default function VolunteerDashboard() { {/* Map */} @@ -136,7 +138,7 @@ export default function VolunteerDashboard() { Announcements - + diff --git a/src/components/Map.tsx b/src/components/Map.tsx index 711791a..94fb8f8 100644 --- a/src/components/Map.tsx +++ b/src/components/Map.tsx @@ -1,5 +1,5 @@ "use client"; -import { useRef, useEffect } from "react"; +import { useRef, useLayoutEffect } from "react"; import { Tree, treeData } from "./map_data"; import { Plus, Minus } from "lucide-react"; import dynamic from "next/dynamic"; @@ -9,7 +9,7 @@ const L = dynamic(() => import("leaflet") as any, { }); export default function Map() { const mapRef = useRef(null); - useEffect(() => { + useLayoutEffect(() => { require("leaflet/dist/leaflet.css"); const L = require("leaflet"); const DefaultIcon = L.icon({ diff --git a/src/components/ProfileCard.tsx b/src/components/ProfileCard.tsx index 536271a..5bdb049 100644 --- a/src/components/ProfileCard.tsx +++ b/src/components/ProfileCard.tsx @@ -13,9 +13,9 @@ export default function ProfileCard() { return ( - + {/*
router.push("/userProfile")}> */} - + router.push("/userProfile")}> {/* TODO: Once funcionality is working for profile card drop down then remove user button