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

Artsem / Disable popovers + change color if user is barred #5191

Merged
merged 6 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 29 additions & 16 deletions packages/p2p/src/components/my-ads/my-ads-row-renderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ const MyAdsRowRenderer = observer(({ row: advert, setAdvert }) => {
const amount_dealt = amount - remaining_amount;
const is_buy_advert = type === buy_sell.BUY;

const onClickActivateDeactivate = () => {
my_ads_store.onClickActivateDeactivate(id, is_advert_active, setIsAdvertActive);
};
const onClickActivateDeactivate = () =>
!general_store.is_barred && my_ads_store.onClickActivateDeactivate(id, is_advert_active, setIsAdvertActive);
artsemkavaleu-binary marked this conversation as resolved.
Show resolved Hide resolved
const onClickDelete = () => !general_store.is_barred && my_ads_store.onClickDelete(id);
const onClickEdit = () => !general_store.is_barred && my_ads_store.onClickEdit(id);
const onMouseEnter = () => setIsPopoverActionsVisible(true);
Expand Down Expand Up @@ -161,13 +160,20 @@ const MyAdsRowRenderer = observer(({ row: advert, setAdvert }) => {
) : (
<div
className='p2p-my-ads__table-add'
onClick={() => {
setAdvert(advert);
my_ads_store.showQuickAddModal(advert);
}}
onClick={
!general_store.is_barred &&
artsemkavaleu-binary marked this conversation as resolved.
Show resolved Hide resolved
(() => {
setAdvert(advert);
my_ads_store.showQuickAddModal(advert);
})
}
>
<Icon icon='IcAdd' />
<Text color='prominent' size='xxs' weight='bold'>
<Icon color={general_store.is_barred && 'disabled'} icon='IcAdd' />
<Text
color={general_store.is_barred ? 'less-prominent' : 'prominent'}
size='xxs'
weight='bold'
>
<Localize i18n_default_text='Add' />
</Text>
</div>
Expand Down Expand Up @@ -226,13 +232,20 @@ const MyAdsRowRenderer = observer(({ row: advert, setAdvert }) => {
) : (
<div
className='p2p-my-ads__table-add'
onClick={() => {
setAdvert(advert);
my_ads_store.showQuickAddModal(advert);
}}
onClick={
!general_store.is_barred &&
(() => {
artsemkavaleu-binary marked this conversation as resolved.
Show resolved Hide resolved
setAdvert(advert);
my_ads_store.showQuickAddModal(advert);
})
}
>
<Icon icon='IcAdd' />
<Text color='prominent' size='xxs' weight='bold'>
<Icon color={general_store.is_barred && 'disabled'} icon='IcAdd' />
<Text
color={general_store.is_barred ? 'less-prominent' : 'prominent'}
size='xxs'
weight='bold'
>
<Localize i18n_default_text='Add' />
</Text>
</div>
Expand Down Expand Up @@ -281,7 +294,7 @@ const MyAdsRowRenderer = observer(({ row: advert, setAdvert }) => {
className='p2p-my-ads__table-popovers__edit'
message={localize('Edit')}
>
<Icon icon='IcEdit' size={16} />
<Icon icon='IcEdit' color={general_store.is_barred && 'disabled'} size={16} />
</Popover>
</div>
<div onClick={onClickDelete}>
Expand Down