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">
20 lines
436 B
TypeScript
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;
|
|
};
|