Always show follow a community prompt

This commit is contained in:
James Grugett 2022-02-06 20:03:42 -06:00
parent ab6cfd2564
commit faa49b750e

View File

@ -62,9 +62,9 @@ const Home = (props: {
contracts.map((contract, index) => [contract.id, index]) contracts.map((contract, index) => [contract.id, index])
) )
const followedFoldIds = useFollowedFolds(user) ?? [] const followedFoldIds = useFollowedFolds(user)
const followedFolds = filterDefined( const followedFolds = filterDefined(
followedFoldIds.map((id) => folds.find((fold) => fold.id === id)) (followedFoldIds ?? []).map((id) => folds.find((fold) => fold.id === id))
) )
const tagSet = new Set( const tagSet = new Set(
_.flatten(followedFolds.map((fold) => fold.lowercaseTags)) _.flatten(followedFolds.map((fold) => fold.lowercaseTags))
@ -75,10 +75,12 @@ const Home = (props: {
? new Set(yourBetContractIds) ? new Set(yourBetContractIds)
: undefined : undefined
// By default, show all contracts // Show no contracts before your info is loaded.
let feedContracts = contracts let feedContracts: Contract[] = []
// If the user is following any folds, then exclude all other contracts if (yourBetContracts && followedFoldIds) {
if (yourBetContracts && followedFoldIds.length > 0) { // Show all contracts if no folds are followed.
if (followedFoldIds.length === 0) feedContracts = contracts
else
feedContracts = contracts.filter( feedContracts = contracts.filter(
(contract) => (contract) =>
contract.lowercaseTags.some((tag) => tagSet.has(tag)) || contract.lowercaseTags.some((tag) => tagSet.has(tag)) ||
@ -145,8 +147,6 @@ const Home = (props: {
<Row className="text-sm text-gray-800 mx-3 mb-3 gap-2 items-center"> <Row className="text-sm text-gray-800 mx-3 mb-3 gap-2 items-center">
<SparklesIcon className="inline w-5 h-5" aria-hidden="true" /> <SparklesIcon className="inline w-5 h-5" aria-hidden="true" />
Recent activity Recent activity
{followedFoldIds.length === 0 ? (
<>
<span></span> <span></span>
<span> <span>
<SiteLink href="/folds" className="font-semibold"> <SiteLink href="/folds" className="font-semibold">
@ -154,8 +154,6 @@ const Home = (props: {
</SiteLink>{' '} </SiteLink>{' '}
to personalize to personalize
</span> </span>
</>
) : null}
</Row> </Row>
{activeContracts ? ( {activeContracts ? (