import { Dispatch, Fragment, SetStateAction, useState } from "react" import { useTranslation } from "react-i18next" import { Menu, Popover, Transition } from "@headlessui/react" import { DeleteConfirmationModal } from "~/components/common/DeleteConfirmationModal" import { NoteType, PageVisibilityEnum } from "~/lib/types" import { cn } from "~/lib/utils" export const OptionsButton = ({ visibility, previewPage, savePage, deletePage, isRendering, renderPage, published, propertiesWidget, type, isModified, discardChanges, }: { visibility: PageVisibilityEnum | undefined previewPage: () => void renderPage: Dispatch> savePage: () => any deletePage: () => any propertiesWidget: React.ReactNode isRendering: boolean published: boolean type: NoteType isModified: boolean discardChanges: () => void }) => { const { t } = useTranslation("dashboard") const [deleteConfirmModalOpen, setDeleteConfirmModalOpen] = useState(false) return ( <>
renderPage(!isRendering)} > {isRendering ? ( ) : ( )}
{({ open, close }) => (
{ // setIsOpen(true) // }} >
{propertiesWidget}
)}
{({ open, close }) => { return ( <>
{open ? ( ) : ( )}
{({ active }) => ( )}
{({ active }) => ( )} {({ active }) => ( )} {isModified && ( {({ active }) => ( )} )} {published && ( {({ active }) => ( )} )}
{ deletePage() }} type={type} /> ) }}
) }