Change home tags to communities

This commit is contained in:
James Grugett 2022-02-03 17:40:37 -06:00
parent e5f553fa1a
commit c36ce3e521
2 changed files with 21 additions and 17 deletions

View File

@ -1,7 +1,6 @@
import clsx from 'clsx' import clsx from 'clsx'
import { Row } from './layout/row' import { Row } from './layout/row'
import { SiteLink } from './site-link' import { SiteLink } from './site-link'
import { Fold } from '../../common/fold'
function Hashtag(props: { tag: string; noLink?: boolean }) { function Hashtag(props: { tag: string; noLink?: boolean }) {
const { tag, noLink } = props const { tag, noLink } = props
@ -45,11 +44,11 @@ export function TagsList(props: {
) )
} }
export function FoldTag(props: { fold: Fold }) { export function FoldTag(props: { fold: { slug: string; name: string } }) {
const { fold } = props const { fold } = props
const { name } = fold const { slug, name } = fold
return ( return (
<SiteLink href={`/fold/${fold.slug}`} className="flex items-center"> <SiteLink href={`/fold/${slug}`} className="flex items-center">
<div <div
className={clsx( className={clsx(
'bg-white border-2 px-4 py-1 rounded-full shadow-md', 'bg-white border-2 px-4 py-1 rounded-full shadow-md',
@ -62,7 +61,10 @@ export function FoldTag(props: { fold: Fold }) {
) )
} }
export function FoldTagList(props: { folds: Fold[]; className?: string }) { export function FoldTagList(props: {
folds: { slug: string; name: string }[]
className?: string
}) {
const { folds, className } = props const { folds, className } = props
return ( return (
<Row className={clsx('flex-wrap gap-2 items-center', className)}> <Row className={clsx('flex-wrap gap-2 items-center', className)}>
@ -70,7 +72,7 @@ export function FoldTagList(props: { folds: Fold[]; className?: string }) {
<> <>
<div className="text-gray-500 mr-1">Communities</div> <div className="text-gray-500 mr-1">Communities</div>
{folds.map((fold) => ( {folds.map((fold) => (
<FoldTag key={fold.id} fold={fold} /> <FoldTag key={fold.slug} fold={fold} />
))} ))}
</> </>
)} )}

View File

@ -17,7 +17,7 @@ import { Fold } from '../../common/fold'
import { filterDefined } from '../../common/util/array' import { filterDefined } from '../../common/util/array'
import { useUserBets } from '../hooks/use-user-bets' import { useUserBets } from '../hooks/use-user-bets'
import { LoadingIndicator } from '../components/loading-indicator' import { LoadingIndicator } from '../components/loading-indicator'
import { TagsList } from '../components/tags-list' import { FoldTagList } from '../components/tags-list'
export async function getStaticProps() { export async function getStaticProps() {
const [contracts, folds] = await Promise.all([ const [contracts, folds] = await Promise.all([
@ -131,19 +131,21 @@ const Home = (props: { contracts: Contract[]; folds: Fold[] }) => {
<Col className="items-center"> <Col className="items-center">
<Col className="max-w-3xl w-full"> <Col className="max-w-3xl w-full">
<FeedCreate user={user ?? undefined} /> <FeedCreate user={user ?? undefined} />
<Spacer h={4} /> <Spacer h={6} />
<TagsList <FoldTagList
className="mx-2" className="mx-2"
tags={[ folds={[
'#politics', { name: 'Politics', slug: 'politics' },
'#crypto', { name: 'Crypto', slug: 'crypto' },
'#covid', { name: 'Sports', slug: 'sports' },
'#sports', { name: 'Science', slug: 'science' },
'#meta', {
'#science', name: 'Manifold Markets',
slug: 'manifold-markets',
},
]} ]}
/> />
<Spacer h={4} /> <Spacer h={6} />
{activeContracts ? ( {activeContracts ? (
<ActivityFeed <ActivityFeed
contracts={activeContracts} contracts={activeContracts}