Compare commits
4 Commits
windows95
...
42066195da
| Author | SHA1 | Date | |
|---|---|---|---|
| 42066195da | |||
| f7c97169d0 | |||
| 5cb323a1d2 | |||
| 8314c4daf8 |
@@ -75,7 +75,4 @@ jobs:
|
||||
docker-compose pull
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$(hyprctl instances -j | jq '.[0].instance' | tr -d "'\"")
|
||||
hyprctl dispatch exec 'pkill firefox'
|
||||
hyprctl dispatch exec 'firefox -kiosk localhost:9123'
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Git Hash</title>
|
||||
</head>
|
||||
<body>
|
||||
<pre>GITHUB_SHA = '$GITHUB_SHA';</pre>
|
||||
</body>
|
||||
</html>" > dist/git-hash.html
|
||||
echo "$GITHUB_SHA" > dist/git-hash.html
|
||||
@@ -1,5 +1,4 @@
|
||||
import FourTwenty from "@components/FourTwenty/FourTwenty";
|
||||
import classNames from "classnames";
|
||||
import { useEffect, useState } from "react";
|
||||
import Amogus from "@/components/Amogus/Amogus";
|
||||
import Card from "@/components/Card/Card";
|
||||
@@ -17,6 +16,28 @@ import Weather from "@/components/Weather/Weather";
|
||||
import style from "./style.module.css";
|
||||
|
||||
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 [schemeIndex, setSchemeIndex] = useState(0);
|
||||
const scheme = schemes[schemeIndex];
|
||||
|
||||
@@ -1,19 +1,53 @@
|
||||
import classNames from "classnames";
|
||||
import { useEffect } from "react";
|
||||
import { useFlatasticStore } from "@/store/flatastic";
|
||||
|
||||
import type { FlatasticChore, FlatasticUser } from "@/types/flatasticChore";
|
||||
|
||||
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() {
|
||||
const fetchFlatasticData = useFlatasticStore((state) => state.fetch);
|
||||
const flatasticData = useFlatasticStore((state) => state.flatasticData);
|
||||
const chores = (flatasticData?.chores as FlatasticChore[]) || [];
|
||||
const regularChores: FlatasticChore[] = [];
|
||||
const irregularChores: FlatasticChore[] = [];
|
||||
|
||||
chores.sort(
|
||||
(a, b) =>
|
||||
a.timeLeftNext - b.timeLeftNext && b.rotationTime - a.rotationTime,
|
||||
);
|
||||
chores.forEach((chore) => {
|
||||
if (chore.rotationTime === -1) {
|
||||
irregularChores.push(chore);
|
||||
} else {
|
||||
regularChores.push(chore);
|
||||
}
|
||||
});
|
||||
|
||||
regularChores.sort((a, b) => a.lastDoneDate - b.lastDoneDate);
|
||||
|
||||
const users = flatasticData?.users;
|
||||
const idToNameMap: Record<number, string> = {};
|
||||
@@ -23,44 +57,28 @@ export default function Flatastic() {
|
||||
|
||||
useEffect(() => {
|
||||
fetchFlatasticData();
|
||||
|
||||
const interval = setInterval(() => {
|
||||
fetchFlatasticData();
|
||||
}, 60000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [fetchFlatasticData]);
|
||||
|
||||
const choresRender = chores.map((chore) => {
|
||||
let className = "";
|
||||
let timeLeftInDays = null;
|
||||
const regularChoresRender = regularChores.map((chore) => {
|
||||
return choreItem(chore, idToNameMap);
|
||||
});
|
||||
|
||||
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={[style.chore, style[className]].join(" ")}
|
||||
>
|
||||
<span className={style.userName}>
|
||||
{`${idToNameMap[chore.currentUser]}`}
|
||||
</span>
|
||||
: {chore.title} {timeLeftInDays} {"🪙".repeat(chore.points)}
|
||||
</li>
|
||||
);
|
||||
const irregularChoresRender = irregularChores.map((chore) => {
|
||||
return choreItem(chore, idToNameMap);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={style.container}>
|
||||
<h1>Chores</h1>
|
||||
<ul className={style.choreList}>{choresRender}</ul>
|
||||
<ul className={style.choreList}>
|
||||
{[...regularChoresRender, ...irregularChoresRender]}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,281 +6,281 @@ const iconNumberToPng = {
|
||||
"0": {
|
||||
day: {
|
||||
description: "Sunny",
|
||||
image: "http://openweathermap.org/img/wn/01d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/01d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Clear",
|
||||
image: "http://openweathermap.org/img/wn/01n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/01n@2x.png",
|
||||
},
|
||||
},
|
||||
"1": {
|
||||
day: {
|
||||
description: "Mainly Sunny",
|
||||
image: "http://openweathermap.org/img/wn/01d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/01d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Mainly Clear",
|
||||
image: "http://openweathermap.org/img/wn/01n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/01n@2x.png",
|
||||
},
|
||||
},
|
||||
"2": {
|
||||
day: {
|
||||
description: "Partly Cloudy",
|
||||
image: "http://openweathermap.org/img/wn/02d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/02d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Partly Cloudy",
|
||||
image: "http://openweathermap.org/img/wn/02n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/02n@2x.png",
|
||||
},
|
||||
},
|
||||
"3": {
|
||||
day: {
|
||||
description: "Cloudy",
|
||||
image: "http://openweathermap.org/img/wn/03d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/03d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Cloudy",
|
||||
image: "http://openweathermap.org/img/wn/03n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/03n@2x.png",
|
||||
},
|
||||
},
|
||||
"45": {
|
||||
day: {
|
||||
description: "Foggy",
|
||||
image: "http://openweathermap.org/img/wn/50d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/50d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Foggy",
|
||||
image: "http://openweathermap.org/img/wn/50n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/50n@2x.png",
|
||||
},
|
||||
},
|
||||
"48": {
|
||||
day: {
|
||||
description: "Rime Fog",
|
||||
image: "http://openweathermap.org/img/wn/50d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/50d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Rime Fog",
|
||||
image: "http://openweathermap.org/img/wn/50n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/50n@2x.png",
|
||||
},
|
||||
},
|
||||
"51": {
|
||||
day: {
|
||||
description: "Light Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"53": {
|
||||
day: {
|
||||
description: "Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"55": {
|
||||
day: {
|
||||
description: "Heavy Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Heavy Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"56": {
|
||||
day: {
|
||||
description: "Light Freezing Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Freezing Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"57": {
|
||||
day: {
|
||||
description: "Freezing Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Freezing Drizzle",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"61": {
|
||||
day: {
|
||||
description: "Light Rain",
|
||||
image: "http://openweathermap.org/img/wn/10d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Rain",
|
||||
image: "http://openweathermap.org/img/wn/10n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10n@2x.png",
|
||||
},
|
||||
},
|
||||
"63": {
|
||||
day: {
|
||||
description: "Rain",
|
||||
image: "http://openweathermap.org/img/wn/10d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Rain",
|
||||
image: "http://openweathermap.org/img/wn/10n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10n@2x.png",
|
||||
},
|
||||
},
|
||||
"65": {
|
||||
day: {
|
||||
description: "Heavy Rain",
|
||||
image: "http://openweathermap.org/img/wn/10d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Heavy Rain",
|
||||
image: "http://openweathermap.org/img/wn/10n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10n@2x.png",
|
||||
},
|
||||
},
|
||||
"66": {
|
||||
day: {
|
||||
description: "Light Freezing Rain",
|
||||
image: "http://openweathermap.org/img/wn/10d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Freezing Rain",
|
||||
image: "http://openweathermap.org/img/wn/10n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10n@2x.png",
|
||||
},
|
||||
},
|
||||
"67": {
|
||||
day: {
|
||||
description: "Freezing Rain",
|
||||
image: "http://openweathermap.org/img/wn/10d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Freezing Rain",
|
||||
image: "http://openweathermap.org/img/wn/10n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/10n@2x.png",
|
||||
},
|
||||
},
|
||||
"71": {
|
||||
day: {
|
||||
description: "Light Snow",
|
||||
image: "http://openweathermap.org/img/wn/13d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Snow",
|
||||
image: "http://openweathermap.org/img/wn/13n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13n@2x.png",
|
||||
},
|
||||
},
|
||||
"73": {
|
||||
day: {
|
||||
description: "Snow",
|
||||
image: "http://openweathermap.org/img/wn/13d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Snow",
|
||||
image: "http://openweathermap.org/img/wn/13n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13n@2x.png",
|
||||
},
|
||||
},
|
||||
"75": {
|
||||
day: {
|
||||
description: "Heavy Snow",
|
||||
image: "http://openweathermap.org/img/wn/13d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Heavy Snow",
|
||||
image: "http://openweathermap.org/img/wn/13n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13n@2x.png",
|
||||
},
|
||||
},
|
||||
"77": {
|
||||
day: {
|
||||
description: "Snow Grains",
|
||||
image: "http://openweathermap.org/img/wn/13d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Snow Grains",
|
||||
image: "http://openweathermap.org/img/wn/13n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13n@2x.png",
|
||||
},
|
||||
},
|
||||
"80": {
|
||||
day: {
|
||||
description: "Light Showers",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Showers",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"81": {
|
||||
day: {
|
||||
description: "Showers",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Showers",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"82": {
|
||||
day: {
|
||||
description: "Heavy Showers",
|
||||
image: "http://openweathermap.org/img/wn/09d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Heavy Showers",
|
||||
image: "http://openweathermap.org/img/wn/09n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/09n@2x.png",
|
||||
},
|
||||
},
|
||||
"85": {
|
||||
day: {
|
||||
description: "Light Snow Showers",
|
||||
image: "http://openweathermap.org/img/wn/13d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Snow Showers",
|
||||
image: "http://openweathermap.org/img/wn/13n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13n@2x.png",
|
||||
},
|
||||
},
|
||||
"86": {
|
||||
day: {
|
||||
description: "Snow Showers",
|
||||
image: "http://openweathermap.org/img/wn/13d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Snow Showers",
|
||||
image: "http://openweathermap.org/img/wn/13n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/13n@2x.png",
|
||||
},
|
||||
},
|
||||
"95": {
|
||||
day: {
|
||||
description: "Thunderstorm",
|
||||
image: "http://openweathermap.org/img/wn/11d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/11d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Thunderstorm",
|
||||
image: "http://openweathermap.org/img/wn/11n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/11n@2x.png",
|
||||
},
|
||||
},
|
||||
"96": {
|
||||
day: {
|
||||
description: "Light Thunderstorms With Hail",
|
||||
image: "http://openweathermap.org/img/wn/11d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/11d@2x.png",
|
||||
},
|
||||
night: {
|
||||
description: "Light Thunderstorms With Hail",
|
||||
image: "http://openweathermap.org/img/wn/11n@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/11n@2x.png",
|
||||
},
|
||||
},
|
||||
"99": {
|
||||
day: {
|
||||
description: "Thunderstorm With Hail",
|
||||
image: "http://openweathermap.org/img/wn/11d@2x.png",
|
||||
image: "https://openweathermap.org/img/wn/11d@2x.png",
|
||||
},
|
||||
night: {
|
||||
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: {},
|
||||
fetchWeatherData: async () => {
|
||||
const data = await fetchWeatherData();
|
||||
|
||||
// Process first location. Add a for-loop for multiple locations or weather models
|
||||
const response = data[0];
|
||||
|
||||
if (response === null) {
|
||||
@@ -300,7 +298,6 @@ const useWeatherStore = create(
|
||||
return;
|
||||
}
|
||||
|
||||
// Attributes for timezone and location
|
||||
const utcOffsetSeconds = response.utcOffsetSeconds();
|
||||
const current = response.current();
|
||||
const hourly = response.hourly();
|
||||
@@ -311,7 +308,6 @@ const useWeatherStore = create(
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: The order of weather variables in the URL query and the indices below need to match!
|
||||
const weatherData = {
|
||||
current: {
|
||||
time: current.time(),
|
||||
|
||||
@@ -16,7 +16,7 @@ interface FlatasticChore {
|
||||
points: number;
|
||||
rotationTime: number;
|
||||
currentUser: number;
|
||||
lastDoneDate: string;
|
||||
lastDoneDate: number;
|
||||
timeLeftNext: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user