Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 28 additions & 30 deletions frontend/src/app/assets/images/genderEllipse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@ export default function GenderEllipseSVG({
}): ReactElement {
const [visible, setVisible] = useState({ male: true, female: true });
const [hasAnimated, setHasAnimated] = useState(false);
const [showChart, setShowChart] = useState(false);
const chartRef = useRef<ChartJS<"doughnut">>(null);
const containerRef = useRef<HTMLDivElement>(null);

const data = {
labels: ["Male", "Female", "+10%"],
datasets: [
{
data: [75, 15, 10],
backgroundColor: [
"rgba(117, 51, 204, 0.77)",
"rgba(157, 75, 173, 1)",
"rgba(235, 140, 253, 1)",
],
hoverBackgroundColor: ["#3B267B", "#E08CF5", "rgba(157, 75, 173, 1)"],
borderWidth: 0,
},
],
};

useEffect(() => {
const observer = new IntersectionObserver(
(entries) => {
Expand All @@ -36,14 +51,17 @@ export default function GenderEllipseSVG({

useEffect(() => {
if (!hasAnimated) return;
let raf1: number, raf2: number;
raf1 = requestAnimationFrame(() => {
raf2 = requestAnimationFrame(() => setShowChart(true));
});
return () => {
cancelAnimationFrame(raf1);
cancelAnimationFrame(raf2);
const chart = chartRef.current;
if (!chart) return;

chart.config.options!.animation = {
duration: 1500,
easing: "easeInOutQuart",
animateRotate: true,
animateScale: true,
};
chart.data = data;
chart.update();
}, [hasAnimated]);

const handleToggle = (gender: "male" | "female") => {
Expand All @@ -61,25 +79,9 @@ export default function GenderEllipseSVG({
chart.update();
};

const data = {
labels: ["Male", "Female", "+10%"],
datasets: [
{
data: [75, 15, 10],
backgroundColor: [
"rgba(117, 51, 204, 0.77)",
"rgba(157, 75, 173, 1)",
"rgba(235, 140, 253, 1)",
],
hoverBackgroundColor: ["#3B267B", "#E08CF5", "rgba(157, 75, 173, 1)"],
borderWidth: 0,
},
],
};

const options: ChartOptions<"doughnut"> = {
animation: {
duration: 2000,
duration: 1500,
animateRotate: true,
animateScale: true,
},
Expand Down Expand Up @@ -115,11 +117,7 @@ export default function GenderEllipseSVG({

return (
<div ref={containerRef} style={{ width, height }} className={className}>
{showChart &&
containerRef.current &&
containerRef.current.getBoundingClientRect().width > 0 && (
<Doughnut key="animated" ref={chartRef} data={data} options={options} />
)}
<Doughnut ref={chartRef} data={{ labels: [], datasets: [] }} options={options} />
</div>
);
}
2 changes: 1 addition & 1 deletion frontend/src/app/sections/FAQ/FAQ.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const Faq = () => {
</div>
<div
ref={containerRef}
className="flex flex-row mx-auto static sm:w-[70%] md:w-[70%] w-[90%] md:flex-col overflow-x-auto md:overflow-hidden no-scrollbar md:mb-20 mb-8 "
className="flex flex-row mx-auto static sm:w-[70%] md:w-[70%] w-[90%] md:flex-col overflow-x-auto md:overflow-hidden no-scrollbar md:mb-[1px] "
>
{sections.map((section, index) => (
<FAQSectionTitle
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/sections/Tracks/TracksCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const TracksCard = () => {
headStyling:
selectedTrack === "Ed-Tech"
? "gradient-bg text-magnolia active"
: "bg-violet hover:gradient-bg hover:text-magnolia transition-all duration-300",
: "bg-violet hover:gradient-bg hover:text-magnolia transition-all duration-1000",
bodyStyling: "gradient-bg text-magnolia",
description:
"Reimagining education at DeerHack through smart, interactive, and personalized tech",
Expand Down
Loading