Skip to content

Commit

Permalink
allow header to show that the system is down
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDTR committed Oct 15, 2024
1 parent 935ae78 commit 3ff6971
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
13 changes: 3 additions & 10 deletions .astro/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,6 @@ declare module 'astro:content' {
collection: "events";
data: InferEntrySchema<"events">
} & { render(): Render[".md"] };
};
"resources": {
"README.md": {
id: "README.md";
slug: "readme";
body: string;
collection: "resources";
data: any
} & { render(): Render[".md"] };
};

};
Expand Down Expand Up @@ -317,11 +308,13 @@ declare module 'astro:content' {
};
};
"docs": {
};
"resources": {
};

};

type AnyEntryMap = ContentEntryMap & DataEntryMap;

export type ContentConfig = typeof import("../src/content/config.js");
export type ContentConfig = typeof import("./../src/content/config.js");
}
50 changes: 33 additions & 17 deletions src/components/DoorStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ const DoorStatus = () => {

if (backDoor?.status === "on" && frontDoor?.status === "on") {
setIsOpen(true);
} else {
} else if (backDoor?.status === "off" && frontDoor?.status === "off") {
setIsOpen(false);
} else {
setIsOpen(null);
}
} catch (error) {
console.error("Error fetching door status:", error);
setIsOpen(false);
setIsOpen(undefined);
}
};

Expand All @@ -35,25 +37,39 @@ const DoorStatus = () => {
<div className="md:text-md text-sm inline-flex flex-col 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 gap-1">
<div className="inline-flex items-center">
<div className="mr-2 flex-shrink-0">
<FontAwesomeIcon icon={isOpen ? faDoorOpen : faDoorClosed} />
</div>
<p className="flex-nowrap m-0">
The doors are{" "}
<span
className={
isOpen === null
? "text-gray-500 font-bold"
<FontAwesomeIcon
icon={
isOpen === undefined
? faDoorClosed
: isOpen
? "text-green-600 font-bold"
: "text-red-600 font-bold"
? faDoorOpen
: faDoorClosed
}
>
{isOpen === null ? "loading..." : isOpen ? "open" : "closed"}
</span>
!
/>
</div>
<p className="flex-nowrap m-0">
{isOpen === undefined ? (
"Door tracker down."
) : (
<>
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>
</div>
{!isOpen && isOpen !== null && (
{!isOpen && isOpen !== null && isOpen !== undefined && (
<a href="/hours" className="text-blue-800 underline m-0">
Check our hours here.
</a>
Expand Down

0 comments on commit 3ff6971

Please sign in to comment.