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

Add artist profiles w orbis #2

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2858a04
added example api syntax
Jul 28, 2022
e4454e1
added html css and images from front end repo
Jul 30, 2022
c046799
updated new index
Jul 30, 2022
6c817ec
moved css code to globals
Aug 2, 2022
9f7d511
refactored data fetching in component
Aug 20, 2022
7a06a3d
added image div
Aug 20, 2022
68c24cc
added new image component
Aug 20, 2022
c5043d3
add video element
streamerd Aug 21, 2022
07808ea
update home with (all) active listings on the market contract
streamerd Aug 21, 2022
d638360
added components and data fetch logic
nmwenz90 Aug 21, 2022
a29656b
added new component
nmwenz90 Aug 21, 2022
08c2f51
fix
nmwenz90 Aug 21, 2022
684fcd7
Merge pull request #1 from afuturemodern/grid
nmwenz90 Aug 21, 2022
060d6a3
fix
nmwenz90 Aug 21, 2022
5047a84
fix
nmwenz90 Aug 21, 2022
841ef73
deleted newIndex page and moved it to index
nmwenz90 Aug 25, 2022
5ae7762
switch from rinkeby to goerli testnet
streamerd Sep 15, 2022
2f21d84
switch network well
streamerd Sep 16, 2022
604a99f
Fixed the grid
thedavidcarlson Sep 25, 2022
ae62349
Merge pull request #2 from afuturemodern/fix-grid
tehownrer Sep 25, 2022
f938a28
fixed listings display
nmwenz90 Oct 1, 2022
2927368
rebuild
streamerd Oct 2, 2022
53d09ca
removed unnecessary divs and vairables, handling image files, fixed b…
nmwenz90 Oct 2, 2022
0fe7f0f
removed unnecessary divs and vairables, handling image files, fixed b…
nmwenz90 Oct 2, 2022
379b5bc
added lightbox/modal when clicking featured art grid item
nmwenz90 Oct 9, 2022
ce4795e
added artist address to grid item
nmwenz90 Oct 9, 2022
c44a683
add wallet connect from orbis-sdk and a few funcs
streamerd Oct 25, 2022
09c9dff
add data to provide profileUpdate payload @ orbis
streamerd Oct 30, 2022
f0652c0
update artist profile with custom fields for Bu1dl store
streamerd Oct 30, 2022
54f9e8d
update card for /listings/id
streamerd Nov 5, 2022
3cba26f
save NFT listing to Ceramic, as a post @ orbis-sdk
streamerd Nov 5, 2022
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
1 change: 0 additions & 1 deletion .env.example

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ yarn-error.log*

# typescript
*.tsbuildinfo

TODOs.md
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The thirdweb React provider makes it straightforward to let your users connect t
Open `pages/_app.tsx` we wrap all of our pages in the `<ThirdwebProvider>` component.

```tsx
<ThirdwebProvider desiredChainId={ChainId.Rinkeby}>
<ThirdwebProvider desiredChainId={ChainId.Goerli}>
<Component {...pageProps} />
</ThirdwebProvider>
```
Expand Down Expand Up @@ -224,7 +224,7 @@ async function createBidOrOffer() {
await marketplace?.direct.makeOffer(
listingId, // The listingId of the listing we want to make an offer for
1, // Quantity = 1
NATIVE_TOKENS[ChainId.Rinkeby].wrapped.address, // Wrapped Ether address on Rinkeby
NATIVE_TOKENS[ChainId.Goerli].wrapped.address, // Wrapped Ether address on Rinkeby
bidAmount // The offer amount the user entered
);
}
Expand Down
22 changes: 22 additions & 0 deletions components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NextPage } from "next";


interface ButtonProps {
href: string;
value: string;
}

const Button: NextPage<ButtonProps> = ({
href,
value
}) => {
return (
<div id="button" className="fmbs-gallery__button-wrapper">
<a className="fmbs-gallery__button" href={href}>
{value}
</a>
</div>
);
};

export default Button;
14 changes: 14 additions & 0 deletions components/FeaturedNftsGrid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NextPage } from "next";
import Button from "./Button";

const FeaturedNftsGrid: NextPage<{}> = ({ children }) => {
return (
<div className="fmbs-gallery fmbs-page-content">
<h1 className="fmbs-gallery__header">Featured Artists</h1>
<div className="fmbs-gallery-grid">{children}</div>
<Button href="javascript://" value="See all artists" />
</div>
);
};

export default FeaturedNftsGrid;
270 changes: 243 additions & 27 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,260 @@
import { useAddress, useMetamask, useDisconnect } from "@thirdweb-dev/react";
import React from "react";
import { useState } from "react";
import styles from "../styles/Home.module.css";
import Image from "next/image";
import fmLogo from "../public/images/fm_logo.png";
import logoText from "../public/images/fm_logo_text.png";
import { Orbis } from "@orbisclub/orbis-sdk";

// used this for settings/user profile dropdown:
//https://mui.com/material-ui/react-app-bar/#app-bar-with-responsive-menu
import Box from "@mui/material/Box";
import Toolbar from "@mui/material/Toolbar";
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import Menu from "@mui/material/Menu";
import Avatar from "@mui/material/Avatar";
import Tooltip from "@mui/material/Tooltip";
import MenuItem from "@mui/material/MenuItem";

const settings = ["Profile", "Account", "Dashboard"];

export default function Header() {
// Helpful thirdweb hooks to connect and manage the wallet from metamask.
const address = useAddress();
const connectWithMetamask = useMetamask();
const disconnectWallet = useDisconnect();
// const connectWithMetamask = useMetamask();
// const disconnectWallet = useDisconnect();
let [address, setAddress] = useState(null);
let [did, setDid] = useState(null);
let orbis = new Orbis();


const [anchorElUser, setAnchorElUser] = React.useState<null | HTMLElement>(
null
);

const handleOpenUserMenu = (event: React.MouseEvent<HTMLElement>) => {
setAnchorElUser(event.currentTarget);
};

const handleCloseUserMenu = () => {
setAnchorElUser(null);
};

async function connectToOrbis() {
let res = await orbis.connect();
console.log("result from connect >>> ", res);
setAddress(res.details.metadata.address);
setDid(res.details.did);
}

async function walletConnected() {
let isConnected = await orbis.isConnected();
return isConnected;
}

async function disconnectWallet() {
let isConnected = await walletConnected();

if (isConnected) {
await orbis.logout();
setAddress(null);
}
}
async function getProfile() {
let { data, error } = await orbis.getProfile(did);
data
? console.log("profile data >> ", JSON.stringify(data))
: console.log("error >> ", error);
}

// second iteration with data and pfp fields included persisted to Ceramic like this:
// https://cerscan.com/mainnet/stream/kjzl6cwe1jw148hc5qrip4fye2xsx5rviiv58wqsl12rgocgoxdunp6hvtb4792
async function updateProfile() {

let isConnected = await walletConnected();

if (isConnected) {
let res = await orbis.updateProfile({
pfp: "https://i.seadn.io/gae/WtwW8sgq8dmeMH_hk5VSE7QK4NnIEHa3L796hQwSJzFnI0E8okltHJ4gsV9pexWmM2N-Rdva7q2HcR4KPaXWmPAHTKbsITVeGogz1w?auto=format&w=1080",
username: "streamerd",
description: "Peacemaker, techie artist",
timestamp: "1666656225",
pfpIsNft: {
chain: "ethereum",
contract: "0xc709999489abbb567b8ae8d40ba91930990e7900",
tokenId: "0x0000000000000000000000000000000000000000000000000000000000000005",
timestamp: Date.now().toString()
},
data: {
"stage_name": "streamerd",
"description": "Peacemaker, techie artist. Mostly visual, also experimenting music as coding with sonic-pi synthesizer for fun.",
"wallet_address": "0xEd2eF70e8B1EBf95bDfD7ba692454143b2A8263B",
"ens_domain": "",
"website_url": "https://atyilmaz.com",
"twitter_url": "https://twitter.com/_streamerd",
"youtube_url": "https://www.youtube.com/channel/UCbqFexBFcfREyGHFtA3DL9Q/",
"bandcamp_url": "",
"genius_url": "",
"instagram_url": "instagram.com/streamerd_/",
"facebook_page_url": "",
"facebook_profile_url": "",
"audius_url": "",
"soundcloud_url": "soundcloud.com/atyilmaz",
"spotify_url": "",
"catalog_url": "",
"zora_url": "",
"opensea_url": "https://opensea.io/streamerd",
"artist_profile_pic": "https://atyilmaz.com/rabbit-holed_01.jpeg",
"total_sales" : 0.00
}
});

console.log("result from updateProfile >>> ", res);

} else {console.log("user seems disconnected");}

}

return (
<div className={styles.header}>
<div className={styles.left}>
<div>
<a
href="/"
rel="noopener noreferrer"
>
<img src={`/logo.png`} alt="Thirdweb Logo" width={80} />
</a>
<div className={`fmbs-header fmbs-bg-wrapper`}>
<div className={"fmbs-bg fmbs-bg--purple"}></div>
<div className={"fmbs-header-wrapper fmbs-page-content"}>
<span className={"fmbs-page-content"}>
<div className={"fmbs-header__logo-icon"}>
<Image src={fmLogo} alt="logo" />
</div>
<div className={"fmbs-header__logo-text"}>
<Image src={logoText} alt="logo text" />
</div>
</span>

<nav className={"fmbs-header-nav"}>
<ul className={"fmbs-header-nav__list"} role="menubar">
<li className={"fmbs-header-nav__list-item"}>
<a className={"fmbs-header-nav__list-link"}>[Launches]</a>
<div className={"fmbs-header-sub-menu"}>
<div
className={"fmbs-header-sub-menu-wrapper fmbs-page-content"}
>
<ul className={"fmbs-header-subnav"} role="menu">
<li className={"fmbs-header-subnav__list-item"}>
<a className={"fmbs-header-subnav__link"}>[Artists]</a>
</li>
<li className={"fmbs-header-subnav__list-item"}>
<a className={"fmbs-header-subnav__link"}>[Auctions]</a>
</li>
<li className={"fmbs-header-subnav__list-item"}>
<a className={"fmbs-header-subnav__link"}>[Collabs]</a>
</li>
<li className={"fmbs-header-subnav__list-item"}>
<a className={"fmbs-header-subnav__link"}>[Events]</a>
</li>
</ul>
<div className={"fmbs-header-sub-menu-display"}>
<div className={"fmbs-header-sub-menu-display__text"}>
<h2>[Auction #5]</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua.
</p>
<a>[see all]</a>
</div>
<Image
className={"fmbs-header-sub-menu__img"}
src="https://www.macmillandictionary.com/external/slideshow/thumb/Grey_thumb.png"
alt="grey thumb"
height={"160px"}
width={"160px"}
/>
</div>
</div>
</div>
</li>
<li className={"fmbs-header-nav__list-item"}>
<a className={"fmbs-header-nav__list-link"}>Marketplace</a>
</li>
<li className={"fmbs-header-nav__list-item"}>
<a className={"fmbs-header-nav__list-link"}>About</a>
</li>
</ul>
</nav>
<div className={"fmbs-header__search-wrapper"}>
<input
className={"fmbs-header__search-input"}
placeholder="Search item here"
/>
</div>
</div>
<div className={styles.right}>

{/* todo add disconnect css style for button */}
{address ? (
<>
<a
className={styles.secondaryButton}
onClick={() => disconnectWallet()}
>
Disconnect Wallet
</a>
<p style={{ marginLeft: 8, marginRight: 8, color: "grey" }}>|</p>
<p>{address.slice(0, 6).concat("...").concat(address.slice(-4))}</p>
<Toolbar disableGutters>
<Box
sx={{ flexGrow: 1, display: { xs: "flex", md: "none" } }}
></Box>

<Box sx={{ flexGrow: 0 }}>
<Tooltip title="Open settings">
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
<Avatar
alt="Remy Sharp"
src="https://i.seadn.io/gae/WtwW8sgq8dmeMH_hk5VSE7QK4NnIEHa3L796hQwSJzFnI0E8okltHJ4gsV9pexWmM2N-Rdva7q2HcR4KPaXWmPAHTKbsITVeGogz1w?auto=format&w=1080"
/>
</IconButton>
</Tooltip>
<Menu
sx={{ mt: "45px" }}
id="menu-appbar"
anchorEl={anchorElUser}
anchorOrigin={{
vertical: "top",
horizontal: "right",
}}
keepMounted
transformOrigin={{
vertical: "top",
horizontal: "right",
}}
open={Boolean(anchorElUser)}
onClose={handleCloseUserMenu}
>
{settings.map((setting) => (
<MenuItem key={setting} onClick={handleCloseUserMenu}>
<Typography textAlign="center">{setting}</Typography>
</MenuItem>
))}

<button
className={"fmbs-header__disconnect"}
type="button"
id="walletButton"
onClick={() => updateProfile()}
>
profile
</button>
<button
className={"fmbs-header__disconnect"}
type="button"
id="walletButton"
onClick={() => disconnectWallet()}
>
disconnect
</button>
</Menu>
</Box>
</Toolbar>
</>
) : (
<a
className={styles.mainButton}
onClick={() => connectWithMetamask()}
<button
className={"fmbs-header__connect"}
type="button"
id="walletButton"
onClick={() => connectToOrbis()}
>
Connect Wallet
</a>
Connect
</button>
)}
</div>
</div>
Expand Down
Loading