Skip to content

Commit

Permalink
[WALL] Lubega / WALL-3521 / Cashier menu and header translations fix (d…
Browse files Browse the repository at this point in the history
…eriv-com#16429)

* fix: cashier menu and header translations

* fix: add preferred language and current language

* fix: added deriv go to dependency

* fix: added preferred language to dependency

* fix: retrigger vercel
  • Loading branch information
lubega-deriv authored Aug 26, 2024
1 parent 4fdc5d2 commit 8537e31
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/cashier/src/containers/cashier/cashier.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useMemo } from 'react';
import { RouteComponentProps } from 'react-router';
import { withRouter } from 'react-router-dom';
import { Button, Div100vhContainer, FadeWrapper, PageOverlay, VerticalTab, Loading } from '@deriv/components';
import { Div100vhContainer, FadeWrapper, PageOverlay, VerticalTab, Loading } from '@deriv/components';
import {
useAuthorize,
useOnrampVisible,
Expand Down Expand Up @@ -61,9 +61,10 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier
isLoading: is_payment_agent_transfer_checking,
isSuccess: is_payment_agent_transfer_visible_is_success,
} = usePaymentAgentTransferVisible();
const { is_from_derivgo } = common;
const { is_cashier_visible: is_visible, toggleCashier, toggleReadyToDepositModal } = ui;
const { currency, is_account_setting_loaded, is_logged_in, is_logging_in, is_svg, is_virtual } = client;
const { current_language, is_from_derivgo } = common;
const { is_cashier_visible: is_visible, is_mobile, toggleCashier, toggleReadyToDepositModal } = ui;
const { account_settings, currency, is_account_setting_loaded, is_logged_in, is_logging_in, is_svg, is_virtual } =
client;
const {
data: paymentAgentList,
isLoading: is_payment_agent_list_loading,
Expand Down Expand Up @@ -105,13 +106,16 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier
});

return options;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
is_account_transfer_visible,
is_onramp_visible,
is_p2p_enabled,
is_payment_agent_transfer_visible,
is_payment_agent_visible,
p2p_notification_count,
account_settings.preferred_language,
current_language,
routes_config,
]);

Expand All @@ -122,11 +126,11 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier

const is_default_route = !!selected_route.default;

const getHeaderTitle = useMemo(() => {
if (isDesktop || (is_default_route && (is_loading || is_cashier_onboarding))) return localize('Cashier');
const getHeaderTitle = () => {
if (!is_mobile || (is_default_route && (is_loading || is_cashier_onboarding))) return localize('Cashier');

return selected_route.getTitle?.();
}, [is_cashier_onboarding, is_default_route, is_loading, selected_route, isDesktop]);
};

const updateActiveTab = useCallback(
(path?: string) => {
Expand Down Expand Up @@ -260,7 +264,7 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier
<FadeWrapper is_visible={is_visible} className='cashier__page-wrapper' keyname='cashier__page-wrapper'>
<ErrorDialog error={error} />
<div className='cashier'>
<PageOverlay header={getHeaderTitle} onClickClose={onClickClose} is_from_app={is_from_derivgo}>
<PageOverlay header={getHeaderTitle()} onClickClose={onClickClose} is_from_app={is_from_derivgo}>
{isDesktop ? (
<VerticalTab
current_path={location.pathname}
Expand Down

0 comments on commit 8537e31

Please sign in to comment.