Skip to content

Commit

Permalink
yashim/fix: onboarding carousel translations (binary-com#7758)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashim-deriv authored and mahdiyeh-deriv committed Mar 2, 2023
1 parent 9bfa9e2 commit 1b5ebbc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
13 changes: 6 additions & 7 deletions packages/appstore/src/constants/tour-steps-config-new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { localize, Localize } from '@deriv/translations';
import 'Components/toggle-account-type/toggle-account-type.scss';
import { isMobile } from '@deriv/shared';

export const tour_step_config: Step[] = [
export const getTourStepConfig = (): Step[] => [
{
title: (
<Text as='p' weight='bold' color='brand-red-coral'>
Expand Down Expand Up @@ -57,7 +57,7 @@ export const tour_step_config: Step[] = [
},
];

export const high_risk_tour_step_config: Step[] = [
export const getTourStepConfigHighRisk = (): Step[] => [
{
title: (
<Text as='p' weight='bold' color='brand-red-coral'>
Expand Down Expand Up @@ -130,19 +130,18 @@ export const tour_styles_dark_mode: Styles = {
fontWeight: 'bold',
},
};

export const tour_step_locale: Locale = {
export const getTourStepLocale = (): Locale => ({
back: <Button has_effect text={localize('Back')} secondary medium />,
close: localize('Close'),
last: localize('OK'),
next: localize('Next'),
skip: localize('Skip'),
};
});

export const high_risk_tour_step_locale: Locale = {
export const getHighRiskTourStepLocale = (): Locale => ({
back: <Button has_effect text={localize('Back')} secondary medium />,
close: localize('Close'),
last: localize('OK'),
next: localize('Next'),
skip: localize('Skip'),
};
});
14 changes: 8 additions & 6 deletions packages/appstore/src/modules/tour-guide/tour-guide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import React from 'react';
import { useHistory } from 'react-router-dom';
import { Localize, localize } from '@deriv/translations';
import {
tour_step_config,
getTourStepConfig,
tour_styles,
tour_step_locale,
getTourStepLocale,
tour_styles_dark_mode,
high_risk_tour_step_config,
high_risk_tour_step_locale,
getTourStepConfigHighRisk,
getHighRiskTourStepLocale,
} from 'Constants/tour-steps-config-new';
import { useStores } from 'Stores/index';
import { routes, ContentFlag } from '@deriv/shared';
Expand All @@ -30,6 +30,8 @@ const TourGuide = () => {

const history = useHistory();
const [joyride_index, setJoyrideIndex] = React.useState<number>(0);
const tour_step_locale = getTourStepLocale();
const high_risk_tour_step_locale = getHighRiskTourStepLocale();

tour_step_locale.last = (
<div
Expand Down Expand Up @@ -68,7 +70,7 @@ const TourGuide = () => {
);
}

if (tour_step_config.length === joyride_index + 1) {
if (getTourStepConfig().length === joyride_index + 1) {
tour_step_locale.back = (
<Button
has_effect
Expand Down Expand Up @@ -105,7 +107,7 @@ const TourGuide = () => {
disableScrolling
hideCloseButton
disableCloseOnEsc
steps={low_risk ? tour_step_config : high_risk_tour_step_config}
steps={low_risk ? getTourStepConfig() : getTourStepConfigHighRisk()}
styles={is_dark_mode_on ? tour_styles_dark_mode : tour_styles}
locale={low_risk ? tour_step_locale : high_risk_tour_step_locale}
floaterProps={{
Expand Down

0 comments on commit 1b5ebbc

Please sign in to comment.