Skip to content

Commit

Permalink
tentative door
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDTR committed Sep 24, 2024
1 parent 4743c69 commit 7700b68
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 140 deletions.
58 changes: 58 additions & 0 deletions src/components/DoorStatus.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { useState, useEffect } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faDoorOpen, faDoorClosed } from "@fortawesome/free-solid-svg-icons";

const DoorStatus = () => {
const [isOpen, setIsOpen] = useState(null);

const fetchDoorStatus = async () => {
try {
const response = await fetch("https://doors.amoses.dev/door-status");
const data = await response.json();
const { door1, door2 } = data.status;

// determine if the UPL is open
if (door1 === "open" && door2 === "open") {
setIsOpen(true);
} else {
setIsOpen(false);
}
} catch (error) {
console.error("Error fetching door status:", error);
setIsOpen(false); // default to closed
}
};

useEffect(() => {
fetchDoorStatus();
const interval = setInterval(fetchDoorStatus, 500); // fetch every 10 seconds
return () => clearInterval(interval);
}, []);

return (
<a
className={`md:text-md text-sm inline-flex items-center w-fit text-black font-sans font-semibold py-2 px-3 rounded-md focus:outline outline-offset outline-3 outline-sky-300`}
>
<div className="mr-2 flex-shrink-0">
<FontAwesomeIcon icon={isOpen ? faDoorOpen : faDoorClosed} />
</div>
<p className="flex-nowrap">
The doors are{" "}
<span
className={
isOpen === null
? "text-gray-500 font-bold"
: isOpen
? "text-green-600 font-bold"
: "text-red-600 font-bold"
}
>
{isOpen === null ? "loading..." : isOpen ? "open" : "closed"}
</span>
!
</p>
</a>
);
};

export default DoorStatus;
152 changes: 80 additions & 72 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -1,83 +1,91 @@
---
import HeaderLink from "./HeaderLink.astro";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faDoorOpen, faDoorClosed } from "@fortawesome/free-solid-svg-icons";
import DoorStatus from "./DoorStatus.jsx";
const ROUTES: {
path: string;
name: string;
path: string;
name: string;
}[] = [
{
path: "/",
name: "Home",
},
{
path: "/events",
name: "Events",
},
{
path: "/blog",
name: "Blog",
},
{
path: "/resources",
name: "Resources",
},
{
path: "/about",
name: "About Us",
},
{
path: "/hours",
name: "Hours",
},
{
path: "/",
name: "Home",
},
{
path: "/events",
name: "Events",
},
{
path: "/blog",
name: "Blog",
},
{
path: "/resources",
name: "Resources",
},
{
path: "/about",
name: "About Us",
},
{
path: "/hours",
name: "Hours",
},
];
---

<div class="navbar bg-gray-50">
<div class="navbar-start">
<div class="dropdown">
<div tabindex="0" role="button" class="btn btn-ghost lg:hidden">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
><path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M4 6h16M4 12h8m-8 6h16"></path></svg
>
</div>
<ul
tabindex="0"
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"
>
{
ROUTES.map((e) => (
<li class="text-red-500 font-bold">
<HeaderLink href={e.path}>{e.name}</HeaderLink>
</li>
))
}
</ul>
</div>
<a
class="btn btn-ghost text-red-500 lg:text-5xl text-xl font-semibold"
href="/">UPL</a
>
</div>
<div class="navbar-start">
<div class="dropdown">
<div tabindex="0" role="button" class="btn btn-ghost lg:hidden">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
><path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M4 6h16M4 12h8m-8 6h16"></path></svg
>
</div>
<ul
tabindex="0"
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"
>
{
ROUTES.map((e) => (
<li class="text-red-500 font-bold">
<HeaderLink href={e.path}>{e.name}</HeaderLink>
</li>
))
}
</ul>
</div>
<a
class="btn btn-ghost text-red-500 lg:text-5xl text-xl font-semibold"
href="/">UPL</a
>
</div>

<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal px-1 text-lg">
{
ROUTES.map((e) => (
<li class="text-red-500 font-bold">
<HeaderLink href={e.path}>{e.name}</HeaderLink>
</li>
))
}
</ul>
</div>
<div class="navbar-end"></div>
<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal px-1 text-lg">
{
ROUTES.map((e) => (
<li class="text-red-500 font-bold">
<HeaderLink href={e.path}>{e.name}</HeaderLink>
</li>
))
}
</ul>
</div>
<!-- this is the door label -->
<div class="navbar-end flex">
<div class="navbar-end flex-none">
<DoorStatus client:load />
</div>
</div>
</div>
129 changes: 61 additions & 68 deletions src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,70 @@ const CoordsCollection = await getCollection("coordinators");
const coc = await getCollection("docs");
const coc_rendered = await coc
.filter((d: any) => d.id == "Code-of-Conduct.md")[0]
?.render();
.filter((d: any) => d.id == "Code-of-Conduct.md")[0]
?.render();
console.log(coc.map((x) => x.id));
---

<Layout>
<div class="inline w-full overflow-hidden text-slate-800 mt-8">
<div class="mx-auto w-3/4">
<div class="text-gray-700 font-sans">
<h1 class="text-4xl font-semibold font-lato text-center pb-2">
Meet the Coords
</h1>
<p class="text-lg text-gray-600 font-light pb-14 text-center">
These are the people that run the UPL day-to-day. If you
have any questions, reach out to upl(at)cs.wisc.edu
</p>
<div
class="grid lg:grid-cols-4 md:grid-cols-3 grid-cols-2 gap-x-8 gap-y-16"
>
{
CoordsCollection.filter((d) => d.data.isActive).map(
(coord) => <CoordCard {coord} />
)
}
</div>
<div class="font-sans mt-8">
<h1
class="text-4xl font-semibold font-lato text-center pb-2"
>
Faculty Advisor
</h1>
<p
class="text-lg text-gray-600 font-light pb-14 text-center"
>
Our faculty advisor is Professor Bart Miller, who can be
contacted at bart (at) cs.wisc.edu
</p>
</div>
<div class="sm:mb-8 mx-auto sm:w-1/4 w-1/2">
<CoordCard
{...{
coord: {
data: {
name: "Bart Miller",
study: "Faculty Advisor",
image: "bart-miller.webp",
personalLink:
"https://www.cs.wisc.edu/~bart/",
links: [
{
name: "Test",
url: "https://www.google.com",
},
],
bio: "Barton Miller is a Vilas Distinguished Achievement Professor and the Amar and Belinder Sohi Professor of Computer Sciences at the University of Wisconsin, Madison. He received his B.A. degree from the University of California, San Diego in 1977, and M.S. and Ph.D. degrees in Computer Science from the University of California, Berkeley in 1980 and 1984. Professor Miller is a Fellow of the ACM.",
},
},
}}
/>
</div>
</div>
<div class="inline w-full overflow-hidden text-slate-800">
<div class="mx-auto w-3/4">
<div
class="text-base/6 font-sans prose prose-lg prose-zinc"
>
<coc_rendered.Content />
</div>
</div>
</div>
</div>
</div></Layout
<div class="inline w-full overflow-hidden text-slate-800 mt-8">
<div class="mx-auto w-3/4">
<div class="text-gray-700 font-sans">
<h1 class="text-4xl font-semibold font-lato text-center pb-2">
Meet the Coords
</h1>
<p class="text-lg text-gray-600 font-light pb-14 text-center">
These are the people that run the UPL day-to-day. If you have any
questions, reach out to upl(at)cs.wisc.edu
</p>
<div
class="grid lg:grid-cols-4 md:grid-cols-3 grid-cols-2 gap-x-8 gap-y-16"
>
{
CoordsCollection.filter((d) => d.data.isActive).map((coord) => (
<CoordCard {coord} />
))
}
</div>
<div class="font-sans mt-8">
<h1 class="text-4xl font-semibold font-lato text-center pb-2">
Faculty Advisor
</h1>
<p class="text-lg text-gray-600 font-light pb-14 text-center">
Our faculty advisor is Professor Bart Miller, who can be contacted
at bart (at) cs.wisc.edu
</p>
</div>
<div class="sm:mb-8 mx-auto sm:w-1/4 w-1/2">
<CoordCard
{...{
coord: {
data: {
name: "Bart Miller",
study: "Faculty Advisor",
image: "bart-miller.webp",
personalLink: "https://www.cs.wisc.edu/~bart/",
links: [
{
name: "Test",
url: "https://www.google.com",
},
],
bio: "Barton Miller is a Vilas Distinguished Achievement Professor and the Amar and Belinder Sohi Professor of Computer Sciences at the University of Wisconsin, Madison. He received his B.A. degree from the University of California, San Diego in 1977, and M.S. and Ph.D. degrees in Computer Science from the University of California, Berkeley in 1980 and 1984. Professor Miller is a Fellow of the ACM.",
},
},
}}
/>
</div>
</div>
<div class="inline w-full overflow-hidden text-slate-800">
<div class="mx-auto w-3/4">
<div class="text-base/6 font-sans prose prose-lg prose-zinc">
<coc_rendered.Content />
</div>
</div>
</div>
</div>
</div></Layout
>
2 changes: 2 additions & 0 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Layout from "../layouts/Layout.astro";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faDiscord } from "@fortawesome/free-brands-svg-icons";
import { faDoorOpen, faDoorClosed } from "@fortawesome/free-solid-svg-icons";
import TypingAnimation from "../components/TypingAnimation.tsx";
const DescriptionStyle = {
Expand Down

0 comments on commit 7700b68

Please sign in to comment.