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])
)
const followedFoldIds = useFollowedFolds(user) ?? []
const followedFoldIds = useFollowedFolds(user)
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(
_.flatten(followedFolds.map((fold) => fold.lowercaseTags))
@ -75,10 +75,12 @@ const Home = (props: {
? new Set(yourBetContractIds)
: undefined
// By default, show all contracts
let feedContracts = contracts
// If the user is following any folds, then exclude all other contracts
if (yourBetContracts && followedFoldIds.length > 0) {
// Show no contracts before your info is loaded.
let feedContracts: Contract[] = []
if (yourBetContracts && followedFoldIds) {
// Show all contracts if no folds are followed.
if (followedFoldIds.length === 0) feedContracts = contracts
else
feedContracts = contracts.filter(
(contract) =>
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">
<SparklesIcon className="inline w-5 h-5" aria-hidden="true" />
Recent activity
{followedFoldIds.length === 0 ? (
<>
<span></span>
<span>
<SiteLink href="/folds" className="font-semibold">
@ -154,8 +154,6 @@ const Home = (props: {
</SiteLink>{' '}
to personalize
</span>
</>
) : null}
</Row>
{activeContracts ? (