From b2794d808d1a416474df94ff5362a8040e2eee16 Mon Sep 17 00:00:00 2001 From: nocnico Date: Sat, 15 Mar 2025 12:08:50 +0100 Subject: [PATCH 1/3] edit .env.example --- apps/dispatch/.env.example | 9 +++++---- apps/hub/.env.example | 2 +- package-lock.json | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/apps/dispatch/.env.example b/apps/dispatch/.env.example index 88aa9476..4f75f0b4 100644 --- a/apps/dispatch/.env.example +++ b/apps/dispatch/.env.example @@ -1,6 +1,7 @@ NEXTAUTH_SECRET= NEXTAUTH_COOKIE_PREFIX= -NEXTAUTH_SECRET= -NEXT_PUBLIC_PUBLIC_URL= -NEXT_PUBLIC_HUB_URL= -NEXT_PUBLIC_SERVICE_ID= \ No newline at end of file +NEXTAUTH_URL=http://localhost:3001 +NEXT_PUBLIC_PUBLIC_URL=http://localhost:3001 +NEXT_PUBLIC_HUB_URL=http://localhost:3000 +NEXT_PUBLIC_SERVICE_ID=1 +NEXT_PUBLIC_DISPATCH_SERVER_URL=http://localhost:3002 \ No newline at end of file diff --git a/apps/hub/.env.example b/apps/hub/.env.example index fa7e22ba..b413bd3f 100644 --- a/apps/hub/.env.example +++ b/apps/hub/.env.example @@ -1,4 +1,4 @@ -NEXTAUTH_URL= +NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET= NEXT_PUBLIC_MOODLE_URL= DATABASE_URL= diff --git a/package-lock.json b/package-lock.json index 2ed2a554..fd82f3a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3798,6 +3798,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, "license": "MIT", "dependencies": { "clean-stack": "^2.0.0", @@ -3893,6 +3894,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^1.9.0" @@ -4236,6 +4238,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, "license": "MIT" }, "node_modules/base64-js": { @@ -4358,6 +4361,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -4569,6 +4573,7 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", @@ -4667,6 +4672,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -4835,6 +4841,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "license": "MIT", "dependencies": { "color-name": "1.1.3" @@ -4844,6 +4851,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "devOptional": true, "license": "MIT" }, "node_modules/color-string": { @@ -4919,6 +4927,7 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, "license": "MIT" }, "node_modules/concurrently": { @@ -6061,6 +6070,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.0" @@ -7096,6 +7106,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -7287,6 +7298,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -7536,6 +7548,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -8091,6 +8104,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -8101,6 +8115,7 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -8117,6 +8132,7 @@ "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, "license": "ISC" }, "node_modules/inline-style-parser": { @@ -8866,6 +8882,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, "license": "ISC" }, "node_modules/iterator.prototype": { @@ -10560,6 +10577,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -13582,6 +13600,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -13814,6 +13833,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, "license": "MIT", "dependencies": { "aggregate-error": "^3.0.0" @@ -13996,6 +14016,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -16281,6 +16302,7 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^3.0.0" @@ -17178,6 +17200,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", "integrity": "sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==", + "dev": true, "license": "ISC", "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -17353,6 +17376,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -17525,6 +17549,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, "license": "ISC" }, "node_modules/ws": { From d942be3af30f34d82988a1a4e9920d308adc2846 Mon Sep 17 00:00:00 2001 From: nocnico Date: Sat, 15 Mar 2025 17:14:36 +0100 Subject: [PATCH 2/3] LST Verbinden & Verbunden Button --- .../app/(dispatch)/_components/Connection.tsx | 81 ++++++++++++++++++- .../app/(dispatch)/_components/Navbar.tsx | 2 +- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/apps/dispatch/app/(dispatch)/_components/Connection.tsx b/apps/dispatch/app/(dispatch)/_components/Connection.tsx index b6b97e44..9754cff2 100644 --- a/apps/dispatch/app/(dispatch)/_components/Connection.tsx +++ b/apps/dispatch/app/(dispatch)/_components/Connection.tsx @@ -1,6 +1,85 @@ import { useSession } from "next-auth/react"; import { connectionStore } from "../../_store/connectionStore"; import { useEffect } from "react"; +import { CheckCircledIcon } from "@radix-ui/react-icons"; + +export const ConnectBtn = () => { + return ( + <> + + +
+

Als Disponent anmelden

+
+ +

+ Du kannst diese Zeit später noch anpassen. +

+
+
+
+ + +
+
+
+
+ + ); +}; + +export const ConnectedBtn = () => { + return ( + <> + + +
+

+ Verbunden als <LST_01> +

+
+ +
+
+
+ + +
+
+
+
+ + ); +}; export const Connection = () => { const session = useSession(); @@ -13,5 +92,5 @@ export const Connection = () => { } }, [uid]); - return
{cStore.isConnected ? "Connected" : "Not Connected"}
; + return
{cStore.isConnected ? : }
; }; diff --git a/apps/dispatch/app/(dispatch)/_components/Navbar.tsx b/apps/dispatch/app/(dispatch)/_components/Navbar.tsx index 08907984..7092820b 100644 --- a/apps/dispatch/app/(dispatch)/_components/Navbar.tsx +++ b/apps/dispatch/app/(dispatch)/_components/Navbar.tsx @@ -51,7 +51,7 @@ export default function Navbar() { -
+
From 6a4f0811b4cfa82f8055d4f60d8a62f7c51e74ba Mon Sep 17 00:00:00 2001 From: nocnico Date: Sat, 15 Mar 2025 17:54:31 +0100 Subject: [PATCH 3/3] darkmode & lightmode switch --- .../app/(dispatch)/_components/Connection.tsx | 1 + .../app/(dispatch)/_components/Navbar.tsx | 81 ------------------- .../(dispatch)/_components/navbar/Navbar.tsx | 70 ++++++++++++++++ .../navbar/_components/ThemeSwap.tsx | 26 ++++++ apps/dispatch/app/(dispatch)/layout.tsx | 2 +- apps/dispatch/app/globals.css | 4 +- 6 files changed, 101 insertions(+), 83 deletions(-) delete mode 100644 apps/dispatch/app/(dispatch)/_components/Navbar.tsx create mode 100644 apps/dispatch/app/(dispatch)/_components/navbar/Navbar.tsx create mode 100644 apps/dispatch/app/(dispatch)/_components/navbar/_components/ThemeSwap.tsx diff --git a/apps/dispatch/app/(dispatch)/_components/Connection.tsx b/apps/dispatch/app/(dispatch)/_components/Connection.tsx index 9754cff2..58dc3856 100644 --- a/apps/dispatch/app/(dispatch)/_components/Connection.tsx +++ b/apps/dispatch/app/(dispatch)/_components/Connection.tsx @@ -1,3 +1,4 @@ +"use client"; import { useSession } from "next-auth/react"; import { connectionStore } from "../../_store/connectionStore"; import { useEffect } from "react"; diff --git a/apps/dispatch/app/(dispatch)/_components/Navbar.tsx b/apps/dispatch/app/(dispatch)/_components/Navbar.tsx deleted file mode 100644 index 7092820b..00000000 --- a/apps/dispatch/app/(dispatch)/_components/Navbar.tsx +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; -import { ToggleTalkButton } from "../_components/ToggleTalkButton"; -import { ChangeRufgruppe } from "../_components/ChangeRufgruppe"; -import { Notifications } from "../_components/Notifications"; -import Link from "next/link"; -import { connectionStore } from "../../_store/connectionStore"; -import { useEffect } from "react"; -import { socket } from "../socket"; -import { useSession } from "next-auth/react"; -import { Connection } from "./Connection"; - -export default function Navbar() { - return ( -
- -
-
    -
  • - -
  • -
  • - -
  • -
-
-
- -
-
- -
- -
-
-
- ... -
- -
-
-
- ); -} diff --git a/apps/dispatch/app/(dispatch)/_components/navbar/Navbar.tsx b/apps/dispatch/app/(dispatch)/_components/navbar/Navbar.tsx new file mode 100644 index 00000000..71a96ed8 --- /dev/null +++ b/apps/dispatch/app/(dispatch)/_components/navbar/Navbar.tsx @@ -0,0 +1,70 @@ +"use client"; + +import { ToggleTalkButton } from "../ToggleTalkButton"; +import { ChangeRufgruppe } from "../ChangeRufgruppe"; +import { Notifications } from "../Notifications"; +import Link from "next/link"; +import { Connection } from "../Connection"; +import { ThemeSwap } from "./_components/ThemeSwap"; +import { useState } from "react"; + +export default function Navbar() { + const [isDark, setIsDark] = useState(false); + + const toggleTheme = () => { + const newTheme = !isDark; + setIsDark(newTheme); + document.documentElement.setAttribute( + "data-theme", + newTheme ? "nord" : "dark", + ); + }; + + return ( +
+ +
+
    +
  • + +
  • +
  • + +
  • +
+
+
+ +
+
+ +
+ +
+
+
+ ... +
+ +
+
+
+ ); +} diff --git a/apps/dispatch/app/(dispatch)/_components/navbar/_components/ThemeSwap.tsx b/apps/dispatch/app/(dispatch)/_components/navbar/_components/ThemeSwap.tsx new file mode 100644 index 00000000..dec2a6fd --- /dev/null +++ b/apps/dispatch/app/(dispatch)/_components/navbar/_components/ThemeSwap.tsx @@ -0,0 +1,26 @@ +"use client"; + +import { MoonIcon, SunIcon } from "@radix-ui/react-icons"; + +interface ThemeSwapProps { + isDark: boolean; + toggleTheme: () => void; +} + +export const ThemeSwap: React.FC = ({ + isDark, + toggleTheme, +}) => { + return ( + + ); +}; diff --git a/apps/dispatch/app/(dispatch)/layout.tsx b/apps/dispatch/app/(dispatch)/layout.tsx index 30116e52..0338c28d 100644 --- a/apps/dispatch/app/(dispatch)/layout.tsx +++ b/apps/dispatch/app/(dispatch)/layout.tsx @@ -1,5 +1,5 @@ import type { Metadata } from "next"; -import Navbar from "./_components/Navbar"; +import Navbar from "./_components/navbar/Navbar"; import { redirect } from "next/navigation"; import { getServerSession } from "../api/auth/[...nextauth]/auth"; diff --git a/apps/dispatch/app/globals.css b/apps/dispatch/app/globals.css index 4c1b0c2f..dca6a6c6 100644 --- a/apps/dispatch/app/globals.css +++ b/apps/dispatch/app/globals.css @@ -1,2 +1,4 @@ @import "tailwindcss"; -@plugin "daisyui"; +@plugin "daisyui" { + themes: dark, nord; +}