Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: renamed your ads are running to hide my ads #8576

7 changes: 0 additions & 7 deletions packages/p2p/src/components/my-ads/my-ads.scss
Original file line number Diff line number Diff line change
Expand Up @@ -720,18 +720,11 @@
.toggle-ads {
display: flex;
align-items: center;
font-size: var(--text-size-s);
justify-items: flex-start;

&__message {
margin-right: 1.6rem;
}
&--on {
color: var(--text-profit-success);
}
&--off {
color: var(--text-less-prominent);
}
}

&__expand-button {
Expand Down
28 changes: 12 additions & 16 deletions packages/p2p/src/components/my-ads/toggle-ads.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { ToggleSwitch } from '@deriv/components';
import { Text, ToggleSwitch } from '@deriv/components';
import { useIsMounted } from '@deriv/shared';
import classNames from 'classnames';
import { observer } from 'mobx-react-lite';
import { requestWS } from 'Utils/websocket';
import { localize } from 'Components/i18next';
import { Localize } from '@deriv/translations';
import { useStores } from 'Stores';
import './my-ads.scss';

Expand Down Expand Up @@ -33,21 +32,18 @@ const ToggleAds = observer(() => {
};

return (
<div
className={classNames('toggle-ads', {
'toggle-ads--on': general_store.is_listed,
'toggle-ads--off': !general_store.is_listed || general_store.is_barred,
})}
>
<div className='toggle-ads__message'>
{(my_ads_store.api_error || general_store.is_listed) && !general_store.is_barred
? localize('Your ads are running')
: localize('Your ads are paused')}
</div>

<div className='toggle-ads'>
<Text
className='toggle-ads__message'
color={general_store.is_listed ? 'less-prominent' : 'profit-success'}
line_height='xl'
size='xs'
>
<Localize i18n_default_text='Hide my ads' />
</Text>
<ToggleSwitch
id='toggle-my-ads'
is_enabled={general_store.is_listed && !general_store.is_barred}
is_enabled={general_store.is_barred || !general_store.is_listed}
handleToggle={handleToggle}
/>
</div>
Expand Down