Home: remove tabs for Recent activity vs Explore
This commit is contained in:
parent
076f2979b4
commit
20db898753
|
@ -1,14 +1,10 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Router from 'next/router'
|
import Router from 'next/router'
|
||||||
import { SparklesIcon, GlobeAltIcon } from '@heroicons/react/solid'
|
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
import { Contract } from '../lib/firebase/contracts'
|
import { Contract } from '../lib/firebase/contracts'
|
||||||
import { Page } from '../components/page'
|
import { Page } from '../components/page'
|
||||||
import {
|
import { ActivityFeed } from '../components/feed/activity-feed'
|
||||||
ActivityFeed,
|
|
||||||
SummaryActivityFeed,
|
|
||||||
} from '../components/feed/activity-feed'
|
|
||||||
import { Comment } from '../lib/firebase/comments'
|
import { Comment } from '../lib/firebase/comments'
|
||||||
import FeedCreate from '../components/feed-create'
|
import FeedCreate from '../components/feed-create'
|
||||||
import { Spacer } from '../components/layout/spacer'
|
import { Spacer } from '../components/layout/spacer'
|
||||||
|
@ -18,7 +14,6 @@ import { Fold } from '../../common/fold'
|
||||||
import { LoadingIndicator } from '../components/loading-indicator'
|
import { LoadingIndicator } from '../components/loading-indicator'
|
||||||
import {
|
import {
|
||||||
getAllContractInfo,
|
getAllContractInfo,
|
||||||
useExploreContracts,
|
|
||||||
useFilterYourContracts,
|
useFilterYourContracts,
|
||||||
useFindActiveContracts,
|
useFindActiveContracts,
|
||||||
} from '../hooks/use-find-active-contracts'
|
} from '../hooks/use-find-active-contracts'
|
||||||
|
@ -26,7 +21,6 @@ import { fromPropz, usePropz } from '../hooks/use-propz'
|
||||||
import { useGetRecentBets, useRecentBets } from '../hooks/use-bets'
|
import { useGetRecentBets, useRecentBets } from '../hooks/use-bets'
|
||||||
import { useActiveContracts } from '../hooks/use-contracts'
|
import { useActiveContracts } from '../hooks/use-contracts'
|
||||||
import { useRecentComments } from '../hooks/use-comments'
|
import { useRecentComments } from '../hooks/use-comments'
|
||||||
import { Tabs } from '../components/layout/tabs'
|
|
||||||
|
|
||||||
export const getStaticProps = fromPropz(getStaticPropz)
|
export const getStaticProps = fromPropz(getStaticPropz)
|
||||||
export async function getStaticPropz() {
|
export async function getStaticPropz() {
|
||||||
|
@ -52,11 +46,7 @@ const Home = (props: {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
const contracts = useActiveContracts() ?? props.contracts
|
const contracts = useActiveContracts() ?? props.contracts
|
||||||
const { yourContracts, initialFollowedFoldSlugs } = useFilterYourContracts(
|
const { yourContracts } = useFilterYourContracts(user, folds, contracts)
|
||||||
user,
|
|
||||||
folds,
|
|
||||||
contracts
|
|
||||||
)
|
|
||||||
|
|
||||||
const initialRecentBets = useGetRecentBets()
|
const initialRecentBets = useGetRecentBets()
|
||||||
const recentBets = useRecentBets() ?? initialRecentBets
|
const recentBets = useRecentBets() ?? initialRecentBets
|
||||||
|
@ -68,8 +58,6 @@ const Home = (props: {
|
||||||
recentComments: props.recentComments,
|
recentComments: props.recentComments,
|
||||||
})
|
})
|
||||||
|
|
||||||
const exploreContracts = useExploreContracts()
|
|
||||||
|
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
Router.replace('/')
|
Router.replace('/')
|
||||||
return <></>
|
return <></>
|
||||||
|
@ -104,28 +92,7 @@ const Home = (props: {
|
||||||
|
|
||||||
<Spacer h={5} />
|
<Spacer h={5} />
|
||||||
|
|
||||||
<Tabs
|
{activityContent}
|
||||||
tabs={[
|
|
||||||
{
|
|
||||||
title: 'Recent activity',
|
|
||||||
tabIcon: (
|
|
||||||
<SparklesIcon className="inline h-5 w-5" aria-hidden="true" />
|
|
||||||
),
|
|
||||||
content: activityContent,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Explore',
|
|
||||||
tabIcon: (
|
|
||||||
<GlobeAltIcon className="inline h-5 w-5" aria-hidden="true" />
|
|
||||||
),
|
|
||||||
content: exploreContracts ? (
|
|
||||||
<SummaryActivityFeed contracts={exploreContracts} />
|
|
||||||
) : (
|
|
||||||
<LoadingIndicator className="mt-4" />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</Col>
|
</Col>
|
||||||
</Col>
|
</Col>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user