import { MiniMap, useReactFlow, useViewport } from "@xyflow/react";
import { useState } from "react";
import { TbMaximize, TbMinus, TbPlus, TbSitemap } from "react-icons/tb";
import { Panel } from "ui/components/canvas/panels/Panel";
export type PanelsProps = {
children?: React.ReactNode;
coordinates?: boolean;
minimap?: boolean;
zoom?: boolean;
};
export function Panels({ children, ...props }: PanelsProps) {
const [minimap, setMinimap] = useState(false);
const reactFlow = useReactFlow();
const { zoom, x, y } = useViewport();
const percent = Math.round(zoom * 100);
const handleZoomIn = async () => await reactFlow.zoomIn();
const handleZoomReset = async () => reactFlow.zoomTo(1);
const handleZoomOut = async () => await reactFlow.zoomOut();
function toggleMinimap() {
setMinimap((p) => !p);
}
return (
<>
{children}
{props.coordinates && (
{x.toFixed(2)},{y.toFixed(2)}
)}
{props.zoom && (
{percent}%
)}
{props.minimap && (
<>
{minimap && }
>
)}
>
);
}