"use client";

import { Pannel } from "dispatch/_components/pannel/Pannel";
import { usePannelStore } from "_store/pannelStore";
import { cn } from "_helpers/cn";
import dynamic from "next/dynamic";
import { Chat } from "../_components/left/Chat";
import { Report } from "../_components/left/Report";
import { SituationBoard } from "_components/left/SituationBoard";

const Map = dynamic(() => import("../_components/map/Map"), { ssr: false });

const DispatchPage = () => {
	const { isOpen } = usePannelStore();
	/* return null; */
	return (
		<div className="relative flex-1 flex transition-all duration-500 ease w-full">
			{/* <MapToastCard2 /> */}
			<div className="flex flex-1 relative">
				<div className="absolute left-0 top-1/2 transform -translate-y-1/2 pl-4 z-999999">
					<Chat />
					<div className="mt-2">
						<Report />
					</div>
				</div>
				<div className="absolute left-0 top-19/20 transform -translate-y-1/2 pl-4 z-999999">
					<div className="flex items-center justify-between gap-4">
						<SituationBoard />
					</div>
				</div>
				<Map />
			</div>
			<div
				className={cn(
					"absolute right-0 w-[500px] z-999 transition-transform",
					isOpen ? "translate-x-0" : "translate-x-full",
				)}
			>
				<Pannel />
			</div>
		</div>
	);
};

DispatchPage.displayName = "DispatchPage";

export default DispatchPage;
