import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // ui import { CustomSelect } from "@plane/ui"; // helpers import { renderEmoji } from "helpers/emoji.helper"; // icons import { Clipboard } from "lucide-react"; export interface IssueProjectSelectProps { value: string; onChange: (value: string) => void; } export const IssueProjectSelect: React.FC = observer((props) => { const { value, onChange } = props; const router = useRouter(); const { workspaceSlug } = router.query; const { project: projectStore } = useMobxStore(); const projects = workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : undefined; const selectedProject = projects?.find((i) => i.id === value); return ( {selectedProject.emoji ? renderEmoji(selectedProject.emoji) : selectedProject.icon_prop ? renderEmoji(selectedProject.icon_prop) : null}
{selectedProject.identifier}
) : ( <>
Select Project
) } onChange={(val: string) => onChange(val)} noChevron > {projects ? ( projects.length > 0 ? ( projects.map((project) => (
{project.emoji ? renderEmoji(project.emoji) : project.icon_prop ? renderEmoji(project.icon_prop) : null} <>{project.name}
)) ) : (

No projects found!

) ) : (
Loading...
)}
); });