From e2109b7e0d9ab3fb36ea9dad90016dfd8872706a Mon Sep 17 00:00:00 2001 From: bartosz-lipinski <264380+bartosz-lipinski@users.noreply.github.com> Date: Wed, 2 Jun 2021 14:14:54 -0500 Subject: [PATCH] feat: hide bids and show create only when store is public or approved --- .../web/src/components/AppBar/index.tsx | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/js/packages/web/src/components/AppBar/index.tsx b/js/packages/web/src/components/AppBar/index.tsx index 2c57106..78c0dd9 100644 --- a/js/packages/web/src/components/AppBar/index.tsx +++ b/js/packages/web/src/components/AppBar/index.tsx @@ -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 ( <> - - - - + {/* + + */} + {canCreate && ( - + )} @@ -56,7 +69,7 @@ const MetaplexMenu = () => { - +