stargaze-studio/components/Sidebar.tsx

245 lines
9.7 KiB
TypeScript
Raw Normal View History

2023-02-14 17:45:25 +00:00
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
2022-07-13 13:56:36 +00:00
import clsx from 'clsx'
import { Anchor } from 'components/Anchor'
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'
// import BrandText from 'public/brand/brand-text.svg'
import { footerLinks, socialsLinks } from 'utils/links'
2022-07-13 13:56:36 +00:00
import { BADGE_HUB_ADDRESS, BASE_FACTORY_ADDRESS, NETWORK } from '../utils/constants'
2023-02-14 17:45:25 +00:00
import { Conditional } from './Conditional'
import { IncomeDashboardDisclaimer } from './IncomeDashboardDisclaimer'
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()
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-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>
<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"
htmlFor="my-modal-1"
>
2023-02-23 14:59:41 +00:00
Revenue Dashboard
</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>
<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>
<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
<IncomeDashboardDisclaimer creatorAddress={wallet.address ? wallet.address : ''} />
2022-07-13 13:56:36 +00:00
<div className="flex-grow" />
{/* Stargaze network status */}
<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 */}
<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>
)
}