generated from hack4impact-calpoly/nextjs-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/develop' into develop
- Loading branch information
Showing
12 changed files
with
241 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# create local copy of this file and rename to .env.local | ||
# make sure to add .env.local to .gitignore!! | ||
MONGO_URI={mongo-uri-here} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
prettier.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {} | ||
const nextConfig = {}; | ||
|
||
module.exports = nextConfig | ||
module.exports = nextConfig; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
"use client"; | ||
import { useRef, useEffect } from "react"; | ||
import { Tree, treeData } from "./tree_data"; | ||
import styles from "@/styles/map.module.css"; | ||
import dynamic from "next/dynamic"; | ||
//import leaflet in client | ||
const L = dynamic(() => import("leaflet") as any, { | ||
ssr: false, | ||
}); | ||
export default function Map() { | ||
return <div>Will probably be made into a component later and not a page, but go to /map to develop!</div>; | ||
const mapRef = useRef(null); | ||
useEffect(() => { | ||
require("leaflet/dist/leaflet.css"); | ||
const L = require("leaflet"); | ||
const DefaultIcon = L.icon({ | ||
iconUrl: "https://unpkg.com/[email protected]/dist/images/marker-icon.png", | ||
shadowUrl: "https://unpkg.com/[email protected]/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(` | ||
<strong>${tree.species}</strong><br/> | ||
Collected by: ${tree.collectorName}<br/> | ||
Date Collected: ${tree.dateCollected.toISOString().split("T")[0]}<br/> | ||
Notes: ${tree.notes || "No additional notes"} | ||
`); | ||
}); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<div className={styles.MapContainer}> | ||
Map with 5 points | ||
<div id="map" style={{ height: "50vh", width: "75%" }}></div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//temp class tree | ||
export interface Tree { | ||
collectorName: string; | ||
gpsCoords: number[]; | ||
dateCollected: Date; | ||
photo?: string; | ||
dbh: number; | ||
canopyBreadth: number; | ||
species: string; | ||
treeCond: string[]; | ||
notes?: string; | ||
} | ||
//Dummy data | ||
export const treeData: Tree[] = [ | ||
{ | ||
collectorName: "John Doe", | ||
gpsCoords: [35.267763, -120.675414], | ||
dateCollected: new Date("2025-01-25"), | ||
dbh: 15.2, | ||
canopyBreadth: 8.5, | ||
species: "Quercus agrifolia", | ||
treeCond: ["Healthy", "Mature"], | ||
}, | ||
{ | ||
collectorName: "Jane Smith", | ||
gpsCoords: [35.273266, -120.680012], | ||
dateCollected: new Date("2025-01-26"), | ||
dbh: 10.4, | ||
canopyBreadth: 6.3, | ||
species: "Pinus ponderosa", | ||
treeCond: ["Healthy", "Young"], | ||
}, | ||
{ | ||
collectorName: "Michael Brown", | ||
gpsCoords: [35.276883, -120.673991], | ||
dateCollected: new Date("2025-01-27"), | ||
dbh: 20.8, | ||
canopyBreadth: 12.4, | ||
species: "Sequoia sempervirens", | ||
treeCond: ["Healthy", "Mature", "Thriving"], | ||
}, | ||
{ | ||
collectorName: "Sarah Johnson", | ||
gpsCoords: [35.276889, -120.686529], | ||
dateCollected: new Date("2025-01-27"), | ||
dbh: 5.9, | ||
canopyBreadth: 3.2, | ||
species: "Acer macrophyllum", | ||
treeCond: ["Healthy", "Young"], | ||
}, | ||
{ | ||
collectorName: "Emily Davis", | ||
gpsCoords: [35.270783, -120.674544], | ||
dateCollected: new Date("2025-01-28"), | ||
dbh: 25.6, | ||
canopyBreadth: 15.7, | ||
species: "Platanus racemosa", | ||
treeCond: ["Healthy", "Old Growth"], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,93 @@ | ||
import { Table, Thead, Tbody, Tr, Th, Td, TableContainer, Box } from "@chakra-ui/react"; | ||
|
||
export default function TreeTable() { | ||
return <div>Will probably be made into a component later, but for now develop on /treeTable</div>; | ||
// dummy tree data | ||
const treeData = [ | ||
{ | ||
collectorName: "Sydney Jones", | ||
dateCollected: "2025-01-22", | ||
contactInfo: "[email protected]", | ||
gpsCoordinates: "34.0522, -118.2437", | ||
photo: "tree1.jpg", | ||
dbh: "15.3", | ||
height: "25 ft", | ||
canopyBreath: "20 ft", | ||
species: "Valley Oak", | ||
mistletoe: false, | ||
epicormicGrowth: true, | ||
deadWood: true, | ||
oakPitScale: "no", | ||
hangingItems: false, | ||
additionalNotes: "Tree appears healthy overall.", | ||
}, | ||
{ | ||
collectorName: "Ryan Smith", | ||
dateCollected: "2025-01-20", | ||
contactInfo: "[email protected]", | ||
gpsCoordinates: "37.7749, -122.4194", | ||
photo: "tree2.jpg", | ||
dbh: "20.1", | ||
height: "30 ft", | ||
canopyBreath: "25 ft", | ||
species: "Blue Oak", | ||
mistletoe: true, | ||
epicormicGrowth: false, | ||
deadWood: false, | ||
oakPitScale: true, | ||
hangingItems: false, | ||
additionalNotes: "Signs of stress due to drought.", | ||
}, | ||
]; | ||
|
||
// tree table structure | ||
return ( | ||
<div> | ||
<Box p={5}> | ||
<TableContainer> | ||
<Table> | ||
<Thead> | ||
<Tr> | ||
<Th>Collector Name</Th> | ||
<Th>Date Collected</Th> | ||
<Th>GPS Coordinates</Th> | ||
<Th>Photo</Th> | ||
<Th>DBH (inches)</Th> | ||
<Th>Height</Th> | ||
<Th>Tree Canopy Breadth</Th> | ||
<Th>Species</Th> | ||
<Th>Mistletoe</Th> | ||
<Th>Epicormic Growth</Th> | ||
<Th>Dead Wood</Th> | ||
<Th>Oak Pit Scale</Th> | ||
<Th>Hanging Items</Th> | ||
<Th>Additional Notes</Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{treeData.map((tree, index) => ( | ||
<Tr key={index}> | ||
<Td>{tree.collectorName}</Td> | ||
<Td>{tree.dateCollected}</Td> | ||
<Td>{tree.gpsCoordinates}</Td> | ||
<Td> | ||
<img src={tree.photo} alt="Tree" width="50" height="50" /> | ||
</Td> | ||
<Td>{tree.dbh}</Td> | ||
<Td>{tree.height}</Td> | ||
<Td>{tree.canopyBreath}</Td> | ||
<Td>{tree.species}</Td> | ||
<Td>{tree.mistletoe === true ? "Yes" : "No"}</Td> | ||
<Td>{tree.epicormicGrowth === true ? "Yes" : "No"}</Td> | ||
<Td>{tree.deadWood === true ? "Yes" : "No"}</Td> | ||
<Td>{tree.oakPitScale === true ? "Yes" : "No"}</Td> | ||
<Td>{tree.hangingItems === true ? "Yes" : "No"}</Td> | ||
<Td>{tree.additionalNotes}</Td> | ||
</Tr> | ||
))} | ||
</Tbody> | ||
</Table> | ||
</TableContainer> | ||
</Box> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.MapContainer { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
height: 100vh; | ||
} |