From af86bc1acf5e45cfc299db2892a37032894f2e8d Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Wed, 30 Mar 2022 22:57:19 -0700 Subject: [PATCH] Use tabs component on /home --- web/pages/home.tsx | 83 ++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 50 deletions(-) diff --git a/web/pages/home.tsx b/web/pages/home.tsx index ee2e72e2..1ce07ef3 100644 --- a/web/pages/home.tsx +++ b/web/pages/home.tsx @@ -1,7 +1,6 @@ -import React, { useState } from 'react' +import React from 'react' import Router from 'next/router' import { SparklesIcon, GlobeAltIcon } from '@heroicons/react/solid' -import clsx from 'clsx' import _ from 'lodash' import { Contract } from '../lib/firebase/contracts' @@ -17,8 +16,6 @@ import { Col } from '../components/layout/col' import { useUser } from '../hooks/use-user' import { Fold } from '../../common/fold' import { LoadingIndicator } from '../components/loading-indicator' -import { Row } from '../components/layout/row' -import { FastFoldFollowing } from '../components/folds/fast-fold-following' import { getAllContractInfo, useExploreContracts, @@ -29,7 +26,7 @@ import { fromPropz, usePropz } from '../hooks/use-propz' import { useGetRecentBets, useRecentBets } from '../hooks/use-bets' import { useActiveContracts } from '../hooks/use-contracts' import { useRecentComments } from '../hooks/use-comments' -import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' +import { Tabs } from '../components/layout/tabs' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz() { @@ -73,13 +70,22 @@ const Home = (props: { const exploreContracts = useExploreContracts() - const [feedMode, setFeedMode] = useState<'activity' | 'explore'>('activity') - if (user === null) { Router.replace('/') return <> } + const activityContent = recentBets ? ( + + ) : ( + + ) + return ( @@ -98,51 +104,28 @@ const Home = (props: { - - -
-
setFeedMode('activity')} - > +
-
setFeedMode('explore')} - > + ), + content: activityContent, + }, + { + title: 'Explore', + tabIcon: (
-
-
- - - {feedMode === 'activity' && - (recentBets ? ( - - ) : ( - - ))} - - {feedMode === 'explore' && - (exploreContracts ? ( - - ) : ( - - ))} + ), + content: exploreContracts ? ( + + ) : ( + + ), + }, + ]} + />