mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
d575e8ec6b
* style: new custom analytics ui * fix: x-axis assignee tick values * chore: assignee names in the custom analytics table
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { useRouter } from "next/router";
|
|
|
|
// ui
|
|
import { CustomSelect } from "components/ui";
|
|
// types
|
|
import { TXAxisValues } from "types";
|
|
// constants
|
|
import { ANALYTICS_X_AXIS_VALUES } from "constants/analytics";
|
|
|
|
type Props = {
|
|
value: TXAxisValues;
|
|
onChange: (val: string) => void;
|
|
};
|
|
|
|
export const SelectXAxis: React.FC<Props> = ({ value, onChange }) => {
|
|
const router = useRouter();
|
|
const { cycleId, moduleId } = router.query;
|
|
|
|
return (
|
|
<CustomSelect
|
|
value={value}
|
|
label={<span>{ANALYTICS_X_AXIS_VALUES.find((v) => v.value === value)?.label}</span>}
|
|
onChange={onChange}
|
|
width="w-full"
|
|
maxHeight="lg"
|
|
>
|
|
{ANALYTICS_X_AXIS_VALUES.map((item) => {
|
|
if (cycleId && item.value === "issue_cycle__cycle__name") return null;
|
|
if (moduleId && item.value === "issue_module__module__name") return null;
|
|
|
|
return (
|
|
<CustomSelect.Option key={item.value} value={item.value}>
|
|
{item.label}
|
|
</CustomSelect.Option>
|
|
);
|
|
})}
|
|
</CustomSelect>
|
|
);
|
|
};
|