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

Adrienne / Hide block user dropdown when user views their own advertiser page #6529

Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { observer } from 'mobx-react-lite';
import PropTypes from 'prop-types';
import { Dropdown, Icon, Text } from '@deriv/components';
import { Localize } from 'Components/i18next';
import { useStores } from 'Stores';
import { useOnClickOutside } from '../../../../components/src/hooks';
import './advertiser-page.scss';

const AdvertiserPageDropdownMenu = ({ is_my_advert }) => {
const AdvertiserPageDropdownMenu = () => {
const dropdown_menu_ref = React.useRef();
const { advertiser_page_store } = useStores();

Expand Down Expand Up @@ -35,7 +34,7 @@ const AdvertiserPageDropdownMenu = ({ is_my_advert }) => {
onClick={advertiser_page_store.showBlockUserModal}
>
<Dropdown
className={`advertiser-page__dropdown-container${is_my_advert ? '--disabled' : ''}`}
className='advertiser-page__dropdown-container'
is_align_text_right
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified with design team, there are currently no cases where the dropdown is disabled, and thus the prop is_my_advert is no longer necessary in this case

list={['Block']}
name='block_user_dropdown'
Expand All @@ -60,7 +59,3 @@ const AdvertiserPageDropdownMenu = ({ is_my_advert }) => {
};

export default observer(AdvertiserPageDropdownMenu);

AdvertiserPageDropdownMenu.propTypes = {
is_my_advert: PropTypes.bool,
};
16 changes: 10 additions & 6 deletions packages/p2p/src/components/advertiser-page/advertiser-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ const AdvertiserPage = () => {
onClick={buy_sell_store.hideAdvertiserPage}
page_title={localize("Advertiser's page")}
/>
<MobileWrapper>
<AdvertiserPageDropdownMenu is_my_advert={is_my_advert} />
</MobileWrapper>
{!is_my_advert && (
<MobileWrapper>
<AdvertiserPageDropdownMenu />
</MobileWrapper>
)}
</div>
<BlockUserOverlay
is_visible={!!advertiser_page_store.is_counterparty_advertiser_blocked}
Expand Down Expand Up @@ -208,9 +210,11 @@ const AdvertiserPage = () => {
/>
</div>
</div>
<DesktopWrapper>
<AdvertiserPageDropdownMenu is_my_advert={is_my_advert} />
</DesktopWrapper>
{!is_my_advert && (
<DesktopWrapper>
<AdvertiserPageDropdownMenu />
</DesktopWrapper>
)}
</div>
<AdvertiserPageStats />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@

&-container {
margin-top: 0;

&--disabled {
margin-top: 0;

span {
color: var(--text-disabled) !important;
}
}
}

&:hover {
Expand Down Expand Up @@ -64,7 +56,6 @@
}

&__page-return-header {
display: flex;
position: relative;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display: flex causes the header to be cropped out due to overlay:
Screenshot 2022-09-19 at 2 54 03 PM
Screenshot 2022-09-19 at 2 54 06 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: Only advertiser-page.jsx is using this class

}

Expand Down