feat: Implement connected user API and integrate chat and report components

- Added API routes for fetching connected users, keywords, missions, and stations.
- Created a new QueryProvider component for managing query states and socket events.
- Introduced connection stores for dispatch and pilot, managing socket connections and states.
- Updated Prisma schema for connected aircraft model.
- Enhanced UI with toast notifications for status updates and chat interactions.
- Implemented query functions for fetching connected users and keywords with error handling.
This commit is contained in:
PxlLoewe
2025-05-07 00:43:45 -07:00
parent 152b3d4689
commit 50f42e99d3
49 changed files with 1040 additions and 701 deletions

View File

@@ -13,6 +13,7 @@ import {
LightningBoltIcon,
LockOpen1Icon,
HobbyKnifeIcon,
ExclamationTriangleIcon,
} from "@radix-ui/react-icons";
import { Button } from "../../../../../_components/ui/Button";
import { Select } from "../../../../../_components/ui/Select";
@@ -22,6 +23,7 @@ import { PaginatedTable, PaginatedTableRef } from "_components/PaginatedTable";
import { min } from "date-fns";
import { cn } from "../../../../../../helper/cn";
import { ChartBarBigIcon, PlaneIcon } from "lucide-react";
import Link from "next/link";
interface ProfileFormProps {
user: User;
@@ -150,6 +152,13 @@ export const ConnectionHistory: React.FC<{ user: User }> = ({
<div className="flex-1">
<h2 className="card-title">
<MixerHorizontalIcon className="w-5 h-5" /> Dispo-Verbindungs Historie
<button
onClick={() => {
dispoTableRef.current?.refresh();
}}
>
refresh
</button>
</h2>
<PaginatedTable
ref={dispoTableRef}
@@ -222,7 +231,22 @@ export const ConnectionHistory: React.FC<{ user: User }> = ({
userId: user.id,
}}
prismaModel={"connectedAircraft"}
include={{ Station: true }}
columns={[
{
accessorKey: "Station.bosCallsign",
header: "Station",
cell: ({ row }) => {
return (
<Link
className="link link-hover"
href={`/admin/station/${(row.original as any).id}`}
>
{(row.original as any).Station.bosCallsign}
</Link>
);
},
},
{
accessorKey: "loginTime",
header: "Login",
@@ -392,6 +416,9 @@ export const AdminForm = ({ user, dispoTime, pilotTime }: AdminFormProps) => {
</div>
</div>
</div>
<h2 className="card-title">
<ExclamationTriangleIcon className="w-5 h-5" /> Reports
</h2>
</div>
);
};

View File

@@ -47,6 +47,7 @@ const Page = async ({ params }: { params: { id: string } }) => {
select: {
loginTime: true,
logoutTime: true,
Station: true,
},
});