import { observer } from "mobx-react-lite"; import { Control, Controller, UseFormSetValue } from "react-hook-form"; import { IAnalyticsParams } from "@plane/types"; // hooks import { SelectProject, SelectSegment, SelectXAxis, SelectYAxis } from "@/components/analytics"; import { ANALYTICS_X_AXIS_VALUES } from "@/constants/analytics"; import { useProject } from "@/hooks/store"; // components // types type Props = { control: Control; setValue: UseFormSetValue; params: IAnalyticsParams; fullScreen: boolean; isProjectLevel: boolean; }; export const CustomAnalyticsSelectBar: React.FC = observer((props) => { const { control, setValue, params, fullScreen, isProjectLevel } = props; const { workspaceProjectIds: workspaceProjectIds, currentProjectDetails } = useProject(); const analyticsOptions = isProjectLevel ? ANALYTICS_X_AXIS_VALUES.filter((v) => { if (v.value === "issue_cycle__cycle_id" && !currentProjectDetails?.cycle_view) return false; if (v.value === "issue_module__module_id" && !currentProjectDetails?.module_view) return false; return true; }) : ANALYTICS_X_AXIS_VALUES; return (
{!isProjectLevel && (
Project
( )} />
)}
Measure (y-axis)
} />
Dimension (x-axis)
( { if (params.segment === val) setValue("segment", null); onChange(val); }} params={params} analyticsOptions={analyticsOptions} /> )} />
Group
( )} />
); });