Portfolio page! Add to sidebar when signed in, move about into more.
This commit is contained in:
parent
5dcd43f5b2
commit
d7b702fe00
|
@ -17,10 +17,10 @@ export function getNavigationOptions(user?: User | null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ name: 'Your trades', href: '/trades' },
|
|
||||||
{ name: 'Add funds', href: '/add-funds' },
|
{ name: 'Add funds', href: '/add-funds' },
|
||||||
{ name: 'Leaderboards', href: '/leaderboards' },
|
{ name: 'Leaderboards', href: '/leaderboards' },
|
||||||
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
|
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
|
||||||
|
{ name: 'About', href: 'https://docs.manifold.markets' },
|
||||||
{ name: 'Sign out', href: '#', onClick: () => firebaseLogout() },
|
{ name: 'Sign out', href: '#', onClick: () => firebaseLogout() },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {
|
||||||
UserGroupIcon,
|
UserGroupIcon,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
BookOpenIcon,
|
BookOpenIcon,
|
||||||
|
TableIcon,
|
||||||
DotsHorizontalIcon,
|
DotsHorizontalIcon,
|
||||||
} from '@heroicons/react/outline'
|
} from '@heroicons/react/outline'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
@ -17,6 +18,12 @@ import { MenuButton } from './menu'
|
||||||
import { getNavigationOptions, ProfileSummary } from './profile-menu'
|
import { getNavigationOptions, ProfileSummary } from './profile-menu'
|
||||||
|
|
||||||
const navigation = [
|
const navigation = [
|
||||||
|
{ name: 'Home', href: '/home', icon: HomeIcon },
|
||||||
|
{ name: 'Markets', href: '/markets', icon: SearchIcon },
|
||||||
|
{ name: 'Portfolio', href: '/portfolio', icon: TableIcon },
|
||||||
|
]
|
||||||
|
|
||||||
|
const signedOutNavigation = [
|
||||||
{ name: 'Home', href: '/home', icon: HomeIcon },
|
{ name: 'Home', href: '/home', icon: HomeIcon },
|
||||||
{ name: 'Markets', href: '/markets', icon: SearchIcon },
|
{ name: 'Markets', href: '/markets', icon: SearchIcon },
|
||||||
{ name: 'About', href: 'https://docs.manifold.markets', icon: BookOpenIcon },
|
{ name: 'About', href: 'https://docs.manifold.markets', icon: BookOpenIcon },
|
||||||
|
@ -76,6 +83,8 @@ export default function Sidebar() {
|
||||||
let folds = useFollowedFolds(user) || []
|
let folds = useFollowedFolds(user) || []
|
||||||
folds = _.sortBy(folds, 'followCount').reverse()
|
folds = _.sortBy(folds, 'followCount').reverse()
|
||||||
|
|
||||||
|
const navigationOptions = user === null ? signedOutNavigation : navigation
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav
|
<nav
|
||||||
aria-label="Sidebar"
|
aria-label="Sidebar"
|
||||||
|
@ -107,7 +116,7 @@ export default function Sidebar() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-1 py-6">
|
<div className="space-y-1 py-6">
|
||||||
{navigation.map((item) => (
|
{navigationOptions.map((item) => (
|
||||||
<SidebarItem key={item.name} item={item} currentPage={currentPage} />
|
<SidebarItem key={item.name} item={item} currentPage={currentPage} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
|
24
web/pages/portfolio.tsx
Normal file
24
web/pages/portfolio.tsx
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import Router from 'next/router'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
import { BetsList } from '../components/bets-list'
|
||||||
|
import { Page } from '../components/page'
|
||||||
|
import { SEO } from '../components/SEO'
|
||||||
|
import { Title } from '../components/title'
|
||||||
|
import { useUser } from '../hooks/use-user'
|
||||||
|
|
||||||
|
export default function PortfolioPage() {
|
||||||
|
const user = useUser()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (user === null) Router.replace('/')
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page>
|
||||||
|
<SEO title="Portfolio" description="Portfolio" url="/portfolio" />
|
||||||
|
<Title className="mx-4 md:mx-0" text="Portfolio" />
|
||||||
|
{user && <BetsList user={user} />}
|
||||||
|
</Page>
|
||||||
|
)
|
||||||
|
}
|
|
@ -1,24 +1,17 @@
|
||||||
import Router from 'next/router'
|
import Router from 'next/router'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
import { BetsList } from '../components/bets-list'
|
|
||||||
import { Page } from '../components/page'
|
|
||||||
import { SEO } from '../components/SEO'
|
|
||||||
import { Title } from '../components/title'
|
|
||||||
import { useUser } from '../hooks/use-user'
|
import { useUser } from '../hooks/use-user'
|
||||||
|
|
||||||
|
// Deprecated: redirects to /portfolio.
|
||||||
|
// Eventually, this will be removed.
|
||||||
export default function TradesPage() {
|
export default function TradesPage() {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
if (user === null) {
|
useEffect(() => {
|
||||||
Router.replace('/')
|
if (user === null) Router.replace('/')
|
||||||
return <></>
|
else Router.replace('/portfolio')
|
||||||
}
|
})
|
||||||
|
|
||||||
return (
|
return <></>
|
||||||
<Page>
|
|
||||||
<SEO title="Your trades" description="Your trades" url="/trades" />
|
|
||||||
<Title className="mx-4 md:mx-0" text="Your trades" />
|
|
||||||
{user && <BetsList user={user} />}
|
|
||||||
</Page>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
<url><loc>https://manifold.markets/markets</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
<url><loc>https://manifold.markets/markets</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
||||||
<url><loc>https://manifold.markets/profile</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
<url><loc>https://manifold.markets/profile</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
||||||
<url><loc>https://manifold.markets/simulator</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
<url><loc>https://manifold.markets/simulator</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
||||||
<url><loc>https://manifold.markets/trades</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
<url><loc>https://manifold.markets/portfolio</loc><changefreq>hourly</changefreq><priority>0.7</priority><lastmod>2022-03-24T16:51:19.526Z</lastmod></url>
|
||||||
</urlset>
|
</urlset>
|
Loading…
Reference in New Issue
Block a user