"use client"; import { useEffect } from "react"; import { observer } from "mobx-react"; // plane imports import { Tooltip } from "@plane/ui"; import { cn } from "@plane/utils"; // hooks import { useLabel } from "@/hooks/store/use-label"; import { usePlatformOS } from "@/hooks/use-platform-os"; export type TReadonlyLabelsProps = { className?: string; hideIcon?: boolean; value: string[]; placeholder?: string; projectId: string | undefined; workspaceSlug: string; }; export const ReadonlyLabels: React.FC = observer((props) => { const { className, value, projectId, workspaceSlug } = props; const { getLabelById, fetchProjectLabels } = useLabel(); const { isMobile } = usePlatformOS(); const labels = value .map((labelId) => getLabelById(labelId)) .filter((label): label is NonNullable => Boolean(label)); useEffect(() => { if (projectId) { fetchProjectLabels(workspaceSlug?.toString(), projectId); } }, [projectId, workspaceSlug]); return (
{labels && ( <> l?.name).join(", ")} isMobile={isMobile} disabled={labels.length === 0} >
{value.length} Labels
)}
); });