Skip to content

Commit

Permalink
Choose titles over labels (#198)
Browse files Browse the repository at this point in the history
* choose titles over labels

* messages

* remove old labels
  • Loading branch information
kate-kazantseva authored Oct 31, 2024
1 parent 437f431 commit 1be9ba2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/transcend-io/consent-manager-ui.git"
},
"homepage": "https://github.com/transcend-io/consent-manager-ui",
"version": "4.22.2",
"version": "4.22.3",
"license": "MIT",
"main": "build/ui",
"files": [
Expand Down
14 changes: 7 additions & 7 deletions src/components/constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { DefinedMessage } from '@transcend-io/internationalization';
import { completeOptionsMessages, completeOptionsInvertedMessages, purposeMessages } from '../messages';
import { completeOptionsInvertedMessages, purposeMessages } from '../messages';

// Mapping of purposes to the message translation key
export const DEFAULT_PURPOSE_TO_MESSAGE_KEY: Record<string, DefinedMessage> = {
Essential: completeOptionsMessages.essentialLabel,
Functional: completeOptionsMessages.functionalLabel,
Analytics: completeOptionsMessages.analyticsLabel,
Advertising: completeOptionsMessages.advertisingLabel,
SaleOfInfo: completeOptionsMessages.saleOfInfoLabel,
Essential: purposeMessages['Essential.title'],
Functional: purposeMessages['Functional.title'],
Analytics: purposeMessages['Analytics.title'],
Advertising: purposeMessages['Advertising.title'],
SaleOfInfo: purposeMessages['SaleOfInfo.title'],
};

export const DEFAULT_PURPOSE_TO_DESCRIPTION_KEY: Record<
Expand All @@ -25,7 +25,7 @@ export const DEFAULT_PURPOSE_TO_INVERTED_MESSAGE_KEY: Record<
string,
DefinedMessage
> = {
Essential: completeOptionsMessages.essentialLabel,
Essential: purposeMessages['Essential.title'],
Functional: completeOptionsInvertedMessages.functionalLabel,
Analytics: completeOptionsInvertedMessages.analyticsLabel,
Advertising: completeOptionsInvertedMessages.advertisingLabel,
Expand Down
7 changes: 2 additions & 5 deletions src/hooks/useGetPurposeMessageKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ export const useGetPurposeMessageKeys = ({
// the purpose type is unique for the bundle
[...Object.keys(consentSelection ?? {}), 'Essential'].reduce(
(allMessages, purposeType) => {
if (allMessages[purposeType]) {
return allMessages;
}
const purposeMessageLabel = `${PURPOSE_MESSAGE_PREFIX}.${purposeType}.title`;
const purposeMessageTitleId = `${PURPOSE_MESSAGE_PREFIX}.${purposeType}.title`;
return {
...allMessages,
[purposeType]: {
id: purposeMessageLabel,
id: purposeMessageTitleId,
defaultMessage: purposeType,
description: `Translatable name for purpose '${purposeType}'`,
} as DefinedMessage,
Expand Down
23 changes: 0 additions & 23 deletions src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,29 +508,6 @@ export const purposeMessages = defineMessages('purpose.trackingType', {
export const completeOptionsMessages = defineMessages(
'ui.src.completeOptions',
{
essentialLabel: {
defaultMessage: 'Essential purposes',
description: 'Text for essential purposes in CompleteOptions view state.',
},
functionalLabel: {
defaultMessage: 'Functionality',
description:
'Text for functional purposes in CompleteOptions view state.',
},
analyticsLabel: {
defaultMessage: 'Analytics',
description: 'Text for analytics purposes in CompleteOptions view state.',
},
advertisingLabel: {
defaultMessage: 'Advertising',
description:
'Text for advertising purposes in CompleteOptions view state.',
},
saleOfInfoLabel: {
defaultMessage: 'Sale of personal information',
description:
'Text for sale of information purposes in CompleteOptions view state.',
},
saveButtonPrimary: {
defaultMessage: 'Confirm',
description: 'Confirm button text in CompleteOptions view state.',
Expand Down

0 comments on commit 1be9ba2

Please sign in to comment.