feat: hide bids and show create only when store is public or approved

This commit is contained in:
bartosz-lipinski 2021-06-02 14:14:54 -05:00
parent 28e0129c4e
commit e2109b7e0d
1 changed files with 20 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import './index.less';
import { Link } from 'react-router-dom';
import { Button, Dropdown, Menu } from 'antd';
@ -6,16 +6,29 @@ import { ConnectButton, CurrentUserBadge, useWallet } from '@oyster/common';
import { Notifications } from '../Notifications';
import useWindowDimensions from '../../utils/layout';
import { MenuOutlined } from '@ant-design/icons';
import { useMeta } from '../../contexts';
const UserActions = () => {
const { wallet } = useWallet();
const { whitelistedCreatorsByCreator, store } = useMeta();
const pubkey = wallet?.publicKey?.toBase58() || '';
const canCreate = useMemo(() => {
return store &&
store.info &&
(store.info.public ||
whitelistedCreatorsByCreator[pubkey]?.info
?.activated);
}, [pubkey, whitelistedCreatorsByCreator, store]);
return (
<>
<Link to={`#`}>
<Button className="app-btn">Bids</Button>
</Link>
<Link to={`/art/create`}>
{/* <Link to={`#`}>
<Button className="app-btn">Bids</Button>
</Link> */}
{canCreate && (<Link to={`/art/create`}>
<Button className="app-btn">Create</Button>
</Link>
</Link>)}
<Link to={`/auction/create/0`}>
<Button className="connector" type="primary" >Sell</Button>
</Link>
@ -56,7 +69,7 @@ const MetaplexMenu = () => {
<Menu.Item>
<Link to={`/`}>
<Button className="app-btn">Explore</Button>
</Link>
</Link>
</Menu.Item>
<Menu.Item>
<Link to={`/artworks`}>