Skip to content

Commit

Permalink
Sergei / wall 680 / Desktop wallet dark theme (#9006)
Browse files Browse the repository at this point in the history
* style: change text color and add bg color for demo wallet in dark mode

* feat: add logo for dark theme

* feat: add @deriv/hooks to package.json in appstore

* chore: empty commit to restart vercel

* refactor: wrap TradersHub component by observer

* chore: empty commit to restart vercel

* feat: change color of button border

* update feature_branch with master (#9220)

* fix: close account message doesn't show up (#9210)

Co-authored-by: niloofar sadeghi <niloofar.sadeghi@re-work.dev>

* Jim/WEBREL-667/fix-bug-revealed-during-ts-migration (#9216)

* revert: revert code changes

* fix: fix bug revealed during ts migration

* chore: add test cases for line changed

---------

Co-authored-by: Niloofar Sadeghi <93518187+niloofar-deriv@users.noreply.github.com>
Co-authored-by: niloofar sadeghi <niloofar.sadeghi@re-work.dev>
Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>

* feat: fix test for useWalletsList

* fix: try to fix useWalletsList test

* feat: add type to default_mock_useFetch_response

* feat: just add @ts-expect-error

* chore: change number to boolean

---------

Co-authored-by: mahdiyeh-deriv <82078941+mahdiyeh-deriv@users.noreply.github.com>
Co-authored-by: Niloofar Sadeghi <93518187+niloofar-deriv@users.noreply.github.com>
Co-authored-by: niloofar sadeghi <niloofar.sadeghi@re-work.dev>
Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
  • Loading branch information
5 people authored Jul 5, 2023
1 parent 08a9c63 commit 17cc1a2
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const WalletOptionsAndMultipliersListing = observer(({ wallet_account }: TProps)
const OptionsTitle = () => {
if (wallet_account.landing_company_name === 'svg' && !is_mobile) {
return (
<Text size='sm' line_height='m' weight='bold'>
<Text size='sm' line_height='m' weight='bold' color='prominent'>
{localize('Options & multipliers')}
</Text>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const WalletHeaderBalance = observer(({ balance, currency }: TWalletHeaderBalanc
} = useStore();

const balance_amount = (
<Text weight='bold' size='m'>
<Text weight='bold' size='m' color='prominent'>
<Localize
i18n_default_text='{{balance}} {{currency}}'
values={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const WalletHeaderButtons = observer(({ is_disabled, is_open, btns, wallet_accou
>
<Icon
icon={btn.icon}
custom_color={is_disabled ? 'var(--general-disabled)' : 'var(--text-general)'}
custom_color={is_disabled ? 'var(--general-disabled)' : 'var(--text-prominent)'}
/>
<CSSTransition
appear
Expand All @@ -53,7 +53,7 @@ const WalletHeaderButtons = observer(({ is_disabled, is_open, btns, wallet_accou
>
<Text
weight='bold'
color={is_disabled ? 'disabled' : 'general'}
color={is_disabled ? 'disabled' : 'prominent'}
size='xs'
className='wallet-header__description-buttons-item-text'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@
width: 100%;
height: 100%;
opacity: 0.1;
background-image: url('./../../public/images/wallet-header-demo-bg.svg');
background-repeat: repeat;
background-position: 3% 30%;
border-radius: $BORDER_RADIUS * 4;
}

.theme--light &__demo:before {
background-image: url('./../../public/images/wallet-header-demo-bg.svg');
}

.theme--dark &__demo:before {
background-image: url('./../../public/images/wallet-header-demo-bg-dark.svg');
}

&__container {
position: relative;
display: flex;
Expand Down Expand Up @@ -64,7 +71,7 @@
border-radius: $BORDER_RADIUS * 4;
padding: 0.6rem 1.6rem;
margin-right: 0.8rem;
border: 1px solid var(--text-general);
border: 1px solid var(--border-hover);
background-color: var(--prominent);

&:hover:not(&-disabled) {
Expand Down
12 changes: 6 additions & 6 deletions packages/appstore/src/modules/traders-hub/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import AccountWithWallets from './account-with-wallets';
import AccountWithoutWallets from './account-without-wallets';
import { useStore, observer } from '@deriv/stores';
import EUDisclaimer from 'Components/eu-disclaimer';
import './traders-hub.scss';
import { useContentFlag } from '@deriv/hooks';
import './traders-hub.scss';

const TradersHub = () => {
const TradersHub = observer(() => {
const { traders_hub, client, ui } = useStore();
const { notification_messages_ui: Notifications } = ui;
const {
Expand Down Expand Up @@ -50,7 +50,7 @@ const TradersHub = () => {
}, 100);
}, [is_tour_open]);

const { is_low_risk_cr_eu, is_high_risk_cr } = useContentFlag();
const { is_low_risk_cr_eu } = useContentFlag();

if (!is_logged_in) return null;

Expand All @@ -69,7 +69,7 @@ const TradersHub = () => {
>
{can_show_notify && <Notifications />}
<div id='traders-hub' className='traders-hub' ref={traders_hub_ref}>
{is_high_risk_cr && <AccountWithWallets />}
{is_wallet_account && <AccountWithWallets />}
<AccountWithoutWallets />
<ModalManager />
{scrolled && <TourGuide />}
Expand All @@ -78,6 +78,6 @@ const TradersHub = () => {
{is_low_risk_cr_eu && <EUDisclaimer />}
</React.Fragment>
);
};
});

export default observer(TradersHub);
export default TradersHub;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 3 additions & 14 deletions packages/hooks/src/__tests__/useWalletsList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('useWalletsList', () => {
},
});

// @ts-expect-error need to come up with a way to mock the return type of useFetch
mockUseFetch.mockReturnValue({
data: {
authorize: {
Expand All @@ -31,21 +32,9 @@ describe('useWalletsList', () => {
currency: 'USD',
is_virtual: 0,
landing_company_name: 'svg',
// @ts-expect-error Need to update @deriv/api-types to fix the TS error
landing_company_shortcode: 'svg',
is_demo: 0,
is_selected: true,
is_malta_wallet: false,
},
],
},
balance: {
accounts: {
CRW909900: {
balance: 1000,
},
},
},
},
});

Expand All @@ -65,13 +54,13 @@ describe('useWalletsList', () => {
gradient_card_class: 'wallet-card__usd-bg',
gradient_header_class: 'wallet-header__usd-bg',
landing_company_name: 'svg',
landing_company_shortcode: 'svg',
icon: 'IcWalletCurrencyUsd',
is_demo: false,
is_malta_wallet: false,
is_selected: false,
is_virtual: 0,
is_virtual: false,
name: 'USD Wallet',
is_disabled: false,
},
]);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/src/useWalletTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ const useWalletTransactions = (
gradient_card_class: `wallet-card__btc-bg${is_dark_mode_on ? '--dark' : ''}`,
icon: getWalletCurrencyIcon('BTC', is_dark_mode_on),
is_demo: !!current_wallet.is_virtual,
is_disabled: 0,
is_disabled: false,
is_malta_wallet: false,
is_selected: false,
is_virtual: current_wallet.is_virtual ? 1 : 0,
is_virtual: Boolean(current_wallet.is_virtual),
landing_company_name: 'svg',
loginid: 'CRWMOCK00042',
name: `${current_wallet.is_virtual ? 'Demo ' : ''}BTC Wallet`,
Expand Down
2 changes: 2 additions & 0 deletions packages/hooks/src/useWalletsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const useWalletsList = () => {
is_dark_mode_on ? '--dark' : ''
}`,
name: `${wallet.is_virtual ? 'Demo ' : ''}${currency} ${'Wallet'}`,
is_disabled: Boolean(wallet.is_disabled),
is_virtual: Boolean(wallet.is_virtual),
}));

// Sort the wallets alphabetically by fiat, crypto, then virtual
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/styles/constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,5 @@ $gradient-virtual-swap-free: linear-gradient(58.51deg, #061828 28.06%, #1a3c60 9
$READY-BANNER-BG-COLOR: #e2f3f3;
$READY-BANNER-TICK-BG-COLOR: #4ab4b3;
$wallet-demo-bg-color: #fff8f9;
$wallet-dark-demo-bg-color: #140506;
$wallet-demo-divider-color: #fff0f1;
4 changes: 2 additions & 2 deletions packages/shared/src/styles/themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@
--wallets-banner-dot-color: #{$color-grey-6};
--wallets-banner-active-dot-color: #{$color-red};
--wallets-card-active-gradient-background: #{$gradient-color-white-2};
--wallet-demo-bg-color: #{$wallet-demo-bg-color};
--wallet-demo-divider-color: #{$wallet-demo-divider-color};
--wallet-demo-bg-color: #{$wallet-dark-demo-bg-color};
--wallet-demo-divider-color: #{$color-black-8};
--wallet-eu-disclaimer: #{$color-grey-4};
// Demo view
--demo-text-color-1: #{$color-black-1};
Expand Down

0 comments on commit 17cc1a2

Please sign in to comment.