mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: string helper function (#2633)
This commit is contained in:
parent
cc26f604aa
commit
cf19afa707
@ -66,6 +66,7 @@ export const CustomAnalyticsSelectBar: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
onChange(val);
|
onChange(val);
|
||||||
}}
|
}}
|
||||||
|
params={params}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
@ -3,16 +3,19 @@ import { useRouter } from "next/router";
|
|||||||
// ui
|
// ui
|
||||||
import { CustomSelect } from "@plane/ui";
|
import { CustomSelect } from "@plane/ui";
|
||||||
// types
|
// types
|
||||||
import { TXAxisValues } from "types";
|
import { IAnalyticsParams, TXAxisValues } from "types";
|
||||||
// constants
|
// constants
|
||||||
import { ANALYTICS_X_AXIS_VALUES } from "constants/analytics";
|
import { ANALYTICS_X_AXIS_VALUES } from "constants/analytics";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: TXAxisValues;
|
value: TXAxisValues;
|
||||||
onChange: (val: string) => void;
|
onChange: (val: string) => void;
|
||||||
|
params: IAnalyticsParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SelectXAxis: React.FC<Props> = ({ value, onChange }) => {
|
export const SelectXAxis: React.FC<Props> = (props) => {
|
||||||
|
const { value, onChange, params } = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { cycleId, moduleId } = router.query;
|
const { cycleId, moduleId } = router.query;
|
||||||
|
|
||||||
@ -25,6 +28,7 @@ export const SelectXAxis: React.FC<Props> = ({ value, onChange }) => {
|
|||||||
maxHeight="lg"
|
maxHeight="lg"
|
||||||
>
|
>
|
||||||
{ANALYTICS_X_AXIS_VALUES.map((item) => {
|
{ANALYTICS_X_AXIS_VALUES.map((item) => {
|
||||||
|
if (params.segment === item.value) return null;
|
||||||
if (cycleId && item.value === "issue_cycle__cycle_id") return null;
|
if (cycleId && item.value === "issue_cycle__cycle_id") return null;
|
||||||
if (moduleId && item.value === "issue_module__module_id") return null;
|
if (moduleId && item.value === "issue_module__module_id") return null;
|
||||||
|
|
||||||
|
@ -5,7 +5,13 @@ import {
|
|||||||
VIEW_ISSUES,
|
VIEW_ISSUES,
|
||||||
} from "constants/fetch-keys";
|
} from "constants/fetch-keys";
|
||||||
|
|
||||||
export const addSpaceIfCamelCase = (str: string) => str.replace(/([a-z])([A-Z])/g, "$1 $2");
|
export const addSpaceIfCamelCase = (str: string) => {
|
||||||
|
if (str === undefined || str === null) return "";
|
||||||
|
|
||||||
|
if (typeof str !== "string") str = `${str}`;
|
||||||
|
|
||||||
|
return str.replace(/([a-z])([A-Z])/g, "$1 $2");
|
||||||
|
};
|
||||||
|
|
||||||
export const replaceUnderscoreIfSnakeCase = (str: string) => str.replace(/_/g, " ");
|
export const replaceUnderscoreIfSnakeCase = (str: string) => str.replace(/_/g, " ");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user