sidebar ordering

This commit is contained in:
mantikoros 2022-08-29 00:00:58 -05:00
parent 62e72b2091
commit 6facf3b7a7
2 changed files with 9 additions and 8 deletions

View File

@ -20,7 +20,6 @@ import React from 'react'
import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants'
import { CreateQuestionButton } from 'web/components/create-question-button' import { CreateQuestionButton } from 'web/components/create-question-button'
import { trackCallback, withTracking } from 'web/lib/service/analytics' import { trackCallback, withTracking } from 'web/lib/service/analytics'
import { Spacer } from '../layout/spacer'
import { CHALLENGES_ENABLED } from 'common/challenge' import { CHALLENGES_ENABLED } from 'common/challenge'
import { buildArray } from 'common/util/array' import { buildArray } from 'common/util/array'
import TrophyIcon from 'web/lib/icons/trophy-icon' import TrophyIcon from 'web/lib/icons/trophy-icon'
@ -66,10 +65,10 @@ function getMoreNavigation(user?: User | null) {
if (!user) { if (!user) {
// Signed out "More" // Signed out "More"
return buildArray( return buildArray(
{ name: 'Leaderboards', href: '/leaderboards' },
{ name: 'Groups', href: '/groups' },
CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' }, CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' },
[ [
{ name: 'Groups', href: '/groups' },
{ name: 'Leaderboards', href: '/leaderboards' },
{ name: 'Tournaments', href: '/tournaments' }, { name: 'Tournaments', href: '/tournaments' },
{ name: 'Charity', href: '/charity' }, { name: 'Charity', href: '/charity' },
{ name: 'Blog', href: 'https://news.manifold.markets' }, { name: 'Blog', href: 'https://news.manifold.markets' },
@ -81,11 +80,11 @@ function getMoreNavigation(user?: User | null) {
// Signed in "More" // Signed in "More"
return buildArray( return buildArray(
{ name: 'Leaderboards', href: '/leaderboards' },
{ name: 'Groups', href: '/groups' },
CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' }, CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' },
[ [
{ name: 'Groups', href: '/groups' },
{ name: 'Referrals', href: '/referrals' }, { name: 'Referrals', href: '/referrals' },
{ name: 'Leaderboards', href: '/leaderboards' },
{ name: 'Charity', href: '/charity' }, { name: 'Charity', href: '/charity' },
{ name: 'Send M$', href: '/links' }, { name: 'Send M$', href: '/links' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
@ -233,9 +232,8 @@ export default function Sidebar(props: { className?: string }) {
> >
<ManifoldLogo className="py-6" twoLine /> <ManifoldLogo className="py-6" twoLine />
{user ? <CreateQuestionButton user={user} /> : <SignInButton />} {!user && <SignInButton className="mb-4" />}
<Spacer h={4} />
{user && ( {user && (
<div className="min-h-[80px] w-full"> <div className="min-h-[80px] w-full">
<ProfileSummary user={user} /> <ProfileSummary user={user} />
@ -265,6 +263,8 @@ export default function Sidebar(props: { className?: string }) {
menuItems={getMoreNavigation(user)} menuItems={getMoreNavigation(user)}
buttonContent={<MoreButton />} buttonContent={<MoreButton />}
/> />
{user && <CreateQuestionButton user={user} />}
</div> </div>
</nav> </nav>
) )

View File

@ -4,7 +4,7 @@ import { useRouter } from 'next/router'
import { firebaseLogin } from 'web/lib/firebase/users' import { firebaseLogin } from 'web/lib/firebase/users'
import { Button } from './button' import { Button } from './button'
export const SignInButton = () => { export const SignInButton = (props: { className?: string }) => {
const router = useRouter() const router = useRouter()
return ( return (
@ -17,6 +17,7 @@ export const SignInButton = () => {
await firebaseLogin() await firebaseLogin()
router.replace(router.asPath) router.replace(router.asPath)
}} }}
className={props.className}
> >
Sign in Sign in
</Button> </Button>