Initial pannel layout
This commit is contained in:
34
apps/dispatch/app/(dispatch)/_components/pannel/Missions.tsx
Normal file
34
apps/dispatch/app/(dispatch)/_components/pannel/Missions.tsx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { useMissionsStore } from "_store/missionsStore";
|
||||||
|
|
||||||
|
export const Missions = () => {
|
||||||
|
const { missions } = useMissionsStore();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<table className="table table-xs">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Einsatzmittel</th>
|
||||||
|
<th>Ort</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{missions.map((mission) => (
|
||||||
|
<tr key={mission.id}>
|
||||||
|
<td>{mission.id}</td>
|
||||||
|
<td>{mission.missionCategory}</td>
|
||||||
|
<td>
|
||||||
|
{mission.addressStreet}, {mission.addressCity}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button className="btn btn-sm">Details</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
|
"use client";
|
||||||
import { usePannelStore } from "_store/pannelStore";
|
import { usePannelStore } from "_store/pannelStore";
|
||||||
|
import { cn } from "helpers/cn";
|
||||||
|
|
||||||
export const OpenButton = () => {
|
export const OpenButton = () => {
|
||||||
const { setOpen } = usePannelStore();
|
const { setOpen, isOpen } = usePannelStore();
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
}}
|
}}
|
||||||
className="btn absolute inset-y-0 right-0 z-9999"
|
className={cn(
|
||||||
|
"btn rounded-r-none absolute inset-y-2.5 right-0 z-999999 transition-all duration-500 ease",
|
||||||
|
isOpen && "transform translate-x-full",
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
Open
|
Open
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
|
import { Missions } from "(dispatch)/_components/pannel/Missions";
|
||||||
import { usePannelStore } from "_store/pannelStore";
|
import { usePannelStore } from "_store/pannelStore";
|
||||||
import { cn } from "helpers/cn";
|
import { cn } from "helpers/cn";
|
||||||
|
|
||||||
export const Pannel = () => {
|
export const Pannel = () => {
|
||||||
const { isOpen, setOpen } = usePannelStore();
|
const { isOpen, setOpen } = usePannelStore();
|
||||||
return (
|
return (
|
||||||
<div className={cn("flex-1 max-w-[200px] z-9999999")}>
|
<div className={cn("flex-1 max-w-[400px] z-9999999")}>
|
||||||
<div className="bg-base-100 h-full w-full">
|
<div className="bg-base-100 h-full w-full">
|
||||||
<div className="flex justify-between items-center p-4">
|
<div className="flex justify-between items-center p-4">
|
||||||
<h1 className="text-xl font-bold">Pannel</h1>
|
<h1 className="text-xl font-bold">Pannel</h1>
|
||||||
<button onClick={() => setOpen(false)}>Close</button>
|
<button className="btn" onClick={() => setOpen(false)}>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<Missions />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { OpenButton } from "(dispatch)/_components/pannel/OpenButton";
|
import { OpenButton } from "(dispatch)/_components/pannel/OpenButton";
|
||||||
import { Pannel } from "(dispatch)/_components/pannel/Pannel";
|
import { Pannel } from "(dispatch)/_components/pannel/Pannel";
|
||||||
|
import MapToastCard2 from "(dispatch)/_components/toast/ToastCard";
|
||||||
import { usePannelStore } from "_store/pannelStore";
|
import { usePannelStore } from "_store/pannelStore";
|
||||||
import { cn } from "helpers/cn";
|
import { cn } from "helpers/cn";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
@@ -13,14 +14,15 @@ export default () => {
|
|||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative flex-1 flex transition-all duration-500 ease",
|
"relative flex-1 flex transition-all duration-500 ease",
|
||||||
!isOpen && "w-[calc(100%+200px)]",
|
!isOpen && "w-[calc(100%+400px)]",
|
||||||
isOpen && "w-[100%]",
|
isOpen && "w-[100%]",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{/* <MapToastCard2 /> */}
|
{/* <MapToastCard2 /> */}
|
||||||
<Map>
|
<div className="flex-1 relative flex">
|
||||||
<OpenButton />
|
<OpenButton />
|
||||||
</Map>
|
<Map />
|
||||||
|
</div>
|
||||||
<Pannel />
|
<Pannel />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,21 @@ import { create } from "zustand";
|
|||||||
|
|
||||||
interface Mission {
|
interface Mission {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
addressLat: number;
|
||||||
|
addressLng: number;
|
||||||
|
addressStreet: string;
|
||||||
|
addressCity: string;
|
||||||
|
addressZip: string;
|
||||||
|
missionCategory: string;
|
||||||
|
missionKeyword: string;
|
||||||
|
missionSummary: string;
|
||||||
|
missionPatientInfo: string;
|
||||||
|
missionAdditionalInfo: string;
|
||||||
|
hpgAmbulanceState?: "ready" | "arrived" | "onway";
|
||||||
|
hpgFireEngineState?: "ready" | "arrived" | "onway";
|
||||||
|
hpgPoliceState?: "ready" | "arrived" | "onway";
|
||||||
|
hpgLocationLat?: number;
|
||||||
|
hpgLocationLng?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MissionStore {
|
interface MissionStore {
|
||||||
@@ -10,7 +24,21 @@ interface MissionStore {
|
|||||||
setMissions: (missions: Mission[]) => void;
|
setMissions: (missions: Mission[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const missionsStore = create<MissionStore>((set) => ({
|
export const useMissionsStore = create<MissionStore>((set) => ({
|
||||||
missions: [],
|
missions: [
|
||||||
|
{
|
||||||
|
id: "01250325",
|
||||||
|
addressLat: 52.520008,
|
||||||
|
addressLng: 13.404954,
|
||||||
|
addressStreet: "Alexanderplatz",
|
||||||
|
addressCity: "Berlin",
|
||||||
|
addressZip: "10178",
|
||||||
|
missionAdditionalInfo: "Additional info",
|
||||||
|
missionCategory: "Category",
|
||||||
|
missionKeyword: "Keyword",
|
||||||
|
missionPatientInfo: "Patient info",
|
||||||
|
missionSummary: "Summary",
|
||||||
|
},
|
||||||
|
],
|
||||||
setMissions: (missions) => set({ missions }),
|
setMissions: (missions) => set({ missions }),
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
"use client";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
|
|
||||||
interface PannelStore {
|
interface PannelStore {
|
||||||
@@ -6,6 +7,6 @@ interface PannelStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const usePannelStore = create<PannelStore>((set) => ({
|
export const usePannelStore = create<PannelStore>((set) => ({
|
||||||
isOpen: true,
|
isOpen: false,
|
||||||
setOpen: (isOpen) => set({ isOpen }),
|
setOpen: (isOpen) => set({ isOpen }),
|
||||||
}));
|
}));
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user