import { useRouter } from "next/router"; // ui import { CustomSelect } from "components/ui"; // types import { IAnalyticsParams, TXAxisValues } from "types"; // constants import { ANALYTICS_X_AXIS_VALUES } from "constants/analytics"; type Props = { value: TXAxisValues | null | undefined; onChange: () => void; params: IAnalyticsParams; }; export const SelectSegment: React.FC = ({ value, onChange, params }) => { const router = useRouter(); const { cycleId, moduleId } = router.query; return ( {ANALYTICS_X_AXIS_VALUES.find((v) => v.value === value)?.label ?? ( No value )} } onChange={onChange} width="w-full" maxHeight="lg" > No value {ANALYTICS_X_AXIS_VALUES.map((item) => { if (params.x_axis === item.value) return null; if (cycleId && item.value === "issue_cycle__cycle__name") return null; if (moduleId && item.value === "issue_module__module__name") return null; return ( {item.label} ); })} ); };