Files
twenty/packages/twenty-front/src/utils/title-utils.ts
T
Charles Bochet da6f1bbef3 Rename serverlessFunction to logicFunction (#17494)
## Summary

Rename "Serverless Function" to "Logic Function" across the codebase for
clearer naming.

### Environment Variable Changes

| Old | New |
|-----|-----|
| `SERVERLESS_TYPE` | `LOGIC_FUNCTION_TYPE` |
| `SERVERLESS_LAMBDA_REGION` | `LOGIC_FUNCTION_LAMBDA_REGION` |
| `SERVERLESS_LAMBDA_ROLE` | `LOGIC_FUNCTION_LAMBDA_ROLE` |
| `SERVERLESS_LAMBDA_SUBHOSTING_URL` |
`LOGIC_FUNCTION_LAMBDA_SUBHOSTING_URL` |
| `SERVERLESS_LAMBDA_ACCESS_KEY_ID` |
`LOGIC_FUNCTION_LAMBDA_ACCESS_KEY_ID` |
| `SERVERLESS_LAMBDA_SECRET_ACCESS_KEY` |
`LOGIC_FUNCTION_LAMBDA_SECRET_ACCESS_KEY` |

### Breaking Changes

- Environment variables must be updated in production deployments
- Database migration renames `serverlessFunction` → `logicFunction`
tables
2026-01-28 01:42:19 +01:00

60 lines
2.1 KiB
TypeScript

import { t } from '@lingui/core/macro';
import { AppBasePath, AppPath, SettingsPath } from 'twenty-shared/types';
enum SettingsPathPrefixes {
Accounts = `${AppBasePath.Settings}/${SettingsPath.Accounts}`,
Experience = `${AppBasePath.Settings}/${SettingsPath.Experience}`,
Profile = `${AppBasePath.Settings}/${SettingsPath.ProfilePage}`,
Objects = `${AppBasePath.Settings}/${SettingsPath.Objects}`,
Members = `${AppBasePath.Settings}/${SettingsPath.WorkspaceMembersPage}`,
ApiWebhooks = `${AppBasePath.Settings}/${SettingsPath.ApiWebhooks}`,
LogicFunctions = `${AppBasePath.Settings}/${SettingsPath.LogicFunctions}`,
Integration = `${AppBasePath.Settings}/${SettingsPath.Integrations}`,
General = `${AppBasePath.Settings}/${SettingsPath.Workspace}`,
}
const getPathnameOrPrefix = (pathname: string) => {
for (const prefix of Object.values(SettingsPathPrefixes)) {
if (pathname.startsWith(prefix)) {
return prefix;
}
}
return pathname;
};
export const getPageTitleFromPath = (pathname: string): string => {
const pathnameOrPrefix = getPathnameOrPrefix(pathname);
switch (pathnameOrPrefix) {
case AppPath.Verify:
return t`Verify`;
case AppPath.SignInUp:
return t`Sign in or Create an account`;
case AppPath.Invite:
return t`Invite`;
case AppPath.CreateWorkspace:
return t`Create Workspace`;
case AppPath.CreateProfile:
return t`Create Profile`;
case SettingsPathPrefixes.Experience:
return t`Experience - Settings`;
case SettingsPathPrefixes.Accounts:
return t`Account - Settings`;
case SettingsPathPrefixes.Profile:
return t`Profile - Settings`;
case SettingsPathPrefixes.Members:
return t`Members - Settings`;
case SettingsPathPrefixes.Objects:
return t`Data model - Settings`;
case SettingsPathPrefixes.ApiWebhooks:
return t`API Keys - Settings`;
case SettingsPathPrefixes.LogicFunctions:
return t`Functions - Settings`;
case SettingsPathPrefixes.Integration:
return t`Integrations - Settings`;
case SettingsPathPrefixes.General:
return t`General - Settings`;
default:
return 'Twenty';
}
};