Skip to content

Commit

Permalink
feat: enhance RootComponent and App to include notification messages UI
Browse files Browse the repository at this point in the history
  • Loading branch information
heorhi-deriv committed Dec 11, 2024
1 parent d8a54db commit fd94d4d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { moduleLoader } from '@deriv/shared';

import { useOauth2 } from '@deriv/hooks';
import { moduleLoader } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';

const AppStore = React.lazy(() =>
Expand All @@ -19,7 +20,11 @@ const Wallets = React.lazy(() =>

const RootComponent = observer(props => {
const { client, ui } = useStore();
const { is_wallets_onboarding_tour_guide_visible, setIsWalletsOnboardingTourGuideVisible } = ui;
const {
is_wallets_onboarding_tour_guide_visible,
setIsWalletsOnboardingTourGuideVisible,
notification_messages_ui,
} = ui;
const { has_wallet, logout } = client;

const { oAuthLogout } = useOauth2({ handleLogout: logout });
Expand All @@ -34,6 +39,7 @@ const RootComponent = observer(props => {
logout={async () => {
await oAuthLogout();
}}
notificationMessagesUi={notification_messages_ui}
onWalletsOnboardingTourGuideCloseHandler={onWalletsOnboardingTourGuideCloseHandler}
/>
) : (
Expand Down
8 changes: 8 additions & 0 deletions packages/wallets/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import './index.scss';
type TProps = {
isWalletsOnboardingTourGuideVisible: boolean;
logout: () => Promise<void>;
notificationMessagesUi: (props?: {
is_mt5?: boolean;
is_notification_loaded?: boolean;
show_trade_notifications?: boolean;
stopNotificationLoading?: VoidFunction;
}) => JSX.Element;
onWalletsOnboardingTourGuideCloseHandler: VoidFunction;
};

Expand All @@ -21,6 +27,7 @@ const LazyWalletTourGuide = lazy(() => import('./components/WalletTourGuide/Wall
const App: React.FC<TProps> = ({
isWalletsOnboardingTourGuideVisible,
logout,
notificationMessagesUi: Notifications,
onWalletsOnboardingTourGuideCloseHandler,
}) => {
const [preferredLanguage, setPreferredLanguage] = useState<TLanguageType | null>(null);
Expand All @@ -42,6 +49,7 @@ const App: React.FC<TProps> = ({
<TranslationProvider defaultLang={defaultLanguage} i18nInstance={i18nInstance}>
<React.Suspense fallback={<Loader />}>
<ModalProvider>
{Notifications && <Notifications />}
<AppContent
isWalletsOnboardingTourGuideVisible={isWalletsOnboardingTourGuideVisible}
setPreferredLanguage={setPreferredLanguage}
Expand Down

0 comments on commit fd94d4d

Please sign in to comment.