Files
twenty_crm/packages/twenty-front/src/modules/settings/utils/getSettingsPagePath.ts
Félix Malfait 719cce1ea2 Improve design of fields menu (#5729)
Improve design of field options menu and redirect to the right object
edit page



<img width="215" alt="Screenshot 2024-06-04 at 12 15 43"
src="https://github.com/twentyhq/twenty/assets/6399865/a8da18a1-49d4-40e3-b2cd-3a1a384366b2">
2024-06-04 12:16:47 +02:00

20 lines
436 B
TypeScript

import { SettingsPath } from '@/types/SettingsPath';
import { isDefined } from '~/utils/isDefined';
type PathParams = {
objectSlug?: string;
};
export const getSettingsPagePath = <Path extends SettingsPath>(
path: Path,
params?: PathParams,
) => {
let resultPath = `/settings/${path}`;
if (isDefined(params?.objectSlug)) {
resultPath = resultPath.replace(':objectSlug', params.objectSlug);
}
return resultPath;
};