Skip to content

Commit

Permalink
Marketplace (#147)
Browse files Browse the repository at this point in the history
* button components

* feat:marketplace & cryptobot single frontend

* WIP: load cryptobots within marketplace

* feat: load 3d cryptobots from smart contract

* WIP: add filter functionailty

* feat: add sort functionailty

* chore: refactor sort & filter func

* fix: build error

* feat: add xtzUsd price func

* Revert "feat: add xtzUsd price func"

This reverts commit be2c661.

* Revert "Revert "feat: add xtzUsd price func""

This reverts commit c230931.

* fix: update price fetching endpoint for xtzUsd

* chore: update marketplace & cryptobot to /tezos/<url>

* chore: Configure PostCSS to use Tailwind

* feat: add method for loading nfts by individual tezos addres

* fix: remove console warning

* feat:basic ui done of transaction

* feat: added footer & removed old footer

* chore: color & font size fixes

* feat:added loader

* chore: remove yarn.lock file

* feat: add logic for loading user owned bots

* feat: option to change beacon to testnet

* fix: handle edge case where nft on offer are null.

* feat: handle extra props for button component

* feat: add logic for purchasing a cryptobot.

* feat: add logic for buying cryptobot from marketplace

* feat: add logic for loading owned bots in profile view

* fix: navBar beacon connect error

* feat: add option to sign out & redirect to prev page on sign in

* chore: remove redundant marketplace js file

* feat: gate marketplace & profile view with auth

* feat: add logic for calculating estimated gas fee

* feat: add logic for withdrawing owned bot from sale

* fix: remove buy button incase bot is not available for sale

* feat: show estimated gas fee for withdrawing bot from sale.

* feat: add logic for putting bot on sale

* feat: estimating gas fee for withdrawal & putting bot on sale

* refactor: cryptobot view

* Fix gas fee estimate error for buying a bot from the marketplace. + Show tick mark icon as user progress throw the transaction.

* feat: add confetti

Co-authored-by: Bhaskar Singh <[email protected]>
Co-authored-by: Manan Gouhari <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2021
1 parent 4d678f7 commit 0acd8b9
Show file tree
Hide file tree
Showing 26 changed files with 19,025 additions and 45,668 deletions.
30,937 changes: 317 additions & 30,620 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"@mdx-js/mdx": "^1.5.7",
"@mdx-js/react": "^1.5.7",
"@monaco-editor/react": "^3.1.2",
"@taquito/beacon-wallet": "^7.1.0-beta.0",
"@taquito/signer": "^7.0.0-beta.0",
"@taquito/taquito": "^7.0.0-beta.0",
"@taquito/taquito": "^7.0.0-beta-RC.0",
"@thanos-wallet/dapp": "^2.2.1",
"amplitude-js": "^5.11.0",
"autoprefixer": "^10.2.3",
Expand Down Expand Up @@ -47,14 +48,17 @@
"gatsby-source-filesystem": "^2.1.46",
"gatsby-transformer-sharp": "^2.3.13",
"jotai": "^0.12.7",
"lodash.uniqby": "^4.7.0",
"magic-sdk": "^4.1.0",
"monaco-editor": "^0.20.0",
"polished": "^3.5.1",
"popper.js": "^1.16.1",
"postcss": "^8.2.4",
"prismjs": "^1.19.0",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-clipboard.js": "^2.0.16",
"react-confetti": "^6.0.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"react-icons": "^3.9.0",
Expand All @@ -65,6 +69,7 @@
"react-tooltip": "^4.2.5",
"react-transition-group": "^4.4.1",
"react-typography": "^0.16.19",
"react-use": "^15.3.8",
"scheduler": "^0.20.1",
"tailwindcss": "^2.0.2",
"typography": "^0.16.19",
Expand Down
5 changes: 1 addition & 4 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
plugins: [require('tailwindcss')],
};
1 change: 1 addition & 0 deletions src/atoms/is-user-atom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import userAtom from './user-atom';
import { atom } from 'jotai';

//TODO: Also check that wallet is present & account is verified
const isUserAtom = atom(get => Object.keys(get(userAtom)).length > 0);

export default isUserAtom;
8 changes: 6 additions & 2 deletions src/components/Buttons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ const Disabled = {
true: 'opacity-50',
};

function Button({ type, size, disabled, children }) {
function Button({ type, size, disabled, children, ...props }) {
const classNames =
ButtonType[type] + ' ' + ButtonSize[size] + ' ' + Disabled[disabled];
return <button className={classNames}>{children}</button>;
return (
<button {...props} className={classNames}>
{children}
</button>
);
}

export default Button;
51 changes: 51 additions & 0 deletions src/components/CryptobotCard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import model from 'src/images/Col-1.png';
import { Link } from 'gatsby';
import { convertMutezToXtz, getXTZPriceInUSD } from 'src/utils/indexer';

function CryptobotCard({ bot, xtzPrice, owned }) {
return (
<div className="bg-base-800 font-mulish h-full border-2 border-base-400 rounded-lg overflow-hidden">
<div>
<model-viewer
style={{ width: '100%' }}
camera-controls
alt="3D Cryptobot"
src={`https://cloudflare-ipfs.com/ipfs/${bot.uri}`}
></model-viewer>
</div>
<Link
to={`/tezos/cryptobot`}
state={{ id: bot.tokenId, bot: bot, xtzPrice: xtzPrice, owned: owned }}
>
<div className="p-6">
<h1 className="font-mulish text-2xl font-bold text-white mb-2">
Cryptobot (#{bot.tokenId})
</h1>
{bot.isForSale ? (
<div>
<p className="font-mulish text-lg font-bold mb-3 text-white">
{convertMutezToXtz(bot.saleValueInMutez)} XTZ
<span>
{xtzPrice ? (
<span className="text-base-100">
{' '}
( $
{getXTZPriceInUSD(xtzPrice.price, bot.saleValueInMutez)} )
</span>
) : null}
</span>
</p>
</div>
) : (
<p className="font-mulish font-bold mb-3 text-lg text-white">
Bot not available for sale{' '}
</p>
)}
</div>
</Link>
</div>
);
}

export default CryptobotCard;
186 changes: 104 additions & 82 deletions src/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,114 @@
import React from 'react';
import {
Footer,
FooterInner,
LinkContainer,
NavigationLink,
StyledOutboundLink,
LOGO,
} from './styled';
import { Link } from 'gatsby';
import Theme from 'src/assets/theme.svg';
import tezoslogo from '../../images/tezos_logo.png';
import buidllogo from '../../images/buidl_logo.png';

import BuidlLabsLogo from '../../images/buidl_labs_logo.png';
import Tezos from '../../images/tezos.png';
function FooterPage() {
const OutboundLink = ({ href, children }) => {
return (
<Footer>
<FooterInner>
<div>
<div></div>
<LOGO rel="noopener" target="_blank" href="https://tezos.com/">
<img src={Tezos} alt="tezos logo" />
<div>
<h3>Tezos</h3>
</div>
</LOGO>
<LOGO
style={{ marginTop: 20 }}
rel="noopener"
target="_blank"
href="https://buidllabs.io/"
>
<img
style={{ marginTop: '1rem' }}
src={BuidlLabsLogo}
alt="build labs logo"
/>
<div>
<h3>BUIDL</h3>
<h4>LABS</h4>
</div>
</LOGO>
<li>
<a
rel="noopener"
target="_blank"
href={href}
className="font-mulish text-lg text-base-100 hover:text-white hover:no-underline"
>
{children}
</a>
</li>
);
};

const NavigationLink = ({ to, children }) => {
return (
<li>
<Link
to={to}
className="font-mulish text-lg text-base-100 hover:text-white hover:no-underline transition duration-400 ease-in-out"
>
{children}
</Link>
</li>
);
};

const Heading = ({ children }) => {
return (
<h2 className="text-xl font-mulish font-bold text-white mb-3 uppercase">
{children}
</h2>
);
};

const LinkContainer = ({ children }) => {
return <div className="lg:w-1/4 md:w-1/2 w-full px-4">{children}</div>;
};

const Footer = () => {
return (
<footer className="bg-base-900 font-mulish">
<div className="container px-30 py-16 mx-auto flex md:items-center lg:items-start md:flex-row md:flex-nowrap flex-wrap flex-col">
<div className="flex flex-col justify-start text-white">
<Heading>Powered By</Heading>
<nav className="list-none mb-8 space-y-6">
<OutboundLink href="https://tezos.com/">
<img src={tezoslogo} className="h-14 w-auto" />
</OutboundLink>
<OutboundLink href="https://buidllabs.io/">
<img src={buidllogo} className="h-14 w-auto" />
</OutboundLink>
</nav>
</div>
<div>
<LinkContainer style={{ width: 200 }}>
<h4>Navigation</h4>
<ul>
<li>
<NavigationLink to="/tezos">Home Page</NavigationLink>
</li>
<li>
<NavigationLink to="/tezos/overview">
Curriculum Overview
</NavigationLink>
</li>
<li>
<NavigationLink to="/tezos/privacy-policy">
Privacy Policy
</NavigationLink>
</li>
</ul>
<div className="flex-grow flex flex-row flex-wrap md:pl-20 -mb-10 md:mt-0 mt-10 md:text-left text-center justify-end">
<LinkContainer>
<Heading>Navigation</Heading>
<nav className="list-none mb-8">
<NavigationLink to={`/tezos`}>Home</NavigationLink>
<NavigationLink to={`/tezos/academy`}>Academy</NavigationLink>
<NavigationLink to={`/tezos/marketplace`}>
Marketplace
</NavigationLink>
<NavigationLink to="/tezos/auth">Sign In</NavigationLink>
</nav>
</LinkContainer>

<LinkContainer>
<Heading>Legal</Heading>
<nav className="list-none mb-10">
<NavigationLink to="/tezos/privacy-policy">
Privacy Policy
</NavigationLink>
<NavigationLink to="/tezos/home">
Terms and Conditions
</NavigationLink>
</nav>
</LinkContainer>

<LinkContainer>
<h4>Social</h4>
<ul>
<li>
<StyledOutboundLink
rel="noopener"
target="_blank"
href="https://github.com/buidl-labs/crypto-code-school-inside-tezos"
>
Github
</StyledOutboundLink>
</li>
<li>
<StyledOutboundLink
rel="noopener"
target="_blank"
href="https://t.me/joinchat/Q4N7fRQPfT1YQvNL1G3xOw"
>
Telegram
</StyledOutboundLink>
</li>
{/* <li>ProductHunt</li> */}
</ul>
<Heading>Social</Heading>
<nav className="list-none mb-10">
<OutboundLink href="https://github.com/buidl-labs/crypto-code-school-inside-tezos">
Github
</OutboundLink>
<OutboundLink href="https://t.me/joinchat/Q4N7fRQPfT1YQvNL1G3xOw">
Telegram
</OutboundLink>
</nav>
</LinkContainer>
</div>
</FooterInner>
<p>2020 | Made with ❤️ by people @ BUIDL Labs</p>
</Footer>
</div>
<div className="bg-gray-800 bg-opacity-75">
<div className="container mx-auto py-8 px-5 flex flex-col justify-center">
<p className="text-white text-xl text-center">
2020 | Made with ❤️ by people @
<a href="https://buidllabs.io/" className="underline">
BUIDL Labs
</a>
</p>
</div>
</div>
</footer>
);
}
};

export default FooterPage;
export default Footer;
Loading

0 comments on commit 0acd8b9

Please sign in to comment.