import { translationAtom } from "@/atoms/translations-atom"; import { lensSizeAtom, viewTypeAtom } from "@/atoms/userSettingsAtom"; import { cn } from "@/lib/utils"; import { useAtom, useAtomValue } from "jotai"; import { WrenchIcon } from "lucide-react"; import { useEffect, useState } from "react"; const ImageOptions = ({ zoomAmount, setZoomAmount, resetImagePaths, hideZoomOptions, }: { zoomAmount: string; setZoomAmount: (arg: any) => void; resetImagePaths: () => void; hideZoomOptions?: boolean; }) => { const [openSidebar, setOpenSidebar] = useState(false); const [viewType, setViewType] = useAtom(viewTypeAtom); const [lensSize, setLensSize] = useAtom(lensSizeAtom); const t = useAtomValue(translationAtom); useEffect(() => { if (!localStorage.getItem("zoomAmount")) { localStorage.setItem("zoomAmount", zoomAmount); } else { setZoomAmount(localStorage.getItem("zoomAmount")); } }, []); return (
{ e.stopPropagation(); }} className={`fixed right-0 top-0 z-50 h-screen w-[28rem] bg-base-100 text-base-content shadow-xl shadow-base-300 transition-all duration-500 ${ openSidebar ? "right-0" : "-right-full translate-x-full" }`} >
{ setOpenSidebar(!openSidebar); }} >

{t("APP.IMAGE_OPTIONS.LENS_VIEW_TITLE")}

{ setViewType(e.target.checked ? "slider" : "lens"); }} />

{t("APP.IMAGE_OPTIONS.SLIDER_VIEW_TITLE")}

{t("APP.IMAGE_OPTIONS.ZOOM_AMOUNT_TITLE")} ({zoomAmount}%)

{ setZoomAmount(e.target.value); localStorage.setItem("zoomAmount", e.target.value); }} />

{t("APP.IMAGE_OPTIONS.LENS_SIZE_TITLE")} ({lensSize / 10})

{ setLensSize(parseInt(e.target.value)); }} />
); }; export default ImageOptions;