Show blog link in sidebar
This commit is contained in:
		
							parent
							
								
									23944bf47a
								
							
						
					
					
						commit
						5978f4b1cb
					
				|  | @ -4,29 +4,6 @@ import { formatMoney } from 'common/util/format' | ||||||
| import { Avatar } from '../avatar' | import { Avatar } from '../avatar' | ||||||
| import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' | 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 }) { | export function ProfileSummary(props: { user: User }) { | ||||||
|   const { user } = props |   const { user } = props | ||||||
|   return ( |   return ( | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ import { | ||||||
|   PresentationChartLineIcon, |   PresentationChartLineIcon, | ||||||
|   ChatAltIcon, |   ChatAltIcon, | ||||||
|   SparklesIcon, |   SparklesIcon, | ||||||
|  |   NewspaperIcon, | ||||||
| } from '@heroicons/react/outline' | } from '@heroicons/react/outline' | ||||||
| import clsx from 'clsx' | import clsx from 'clsx' | ||||||
| import { sortBy } from 'lodash' | import { sortBy } from 'lodash' | ||||||
|  | @ -16,16 +17,17 @@ import Link from 'next/link' | ||||||
| import { useRouter } from 'next/router' | import { useRouter } from 'next/router' | ||||||
| import { useFollowedFolds } from 'web/hooks/use-fold' | import { useFollowedFolds } from 'web/hooks/use-fold' | ||||||
| import { useUser } from 'web/hooks/use-user' | 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 { ManifoldLogo } from './manifold-logo' | ||||||
| import { MenuButton } from './menu' | import { MenuButton } from './menu' | ||||||
| import { getNavigationOptions, ProfileSummary } from './profile-menu' | import { ProfileSummary } from './profile-menu' | ||||||
| import { | import { | ||||||
|   getUtcFreeMarketResetTime, |   getUtcFreeMarketResetTime, | ||||||
|   useHasCreatedContractToday, |   useHasCreatedContractToday, | ||||||
| } from 'web/hooks/use-has-created-contract-today' | } from 'web/hooks/use-has-created-contract-today' | ||||||
| import { Row } from '../layout/row' | import { Row } from '../layout/row' | ||||||
| import React, { useEffect, useState } from 'react' | import React, { useEffect, useState } from 'react' | ||||||
|  | import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' | ||||||
| 
 | 
 | ||||||
| // Create an icon from the url of an image
 | // Create an icon from the url of an image
 | ||||||
| function IconFromUrl(url: string): React.ComponentType<{ className?: string }> { | 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 = [ | const signedOutNavigation = [ | ||||||
|   { name: 'Home', href: '/home', icon: HomeIcon }, |   { name: 'Home', href: '/home', icon: HomeIcon }, | ||||||
|   { name: 'Explore', href: '/markets', icon: SearchIcon }, |   { name: 'Explore', href: '/markets', icon: SearchIcon }, | ||||||
|  | @ -57,6 +83,7 @@ const signedOutNavigation = [ | ||||||
| const signedOutMobileNavigation = [ | const signedOutMobileNavigation = [ | ||||||
|   { name: 'Charity', href: '/charity', icon: HeartIcon }, |   { name: 'Charity', href: '/charity', icon: HeartIcon }, | ||||||
|   { name: 'Leaderboards', href: '/leaderboards', icon: CakeIcon }, |   { name: 'Leaderboards', href: '/leaderboards', icon: CakeIcon }, | ||||||
|  |   { name: 'Blog', href: 'https://news.manifold.markets', icon: NewspaperIcon }, | ||||||
|   { |   { | ||||||
|     name: 'Discord', |     name: 'Discord', | ||||||
|     href: 'https://discord.gg/eHQBNBqXuh', |     href: 'https://discord.gg/eHQBNBqXuh', | ||||||
|  | @ -193,7 +220,7 @@ export default function Sidebar(props: { className?: string }) { | ||||||
|         ))} |         ))} | ||||||
| 
 | 
 | ||||||
|         <MenuButton |         <MenuButton | ||||||
|           menuItems={getNavigationOptions(user)} |           menuItems={getMoreNavigation(user)} | ||||||
|           buttonContent={<MoreButton />} |           buttonContent={<MoreButton />} | ||||||
|         /> |         /> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user