import React from "react"; import Image from "next/image"; // ui import { PrimaryButton } from "components/ui"; // icon import { PlusIcon } from "@heroicons/react/24/outline"; // helper import { capitalizeFirstLetter } from "helpers/string.helper"; type Props = { type: "cycle" | "module" | "project" | "issue" | "view" | "page"; title: string; description: React.ReactNode | string; imgURL: string; action?: () => void; }; export const EmptyState: React.FC = ({ type, title, description, imgURL, action }) => { const shortcutKey = (type: string) => { switch (type) { case "cycle": return "Q"; case "module": return "M"; case "project": return "P"; case "issue": return "C"; default: return null; } }; return (
{type}

{title}

{shortcutKey(type) && ( Use shortcut{" "} {shortcutKey(type)} {" "} to create {type} from anywhere. )}

{description}

{ if (action) { action(); return; } if (!shortcutKey(type)) return; const e = new KeyboardEvent("keydown", { key: shortcutKey(type) as string, }); document.dispatchEvent(e); }} > Create New {capitalizeFirstLetter(type)}
); };