import React from "react"; import Image from "next/image"; import { useTheme } from "next-themes"; // hooks import { useUser } from "hooks/store"; // components import { ComicBoxButton } from "./comic-box-button"; import { Button } from "@plane/ui"; // constant import { EMPTY_STATE_DETAILS, EmptyStateKeys } from "constants/empty-state"; // helpers import { cn } from "helpers/common.helper"; type Props = { type: EmptyStateKeys; size?: "sm" | "md" | "lg"; layout?: "widget-simple" | "screen-detailed" | "screen-simple"; additionalPath?: string; primaryButtonOnClick?: () => void; secondaryButtonOnClick?: () => void; }; export const EmptyStateComponent: React.FC = (props) => { const { type, size = "lg", layout = "screen-detailed", additionalPath = "", primaryButtonOnClick, secondaryButtonOnClick, } = props; // store const { membership: { currentWorkspaceRole, currentProjectRole }, } = useUser(); // theme const { resolvedTheme } = useTheme(); // current empty state details const { key, title, description, path, primaryButton, secondaryButton, accessType, access } = EMPTY_STATE_DETAILS[type]; // resolved empty state path const resolvedEmptyStatePath = `${additionalPath && additionalPath !== "" ? `${path}${additionalPath}` : path}-${ resolvedTheme === "light" ? "light" : "dark" }.webp`; // current access type const currentAccessType = accessType === "workspace" ? currentWorkspaceRole : currentProjectRole; // permission const isEditingAllowed = currentAccessType && access && access >= currentAccessType; const anyButton = primaryButton || secondaryButton; if (layout === "screen-detailed") return (
{description ? ( <>

{title}

{description}

) : (

{title}

)}
{path && ( {key )} {anyButton && ( <>
{primaryButton && (
{primaryButton.comicBox ? ( ) : ( )}
)} {secondaryButton && ( )}
)}
); };