13 Commits

Author SHA1 Message Date
42066195da fix docker-compose yml
All checks were successful
CI / build (push) Successful in 13s
CI / lint (push) Successful in 10s
CI / create-and-publish-docker-image (push) Successful in 15s
2025-09-03 15:26:54 +02:00
f7c97169d0 check git hash to reset page
All checks were successful
CI / build (push) Successful in 34s
CI / lint (push) Successful in 8s
CI / create-and-publish-docker-image (push) Successful in 13s
2025-09-03 15:15:08 +02:00
5cb323a1d2 remove useless import
Some checks failed
CI / build (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / create-and-publish-docker-image (push) Has been cancelled
2025-09-03 14:57:57 +02:00
8314c4daf8 fix sorting of chores 2025-09-03 14:57:35 +02:00
cb4ce4188e Amogus cleanup
All checks were successful
CI / build (pull_request) Successful in 12s
CI / lint (pull_request) Successful in 10s
CI / create-and-publish-docker-image (pull_request) Successful in 14s
CI / build (push) Successful in 12s
CI / lint (push) Successful in 9s
CI / create-and-publish-docker-image (push) Successful in 12s
2025-09-01 20:24:19 +02:00
53db7e795c Bad collision 2025-09-01 20:24:19 +02:00
3606f9b043 restart firefox after pull 2025-09-01 20:24:19 +02:00
5da900c1c3 Enhance Amogus 2025-09-01 20:24:19 +02:00
8653365af1 rename github folder
All checks were successful
CI / build (push) Successful in 13s
CI / lint (push) Successful in 9s
CI / create-and-publish-docker-image (push) Successful in 14s
2025-08-31 23:55:45 +02:00
d914f47640 Merge branch 'better-deploy'
Some checks failed
CI / build (push) Successful in 15s
CI / lint (push) Successful in 13s
CI / create-and-publish-docker-image (push) Has been cancelled
2025-08-31 21:04:52 +02:00
668d260fd6 fix typo in ci
All checks were successful
CI / build (push) Successful in 15s
CI / lint (push) Successful in 10s
CI / create-and-publish-docker-image (push) Successful in 18s
2025-08-31 18:36:41 +02:00
03dc0984f3 quic commit
Some checks failed
CI / build (push) Successful in 13s
CI / lint (push) Successful in 9s
CI / create-and-publish-docker-image (push) Failing after 16s
2025-08-31 18:26:33 +02:00
0d94904c50 set HYPRLAND_INSTANCE_SIGNATURE
Some checks failed
CI / build (push) Successful in 13s
CI / create-and-publish-docker-image (push) Failing after 7s
CI / lint (push) Successful in 8s
2025-08-31 18:25:32 +02:00
9 changed files with 240 additions and 203 deletions

View File

@@ -69,11 +69,10 @@ jobs:
password: ${{ secrets.GARRISON_DOCKER_PASSWORD }} password: ${{ secrets.GARRISON_DOCKER_PASSWORD }}
script: | script: |
cd monitor-im-flur cd monitor-im-flur
hyprctl dispatch exec 'pkill firefox'
hyprctl dispatch exec 'firefox -kiosk localhost:9123'
git clean -dfx git clean -dfx
git reset --hard HEAD git reset --hard HEAD
git pull git pull
docker-compose pull docker-compose pull
docker-compose down docker-compose down
docker-compose up -d docker-compose up -d

View File

@@ -1,11 +1,3 @@
#!/bin/sh #!/bin/sh
echo "<!DOCTYPE html> echo "$GITHUB_SHA" > dist/git-hash.html
<html>
<head>
<title>Git Hash</title>
</head>
<body>
<pre>GITHUB_SHA = '$GITHUB_SHA';</pre>
</body>
</html>" > dist/git-hash.html

View File

@@ -11,81 +11,122 @@ type Amogus = {
speedY: number; speedY: number;
}; };
const amogusWidth = 70;
const amogusHeight = 70;
const { innerWidth: width, innerHeight: height } = window;
const getImage = (sus: Amogus) => (sus.isImposter ? imposter : amogus); const getImage = (sus: Amogus) => (sus.isImposter ? imposter : amogus);
const initialCrewmates: Amogus[] = [ const makeInitialCrewmates = (): Amogus[] => {
{ key: "a", isImposter: true, posX: 10, posY: 20, speedX: 10, speedY: 30 }, return [
{ makeCrewmate(true),
key: "b", makeCrewmate(false),
isImposter: false, makeCrewmate(false),
posX: 400, makeCrewmate(false),
posY: 200, makeCrewmate(false),
speedX: 10, makeCrewmate(false),
speedY: -20, makeCrewmate(false),
}, makeCrewmate(false),
{ makeCrewmate(false),
key: "c", ];
isImposter: false,
posX: 900,
posY: 200,
speedX: -20,
speedY: 10,
},
];
const makeCrewmate = (crewmate: Amogus) => {
const image = getImage(crewmate);
return (
<div
key={crewmate.key}
className={style.container}
style={{ top: crewmate.posY, left: crewmate.posX }}
>
<img src={image} alt="Amogus" />
</div>
);
}; };
const stepCrewmates = (list: Amogus[]) => { const randNum = (min: number, max: number): number =>
const { innerWidth: width, innerHeight: height } = window; Math.random() * (max - min) + min;
const newCrewmates = list.slice();
for (const c of newCrewmates) { const makeCrewmate = (imposter: boolean): Amogus => ({
let newX = c.posX + c.speedX; isImposter: imposter,
let newY = c.posY + c.speedY; posX: randNum(0, width - amogusWidth),
if (newX > width - 90) { posY: randNum(0, height - amogusHeight),
newX = width - 90; speedX: Math.random() > 0.5 ? randNum(3, 10) : randNum(-3, -10),
c.speedX *= -1; speedY: Math.random() > 0.5 ? randNum(3, 10) : randNum(-3, -10),
});
const intersect = (c1: Amogus, c2: Amogus): boolean =>
Math.abs(c1.posX - c2.posX) < amogusWidth - 20 &&
Math.abs(c1.posY - c2.posY) < amogusHeight - 20;
const doMove = (crewmates: Amogus[]) =>
crewmates.map((c) => ({
...c,
posX: c.posX + c.speedX,
posY: c.posY + c.speedY,
}));
const doCollisionWalls = (crewmates: Amogus[]) =>
crewmates.map((c) => {
if (c.posX > width - amogusWidth) {
return {
...c,
posX: width - amogusWidth,
speedX: c.speedX * -1,
};
} else if (c.posX < -20) {
return { ...c, posX: -20, speedX: c.speedX * -1 };
} else if (c.posY > height - amogusHeight) {
return {
...c,
posY: height - amogusHeight,
speedY: c.speedY * -1,
};
} else if (c.posY < -20) {
return { ...c, posY: -20, speedY: c.speedY * -1 };
} else return c;
});
// TODO: This is ugly
const doCollisionOthers = (crewmates: Amogus[]) =>
crewmates.map((c) => {
const intersections = crewmates
.filter((o) => o !== c) // don't collide with yourself pls
.filter((o) => intersect(c, o));
if (intersections.some((o) => Math.abs(o.posX - c.posX) < 50)) {
return { ...c, speedX: c.speedX * -1 };
} }
if (newX < 0) { if (intersections.some((o) => Math.abs(o.posY - c.posY) < 50)) {
newX = 0; return { ...c, speedY: c.speedY * -1 };
c.speedX *= -1;
} }
if (newY > height - 120) { return c;
newY = height - 120; });
c.speedY *= -1;
} const doKills = (crewmates: Amogus[]) => {
if (newY < 0) { const imposters = crewmates.filter((c) => c.isImposter);
newY = 0; const alive = crewmates
c.speedY *= -1; .filter((c) => !c.isImposter)
} .filter((c) => imposters.every((i) => !intersect(i, c)));
c.posX = newX; return imposters.concat(alive);
c.posY = newY;
}
return newCrewmates;
}; };
const checkReset = (crewmates: Amogus[]) =>
crewmates.every((c) => c.isImposter) ? makeInitialCrewmates() : crewmates;
const renderCrewmate = (crewmate: Amogus, key: number) => (
<div
key={key}
className={style.container}
style={{ top: crewmate.posY, left: crewmate.posX }}
>
<img src={getImage(crewmate)} alt="Amogus" />
</div>
);
export default function Amogus() { export default function Amogus() {
const [crewmates, setCrewmates] = useState(initialCrewmates); const [crewmates, setCrewmates] = useState(() => makeInitialCrewmates());
useEffect(() => { useEffect(() => {
const timer = setInterval(() => { const timer = setInterval(() => {
const c = crewmates; setCrewmates((c) => doMove(c));
setCrewmates(stepCrewmates(c)); setCrewmates((c) => doCollisionWalls(c));
}, 100); setCrewmates((c) => doCollisionOthers(c));
setCrewmates((c) => doKills(c));
setCrewmates((c) => checkReset(c));
}, 50);
return () => { return () => {
clearInterval(timer); clearInterval(timer);
}; };
}, [crewmates]); }, []);
return <>{crewmates.map((c) => makeCrewmate(c))}</>; return <>{crewmates.map((c, index) => renderCrewmate(c, index))}</>;
} }

View File

@@ -1,4 +1,8 @@
.container { .container {
z-index: 100; z-index: 100;
position: absolute; position: absolute;
scale: 50%;
display: flex;
justify-content: center;
align-items: center;
} }

View File

@@ -1,5 +1,4 @@
import FourTwenty from "@components/FourTwenty/FourTwenty"; import FourTwenty from "@components/FourTwenty/FourTwenty";
import classNames from "classnames";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Amogus from "@/components/Amogus/Amogus"; import Amogus from "@/components/Amogus/Amogus";
import Card from "@/components/Card/Card"; import Card from "@/components/Card/Card";
@@ -17,6 +16,28 @@ import Weather from "@/components/Weather/Weather";
import style from "./style.module.css"; import style from "./style.module.css";
export default function Dashboard() { export default function Dashboard() {
// '/git-hash.html' contains the current git commit hash, check it every 10 seconds and reload if it isn't the same
const [gitHash, setGitHash] = useState("");
useEffect(() => {
const interval = setInterval(async () => {
const response = await fetch("/git-hash.html");
const text = await response.text();
const newHash = text.trim();
console.log("Fetched git hash:", newHash);
if (gitHash === "") {
setGitHash(newHash);
}
if (gitHash !== "" && newHash !== gitHash) {
setGitHash(newHash);
window.location.reload();
}
}, 10000);
return () => clearInterval(interval);
}, [gitHash]);
const schemes = [style.day, style.evening, style.night]; const schemes = [style.day, style.evening, style.night];
const [schemeIndex, setSchemeIndex] = useState(0); const [schemeIndex, setSchemeIndex] = useState(0);
const scheme = schemes[schemeIndex]; const scheme = schemes[schemeIndex];
@@ -60,16 +81,9 @@ export default function Dashboard() {
<Weather /> <Weather />
</Card> </Card>
<div <Card icon="🍁" name="420">
className={classNames( <FourTwenty />
style.bouncingWindow, </Card>
style.hidden,
)}
>
<Card icon="🍁" name="420">
<FourTwenty />
</Card>
</div>
</CardRow> </CardRow>
<Card icon="🔔" name="Terminal" active={true}> <Card icon="🔔" name="Terminal" active={true}>

View File

@@ -25,30 +25,3 @@
.night { .night {
background-color: #2a3f55; background-color: #2a3f55;
} }
.amogus {
z-index: 100;
position: absolute;
scale: 60%;
animation:
x 10s linear infinite alternate,
y 7s linear infinite alternate;
}
@keyframes x {
from {
left: 0;
}
to {
left: calc(100vw - 70px);
}
}
@keyframes y {
from {
top: 0;
}
to {
top: calc(100vh - 90px);
}
}

View File

@@ -1,19 +1,53 @@
import classNames from "classnames";
import { useEffect } from "react"; import { useEffect } from "react";
import { useFlatasticStore } from "@/store/flatastic"; import { useFlatasticStore } from "@/store/flatastic";
import type { FlatasticChore, FlatasticUser } from "@/types/flatasticChore"; import type { FlatasticChore, FlatasticUser } from "@/types/flatasticChore";
import style from "./style.module.css"; import style from "./style.module.css";
function choreItem(chore: FlatasticChore, idToNameMap: Record<number, string>) {
let className = "";
let timeLeftInDays = null;
if (chore.rotationTime === -1) {
className = "irregular";
} else {
className = chore.timeLeftNext <= 0 ? "due" : "notDue";
timeLeftInDays = (
<span className={style.timeLeft}>
{Math.abs(Math.floor(chore.timeLeftNext / (60 * 60 * 24)))}d
</span>
);
}
return (
<li
key={chore.id}
className={classNames(style.chore, style[className])}
>
<span className={style.userName}>
{`${idToNameMap[chore.currentUser]}`}
</span>
: {chore.title} {timeLeftInDays} {"🪙".repeat(chore.points)}
</li>
);
}
export default function Flatastic() { export default function Flatastic() {
const fetchFlatasticData = useFlatasticStore((state) => state.fetch); const fetchFlatasticData = useFlatasticStore((state) => state.fetch);
const flatasticData = useFlatasticStore((state) => state.flatasticData); const flatasticData = useFlatasticStore((state) => state.flatasticData);
const chores = (flatasticData?.chores as FlatasticChore[]) || []; const chores = (flatasticData?.chores as FlatasticChore[]) || [];
const regularChores: FlatasticChore[] = [];
const irregularChores: FlatasticChore[] = [];
chores.sort( chores.forEach((chore) => {
(a, b) => if (chore.rotationTime === -1) {
a.timeLeftNext - b.timeLeftNext && b.rotationTime - a.rotationTime, irregularChores.push(chore);
); } else {
regularChores.push(chore);
}
});
regularChores.sort((a, b) => a.lastDoneDate - b.lastDoneDate);
const users = flatasticData?.users; const users = flatasticData?.users;
const idToNameMap: Record<number, string> = {}; const idToNameMap: Record<number, string> = {};
@@ -23,44 +57,28 @@ export default function Flatastic() {
useEffect(() => { useEffect(() => {
fetchFlatasticData(); fetchFlatasticData();
const interval = setInterval(() => { const interval = setInterval(() => {
fetchFlatasticData(); fetchFlatasticData();
}, 60000); }, 60000);
return () => clearInterval(interval); return () => clearInterval(interval);
}, [fetchFlatasticData]); }, [fetchFlatasticData]);
const choresRender = chores.map((chore) => { const regularChoresRender = regularChores.map((chore) => {
let className = ""; return choreItem(chore, idToNameMap);
let timeLeftInDays = null; });
if (chore.rotationTime === -1) { const irregularChoresRender = irregularChores.map((chore) => {
className = "irregular"; return choreItem(chore, idToNameMap);
} else {
className = chore.timeLeftNext <= 0 ? "due" : "notDue";
timeLeftInDays = (
<span className={style.timeLeft}>
{Math.abs(Math.floor(chore.timeLeftNext / (60 * 60 * 24)))}d
</span>
);
}
return (
<li
key={chore.id}
className={[style.chore, style[className]].join(" ")}
>
<span className={style.userName}>
{`${idToNameMap[chore.currentUser]}`}
</span>
: {chore.title} {timeLeftInDays} {"🪙".repeat(chore.points)}
</li>
);
}); });
return ( return (
<div className={style.container}> <div className={style.container}>
<h1>Chores</h1> <h1>Chores</h1>
<ul className={style.choreList}>{choresRender}</ul> <ul className={style.choreList}>
{[...regularChoresRender, ...irregularChoresRender]}
</ul>
</div> </div>
); );
} }

View File

@@ -6,281 +6,281 @@ const iconNumberToPng = {
"0": { "0": {
day: { day: {
description: "Sunny", description: "Sunny",
image: "http://openweathermap.org/img/wn/01d@2x.png", image: "https://openweathermap.org/img/wn/01d@2x.png",
}, },
night: { night: {
description: "Clear", description: "Clear",
image: "http://openweathermap.org/img/wn/01n@2x.png", image: "https://openweathermap.org/img/wn/01n@2x.png",
}, },
}, },
"1": { "1": {
day: { day: {
description: "Mainly Sunny", description: "Mainly Sunny",
image: "http://openweathermap.org/img/wn/01d@2x.png", image: "https://openweathermap.org/img/wn/01d@2x.png",
}, },
night: { night: {
description: "Mainly Clear", description: "Mainly Clear",
image: "http://openweathermap.org/img/wn/01n@2x.png", image: "https://openweathermap.org/img/wn/01n@2x.png",
}, },
}, },
"2": { "2": {
day: { day: {
description: "Partly Cloudy", description: "Partly Cloudy",
image: "http://openweathermap.org/img/wn/02d@2x.png", image: "https://openweathermap.org/img/wn/02d@2x.png",
}, },
night: { night: {
description: "Partly Cloudy", description: "Partly Cloudy",
image: "http://openweathermap.org/img/wn/02n@2x.png", image: "https://openweathermap.org/img/wn/02n@2x.png",
}, },
}, },
"3": { "3": {
day: { day: {
description: "Cloudy", description: "Cloudy",
image: "http://openweathermap.org/img/wn/03d@2x.png", image: "https://openweathermap.org/img/wn/03d@2x.png",
}, },
night: { night: {
description: "Cloudy", description: "Cloudy",
image: "http://openweathermap.org/img/wn/03n@2x.png", image: "https://openweathermap.org/img/wn/03n@2x.png",
}, },
}, },
"45": { "45": {
day: { day: {
description: "Foggy", description: "Foggy",
image: "http://openweathermap.org/img/wn/50d@2x.png", image: "https://openweathermap.org/img/wn/50d@2x.png",
}, },
night: { night: {
description: "Foggy", description: "Foggy",
image: "http://openweathermap.org/img/wn/50n@2x.png", image: "https://openweathermap.org/img/wn/50n@2x.png",
}, },
}, },
"48": { "48": {
day: { day: {
description: "Rime Fog", description: "Rime Fog",
image: "http://openweathermap.org/img/wn/50d@2x.png", image: "https://openweathermap.org/img/wn/50d@2x.png",
}, },
night: { night: {
description: "Rime Fog", description: "Rime Fog",
image: "http://openweathermap.org/img/wn/50n@2x.png", image: "https://openweathermap.org/img/wn/50n@2x.png",
}, },
}, },
"51": { "51": {
day: { day: {
description: "Light Drizzle", description: "Light Drizzle",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Light Drizzle", description: "Light Drizzle",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"53": { "53": {
day: { day: {
description: "Drizzle", description: "Drizzle",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Drizzle", description: "Drizzle",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"55": { "55": {
day: { day: {
description: "Heavy Drizzle", description: "Heavy Drizzle",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Heavy Drizzle", description: "Heavy Drizzle",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"56": { "56": {
day: { day: {
description: "Light Freezing Drizzle", description: "Light Freezing Drizzle",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Light Freezing Drizzle", description: "Light Freezing Drizzle",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"57": { "57": {
day: { day: {
description: "Freezing Drizzle", description: "Freezing Drizzle",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Freezing Drizzle", description: "Freezing Drizzle",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"61": { "61": {
day: { day: {
description: "Light Rain", description: "Light Rain",
image: "http://openweathermap.org/img/wn/10d@2x.png", image: "https://openweathermap.org/img/wn/10d@2x.png",
}, },
night: { night: {
description: "Light Rain", description: "Light Rain",
image: "http://openweathermap.org/img/wn/10n@2x.png", image: "https://openweathermap.org/img/wn/10n@2x.png",
}, },
}, },
"63": { "63": {
day: { day: {
description: "Rain", description: "Rain",
image: "http://openweathermap.org/img/wn/10d@2x.png", image: "https://openweathermap.org/img/wn/10d@2x.png",
}, },
night: { night: {
description: "Rain", description: "Rain",
image: "http://openweathermap.org/img/wn/10n@2x.png", image: "https://openweathermap.org/img/wn/10n@2x.png",
}, },
}, },
"65": { "65": {
day: { day: {
description: "Heavy Rain", description: "Heavy Rain",
image: "http://openweathermap.org/img/wn/10d@2x.png", image: "https://openweathermap.org/img/wn/10d@2x.png",
}, },
night: { night: {
description: "Heavy Rain", description: "Heavy Rain",
image: "http://openweathermap.org/img/wn/10n@2x.png", image: "https://openweathermap.org/img/wn/10n@2x.png",
}, },
}, },
"66": { "66": {
day: { day: {
description: "Light Freezing Rain", description: "Light Freezing Rain",
image: "http://openweathermap.org/img/wn/10d@2x.png", image: "https://openweathermap.org/img/wn/10d@2x.png",
}, },
night: { night: {
description: "Light Freezing Rain", description: "Light Freezing Rain",
image: "http://openweathermap.org/img/wn/10n@2x.png", image: "https://openweathermap.org/img/wn/10n@2x.png",
}, },
}, },
"67": { "67": {
day: { day: {
description: "Freezing Rain", description: "Freezing Rain",
image: "http://openweathermap.org/img/wn/10d@2x.png", image: "https://openweathermap.org/img/wn/10d@2x.png",
}, },
night: { night: {
description: "Freezing Rain", description: "Freezing Rain",
image: "http://openweathermap.org/img/wn/10n@2x.png", image: "https://openweathermap.org/img/wn/10n@2x.png",
}, },
}, },
"71": { "71": {
day: { day: {
description: "Light Snow", description: "Light Snow",
image: "http://openweathermap.org/img/wn/13d@2x.png", image: "https://openweathermap.org/img/wn/13d@2x.png",
}, },
night: { night: {
description: "Light Snow", description: "Light Snow",
image: "http://openweathermap.org/img/wn/13n@2x.png", image: "https://openweathermap.org/img/wn/13n@2x.png",
}, },
}, },
"73": { "73": {
day: { day: {
description: "Snow", description: "Snow",
image: "http://openweathermap.org/img/wn/13d@2x.png", image: "https://openweathermap.org/img/wn/13d@2x.png",
}, },
night: { night: {
description: "Snow", description: "Snow",
image: "http://openweathermap.org/img/wn/13n@2x.png", image: "https://openweathermap.org/img/wn/13n@2x.png",
}, },
}, },
"75": { "75": {
day: { day: {
description: "Heavy Snow", description: "Heavy Snow",
image: "http://openweathermap.org/img/wn/13d@2x.png", image: "https://openweathermap.org/img/wn/13d@2x.png",
}, },
night: { night: {
description: "Heavy Snow", description: "Heavy Snow",
image: "http://openweathermap.org/img/wn/13n@2x.png", image: "https://openweathermap.org/img/wn/13n@2x.png",
}, },
}, },
"77": { "77": {
day: { day: {
description: "Snow Grains", description: "Snow Grains",
image: "http://openweathermap.org/img/wn/13d@2x.png", image: "https://openweathermap.org/img/wn/13d@2x.png",
}, },
night: { night: {
description: "Snow Grains", description: "Snow Grains",
image: "http://openweathermap.org/img/wn/13n@2x.png", image: "https://openweathermap.org/img/wn/13n@2x.png",
}, },
}, },
"80": { "80": {
day: { day: {
description: "Light Showers", description: "Light Showers",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Light Showers", description: "Light Showers",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"81": { "81": {
day: { day: {
description: "Showers", description: "Showers",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Showers", description: "Showers",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"82": { "82": {
day: { day: {
description: "Heavy Showers", description: "Heavy Showers",
image: "http://openweathermap.org/img/wn/09d@2x.png", image: "https://openweathermap.org/img/wn/09d@2x.png",
}, },
night: { night: {
description: "Heavy Showers", description: "Heavy Showers",
image: "http://openweathermap.org/img/wn/09n@2x.png", image: "https://openweathermap.org/img/wn/09n@2x.png",
}, },
}, },
"85": { "85": {
day: { day: {
description: "Light Snow Showers", description: "Light Snow Showers",
image: "http://openweathermap.org/img/wn/13d@2x.png", image: "https://openweathermap.org/img/wn/13d@2x.png",
}, },
night: { night: {
description: "Light Snow Showers", description: "Light Snow Showers",
image: "http://openweathermap.org/img/wn/13n@2x.png", image: "https://openweathermap.org/img/wn/13n@2x.png",
}, },
}, },
"86": { "86": {
day: { day: {
description: "Snow Showers", description: "Snow Showers",
image: "http://openweathermap.org/img/wn/13d@2x.png", image: "https://openweathermap.org/img/wn/13d@2x.png",
}, },
night: { night: {
description: "Snow Showers", description: "Snow Showers",
image: "http://openweathermap.org/img/wn/13n@2x.png", image: "https://openweathermap.org/img/wn/13n@2x.png",
}, },
}, },
"95": { "95": {
day: { day: {
description: "Thunderstorm", description: "Thunderstorm",
image: "http://openweathermap.org/img/wn/11d@2x.png", image: "https://openweathermap.org/img/wn/11d@2x.png",
}, },
night: { night: {
description: "Thunderstorm", description: "Thunderstorm",
image: "http://openweathermap.org/img/wn/11n@2x.png", image: "https://openweathermap.org/img/wn/11n@2x.png",
}, },
}, },
"96": { "96": {
day: { day: {
description: "Light Thunderstorms With Hail", description: "Light Thunderstorms With Hail",
image: "http://openweathermap.org/img/wn/11d@2x.png", image: "https://openweathermap.org/img/wn/11d@2x.png",
}, },
night: { night: {
description: "Light Thunderstorms With Hail", description: "Light Thunderstorms With Hail",
image: "http://openweathermap.org/img/wn/11n@2x.png", image: "https://openweathermap.org/img/wn/11n@2x.png",
}, },
}, },
"99": { "99": {
day: { day: {
description: "Thunderstorm With Hail", description: "Thunderstorm With Hail",
image: "http://openweathermap.org/img/wn/11d@2x.png", image: "https://openweathermap.org/img/wn/11d@2x.png",
}, },
night: { night: {
description: "Thunderstorm With Hail", description: "Thunderstorm With Hail",
image: "http://openweathermap.org/img/wn/11n@2x.png", image: "https://openweathermap.org/img/wn/11n@2x.png",
}, },
}, },
}; };
@@ -291,8 +291,6 @@ const useWeatherStore = create(
weatherData: {}, weatherData: {},
fetchWeatherData: async () => { fetchWeatherData: async () => {
const data = await fetchWeatherData(); const data = await fetchWeatherData();
// Process first location. Add a for-loop for multiple locations or weather models
const response = data[0]; const response = data[0];
if (response === null) { if (response === null) {
@@ -300,7 +298,6 @@ const useWeatherStore = create(
return; return;
} }
// Attributes for timezone and location
const utcOffsetSeconds = response.utcOffsetSeconds(); const utcOffsetSeconds = response.utcOffsetSeconds();
const current = response.current(); const current = response.current();
const hourly = response.hourly(); const hourly = response.hourly();
@@ -311,7 +308,6 @@ const useWeatherStore = create(
return; return;
} }
// Note: The order of weather variables in the URL query and the indices below need to match!
const weatherData = { const weatherData = {
current: { current: {
time: current.time(), time: current.time(),

View File

@@ -16,7 +16,7 @@ interface FlatasticChore {
points: number; points: number;
rotationTime: number; rotationTime: number;
currentUser: number; currentUser: number;
lastDoneDate: string; lastDoneDate: number;
timeLeftNext: number; timeLeftNext: number;
} }