Compare commits
6 Commits
windows95
...
ff89115f36
| Author | SHA1 | Date | |
|---|---|---|---|
| ff89115f36 | |||
| 4f362ca2de | |||
| 42066195da | |||
| f7c97169d0 | |||
| 5cb323a1d2 | |||
| 8314c4daf8 |
@@ -75,7 +75,4 @@ jobs:
|
|||||||
docker-compose pull
|
docker-compose pull
|
||||||
docker-compose down
|
docker-compose down
|
||||||
docker-compose up -d
|
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'
|
|
||||||
|
|
||||||
|
|||||||
188
README.md
188
README.md
@@ -1,69 +1,135 @@
|
|||||||
# React + TypeScript + Vite
|
## monitor-im-flur
|
||||||
|
|
||||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|

|
||||||
|
|
||||||
Currently, two official plugins are available:
|
Hallway / common-area wall monitor dashboard. A single-page React + Vite app that surfaces useful household + transit + weather + fun data on a passive display.
|
||||||
|
|
||||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
### Key Features
|
||||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
* Realtime-ish auto‑refresh via git commit hash file (`/git-hash.html`) – hot-reloads the deployed page when a new build is published.
|
||||||
|
* Dynamic theming (day / evening / night) based on current time.
|
||||||
|
* Public transport departures (KVV) for two nearby stops (IDs 7000044 & 7000045).
|
||||||
|
* Weather (current, hourly, daily min/max) via Open‑Meteo.
|
||||||
|
* Flatastic chores integration (tasks + flatmates) with API key.
|
||||||
|
* Home Assistant readings (tent temperature + humidity) displayed in a faux terminal with rotating shitposts.
|
||||||
|
* 4:20 easter egg card + Amogus sprite + other playful flourishes.
|
||||||
|
* Docker / Nginx static deployment image (`git.rivercry.com/wg/monitor-im-flur:latest`).
|
||||||
|
* Strict linting + formatting (ESLint AirBnB + Prettier + Biome optional).
|
||||||
|
* Zustand + RTK (toolkit present) state management (currently Zustand in active use).
|
||||||
|
|
||||||
## Expanding the ESLint configuration
|
### Tech Stack
|
||||||
|
* React 19 + TypeScript + Vite
|
||||||
|
* Zustand (with devtools) for app stores (weather, kvv, flatastic, home assistant)
|
||||||
|
* Nginx (static file serving) inside minimal Docker image
|
||||||
|
* Open‑Meteo, Flatastic, KVV, Home Assistant external APIs
|
||||||
|
* Git hash pipeline script to trigger client self‑reloads
|
||||||
|
|
||||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
### Project Structure (abridged)
|
||||||
|
```
|
||||||
```js
|
src/
|
||||||
export default tseslint.config([
|
api/ # External data fetchers
|
||||||
globalIgnores(["dist"]),
|
components/ # UI building blocks (Cards, Timetable, Weather, Terminal, etc.)
|
||||||
{
|
store/ # Zustand stores encapsulating fetch + state
|
||||||
files: ["**/*.{ts,tsx}"],
|
types/ # Type definitions for external data
|
||||||
extends: [
|
pipeline/
|
||||||
// Other configs...
|
create-git-hash-html.sh # Injects current commit hash into dist
|
||||||
|
Dockerfile # Nginx static hosting
|
||||||
// Remove tseslint.configs.recommended and replace with this
|
docker-compose.yml # Example runtime service definition
|
||||||
...tseslint.configs.recommendedTypeChecked,
|
|
||||||
// Alternatively, use this for stricter rules
|
|
||||||
...tseslint.configs.strictTypeChecked,
|
|
||||||
// Optionally, add this for stylistic rules
|
|
||||||
...tseslint.configs.stylisticTypeChecked,
|
|
||||||
|
|
||||||
// Other configs...
|
|
||||||
],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
// other options...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
### Environment Configuration
|
||||||
|
Create a `.env` (or `.env.local`) for Vite with the following (only what you need):
|
||||||
```js
|
|
||||||
// eslint.config.js
|
|
||||||
import reactX from "eslint-plugin-react-x";
|
|
||||||
import reactDom from "eslint-plugin-react-dom";
|
|
||||||
|
|
||||||
export default tseslint.config([
|
|
||||||
globalIgnores(["dist"]),
|
|
||||||
{
|
|
||||||
files: ["**/*.{ts,tsx}"],
|
|
||||||
extends: [
|
|
||||||
// Other configs...
|
|
||||||
// Enable lint rules for React
|
|
||||||
reactX.configs["recommended-typescript"],
|
|
||||||
// Enable lint rules for React DOM
|
|
||||||
reactDom.configs.recommended,
|
|
||||||
],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
// other options...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
```
|
```
|
||||||
|
VITE_FLATTASTIC_API_KEY=your_flatastic_api_key
|
||||||
|
# (Planned) VITE_HOME_ASSISTANT_TOKEN=your_long_lived_token # NOTE: currently hardcoded – see Security section
|
||||||
|
```
|
||||||
|
|
||||||
|
Vite automatically exposes variables prefixed with `VITE_` to the client bundle. Do NOT place secrets without that prefix – but remember: anything in the client bundle is public. For sensitive data consider a tiny proxy backend instead of calling APIs directly from the browser.
|
||||||
|
|
||||||
|
### Security Notice
|
||||||
|
`src/api/homeAssistant.ts` currently contains a hard‑coded long‑lived Home Assistant token. This should be refactored before any public deployment:
|
||||||
|
1. Remove the literal token from the repository.
|
||||||
|
2. Load it via environment variable during build (`import.meta.env.VITE_HOME_ASSISTANT_TOKEN`) OR
|
||||||
|
3. Prefer a minimal server proxy so the token never ships to the browser.
|
||||||
|
|
||||||
|
### Development
|
||||||
|
Install dependencies (Bun is inferred from `bun.lock`, but npm/pnpm/yarn also work).
|
||||||
|
```
|
||||||
|
bun install
|
||||||
|
```
|
||||||
|
Run the dev server (HTTPS support possible with `vite-plugin-mkcert` if certificates are trusted):
|
||||||
|
```
|
||||||
|
bun run dev
|
||||||
|
```
|
||||||
|
Open: http://localhost:5173
|
||||||
|
|
||||||
|
### Lint & Format
|
||||||
|
```
|
||||||
|
bun run lint
|
||||||
|
```
|
||||||
|
Optionally run Biome (if desired):
|
||||||
|
```
|
||||||
|
npx biome check --apply .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build
|
||||||
|
```
|
||||||
|
bun run build
|
||||||
|
```
|
||||||
|
Outputs production bundle to `dist/`.
|
||||||
|
|
||||||
|
### Docker Image
|
||||||
|
Build locally:
|
||||||
|
```
|
||||||
|
docker build -t monitor-im-flur:local .
|
||||||
|
```
|
||||||
|
Run:
|
||||||
|
```
|
||||||
|
docker run --rm -p 9123:80 monitor-im-flur:local
|
||||||
|
```
|
||||||
|
Or use compose (uses published image):
|
||||||
|
```
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
Visit: http://localhost:9123
|
||||||
|
|
||||||
|
### Git Hash Auto‑Reload Mechanism
|
||||||
|
`pipeline/create-git-hash-html.sh` writes the current commit (`$GITHUB_SHA`) to `dist/git-hash.html` during CI. The dashboard polls `/git-hash.html` every 10s; when the value changes it performs `window.location.reload()`. Ensure your CI runs the script after `vite build` and before creating the Docker image.
|
||||||
|
|
||||||
|
Pseudo CI step example:
|
||||||
|
```
|
||||||
|
vite build
|
||||||
|
GITHUB_SHA=$(git rev-parse HEAD) ./pipeline/create-git-hash-html.sh
|
||||||
|
docker build -t git.rivercry.com/wg/monitor-im-flur:$(git rev-parse --short HEAD) .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Data Sources
|
||||||
|
* KVV Departures: Public endpoint (JSON) for stop IDs 7000044 / 7000045.
|
||||||
|
* Weather: Open‑Meteo forecast API (lat 49.0094, lon 8.4044, Europe/Berlin TZ).
|
||||||
|
* Flatastic: Auth via `x-api-key` (user provided).
|
||||||
|
* Home Assistant: Long‑lived bearer token (refactor recommended).
|
||||||
|
|
||||||
|
### Adding a New Card
|
||||||
|
1. Create a directory under `src/components/<NewCard>/` with `NewCard.tsx` & optional `style.module.css`.
|
||||||
|
2. Wrap content with existing `Card` component (`icon` + `name` props).
|
||||||
|
3. Register inside `Dashboard.tsx` where layout lives (using `CardColumn` / `CardRow`).
|
||||||
|
|
||||||
|
### State Management Notes
|
||||||
|
All data fetching is encapsulated inside zustand store `fetch` methods invoked on an interval within the respective components. Consider centralizing polling or using React Query if complexity grows.
|
||||||
|
|
||||||
|
### Potential Improvements / TODO
|
||||||
|
* Remove hard‑coded Home Assistant token.
|
||||||
|
* Error + loading states (currently optimistic, failures would be silent / console only).
|
||||||
|
* Retry & backoff strategy for network calls.
|
||||||
|
* Dark mode override / manual theme toggle.
|
||||||
|
* Accessibility pass (ARIA, focus management) – current dashboard is mostly passive.
|
||||||
|
* Tests (none yet). Could add Vitest + React Testing Library.
|
||||||
|
* Switch transit API code to gracefully handle outages (KVV sometimes rate limits).
|
||||||
|
|
||||||
|
### License
|
||||||
|
Add a license file if you plan to share externally (currently unspecified).
|
||||||
|
|
||||||
|
### Support / Contact
|
||||||
|
Internal project (wg). For issues open a ticket on Gitea: https://git.rivercry.com/wg/monitor-im-flur
|
||||||
|
|
||||||
|
---
|
||||||
|
Generated README draft – adjust repository paths / badge branch name if different (e.g., replace `master` with your default branch).
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -39,8 +39,8 @@ const makeCrewmate = (imposter: boolean): Amogus => ({
|
|||||||
isImposter: imposter,
|
isImposter: imposter,
|
||||||
posX: randNum(0, width - amogusWidth),
|
posX: randNum(0, width - amogusWidth),
|
||||||
posY: randNum(0, height - amogusHeight),
|
posY: randNum(0, height - amogusHeight),
|
||||||
speedX: Math.random() > 0.5 ? randNum(3, 10) : randNum(-3, -10),
|
speedX: Math.random() > 0.5 ? randNum(1, 2) : randNum(-1, -2),
|
||||||
speedY: Math.random() > 0.5 ? randNum(3, 10) : randNum(-3, -10),
|
speedY: Math.random() > 0.5 ? randNum(1, 2) : randNum(-1, -2),
|
||||||
});
|
});
|
||||||
|
|
||||||
const intersect = (c1: Amogus, c2: Amogus): boolean =>
|
const intersect = (c1: Amogus, c2: Amogus): boolean =>
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
.container {
|
.container {
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
scale: 50%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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];
|
||||||
@@ -44,7 +65,6 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${style.dashboard} ${scheme}`}>
|
<div className={`${style.dashboard} ${scheme}`}>
|
||||||
<Amogus />
|
|
||||||
<div className={style.body}>
|
<div className={style.body}>
|
||||||
<CardColumn>
|
<CardColumn>
|
||||||
<Card icon="🚊" name="Timetable">
|
<Card icon="🚊" name="Timetable">
|
||||||
@@ -74,7 +94,7 @@ export default function Dashboard() {
|
|||||||
</Card>
|
</Card>
|
||||||
</CardColumn>
|
</CardColumn>
|
||||||
</div>
|
</div>
|
||||||
|
<Amogus />
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
|
|
||||||
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 7 to 16 */
|
/* 7 to 16 */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
align-items: ;
|
||||||
padding: 0 10px 20px 10px;
|
padding: 0 10px 20px 10px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
border-top: 2px solid white;
|
border-top: 2px solid white;
|
||||||
@@ -13,8 +13,7 @@
|
|||||||
.departureLists {
|
.departureLists {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-around;
|
width: 600px;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
|
|||||||
@@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export default function Terminal() {
|
|||||||
<span>
|
<span>
|
||||||
<pre>
|
<pre>
|
||||||
{" "}NNssussNNN{" "}plants{" "}
|
{" "}NNssussNNN{" "}plants{" "}
|
||||||
<span className={style.plants}>4</span>
|
<span className={style.plants}>2</span>
|
||||||
</pre>
|
</pre>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
|
||||||
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
|||||||
@@ -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(),
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user