From 5978f4b1cb81e640d972103792c82d4521773d4b Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sun, 29 May 2022 17:33:41 -0700 Subject: [PATCH] Show blog link in sidebar --- web/components/nav/profile-menu.tsx | 23 -------------------- web/components/nav/sidebar.tsx | 33 ++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/web/components/nav/profile-menu.tsx b/web/components/nav/profile-menu.tsx index 0082e4ca..e026b35d 100644 --- a/web/components/nav/profile-menu.tsx +++ b/web/components/nav/profile-menu.tsx @@ -4,29 +4,6 @@ import { formatMoney } from 'common/util/format' import { Avatar } from '../avatar' import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' -export function getNavigationOptions(user?: User | null) { - if (IS_PRIVATE_MANIFOLD) { - return [{ name: 'Leaderboards', href: '/leaderboards' }] - } - - if (!user) { - return [ - { name: 'Leaderboards', href: '/leaderboards' }, - { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, - { name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' }, - ] - } - - return [ - { name: 'Add funds', href: '/add-funds' }, - { name: 'Leaderboards', href: '/leaderboards' }, - { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, - { name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' }, - { name: 'About', href: 'https://docs.manifold.markets' }, - { name: 'Sign out', href: '#', onClick: () => firebaseLogout() }, - ] -} - export function ProfileSummary(props: { user: User }) { const { user } = props return ( diff --git a/web/components/nav/sidebar.tsx b/web/components/nav/sidebar.tsx index 33a84191..db81b97d 100644 --- a/web/components/nav/sidebar.tsx +++ b/web/components/nav/sidebar.tsx @@ -9,6 +9,7 @@ import { PresentationChartLineIcon, ChatAltIcon, SparklesIcon, + NewspaperIcon, } from '@heroicons/react/outline' import clsx from 'clsx' import { sortBy } from 'lodash' @@ -16,16 +17,17 @@ import Link from 'next/link' import { useRouter } from 'next/router' import { useFollowedFolds } from 'web/hooks/use-fold' import { useUser } from 'web/hooks/use-user' -import { firebaseLogin, firebaseLogout } from 'web/lib/firebase/users' +import { firebaseLogin, firebaseLogout, User } from 'web/lib/firebase/users' import { ManifoldLogo } from './manifold-logo' import { MenuButton } from './menu' -import { getNavigationOptions, ProfileSummary } from './profile-menu' +import { ProfileSummary } from './profile-menu' import { getUtcFreeMarketResetTime, useHasCreatedContractToday, } from 'web/hooks/use-has-created-contract-today' import { Row } from '../layout/row' import React, { useEffect, useState } from 'react' +import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' // Create an icon from the url of an image function IconFromUrl(url: string): React.ComponentType<{ className?: string }> { @@ -47,6 +49,30 @@ function getNavigation(username: string) { ] } +function getMoreNavigation(user?: User | null) { + if (IS_PRIVATE_MANIFOLD) { + return [{ name: 'Leaderboards', href: '/leaderboards' }] + } + + if (!user) { + return [ + { name: 'Leaderboards', href: '/leaderboards' }, + { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, + { name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' }, + ] + } + + return [ + { name: 'Add funds', href: '/add-funds' }, + { name: 'Leaderboards', href: '/leaderboards' }, + { name: 'Blog', href: 'https://news.manifold.markets' }, + { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, + { name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' }, + { name: 'About', href: 'https://docs.manifold.markets' }, + { name: 'Sign out', href: '#', onClick: () => firebaseLogout() }, + ] +} + const signedOutNavigation = [ { name: 'Home', href: '/home', icon: HomeIcon }, { name: 'Explore', href: '/markets', icon: SearchIcon }, @@ -57,6 +83,7 @@ const signedOutNavigation = [ const signedOutMobileNavigation = [ { name: 'Charity', href: '/charity', icon: HeartIcon }, { name: 'Leaderboards', href: '/leaderboards', icon: CakeIcon }, + { name: 'Blog', href: 'https://news.manifold.markets', icon: NewspaperIcon }, { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh', @@ -193,7 +220,7 @@ export default function Sidebar(props: { className?: string }) { ))} } />