translate rate
This commit is contained in:
@@ -50,6 +50,11 @@ function RatingOrderIndex({ }: Props) {
|
|||||||
NegativePointEnum.UNFRIENDLY_SERVICE,
|
NegativePointEnum.UNFRIENDLY_SERVICE,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const getTranslationKey = (point: string, isPositive: boolean): string => {
|
||||||
|
const basePath = isPositive ? 'Tabs.Strengths.Options' : 'Tabs.Weeknesses.Options';
|
||||||
|
return `${basePath}.${point}`;
|
||||||
|
};
|
||||||
|
|
||||||
const handleToggle = (pointValue: string, isPositive: boolean) => (checked: boolean) => {
|
const handleToggle = (pointValue: string, isPositive: boolean) => (checked: boolean) => {
|
||||||
const setter = isPositive ? setPositivePoints : setNegativePoints;
|
const setter = isPositive ? setPositivePoints : setNegativePoints;
|
||||||
|
|
||||||
@@ -76,7 +81,7 @@ function RatingOrderIndex({ }: Props) {
|
|||||||
// @ts-expect-error - Type mismatch between custom ToggleButton and React types
|
// @ts-expect-error - Type mismatch between custom ToggleButton and React types
|
||||||
onToggle={handleToggle(point, false)}
|
onToggle={handleToggle(point, false)}
|
||||||
>
|
>
|
||||||
{t(`Tabs.Weeknesses.Options.${point}`)}
|
{t(getTranslationKey(point, false))}
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -95,7 +100,7 @@ function RatingOrderIndex({ }: Props) {
|
|||||||
// @ts-expect-error - Type mismatch between custom ToggleButton and React types
|
// @ts-expect-error - Type mismatch between custom ToggleButton and React types
|
||||||
onToggle={handleToggle(point, true)}
|
onToggle={handleToggle(point, true)}
|
||||||
>
|
>
|
||||||
{t(`Tabs.Strengths.Options.${point}`)}
|
{t(getTranslationKey(point, true))}
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const enum PositivePointEnum {
|
export enum PositivePointEnum {
|
||||||
GREAT_TASTE = "great_taste",
|
GREAT_TASTE = "great_taste",
|
||||||
FAST_DELIVERY = "fast_delivery",
|
FAST_DELIVERY = "fast_delivery",
|
||||||
GOOD_QUALITY = "good_quality",
|
GOOD_QUALITY = "good_quality",
|
||||||
@@ -6,7 +6,7 @@ export const enum PositivePointEnum {
|
|||||||
FRIENDLY_SERVICE = "friendly_service",
|
FRIENDLY_SERVICE = "friendly_service",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum NegativePointEnum {
|
export enum NegativePointEnum {
|
||||||
SMALL_PORTION = "small_portion",
|
SMALL_PORTION = "small_portion",
|
||||||
SLOW_DELIVERY = "slow_delivery",
|
SLOW_DELIVERY = "slow_delivery",
|
||||||
POOR_QUALITY = "poor_quality",
|
POOR_QUALITY = "poor_quality",
|
||||||
|
|||||||
Reference in New Issue
Block a user