From 6dfa50f3edb6b0845ecd5ab6d32f1e03f9bd314b Mon Sep 17 00:00:00 2001 From: Darius Schefer Date: Fri, 29 Aug 2025 01:00:47 +0200 Subject: [PATCH 01/25] Make dashboard change background based on time of day --- src/components/Dashboard/Dashboard.tsx | 28 ++++++++++++++++++++++- src/components/Dashboard/style.module.css | 21 +++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx index ad163e3..3304468 100644 --- a/src/components/Dashboard/Dashboard.tsx +++ b/src/components/Dashboard/Dashboard.tsx @@ -1,3 +1,5 @@ +import { useEffect, useState } from "react"; + import Datetime from "@/components/Datetime/Datetime"; import Flatastic from "@/components/Flatastic/Flatastic"; import Footer from "@/components/Footer/Footer"; @@ -7,8 +9,32 @@ import Timetable from "@/components/Timetable/Timetable"; import style from "./style.module.css"; export default function Dashboard() { + const schemes = [style.day, style.evening, style.night]; + const [scheme, setScheme] = useState(style.day); + + // change background color based on time of day + const time = useEffect(() => { + const timer = setInterval( + () => { + let d = new Date(); + let hour = d.getHours(); + if (hour >= 7 && hour < 16) { + setScheme(style.day); + } else if (hour < 23) { + setScheme(style.evening); + } else { + setScheme(style.night); + } + }, + 20 * 60 * 1000, + ); + return () => { + clearInterval(timer); + }; + }, []); + return ( -
+
๐ŸšŠ Timetable
diff --git a/src/components/Dashboard/style.module.css b/src/components/Dashboard/style.module.css index b78f3e3..9535ef1 100644 --- a/src/components/Dashboard/style.module.css +++ b/src/components/Dashboard/style.module.css @@ -2,9 +2,24 @@ display: flex; flex-direction: column; height: 100%; + transition: 0.5s; +} + +/* 7 to 16 */ +.day { background-color: #007c7d; } +/* 16 to 23 */ +.evening { + background-color: #3b5773; +} + +/* 23 to 8 */ +.night { + background-color: #2a3f55; +} + .cardWrapper { margin: 30px; height: 100%; @@ -48,6 +63,12 @@ .clock { width: 45%; +<<<<<<< HEAD +======= +} + +.terminal { +>>>>>>> 115a228 (Make dashboard change background based on time of day) } .footer { -- 2.49.1 From afde5576055131fffd94fb7bd4fcbb28fda57742 Mon Sep 17 00:00:00 2001 From: Darius Schefer Date: Fri, 29 Aug 2025 03:17:07 +0200 Subject: [PATCH 02/25] New font and new footer --- src/components/Footer/Footer.tsx | 17 ++++++++++++----- src/components/Footer/style.module.css | 26 ++++++++++++-------------- src/index.css | 2 +- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 08fe504..6384ffe 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -16,12 +16,19 @@ export default function Footer() { /> Start
-
- ๐ŸšŠ Timetable - ๐Ÿ• Clock - ๐Ÿ”” Terminal - ๐Ÿงน Flatastic + + ๐ŸšŠTimetable + + + ๐Ÿ•Clock + + + ๐Ÿ””Terminal + + + ๐ŸงนFlatastic +
diff --git a/src/components/Footer/style.module.css b/src/components/Footer/style.module.css index 5b09dc8..eacfb09 100644 --- a/src/components/Footer/style.module.css +++ b/src/components/Footer/style.module.css @@ -1,5 +1,5 @@ .container { - height: 35px; + height: 30px; display: flex; flex-direction: row; justify-content: space-between; @@ -9,44 +9,37 @@ } .taskbar { - font-weight: bold; display: flex; flex-direction: row; text-align: left; } .startButton { + font-weight: bold; display: inline-flex; justify-content: space-around; align-items: center; - width: 100px; + width: 80px; border-top: 2px solid white; border-left: 2px solid white; border-bottom: 2px solid #828282; border-right: 2px solid #828282; + margin-right: 10px; } .startIcon { - height: 30px; -} - -.divider { - margin: auto 8px; - width: 4px; - height: 25px; - border-top: 2px solid white; - border-left: 2px solid white; - border-bottom: 2px solid #828282; - border-right: 2px solid #828282; + height: 20px; } .windows { display: flex; flex-direction: row; + align-items: center; gap: 5px; } .window { + height: 25px; min-width: 150px; padding-left: 10px; display: inline-flex; @@ -57,6 +50,11 @@ border-right: 2px solid #828282; } +.windowIcon { + font-size: 11pt; + margin-right: 5px; +} + .windowActive { min-width: 150px; padding-left: 10px; diff --git a/src/index.css b/src/index.css index f18b694..c7f5026 100644 --- a/src/index.css +++ b/src/index.css @@ -1,5 +1,5 @@ :root { - font-family: Arial, sans-serif; + font-family: Noto Sans Condensed, sans-serif; line-height: 1.5; font-weight: 400; -- 2.49.1 From 79117da96939a569b345d1ab85ee3af854e579a3 Mon Sep 17 00:00:00 2001 From: Darius Schefer Date: Fri, 29 Aug 2025 03:18:08 +0200 Subject: [PATCH 03/25] Add Card components --- src/components/Card/Card.tsx | 5 +++ src/components/Card/style.module.css | 14 ++++++ src/components/CardHeader/CardHeader.tsx | 16 +++++++ src/components/CardHeader/style.module.css | 27 ++++++++++++ src/components/Dashboard/Dashboard.tsx | 51 ++++++++++------------ src/components/Dashboard/style.module.css | 38 +--------------- src/components/Flatastic/Flatastic.tsx | 2 +- src/components/Flatastic/style.module.css | 4 ++ src/components/Terminal/Terminal.tsx | 5 +-- src/components/Timetable/Timetable.tsx | 2 +- src/components/Timetable/style.module.css | 3 ++ 11 files changed, 99 insertions(+), 68 deletions(-) create mode 100644 src/components/Card/Card.tsx create mode 100644 src/components/Card/style.module.css create mode 100644 src/components/CardHeader/CardHeader.tsx create mode 100644 src/components/CardHeader/style.module.css diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx new file mode 100644 index 0000000..c6f1517 --- /dev/null +++ b/src/components/Card/Card.tsx @@ -0,0 +1,5 @@ +import style from "./style.module.css"; + +export default function Card({ active, children }) { + return
{children}
; +} diff --git a/src/components/Card/style.module.css b/src/components/Card/style.module.css new file mode 100644 index 0000000..773bd02 --- /dev/null +++ b/src/components/Card/style.module.css @@ -0,0 +1,14 @@ +.card { + flex-direction: column; + justify-content: flex-start; + background-color: #c0c0c0; + border-top: 2px solid white; + border-left: 2px solid white; + border-bottom: 2px solid #828282; + border-right: 2px solid #828282; + margin: 10px; +} + +.cardContent { + padding: 1px 100px 30px 100px; +} diff --git a/src/components/CardHeader/CardHeader.tsx b/src/components/CardHeader/CardHeader.tsx new file mode 100644 index 0000000..482d00e --- /dev/null +++ b/src/components/CardHeader/CardHeader.tsx @@ -0,0 +1,16 @@ +import style from "./style.module.css"; + +export default function CardHeader({ icon, content, active = false }) { + let containerClass = style.container; + if (active) { + containerClass += " " + style.active; + } + return ( +
+
+
{icon}
+
{content}
+
+
+ ); +} diff --git a/src/components/CardHeader/style.module.css b/src/components/CardHeader/style.module.css new file mode 100644 index 0000000..700cd96 --- /dev/null +++ b/src/components/CardHeader/style.module.css @@ -0,0 +1,27 @@ +.container { + height: 28px; + display: flex; + flex-direction: row; + margin: 2px; + justify-content: space-between; + align-items: center; + color: #c0c0c0; + background-color: #808080; +} + +.active { + color: white; + background-color: #000082; +} + +.title { + display: flex; + flex-direction: row; + font-weight: bold; + gap: 7px; + padding-left: 5px; +} + +.icon { + font-size: 10pt; +} diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx index 3304468..77a1ce2 100644 --- a/src/components/Dashboard/Dashboard.tsx +++ b/src/components/Dashboard/Dashboard.tsx @@ -1,5 +1,7 @@ import { useEffect, useState } from "react"; +import Card from "@/components/Card/Card"; +import CardHeader from "@/components/CardHeader/CardHeader"; import Datetime from "@/components/Datetime/Datetime"; import Flatastic from "@/components/Flatastic/Flatastic"; import Footer from "@/components/Footer/Footer"; @@ -10,7 +12,8 @@ import style from "./style.module.css"; export default function Dashboard() { const schemes = [style.day, style.evening, style.night]; - const [scheme, setScheme] = useState(style.day); + const [schemeIndex, setSchemeIndex] = useState(0); + const scheme = schemes[schemeIndex]; // change background color based on time of day const time = useEffect(() => { @@ -19,11 +22,11 @@ export default function Dashboard() { let d = new Date(); let hour = d.getHours(); if (hour >= 7 && hour < 16) { - setScheme(style.day); - } else if (hour < 23) { - setScheme(style.evening); + setSchemeIndex(0); + } else if (hour >= 16 && hour < 23) { + setSchemeIndex(1); } else { - setScheme(style.night); + setSchemeIndex(2); } }, 20 * 60 * 1000, @@ -36,33 +39,27 @@ export default function Dashboard() { return (
-
-
๐ŸšŠ Timetable
-
- -
-
+ + + + -
-
-
๐Ÿ• Clock
+
+ + -
+
-
-
-
๐Ÿ”” Terminal
- -
-
+ + + + -
-
๐Ÿงน Flatastic
-
- -
-
+ + + +
diff --git a/src/components/Dashboard/style.module.css b/src/components/Dashboard/style.module.css index 9535ef1..4a312cc 100644 --- a/src/components/Dashboard/style.module.css +++ b/src/components/Dashboard/style.module.css @@ -29,46 +29,12 @@ justify-content: flex-start; } -.card { - flex-direction: column; - justify-content: flex-start; - background-color: #c0c0c0; - border-top: 2px solid white; - border-left: 2px solid white; - border-bottom: 2px solid #828282; - border-right: 2px solid #828282; -} - -.cardContent { - padding: 1px 100px 30px 100px; -} - -.cardHeader { - height: 30px; - color: white; - background-color: #000082; - text-align: left; - padding-left: 5px; - font-weight: bold; -} - -.cardHeaderInactive { - height: 30px; - color: #c0c0c0; - background-color: #808080; - text-align: left; - padding-left: 5px; - font-weight: bold; -} - -.clock { +.small { width: 45%; -<<<<<<< HEAD -======= } .terminal { ->>>>>>> 115a228 (Make dashboard change background based on time of day) + margin: 2px; } .footer { diff --git a/src/components/Flatastic/Flatastic.tsx b/src/components/Flatastic/Flatastic.tsx index cce0b55..7612157 100644 --- a/src/components/Flatastic/Flatastic.tsx +++ b/src/components/Flatastic/Flatastic.tsx @@ -56,7 +56,7 @@ export default function Flatastic() { }); return ( -
+

Chores

    {choresRender}
diff --git a/src/components/Flatastic/style.module.css b/src/components/Flatastic/style.module.css index eb1f027..46582c7 100644 --- a/src/components/Flatastic/style.module.css +++ b/src/components/Flatastic/style.module.css @@ -1,3 +1,7 @@ +.container { + padding: 1px 100px 30px 100px; +} + .choreList { list-style-type: none; display: flex; diff --git a/src/components/Terminal/Terminal.tsx b/src/components/Terminal/Terminal.tsx index e3cea94..52fdbd6 100644 --- a/src/components/Terminal/Terminal.tsx +++ b/src/components/Terminal/Terminal.tsx @@ -84,9 +84,8 @@ export default function Terminal() {
{text}
- - [sus@home ~/hallway]{"$"} - {" "} + [sus@home ~/hallway]{"$"} + {" โ–ˆ"}
); diff --git a/src/components/Timetable/Timetable.tsx b/src/components/Timetable/Timetable.tsx index f59803a..6a167e9 100644 --- a/src/components/Timetable/Timetable.tsx +++ b/src/components/Timetable/Timetable.tsx @@ -18,7 +18,7 @@ export default function Timetable() { }, [fetchTimetable]); return ( -
+

Departures

Date: Fri, 29 Aug 2025 11:57:14 +0200 Subject: [PATCH 04/25] fix rebase issues --- src/components/Dashboard/Dashboard.tsx | 6 ++-- src/components/Datetime/style.module.css | 6 ++-- src/components/Flatastic/Flatastic.tsx | 10 +++--- src/components/Footer/Footer.tsx | 4 --- src/components/Terminal/Terminal.tsx | 7 ++-- src/components/Terminal/style.module.css | 44 +++++++++++------------- src/index.css | 4 ++- 7 files changed, 38 insertions(+), 43 deletions(-) diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx index 77a1ce2..2921a44 100644 --- a/src/components/Dashboard/Dashboard.tsx +++ b/src/components/Dashboard/Dashboard.tsx @@ -16,11 +16,11 @@ export default function Dashboard() { const scheme = schemes[schemeIndex]; // change background color based on time of day - const time = useEffect(() => { + useEffect(() => { const timer = setInterval( () => { - let d = new Date(); - let hour = d.getHours(); + const d = new Date(); + const hour = d.getHours(); if (hour >= 7 && hour < 16) { setSchemeIndex(0); } else if (hour >= 16 && hour < 23) { diff --git a/src/components/Datetime/style.module.css b/src/components/Datetime/style.module.css index ad15448..8a0d38e 100644 --- a/src/components/Datetime/style.module.css +++ b/src/components/Datetime/style.module.css @@ -19,11 +19,11 @@ img { } .divider { - animation: blink 3s step-end infinite; + animation: blink 3s step-end infinite; } @keyframes blink { 50% { - opacity: 0; - } + opacity: 0; + } } diff --git a/src/components/Flatastic/Flatastic.tsx b/src/components/Flatastic/Flatastic.tsx index 7612157..0809620 100644 --- a/src/components/Flatastic/Flatastic.tsx +++ b/src/components/Flatastic/Flatastic.tsx @@ -35,11 +35,11 @@ export default function Flatastic() { className = "irregular"; } else { className = chore.timeLeftNext <= 0 ? "due" : "notDue"; - timeLeftInDays = - {Math.abs( - Math.floor(chore.timeLeftNext / (60 * 60 * 24)), - )}d - ; + timeLeftInDays = ( + + {Math.abs(Math.floor(chore.timeLeftNext / (60 * 60 * 24)))}d + + ); } return ( diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 6384ffe..7909725 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -1,7 +1,3 @@ -import { useEffect, useState } from "react"; -import Marquee from "react-fast-marquee"; - -import pasta from "./pasta.ts"; import style from "./style.module.css"; export default function Footer() { diff --git a/src/components/Terminal/Terminal.tsx b/src/components/Terminal/Terminal.tsx index 52fdbd6..bd4e56a 100644 --- a/src/components/Terminal/Terminal.tsx +++ b/src/components/Terminal/Terminal.tsx @@ -1,8 +1,7 @@ -import { useHomeAssistantStore } from "@/store/homeAssistant"; import { useEffect, useState } from "react"; - -import style from "./style.module.css"; +import { useHomeAssistantStore } from "@/store/homeAssistant"; import pasta from "./pasta.ts"; +import style from "./style.module.css"; export default function Terminal() { const [index, setIndex] = useState(0); @@ -44,7 +43,7 @@ export default function Terminal() {
-                        {"      "}-///:.{"      "}
+                        {"      -///:.      "}
                         tent@
                         home
                     
diff --git a/src/components/Terminal/style.module.css b/src/components/Terminal/style.module.css index 5c4a434..e836dbb 100644 --- a/src/components/Terminal/style.module.css +++ b/src/components/Terminal/style.module.css @@ -1,49 +1,47 @@ .container { - display: flex; - flex-direction: column; - font-family: monospace; - font-size: 10pt; - background-color: black; - color: white; - display: flex; - flex-direction: column; - width: 100%; - height: 290px; - overflow: hidden; + display: flex; + flex-direction: column; + font-family: monospace; + font-size: 10pt; + background-color: black; + color: white; + width: 100%; + height: 290px; + overflow: hidden; } .fetch { - display: flex; - flex-direction: column; - padding-bottom: 10px; + display: flex; + flex-direction: column; + padding-bottom: 10px; } .prompt { - color: lightgreen; + color: lightgreen; } .username { - color: violet; + color: violet; } .hostname { - color: skyblue; + color: skyblue; } .temp { - color: pink; - font-weight: bold; + color: pink; + font-weight: bold; } .humidity { - color: skyblue; - font-weight: bold; + color: skyblue; + font-weight: bold; } .plants { - color: lightgreen; + color: lightgreen; } pre { - margin: 0; + margin: 0; } diff --git a/src/index.css b/src/index.css index c7f5026..d9326cf 100644 --- a/src/index.css +++ b/src/index.css @@ -1,5 +1,7 @@ :root { - font-family: Noto Sans Condensed, sans-serif; + font-family: + Noto Sans Condensed, + sans-serif; line-height: 1.5; font-weight: 400; -- 2.49.1 From b27be08b87608f0faf026a15c32bb9fc0d45604c Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 12:13:49 +0200 Subject: [PATCH 05/25] install classnames --- bun.lock | 3 +++ package.json | 1 + 2 files changed, 4 insertions(+) diff --git a/bun.lock b/bun.lock index 3beb17e..46f334f 100644 --- a/bun.lock +++ b/bun.lock @@ -7,6 +7,7 @@ "@reduxjs/toolkit": "^2.8.2", "@types/lodash": "^4.17.20", "@types/node": "^24.1.0", + "classnames": "^2.5.1", "lodash": "^4.17.21", "react": "^19.1.0", "react-dom": "^19.1.0", @@ -311,6 +312,8 @@ "chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + "classnames": ["classnames@2.5.1", "", {}, "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="], + "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], diff --git a/package.json b/package.json index 71b51fe..1ecc6fd 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@reduxjs/toolkit": "^2.8.2", "@types/lodash": "^4.17.20", "@types/node": "^24.1.0", + "classnames": "^2.5.1", "lodash": "^4.17.21", "react": "^19.1.0", "react-dom": "^19.1.0", -- 2.49.1 From 69f46059e0a9531abec16eb659d6d64bebb4b844 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:15:38 +0200 Subject: [PATCH 06/25] add weather module --- bun.lock | 7 + package.json | 1 + src/api/weather.ts | 34 ++ src/components/Card/Card.tsx | 8 +- src/components/CardHeader/CardHeader.tsx | 2 +- src/components/Dashboard/Dashboard.tsx | 17 +- src/components/Dashboard/style.module.css | 5 + src/components/Flatastic/Flatastic.tsx | 2 + src/components/Weather/Weather.tsx | 41 +++ src/components/Weather/style.module.css | 30 ++ src/store/Weather/Weather.ts | 0 src/store/weather.ts | 389 ++++++++++++++++++++++ 12 files changed, 527 insertions(+), 9 deletions(-) create mode 100644 src/api/weather.ts create mode 100644 src/components/Weather/Weather.tsx create mode 100644 src/components/Weather/style.module.css delete mode 100644 src/store/Weather/Weather.ts create mode 100644 src/store/weather.ts diff --git a/bun.lock b/bun.lock index 46f334f..d7200b3 100644 --- a/bun.lock +++ b/bun.lock @@ -9,6 +9,7 @@ "@types/node": "^24.1.0", "classnames": "^2.5.1", "lodash": "^4.17.21", + "openmeteo": "^1.2.0", "react": "^19.1.0", "react-dom": "^19.1.0", "react-fast-marquee": "^1.6.5", @@ -142,6 +143,8 @@ "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], + "@openmeteo/sdk": ["@openmeteo/sdk@1.20.1", "", { "dependencies": { "flatbuffers": "^25.2.10" } }, "sha512-o5tw3+N617Ms8nDm649PWwWt6PDz8NHWBLjOOFB8bx/EJpvsvKEeHMMoapxQ71bjHzQM+4h39eCe6/nM+nBuwg=="], + "@pkgr/core": ["@pkgr/core@0.2.9", "", {}, "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA=="], "@reduxjs/toolkit": ["@reduxjs/toolkit@2.8.2", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@standard-schema/utils": "^0.3.0", "immer": "^10.0.3", "redux": "^5.0.1", "redux-thunk": "^3.1.0", "reselect": "^5.1.0" }, "peerDependencies": { "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" }, "optionalPeers": ["react", "react-redux"] }, "sha512-MYlOhQ0sLdw4ud48FoC5w0dH9VfWQjtCjreKwYTT3l+r427qYC5Y8PihNutepr8XrNaBUDQo9khWUwQxZaqt5A=="], @@ -428,6 +431,8 @@ "flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="], + "flatbuffers": ["flatbuffers@25.2.10", "", {}, "sha512-7JlN9ZvLDG1McO3kbX0k4v+SUAg48L1rIwEvN6ZQl/eCtgJz9UylTMzE9wrmYrcorgxm3CX/3T/w5VAub99UUw=="], + "flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="], "for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="], @@ -598,6 +603,8 @@ "object.values": ["object.values@1.2.1", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" } }, "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA=="], + "openmeteo": ["openmeteo@1.2.0", "", { "dependencies": { "@openmeteo/sdk": "^1.19.0", "flatbuffers": "^25.2.10" } }, "sha512-YinFo02TM4wXdm9o2FBAO2u1ka3drNdnFsGNskiO8aCWvZa6nljh3ioH79ipwPdFhCrIiq/LCfpjDGXqH2RBFw=="], + "optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="], "own-keys": ["own-keys@1.0.1", "", { "dependencies": { "get-intrinsic": "^1.2.6", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg=="], diff --git a/package.json b/package.json index 1ecc6fd..cb35ab7 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@types/node": "^24.1.0", "classnames": "^2.5.1", "lodash": "^4.17.21", + "openmeteo": "^1.2.0", "react": "^19.1.0", "react-dom": "^19.1.0", "react-fast-marquee": "^1.6.5", diff --git a/src/api/weather.ts b/src/api/weather.ts new file mode 100644 index 0000000..06126f6 --- /dev/null +++ b/src/api/weather.ts @@ -0,0 +1,34 @@ +import { fetchWeatherApi } from "openmeteo"; + +const params = { + latitude: 49.0094, + longitude: 8.4044, + daily: ["temperature_2m_max", "temperature_2m_min"], + hourly: [ + "temperature_2m", + "precipitation", + "rain", + "precipitation_probability", + ], + current: [ + "temperature_2m", + "precipitation", + "rain", + "showers", + "snowfall", + "relative_humidity_2m", + "apparent_temperature", + "weather_code", + "cloud_cover", + "is_day", + ], + timezone: "Europe/Berlin", + timeformat: "unixtime", +}; +const url = "https://api.open-meteo.com/v1/forecast"; + +function fetchWeatherData() { + return fetchWeatherApi(url, params); +} + +export default fetchWeatherData; diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index c6f1517..91f1053 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -1,5 +1,11 @@ import style from "./style.module.css"; -export default function Card({ active, children }) { +export default function Card({ + active, + children, +}: { + active?: boolean; + children: React.ReactNode; +}) { return
{children}
; } diff --git a/src/components/CardHeader/CardHeader.tsx b/src/components/CardHeader/CardHeader.tsx index 482d00e..d04600f 100644 --- a/src/components/CardHeader/CardHeader.tsx +++ b/src/components/CardHeader/CardHeader.tsx @@ -3,7 +3,7 @@ import style from "./style.module.css"; export default function CardHeader({ icon, content, active = false }) { let containerClass = style.container; if (active) { - containerClass += " " + style.active; + containerClass += ` ${style.active}`; } return (
diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx index 2921a44..b2a1e52 100644 --- a/src/components/Dashboard/Dashboard.tsx +++ b/src/components/Dashboard/Dashboard.tsx @@ -7,7 +7,7 @@ import Flatastic from "@/components/Flatastic/Flatastic"; import Footer from "@/components/Footer/Footer"; import Terminal from "@/components/Terminal/Terminal"; import Timetable from "@/components/Timetable/Timetable"; - +import Weather from "../Weather/Weather"; import style from "./style.module.css"; export default function Dashboard() { @@ -43,14 +43,18 @@ export default function Dashboard() { - -
+
+
+ + + + +
- - + +
- @@ -61,7 +65,6 @@ export default function Dashboard() {
-
diff --git a/src/components/Dashboard/style.module.css b/src/components/Dashboard/style.module.css index 4a312cc..b773a63 100644 --- a/src/components/Dashboard/style.module.css +++ b/src/components/Dashboard/style.module.css @@ -20,6 +20,11 @@ background-color: #2a3f55; } +.clockAndWeather { + display: flex; + align-items: center; +} + .cardWrapper { margin: 30px; height: 100%; diff --git a/src/components/Flatastic/Flatastic.tsx b/src/components/Flatastic/Flatastic.tsx index 0809620..270db81 100644 --- a/src/components/Flatastic/Flatastic.tsx +++ b/src/components/Flatastic/Flatastic.tsx @@ -9,10 +9,12 @@ export default function Flatastic() { const fetchFlatasticData = useFlatasticStore((state) => state.fetch); const flatasticData = useFlatasticStore((state) => state.flatasticData); const chores = (flatasticData?.chores as FlatasticChore[]) || []; + chores.sort( (a, b) => a.timeLeftNext - b.timeLeftNext && b.rotationTime - a.rotationTime, ); + const users = flatasticData?.users; const idToNameMap: Record = {}; users.forEach((user: FlatasticUser) => { diff --git a/src/components/Weather/Weather.tsx b/src/components/Weather/Weather.tsx new file mode 100644 index 0000000..fe8ac0b --- /dev/null +++ b/src/components/Weather/Weather.tsx @@ -0,0 +1,41 @@ +import { useEffect } from "react"; +import { useWeatherStore } from "@/store/weather"; + +import styles from "./style.module.css"; + +export default function Weather() { + const weatherData = useWeatherStore((state) => state.weatherData); + const fetchWeatherData = useWeatherStore((state) => state.fetchWeatherData); + + useEffect(() => { + fetchWeatherData(); + const interval = setInterval(() => { + fetchWeatherData(); + }, 10 * 60000); + return () => clearInterval(interval); + }, [fetchWeatherData]); + + if (!weatherData.current) { + return
Loading...
; + } + + return ( +
+
+ {weatherData.current.weather_description} + {weatherData.current.temperature_2m.toFixed(1)}ยฐC +
+
+ + {weatherData.daily.temperature_2m_min[0].toFixed(1)}ยฐC + + + {weatherData.daily.temperature_2m_max[0].toFixed(1)}ยฐC + +
+
+ ); +} diff --git a/src/components/Weather/style.module.css b/src/components/Weather/style.module.css new file mode 100644 index 0000000..ee8acbd --- /dev/null +++ b/src/components/Weather/style.module.css @@ -0,0 +1,30 @@ +.weatherContainer { + display: flex; + flex-direction: row; + width: 100%; + padding: 3px; + padding-right: 15px; +} + +.currentTemperature { + display: flex; + align-items: center; + font-size: 2rem; + font-weight: bold; + padding-right: 5px; +} + +.dailyTemperatures { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.min-temperature { + color: blue; +} + +.max-temperature { + color: red; +} diff --git a/src/store/Weather/Weather.ts b/src/store/Weather/Weather.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/store/weather.ts b/src/store/weather.ts new file mode 100644 index 0000000..4175599 --- /dev/null +++ b/src/store/weather.ts @@ -0,0 +1,389 @@ +import { create } from "zustand"; +import { devtools } from "zustand/middleware"; +import fetchWeatherData from "@/api/weather"; + +const iconNumberToPng = { + "0": { + day: { + description: "Sunny", + image: "http://openweathermap.org/img/wn/01d@2x.png", + }, + night: { + description: "Clear", + image: "http://openweathermap.org/img/wn/01n@2x.png", + }, + }, + "1": { + day: { + description: "Mainly Sunny", + image: "http://openweathermap.org/img/wn/01d@2x.png", + }, + night: { + description: "Mainly Clear", + image: "http://openweathermap.org/img/wn/01n@2x.png", + }, + }, + "2": { + day: { + description: "Partly Cloudy", + image: "http://openweathermap.org/img/wn/02d@2x.png", + }, + night: { + description: "Partly Cloudy", + image: "http://openweathermap.org/img/wn/02n@2x.png", + }, + }, + "3": { + day: { + description: "Cloudy", + image: "http://openweathermap.org/img/wn/03d@2x.png", + }, + night: { + description: "Cloudy", + image: "http://openweathermap.org/img/wn/03n@2x.png", + }, + }, + "45": { + day: { + description: "Foggy", + image: "http://openweathermap.org/img/wn/50d@2x.png", + }, + night: { + description: "Foggy", + image: "http://openweathermap.org/img/wn/50n@2x.png", + }, + }, + "48": { + day: { + description: "Rime Fog", + image: "http://openweathermap.org/img/wn/50d@2x.png", + }, + night: { + description: "Rime Fog", + image: "http://openweathermap.org/img/wn/50n@2x.png", + }, + }, + "51": { + day: { + description: "Light Drizzle", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Light Drizzle", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "53": { + day: { + description: "Drizzle", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Drizzle", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "55": { + day: { + description: "Heavy Drizzle", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Heavy Drizzle", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "56": { + day: { + description: "Light Freezing Drizzle", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Light Freezing Drizzle", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "57": { + day: { + description: "Freezing Drizzle", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Freezing Drizzle", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "61": { + day: { + description: "Light Rain", + image: "http://openweathermap.org/img/wn/10d@2x.png", + }, + night: { + description: "Light Rain", + image: "http://openweathermap.org/img/wn/10n@2x.png", + }, + }, + "63": { + day: { + description: "Rain", + image: "http://openweathermap.org/img/wn/10d@2x.png", + }, + night: { + description: "Rain", + image: "http://openweathermap.org/img/wn/10n@2x.png", + }, + }, + "65": { + day: { + description: "Heavy Rain", + image: "http://openweathermap.org/img/wn/10d@2x.png", + }, + night: { + description: "Heavy Rain", + image: "http://openweathermap.org/img/wn/10n@2x.png", + }, + }, + "66": { + day: { + description: "Light Freezing Rain", + image: "http://openweathermap.org/img/wn/10d@2x.png", + }, + night: { + description: "Light Freezing Rain", + image: "http://openweathermap.org/img/wn/10n@2x.png", + }, + }, + "67": { + day: { + description: "Freezing Rain", + image: "http://openweathermap.org/img/wn/10d@2x.png", + }, + night: { + description: "Freezing Rain", + image: "http://openweathermap.org/img/wn/10n@2x.png", + }, + }, + "71": { + day: { + description: "Light Snow", + image: "http://openweathermap.org/img/wn/13d@2x.png", + }, + night: { + description: "Light Snow", + image: "http://openweathermap.org/img/wn/13n@2x.png", + }, + }, + "73": { + day: { + description: "Snow", + image: "http://openweathermap.org/img/wn/13d@2x.png", + }, + night: { + description: "Snow", + image: "http://openweathermap.org/img/wn/13n@2x.png", + }, + }, + "75": { + day: { + description: "Heavy Snow", + image: "http://openweathermap.org/img/wn/13d@2x.png", + }, + night: { + description: "Heavy Snow", + image: "http://openweathermap.org/img/wn/13n@2x.png", + }, + }, + "77": { + day: { + description: "Snow Grains", + image: "http://openweathermap.org/img/wn/13d@2x.png", + }, + night: { + description: "Snow Grains", + image: "http://openweathermap.org/img/wn/13n@2x.png", + }, + }, + "80": { + day: { + description: "Light Showers", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Light Showers", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "81": { + day: { + description: "Showers", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Showers", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "82": { + day: { + description: "Heavy Showers", + image: "http://openweathermap.org/img/wn/09d@2x.png", + }, + night: { + description: "Heavy Showers", + image: "http://openweathermap.org/img/wn/09n@2x.png", + }, + }, + "85": { + day: { + description: "Light Snow Showers", + image: "http://openweathermap.org/img/wn/13d@2x.png", + }, + night: { + description: "Light Snow Showers", + image: "http://openweathermap.org/img/wn/13n@2x.png", + }, + }, + "86": { + day: { + description: "Snow Showers", + image: "http://openweathermap.org/img/wn/13d@2x.png", + }, + night: { + description: "Snow Showers", + image: "http://openweathermap.org/img/wn/13n@2x.png", + }, + }, + "95": { + day: { + description: "Thunderstorm", + image: "http://openweathermap.org/img/wn/11d@2x.png", + }, + night: { + description: "Thunderstorm", + image: "http://openweathermap.org/img/wn/11n@2x.png", + }, + }, + "96": { + day: { + description: "Light Thunderstorms With Hail", + image: "http://openweathermap.org/img/wn/11d@2x.png", + }, + night: { + description: "Light Thunderstorms With Hail", + image: "http://openweathermap.org/img/wn/11n@2x.png", + }, + }, + "99": { + day: { + description: "Thunderstorm With Hail", + image: "http://openweathermap.org/img/wn/11d@2x.png", + }, + night: { + description: "Thunderstorm With Hail", + image: "http://openweathermap.org/img/wn/11n@2x.png", + }, + }, +}; + +const useWeatherStore = create( + devtools( + (set) => ({ + 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) { + console.error("Failed to fetch weather data"); + return; + } + + // Attributes for timezone and location + const utcOffsetSeconds = response.utcOffsetSeconds(); + const current = response.current(); + const hourly = response.hourly(); + const daily = response.daily(); + + if (!current || !hourly || !daily) { + console.error("Failed to fetch weather data"); + return; + } + + // Note: The order of weather variables in the URL query and the indices below need to match! + const weatherData = { + current: { + time: current.time(), + temperature_2m: current.variables(0)?.value(), + precipitation: current.variables(1)?.value(), + rain: current.variables(2)?.value(), + showers: current.variables(3)?.value(), + snowfall: current.variables(4)?.value(), + relative_humidity_2m: current.variables(5)?.value(), + apparent_temperature: current.variables(6)?.value(), + weather_code: current.variables(7)?.value(), + cloud_cover: current.variables(8)?.value(), + is_day: current.variables(9)?.value(), + }, + hourly: { + time: [ + ...Array( + (Number(hourly.timeEnd()) - + Number(hourly.time())) / + hourly.interval(), + ), + ].map( + (_, i) => + new Date( + (Number(hourly.time()) + + i * hourly.interval() + + utcOffsetSeconds) * + 1000, + ), + ), + temperature_2m: hourly.variables(0)?.valuesArray(), + precipitation: hourly.variables(1)?.valuesArray(), + rain: hourly.variables(2)?.valuesArray(), + precipitation_probability: hourly + .variables(3) + ?.valuesArray(), + }, + daily: { + time: [ + ...Array( + (Number(daily.timeEnd()) - + Number(daily.time())) / + daily.interval(), + ), + ].map( + (_, i) => + new Date( + (Number(daily.time()) + + i * daily.interval() + + utcOffsetSeconds) * + 1000, + ), + ), + temperature_2m_max: daily.variables(0)?.valuesArray(), + temperature_2m_min: daily.variables(1)?.valuesArray(), + }, + }; + + const isDay = weatherData.current.is_day === 1; + const weatherCode = weatherData.current.weather_code; + const url = + iconNumberToPng[weatherCode][isDay ? "day" : "night"].image; + + weatherData.current = { ...weatherData.current, icon: url }; + + set({ weatherData }); + }, + }), + { + name: "weather-store", + }, + ), +); + +export { useWeatherStore }; -- 2.49.1 From 20bf530f189411b4ef181effcb37a81fd9789527 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:19:19 +0200 Subject: [PATCH 07/25] use biome action directly --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9041556..ca949f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,14 +10,11 @@ on: jobs: lint: runs-on: ubuntu-latest - container: - image: oven/bun steps: - uses: actions/checkout@v4 - - name: Install Biome - run: bun install -g biome - - name: Biome CI - run: biome ci + - uses: biomejs/setup-biome@v2 + - name: Run Biome lint + run: biome lint . build: runs-on: ubuntu-latest -- 2.49.1 From 3a5e5ab2b9d4ecf3961faec0918a7b9f77765074 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:20:36 +0200 Subject: [PATCH 08/25] revert biome action --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca949f1..22a0ac7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,12 @@ on: jobs: lint: runs-on: ubuntu-latest + container: + image: oven/bun steps: - uses: actions/checkout@v4 - - uses: biomejs/setup-biome@v2 + - name: Install Biome + run: bun install -g biome - name: Run Biome lint run: biome lint . -- 2.49.1 From 63322a2c5694bc25727ed5516c96bf0ac60e3a07 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:25:02 +0200 Subject: [PATCH 09/25] use artifacts instead of checkout --- .github/workflows/ci.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22a0ac7..6d89418 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,20 +8,8 @@ on: workflow_dispatch: jobs: - lint: - runs-on: ubuntu-latest - container: - image: oven/bun - steps: - - uses: actions/checkout@v4 - - name: Install Biome - run: bun install -g biome - - name: Run Biome lint - run: biome lint . - build: runs-on: ubuntu-latest - needs: lint container: image: oven/bun steps: @@ -30,6 +18,25 @@ jobs: run: bun install - name: Build run: bun run build + - name: Create Artifact + uses: actions/upload-artifact@v4 + with: + name: build + + lint: + runs-on: ubuntu-latest + needs: build + container: + image: oven/bun + steps: + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: build + - name: Install Biome + run: bun install -g biome + - name: Run Biome lint + run: biome lint . build-and-push-docker: needs: [build] -- 2.49.1 From 466b73652c74a16c7edb501a4c969711754a01ab Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:26:06 +0200 Subject: [PATCH 10/25] set path for build artifact --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d89418..85b850c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: build + path: . lint: runs-on: ubuntu-latest -- 2.49.1 From abb4db58647a9003b0d04ca5feea95973ba0f43a Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:27:30 +0200 Subject: [PATCH 11/25] use lower artifact up/download actions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85b850c..bf8a805 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v2 with: name: build path: . @@ -31,7 +31,7 @@ jobs: image: oven/bun steps: - name: Download Artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v2 with: name: build - name: Install Biome -- 2.49.1 From 042cbe97c5a6e7fa94fdae29c840bf00ecad2112 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:29:39 +0200 Subject: [PATCH 12/25] ci test commit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf8a805..85b850c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: build path: . @@ -31,7 +31,7 @@ jobs: image: oven/bun steps: - name: Download Artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: build - name: Install Biome -- 2.49.1 From 085cbe336332124ef813821f45260380064a7f70 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:31:48 +0200 Subject: [PATCH 13/25] ci test commit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85b850c..b73d9c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: actions/upload-artifact@v4 + uses: christopherhx/gitea-upload-artifact@v4 with: name: build path: . @@ -31,7 +31,7 @@ jobs: image: oven/bun steps: - name: Download Artifact - uses: actions/download-artifact@v4 + uses: christopherhx/gitea-download-artifact@v4 with: name: build - name: Install Biome -- 2.49.1 From a40f8c875d7cf7931da68d61a27fe56d51deda64 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:34:36 +0200 Subject: [PATCH 14/25] ci test commit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b73d9c1..29be26b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: christopherhx/gitea-upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: build path: . -- 2.49.1 From c80e5e9f0738799c13e27e376c1d025d9009435c Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:37:38 +0200 Subject: [PATCH 15/25] ci test commit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29be26b..b73d9c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: actions/upload-artifact@v3 + uses: christopherhx/gitea-upload-artifact@v4 with: name: build path: . -- 2.49.1 From 94b4c24bb3a17fcce193e99bc94bab1c57eede80 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:38:20 +0200 Subject: [PATCH 16/25] ci test commit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b73d9c1..b095630 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: christopherhx/gitea-upload-artifact@v4 + uses: christopherhx/gitea-upload-artifact@v3 with: name: build path: . -- 2.49.1 From 8d644dbd35a94dd473671c8fc1ea84a78edad46b Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:38:49 +0200 Subject: [PATCH 17/25] ci test commit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b095630..6008bc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: christopherhx/gitea-upload-artifact@v3 + uses: christopherhx/gitea-upload-artifact@v2 with: name: build path: . -- 2.49.1 From 8126813216e456b1e28c944bfbafb8016ca78461 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:39:00 +0200 Subject: [PATCH 18/25] ci test commit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6008bc8..b73d9c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: bun run build - name: Create Artifact - uses: christopherhx/gitea-upload-artifact@v2 + uses: christopherhx/gitea-upload-artifact@v4 with: name: build path: . -- 2.49.1 From aeb8e836ebd898b4305f411e997136ef910a854a Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:43:50 +0200 Subject: [PATCH 19/25] create buid artifact --- .github/workflows/ci.yml | 11 ++++++++--- Dockerfile | 14 +++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b73d9c1..113f506 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,10 +18,10 @@ jobs: run: bun install - name: Build run: bun run build - - name: Create Artifact + - name: Create Project Artifact uses: christopherhx/gitea-upload-artifact@v4 with: - name: build + name: project path: . lint: @@ -33,11 +33,16 @@ jobs: - name: Download Artifact uses: christopherhx/gitea-download-artifact@v4 with: - name: build + name: project - name: Install Biome run: bun install -g biome - name: Run Biome lint run: biome lint . + - name: Create Build Artifact + uses: christopherhx/gitea-upload-artifact@v4 + with: + name: project + path: dist build-and-push-docker: needs: [build] diff --git a/Dockerfile b/Dockerfile index 4897c34..a9bd62f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,7 @@ -FROM oven/bun +FROM nginx:latest WORKDIR /app -COPY package.json bun.lock ./ +COPY ./dist . -RUN bun install - -COPY . . - -RUN bun run build - -EXPOSE 5173 - -CMD ["bun", "run", "dev", "--host"] +CMD ["nginx", "-g", "daemon off; "] -- 2.49.1 From a18a1bfc9b6967c03743403bc1b4a9a3c1101db4 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:48:47 +0200 Subject: [PATCH 20/25] fix biome when dist folder is present --- .github/workflows/ci.yml | 12 +++++++----- biome.json | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 113f506..55f9078 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,11 @@ jobs: with: name: project path: . + - name: Create Build Artifact + uses: christopherhx/gitea-upload-artifact@v4 + with: + name: build + path: dist lint: runs-on: ubuntu-latest @@ -38,11 +43,8 @@ jobs: run: bun install -g biome - name: Run Biome lint run: biome lint . - - name: Create Build Artifact - uses: christopherhx/gitea-upload-artifact@v4 - with: - name: project - path: dist + - name: Run Biome format check + run: biome format . build-and-push-docker: needs: [build] diff --git a/biome.json b/biome.json index 8a3e2dc..9635976 100644 --- a/biome.json +++ b/biome.json @@ -5,7 +5,8 @@ "useIgnoreFile": false }, "files": { - "ignoreUnknown": false + "ignoreUnknown": false, + "includes": ["!**/dist/**"] }, "formatter": { "enabled": true, -- 2.49.1 From 65fa8badd832053e86f11425a38efa7edde0b030 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:51:00 +0200 Subject: [PATCH 21/25] only create artifact for build --- .github/workflows/ci.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55f9078..7106433 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,6 @@ jobs: run: bun install - name: Build run: bun run build - - name: Create Project Artifact - uses: christopherhx/gitea-upload-artifact@v4 - with: - name: project - path: . - name: Create Build Artifact uses: christopherhx/gitea-upload-artifact@v4 with: @@ -35,10 +30,7 @@ jobs: container: image: oven/bun steps: - - name: Download Artifact - uses: christopherhx/gitea-download-artifact@v4 - with: - name: project + - uses: actions/checkout@v4 - name: Install Biome run: bun install -g biome - name: Run Biome lint -- 2.49.1 From a625aee9d8da760624194b310ab2b2964a16cdf1 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:54:43 +0200 Subject: [PATCH 22/25] use nginx for docker image --- .github/workflows/ci.yml | 3 +++ Dockerfile | 3 ++- docker-compose.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7106433..7aa9421 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: christopherhx/gitea-download-artifact@v4 + with: + name: build - name: Log in to Docker Registry uses: docker/login-action@v2 with: diff --git a/Dockerfile b/Dockerfile index a9bd62f..f71b53f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,5 @@ WORKDIR /app COPY ./dist . -CMD ["nginx", "-g", "daemon off; "] +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml index 0c146ed..288434f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,5 +2,5 @@ services: monitor-im-flur: image: git.rivercry.com/wg/monitor-im-flur:latest ports: - - "9123:5173" + - "9123:80" restart: unless-stopped -- 2.49.1 From 18bf7cb6ce3155dc6e0920d0890a71bf9cedaab0 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:55:21 +0200 Subject: [PATCH 23/25] fix path in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f71b53f..43d6f64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM nginx:latest WORKDIR /app -COPY ./dist . +COPY ./dist/* . EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] -- 2.49.1 From 2cb457c77692be55f11a4d8a9814490b43d7f9bd Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 13:56:53 +0200 Subject: [PATCH 24/25] ci test commit --- .github/workflows/ci.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7aa9421..6ca7a1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image - run: docker build -t git.rivercry.com/wg/monitor-im-flur . + run: ls -la && docker build -t git.rivercry.com/wg/monitor-im-flur . - name: Push Docker image run: docker push git.rivercry.com/wg/monitor-im-flur diff --git a/Dockerfile b/Dockerfile index 43d6f64..2dddbea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM nginx:latest WORKDIR /app -COPY ./dist/* . +COPY ./build/* . EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] -- 2.49.1 From 9d0d458fe3991b29056f5e0aaaa79af1fa07729f Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 29 Aug 2025 14:01:37 +0200 Subject: [PATCH 25/25] ci test commit --- .github/workflows/ci.yml | 3 ++- Dockerfile | 2 +- nginx.conf | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 nginx.conf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ca7a1b..9103384 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: - uses: christopherhx/gitea-download-artifact@v4 with: name: build + path: build - name: Log in to Docker Registry uses: docker/login-action@v2 with: @@ -53,7 +54,7 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image - run: ls -la && docker build -t git.rivercry.com/wg/monitor-im-flur . + run: docker build -t git.rivercry.com/wg/monitor-im-flur . - name: Push Docker image run: docker push git.rivercry.com/wg/monitor-im-flur diff --git a/Dockerfile b/Dockerfile index 2dddbea..e87923e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM nginx:latest WORKDIR /app -COPY ./build/* . +COPY ./build/* /usr/share/nginx/html/ EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..432d33c --- /dev/null +++ b/nginx.conf @@ -0,0 +1,29 @@ +http { + + include mime.types; + + set_real_ip_from 0.0.0.0/0; + real_ip_recursive on; + real_ip_header X-Forward-For; + limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s; + + server { + listen 80; + server_name localhost; + root /proxy; + limit_req zone=mylimit burst=70 nodelay; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} + +events {} -- 2.49.1