Skip to content

Commit

Permalink
Add ability to mint an NFT from any screen WeAreNewt#271
Browse files Browse the repository at this point in the history
  • Loading branch information
ga-reth committed Apr 26, 2022
1 parent ac6faab commit 04392ba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
16 changes: 12 additions & 4 deletions packages/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion packages/frontend/src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import ConnectButton from '../ConnectButton';
import icon from '../../images/icon.png';
import { useLocation } from 'react-router-dom';
import Toggle from '../../ThemeToggle';
import { Button } from '../Button';
import MintModal from '../MintModal';
import { useAppDataProvider } from '../../lib/providers/app-data-provider';

interface Navigation {
Expand All @@ -14,6 +16,7 @@ interface Navigation {
export default function Navbar() {
const { currentAccount, ensName } = useAppDataProvider();
const [menuOpen, setMenuOpen] = useState(false);
const [mintModalOpen, setMintModalOpen] = useState<boolean>(false);
const location = useLocation();
const activePage = location.pathname.split('/')[1];

Expand Down Expand Up @@ -134,10 +137,24 @@ export default function Navbar() {
</div>
);
})}

{/** Mint */}
{currentAccount && (
<Button
onClick={() => {
setMintModalOpen(true);
}}
>
Mint new
</Button>
)}
{/** Mint Modal */}
<MintModal open={mintModalOpen} onClose={() => setMintModalOpen(false)} />

<Toggle />
</div>
</div>

{/** Wallet */}
<div className="ml-3 relative">
<ConnectButton />
Expand Down

0 comments on commit 04392ba

Please sign in to comment.