diff --git a/apps/dispatch/app/_components/Badge/Badge.tsx b/apps/dispatch/app/_components/Badge/Badge.tsx new file mode 100644 index 00000000..d6600b27 --- /dev/null +++ b/apps/dispatch/app/_components/Badge/Badge.tsx @@ -0,0 +1,29 @@ +import { BADGES } from "@repo/db"; +import P1 from "./p-1.png"; +import P2 from "./p-2.png"; +import P3 from "./p-3.png"; +import D1 from "./d-1.png"; +import D2 from "./d-2.png"; +import D3 from "./d-3.png"; +import DAY1 from "./day-1-member.png"; +import { cn } from "_helpers/cn"; + +const BadgeImage = { + [BADGES.P1]: P1, + [BADGES.P2]: P2, + [BADGES.P3]: P3, + [BADGES.D1]: D1, + [BADGES.D2]: D2, + [BADGES.D3]: D3, + [BADGES.DAY1]: DAY1, +}; + +export const Badge = ({ name, className }: { name: BADGES; className?: string }) => { + const image = BadgeImage[name]; + + return ( + + {name} + + ); +}; diff --git a/apps/dispatch/app/_components/Badge/d-1.png b/apps/dispatch/app/_components/Badge/d-1.png new file mode 100644 index 00000000..8fa5ec32 Binary files /dev/null and b/apps/dispatch/app/_components/Badge/d-1.png differ diff --git a/apps/dispatch/app/_components/Badge/d-2.png b/apps/dispatch/app/_components/Badge/d-2.png new file mode 100644 index 00000000..d65b164c Binary files /dev/null and b/apps/dispatch/app/_components/Badge/d-2.png differ diff --git a/apps/dispatch/app/_components/Badge/d-3.png b/apps/dispatch/app/_components/Badge/d-3.png new file mode 100644 index 00000000..e48113d7 Binary files /dev/null and b/apps/dispatch/app/_components/Badge/d-3.png differ diff --git a/apps/dispatch/app/_components/Badge/day-1-member.png b/apps/dispatch/app/_components/Badge/day-1-member.png new file mode 100644 index 00000000..a0c383f8 Binary files /dev/null and b/apps/dispatch/app/_components/Badge/day-1-member.png differ diff --git a/apps/dispatch/app/_components/Badge/p-1.png b/apps/dispatch/app/_components/Badge/p-1.png new file mode 100644 index 00000000..1e979605 Binary files /dev/null and b/apps/dispatch/app/_components/Badge/p-1.png differ diff --git a/apps/dispatch/app/_components/Badge/p-2.png b/apps/dispatch/app/_components/Badge/p-2.png new file mode 100644 index 00000000..0ebe38bf Binary files /dev/null and b/apps/dispatch/app/_components/Badge/p-2.png differ diff --git a/apps/dispatch/app/_components/Badge/p-3.png b/apps/dispatch/app/_components/Badge/p-3.png new file mode 100644 index 00000000..d83d0db0 Binary files /dev/null and b/apps/dispatch/app/_components/Badge/p-3.png differ diff --git a/apps/dispatch/app/_querys/aircrafts.ts b/apps/dispatch/app/_querys/aircrafts.ts index 021741f2..c95db5ab 100644 --- a/apps/dispatch/app/_querys/aircrafts.ts +++ b/apps/dispatch/app/_querys/aircrafts.ts @@ -1,4 +1,4 @@ -import { ConnectedAircraft, Prisma, Station } from "@repo/db"; +import { ConnectedAircraft, Prisma, PublicUser, Station } from "@repo/db"; import axios from "axios"; import { serverApi } from "_helpers/axios"; diff --git a/apps/dispatch/app/dispatch/_components/navbar/_components/Settings.tsx b/apps/dispatch/app/dispatch/_components/navbar/_components/Settings.tsx deleted file mode 100644 index 5a51934f..00000000 --- a/apps/dispatch/app/dispatch/_components/navbar/_components/Settings.tsx +++ /dev/null @@ -1,103 +0,0 @@ -"use client"; -import { useRef } from "react"; -import { GearIcon } from "@radix-ui/react-icons"; -import { SettingsIcon, Volume2 } from "lucide-react"; - -export const SettingsBtn = () => { - const modalRef = useRef(null); - - return ( -
- - - -
-

- Einstellungen -

-
-
- -
- {/* FÜGE HIER BITTE DEN MIKROFONAUSSCHLAG EIN WIE IN DER V1 */} -
-
-

- Ausgabelautstärke -

-
- -
- 0 - 25 - 50 - 75 - 100 -
-
- -
- - -
-
-
-
- ); -}; - -export const Settings = () => { - return ( -
- -
- ); -}; diff --git a/apps/dispatch/app/tracker/_components/ConnectedDispatcher.tsx b/apps/dispatch/app/tracker/_components/ConnectedDispatcher.tsx index 20794e0e..3b5e8e44 100644 --- a/apps/dispatch/app/tracker/_components/ConnectedDispatcher.tsx +++ b/apps/dispatch/app/tracker/_components/ConnectedDispatcher.tsx @@ -1,50 +1,56 @@ +import { BADGES, PublicUser } from "@repo/db"; import { useQuery } from "@tanstack/react-query"; +import { Badge } from "_components/Badge/Badge"; +import { getConnectedAircraftsAPI } from "_querys/aircrafts"; import { getConnectedDispatcherAPI } from "_querys/connected-user"; -import { useState } from "react"; export const ConnectedDispatcher = () => { - const [open, setOpen] = useState(false); const { data: dispatcher } = useQuery({ queryKey: ["dispatcher"], queryFn: () => getConnectedDispatcherAPI(), refetchInterval: 10000, }); - console.log("ConnectedDispatcher", dispatcher); + const { data: aircrafts } = useQuery({ + queryKey: ["aircrafts"], + queryFn: () => getConnectedAircraftsAPI(), + refetchInterval: 10000, + }); return (
{/*
Kein Disponent Online
*/} -
15 Verbundene Mitglieder
+
+ {(aircrafts?.length || 0) + (dispatcher?.length || 0)} Verbundene Mitglieder +
    -
  • Disponenten: 1
  • -
  • Piloten: 14
  • - -
  • -
    -
    Nicolas K.
    -
    LST_1
    -
    -
    INSERT BADGES HERE
    +
  • + Disponenten: {dispatcher?.length || 0} +
  • +
  • + Piloten: {aircrafts?.length || 0}
  • -
  • -
    -
    Marvin S.
    -
    Christoph 100
    -
    -
    INSERT BADGES HERE
    -
  • - -
  • -
    -
    Sabrino Gardener
    -
    Christophorus 1
    -
    -
    INSERT BADGES HERE
    -
  • + {dispatcher?.map((d) => { + console.log("dispatcher", d); + return ( +
  • +
    +
    {(d.publicUser as unknown as PublicUser)?.firstname}
    +
    {d.zone}
    +
    +
    + {(d.publicUser as unknown as PublicUser).badges + .filter((b) => b.startsWith("D")) + .map((b) => ( + + ))} +
    +
  • + ); + })}
diff --git a/apps/dispatch/app/tracker/page.tsx b/apps/dispatch/app/tracker/page.tsx index 0235bdd5..b80d841b 100644 --- a/apps/dispatch/app/tracker/page.tsx +++ b/apps/dispatch/app/tracker/page.tsx @@ -9,7 +9,7 @@ const Map = dynamic(() => import("../_components/map/Map"), { const Page = () => { return ( <> - ; + );