2023-02-14 17:45:25 +00:00
|
|
|
/* eslint-disable eslint-comments/disable-enable-pair */
|
|
|
|
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
|
2023-02-23 06:47:05 +00:00
|
|
|
|
2022-07-13 13:56:36 +00:00
|
|
|
import clsx from 'clsx'
|
|
|
|
import { Anchor } from 'components/Anchor'
|
2023-05-03 18:17:42 +00:00
|
|
|
import { setLogItemList, useLogStore } from 'contexts/log'
|
2022-07-13 13:56:36 +00:00
|
|
|
import { useWallet } from 'contexts/wallet'
|
2023-02-14 17:45:25 +00:00
|
|
|
import Link from 'next/link'
|
2022-07-13 13:56:36 +00:00
|
|
|
import { useRouter } from 'next/router'
|
2023-05-03 18:17:42 +00:00
|
|
|
import { useEffect } from 'react'
|
2022-07-19 07:53:03 +00:00
|
|
|
// import BrandText from 'public/brand/brand-text.svg'
|
2022-07-25 08:29:52 +00:00
|
|
|
import { footerLinks, socialsLinks } from 'utils/links'
|
2022-07-13 13:56:36 +00:00
|
|
|
|
2023-06-17 09:03:23 +00:00
|
|
|
import { BADGE_HUB_ADDRESS, BASE_FACTORY_ADDRESS, NETWORK, OPEN_EDITION_FACTORY_ADDRESS } from '../utils/constants'
|
2023-02-14 17:45:25 +00:00
|
|
|
import { Conditional } from './Conditional'
|
2023-02-23 08:33:42 +00:00
|
|
|
import { IncomeDashboardDisclaimer } from './IncomeDashboardDisclaimer'
|
2023-05-03 18:17:42 +00:00
|
|
|
import { LogModal } from './LogModal'
|
2022-07-13 13:56:36 +00:00
|
|
|
import { SidebarLayout } from './SidebarLayout'
|
|
|
|
import { WalletLoader } from './WalletLoader'
|
|
|
|
|
|
|
|
export const Sidebar = () => {
|
|
|
|
const router = useRouter()
|
|
|
|
const wallet = useWallet()
|
2023-05-03 18:17:42 +00:00
|
|
|
const logs = useLogStore()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (logs.itemList.length === 0) return
|
|
|
|
console.log('Stringified log item list: ', JSON.stringify(logs.itemList))
|
|
|
|
window.localStorage.setItem('logs', JSON.stringify(logs.itemList))
|
|
|
|
}, [logs])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
console.log(window.localStorage.getItem('logs'))
|
|
|
|
setLogItemList(JSON.parse(window.localStorage.getItem('logs') || '[]'))
|
|
|
|
}, [])
|
2022-07-13 13:56:36 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<SidebarLayout>
|
|
|
|
{/* Stargaze brand as home button */}
|
|
|
|
<Anchor href="/" onContextMenu={(e) => [e.preventDefault(), router.push('/brand')]}>
|
2022-09-19 08:41:40 +00:00
|
|
|
<img alt="Brand Text" className="w-full" src="/stargaze_logo_800.svg" />
|
2022-07-13 13:56:36 +00:00
|
|
|
</Anchor>
|
|
|
|
{/* wallet button */}
|
|
|
|
<WalletLoader />
|
|
|
|
{/* main navigation routes */}
|
2023-02-22 17:52:00 +00:00
|
|
|
|
2023-02-14 17:45:25 +00:00
|
|
|
<div className="absolute top-[20%] left-[5%]">
|
2023-02-15 14:17:30 +00:00
|
|
|
<ul className="group p-2 w-full bg-transparent menu rounded-box">
|
2023-02-14 17:45:25 +00:00
|
|
|
<li tabIndex={0}>
|
2023-02-16 07:51:30 +00:00
|
|
|
<div
|
2023-02-14 17:45:25 +00:00
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'z-40 text-xl font-bold group-hover:text-white bg-transparent rounded-lg small-caps',
|
2023-02-14 17:45:25 +00:00
|
|
|
'hover:bg-white/5 transition-colors',
|
|
|
|
router.asPath.includes('/collections/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
>
|
2023-02-16 07:51:30 +00:00
|
|
|
<Link href="/collections/" passHref>
|
|
|
|
Collections
|
|
|
|
</Link>
|
|
|
|
</div>
|
2023-02-14 17:45:25 +00:00
|
|
|
<ul className="z-50 p-2 bg-base-200">
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/collections/create') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/collections/create/">Create a Collection</Link>
|
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/collections/myCollections/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/collections/myCollections/">My Collections</Link>
|
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/collections/actions/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/collections/actions/">Collection Actions</Link>
|
|
|
|
</li>
|
2023-02-23 08:33:42 +00:00
|
|
|
<Conditional test={NETWORK === 'mainnet'}>
|
|
|
|
<li className={clsx('text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded')} tabIndex={-1}>
|
|
|
|
<label
|
2023-02-23 09:25:35 +00:00
|
|
|
className="w-full h-full text-lg font-bold text-gray hover:text-white normal-case bg-clip-text bg-transparent border-none animate-none btn modal-button"
|
2023-02-23 08:33:42 +00:00
|
|
|
htmlFor="my-modal-1"
|
|
|
|
>
|
2023-02-23 14:59:41 +00:00
|
|
|
Revenue Dashboard
|
2023-02-23 08:33:42 +00:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</Conditional>
|
2023-02-14 17:45:25 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<Conditional test={BADGE_HUB_ADDRESS !== undefined}>
|
2023-02-15 14:17:30 +00:00
|
|
|
<ul className="group p-2 w-full bg-transparent menu rounded-box">
|
2023-02-14 17:45:25 +00:00
|
|
|
<li tabIndex={0}>
|
|
|
|
<span
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'z-40 text-xl font-bold group-hover:text-white bg-transparent rounded-lg small-caps',
|
2023-02-14 17:45:25 +00:00
|
|
|
'hover:bg-white/5 transition-colors',
|
|
|
|
router.asPath.includes('/badges/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<Link href="/badges/"> Badges </Link>
|
|
|
|
</span>
|
|
|
|
<ul className="z-50 p-2 rounded-box bg-base-200">
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/badges/create/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/badges/create/">Create a Badge</Link>
|
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/badges/myBadges/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/badges/myBadges/">My Badges</Link>
|
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/badges/actions/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/badges/actions/">Badge Actions</Link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</Conditional>
|
2023-02-15 14:17:30 +00:00
|
|
|
<ul className="group p-2 w-full bg-transparent menu rounded-box">
|
2023-02-14 17:45:25 +00:00
|
|
|
<li tabIndex={0}>
|
|
|
|
<span
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'z-40 text-xl font-bold group-hover:text-white bg-transparent rounded-lg small-caps',
|
2023-02-14 17:45:25 +00:00
|
|
|
'hover:bg-white/5 transition-colors',
|
|
|
|
router.asPath.includes('/contracts/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/"> Contract Dashboards </Link>
|
|
|
|
</span>
|
|
|
|
<ul className="z-50 p-2 bg-base-200">
|
|
|
|
<Conditional test={BASE_FACTORY_ADDRESS !== undefined}>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/contracts/baseMinter/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/baseMinter/">Base Minter Contract</Link>
|
|
|
|
</li>
|
|
|
|
</Conditional>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/contracts/vendingMinter/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/vendingMinter/">Vending Minter Contract</Link>
|
|
|
|
</li>
|
2023-06-17 09:03:23 +00:00
|
|
|
<Conditional test={OPEN_EDITION_FACTORY_ADDRESS !== undefined}>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
|
|
|
router.asPath.includes('/contracts/openEditionMinter/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/openEditionMinter/">Open Edition Minter Contract</Link>
|
|
|
|
</li>
|
|
|
|
</Conditional>
|
2023-02-14 17:45:25 +00:00
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/contracts/sg721/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/sg721/">SG721 Contract</Link>
|
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/contracts/whitelist/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/whitelist/">Whitelist Contract</Link>
|
|
|
|
</li>
|
|
|
|
<Conditional test={BADGE_HUB_ADDRESS !== undefined}>
|
|
|
|
<li
|
|
|
|
className={clsx(
|
2023-02-16 07:51:30 +00:00
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
2023-02-14 17:45:25 +00:00
|
|
|
router.asPath.includes('/contracts/badgeHub/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/badgeHub/">Badge Hub Contract</Link>
|
|
|
|
</li>
|
|
|
|
</Conditional>
|
2023-03-19 18:18:43 +00:00
|
|
|
<li
|
|
|
|
className={clsx(
|
|
|
|
'text-lg font-bold hover:text-white hover:bg-stargaze-80 rounded',
|
|
|
|
router.asPath.includes('/contracts/splits/') ? 'text-white' : 'text-gray',
|
|
|
|
)}
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
<Link href="/contracts/splits/">Splits Contract</Link>
|
|
|
|
</li>
|
2023-02-14 17:45:25 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2022-07-13 13:56:36 +00:00
|
|
|
|
2023-02-23 08:33:42 +00:00
|
|
|
<IncomeDashboardDisclaimer creatorAddress={wallet.address ? wallet.address : ''} />
|
2023-05-03 18:17:42 +00:00
|
|
|
<LogModal />
|
2023-02-23 08:33:42 +00:00
|
|
|
|
2022-07-13 13:56:36 +00:00
|
|
|
<div className="flex-grow" />
|
2023-05-03 18:17:42 +00:00
|
|
|
{logs.itemList.length > 0 && (
|
|
|
|
<label
|
|
|
|
className="w-[65%] h-[4px] text-lg font-bold text-white normal-case bg-blue-500 hover:bg-blue-600 border-none animate-none btn modal-button"
|
|
|
|
htmlFor="my-modal-8"
|
|
|
|
>
|
|
|
|
View Logs
|
|
|
|
</label>
|
|
|
|
)}
|
2022-07-13 13:56:36 +00:00
|
|
|
{/* Stargaze network status */}
|
2022-07-25 08:29:52 +00:00
|
|
|
<div className="text-sm capitalize">Network: {wallet.network}</div>
|
2022-07-13 13:56:36 +00:00
|
|
|
|
|
|
|
{/* footer reference links */}
|
|
|
|
<ul className="text-sm list-disc list-inside">
|
|
|
|
{footerLinks.map(({ href, text }) => (
|
|
|
|
<li key={href}>
|
|
|
|
<Anchor className="hover:text-plumbus hover:underline" href={href}>
|
|
|
|
{text}
|
|
|
|
</Anchor>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
{/* footer attribution */}
|
2022-08-16 07:28:18 +00:00
|
|
|
<div className="text-xs text-white/50">
|
|
|
|
Stargaze Studio {process.env.APP_VERSION} <br />
|
|
|
|
Made by{' '}
|
|
|
|
<Anchor className="text-plumbus hover:underline" href="https://deuslabs.fi">
|
|
|
|
deus labs
|
|
|
|
</Anchor>
|
|
|
|
</div>
|
2022-07-13 13:56:36 +00:00
|
|
|
|
|
|
|
{/* footer social links */}
|
|
|
|
<div className="flex gap-x-6 items-center text-white/75">
|
|
|
|
{socialsLinks.map(({ Icon, href, text }) => (
|
|
|
|
<Anchor key={href} className="hover:text-plumbus" href={href}>
|
|
|
|
<Icon aria-label={text} size={20} />
|
|
|
|
</Anchor>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</SidebarLayout>
|
|
|
|
)
|
|
|
|
}
|