Replace /portfolio with /Austin?tab=Bets

This commit is contained in:
Austin Chen 2022-05-18 09:27:23 -04:00
parent 1422749aaf
commit c2b1ceabfa
3 changed files with 18 additions and 9 deletions

View File

@ -47,7 +47,7 @@ export function BottomNavBar() {
)}
{user !== null && (
<Link href="/portfolio">
<Link href={`${user}?tab=Bets`}>
<a className="block w-full py-1 px-3 text-center hover:bg-indigo-200 hover:text-indigo-700">
<PresentationChartLineIcon
className="my-1 mx-auto h-6 w-6"

View File

@ -28,12 +28,18 @@ function IconFromUrl(url: string): React.ComponentType<{ className?: string }> {
}
}
const navigation = [
{ name: 'Home', href: '/home', icon: HomeIcon },
{ name: 'Activity', href: '/activity', icon: ChatAltIcon },
{ name: 'Portfolio', href: '/portfolio', icon: PresentationChartLineIcon },
{ name: 'Charity', href: '/charity', icon: HeartIcon },
]
function getNavigation(userName: string) {
return [
{ name: 'Home', href: '/home', icon: HomeIcon },
{ name: 'Activity', href: '/activity', icon: ChatAltIcon },
{
name: 'Portfolio',
href: `${userName}?tab=Bets`,
icon: PresentationChartLineIcon,
},
{ name: 'Charity', href: '/charity', icon: HeartIcon },
]
}
const signedOutNavigation = [
{ name: 'Home', href: '/home', icon: HomeIcon },
@ -119,7 +125,8 @@ export default function Sidebar(props: { className?: string }) {
folds = _.sortBy(folds, 'followCount').reverse()
const deservesDailyFreeMarket = !useHasCreatedContractToday(user)
const navigationOptions = user === null ? signedOutNavigation : navigation
const navigationOptions =
user === null ? signedOutNavigation : getNavigation(user?.name || 'error')
const mobileNavigationOptions =
user === null ? signedOutMobileNavigation : mobileNavigation

View File

@ -192,7 +192,9 @@ export function UserPage(props: {
{usersContracts !== 'loading' && commentsByContract != 'loading' ? (
<Tabs
className={'pb-2 pt-1 '}
defaultIndex={defaultTabTitle === 'Comments' ? 1 : 0}
defaultIndex={['Markets', 'Comments', 'Bets'].indexOf(
defaultTabTitle
)}
onClick={(tabName) =>
router.push(
{