fix(settings): force display "Standard" and "Custom" for app chips (#19912)
## Summary - Override the `AppChip` label so the Twenty standard application always renders as `Standard` and the workspace custom application always renders as `Custom`, instead of leaking each app's underlying name (e.g. `Twenty Eng's custom application`). - Detection mirrors the logic already used in `useApplicationAvatarColors`, relying on `TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER` / `TWENTY_STANDARD_APPLICATION_NAME` and `currentWorkspace.workspaceCustomApplication.id`. - The `This app` label for the current application context and the original `application.name` fallback for any other installed app are preserved. ## Affected UI - Settings → Data model → Existing objects (App column). - Anywhere else `AppChip` / `useApplicationChipData` is used.
This commit is contained in:
@@ -7,6 +7,7 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useContext } from 'react';
|
||||
import { TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER } from 'twenty-shared/application';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
type UseApplicationChipDataArgs = {
|
||||
@@ -47,9 +48,26 @@ export const useApplicationChipData = ({
|
||||
const isCurrent =
|
||||
isDefined(currentApplicationId) && currentApplicationId === applicationId;
|
||||
|
||||
const isStandard =
|
||||
isDefined(application.universalIdentifier) &&
|
||||
application.universalIdentifier ===
|
||||
TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER;
|
||||
|
||||
const isCustom =
|
||||
isDefined(currentWorkspace?.workspaceCustomApplication?.id) &&
|
||||
currentWorkspace.workspaceCustomApplication.id === application.id;
|
||||
|
||||
const displayName = isCurrent
|
||||
? t`This app`
|
||||
: isStandard
|
||||
? t`Standard`
|
||||
: isCustom
|
||||
? t`Custom`
|
||||
: application.name;
|
||||
|
||||
return {
|
||||
applicationChipData: {
|
||||
name: isCurrent ? t`This app` : application.name,
|
||||
name: displayName,
|
||||
seed: application.universalIdentifier ?? application.name,
|
||||
colors,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user