Skip to content

Commit ec757ec

Browse files
author
ESaracay
committed
Working prototype of software guide
1 parent 143180d commit ec757ec

11 files changed

+288
-101
lines changed

package-lock.json

+19-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"next": "14.2.3",
1213
"react": "^18",
1314
"react-dom": "^18",
14-
"next": "14.2.3"
15+
"react-img-mapper": "^1.5.1"
1516
},
1617
"devDependencies": {
1718
"postcss": "^8",

public/exhibit_floor_plan.png

114 KB
Loading

public/software_fair.png

2.92 MB
Loading

src/app/components/Legend.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// components/Legend.js
2+
const Legend = ({ categoryMap }) => {
3+
const openSection = (sectionNum) => {
4+
let section_id = `section-${sectionNum}`;
5+
const section_elem = document.getElementById(section_id);
6+
7+
if (section_elem) {
8+
if (!section_elem.open) {
9+
section_elem.open = true;
10+
}
11+
window.scrollTo({
12+
top:section_elem.offsetTop,
13+
behavior: 'smooth'
14+
})
15+
} else {
16+
console.log("Id not found for this section")
17+
}
18+
}
19+
20+
return (
21+
<div className="flex flex-row flex-wrap gap-2">
22+
{Object.entries(categoryMap).map(([category, details]) => {
23+
24+
return (
25+
<button
26+
key={category}
27+
onClick={() => openSection(details.section)}
28+
className={`px-3 py-1 text-white rounded ${details.color || "bg-gray-500"}`}
29+
>
30+
{category}
31+
</button>
32+
);
33+
})}
34+
</div>
35+
);
36+
};
37+
38+
export default Legend;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { useEffect, useState, useRef } from 'react';
2+
import ImageMapper from 'react-img-mapper';
3+
4+
const ResponsiveImageMapper = ({ src, map, imgWidth, clickFunc, parentWidth = '100%' }) => {
5+
const [dimensions, setDimensions] = useState({ width: 0 });
6+
const containerRef = useRef(null);
7+
8+
const updateDimensions = () => {
9+
if (containerRef.current) {
10+
setDimensions({ width: containerRef.current.clientWidth });
11+
}
12+
};
13+
14+
useEffect(() => {
15+
updateDimensions();
16+
window.addEventListener('resize', updateDimensions);
17+
return () => window.removeEventListener('resize', updateDimensions);
18+
}, []);
19+
20+
return (
21+
<div ref={containerRef} style={{ width: parentWidth }}>
22+
<ImageMapper
23+
src={src}
24+
map={map}
25+
imgWidth={imgWidth}
26+
width={dimensions.width}
27+
onClick={clickFunc}
28+
responsive={false}
29+
/>
30+
</div>
31+
);
32+
};
33+
34+
export default ResponsiveImageMapper;

src/app/components/TeamInfo.js

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, { useState } from 'react';
2+
3+
const TeamInfo = ({ teamName, teamNum, description, teamMembers, categories, categoryMap }) => {
4+
const [showDescription, setShowDescription] = useState(false);
5+
const teamId = `team-div-${teamNum}`;
6+
7+
const openSection = (sectionNum) => {
8+
let section_id = `section-${sectionNum}`;
9+
const section_elem = document.getElementById(section_id);
10+
11+
if (section_elem) {
12+
if (!section_elem.open) {
13+
section_elem.open = true;
14+
}
15+
window.scrollTo({
16+
top:section_elem.offsetTop,
17+
behavior: 'smooth'
18+
})
19+
} else {
20+
console.log("Id not found for this section")
21+
}
22+
}
23+
24+
return (
25+
<div id={teamId} className="container mx-auto p-4 border-b border-black">
26+
<h1 className="text-2xl font-bold mb-4">{teamName}</h1>
27+
<div className="flex space-x-2 mb-4">
28+
{categories.map((category, index) => {
29+
const categoryData = categoryMap[category];
30+
return (
31+
<button
32+
key={index}
33+
onClick={() => openSection(categoryData.section)}
34+
className={`px-3 py-1 text-white rounded ${categoryData.color || "bg-gray-500"}`}
35+
>
36+
{category}
37+
</button>
38+
);
39+
})}
40+
</div>
41+
<p>Team Members: {teamMembers}</p>
42+
<button
43+
className="text-blue-500 hover:text-blue-700 cursor-pointer pt-4"
44+
onClick={() => setShowDescription(!showDescription)}
45+
>
46+
{showDescription ? 'Hide Description' : 'Show Description'}
47+
</button>
48+
{showDescription && (
49+
<p className="bg-gray-200 text-black rounded-lg p-4">{description}</p>
50+
)}
51+
</div>
52+
);
53+
};
54+
55+
export default TeamInfo;

src/app/components/areas.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
{
3+
"name": "0-1",
4+
"shape": "poly",
5+
"coords": [1468,317,1433,337,1507,371,1540,355],
6+
"preFillColor": "green",
7+
"fillColor": "#0000ff"
8+
}
9+
]

src/app/components/categoryMap.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const categoryMap = {
2+
"AI": {
3+
"section": "0",
4+
"color": "bg-red-500"
5+
},
6+
"Behavior Change/Wellness": {
7+
"section": "1",
8+
"color": "bg-blue-400"
9+
},
10+
"Business/Office": {
11+
"section": "2",
12+
"color": "bg-green-400"
13+
},
14+
"Marketing": {
15+
"section": "3",
16+
"color": "bg-pink-500"
17+
},
18+
"Education": {
19+
"section": "4",
20+
"color": "bg-lime-400"
21+
},
22+
"Finance": {
23+
"section": "5",
24+
"color": "bg-orange-400"
25+
},
26+
"Games": {
27+
"section": "6",
28+
"color": "bg-purple-500"
29+
},
30+
"Healthcare": {
31+
"section": "7",
32+
"color": "bg-yellow-400"
33+
},
34+
"Productivity": {
35+
"section": "8",
36+
"color": "bg-red-800"
37+
},
38+
"Research": {
39+
"section": "9",
40+
"color": "bg-emerald-400"
41+
},
42+
"Security": {
43+
"section": "10",
44+
"color": "bg-fuchsia-500"
45+
},
46+
"Social Media": {
47+
"section": "11",
48+
"color": "bg-sky-400"
49+
},
50+
"XR": {
51+
"section": "12",
52+
"color": "bg-amber-500"
53+
}
54+
};
55+
56+
export default categoryMap;

src/app/globals.css

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
--background-end-rgb: 255, 255, 255;
99
}
1010

11+
.shadow-blue {
12+
box-shadow: 10px 10px 24px 7px rgba(133,198,255,0.76);
13+
}
14+
1115
@media (prefers-color-scheme: dark) {
1216
:root {
1317
--foreground-rgb: 255, 255, 255;

0 commit comments

Comments
 (0)