Show tags on fold page

This commit is contained in:
jahooma 2022-01-20 12:59:13 -06:00
parent 3f6c9703d9
commit 3686697237
4 changed files with 24 additions and 10 deletions

View File

@ -5,7 +5,7 @@ export type Fold = {
curatorId: string // User id curatorId: string // User id
createdTime: number createdTime: number
tags: string tags: string[]
contractIds: string[] contractIds: string[]
excludedContractIds: string[] excludedContractIds: string[]

View File

@ -3,7 +3,6 @@ import Link from 'next/link'
import { Row } from '../components/layout/row' import { Row } from '../components/layout/row'
import { formatMoney } from '../lib/util/format' import { formatMoney } from '../lib/util/format'
import { UserLink } from './user-page' import { UserLink } from './user-page'
import { Linkify } from './linkify'
import { import {
Contract, Contract,
contractMetrics, contractMetrics,
@ -14,6 +13,7 @@ import { parseTags } from '../../common/util/parse'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { TrendingUpIcon, ClockIcon } from '@heroicons/react/solid' import { TrendingUpIcon, ClockIcon } from '@heroicons/react/solid'
import { DateTimeTooltip } from './datetime-tooltip' import { DateTimeTooltip } from './datetime-tooltip'
import { TagsList } from './tags-list'
export function ContractCard(props: { export function ContractCard(props: {
contract: Contract contract: Contract
@ -187,14 +187,7 @@ export function ContractDetails(props: { contract: Contract }) {
{tags.length > 0 && ( {tags.length > 0 && (
<> <>
<div className="hidden sm:block"></div> <div className="hidden sm:block"></div>
<TagsList tags={tags} />
<Row className="gap-2 flex-wrap">
{tags.map((tag) => (
<div key={tag} className="bg-gray-100 px-1">
<Linkify text={tag} gray />
</div>
))}
</Row>
</> </>
)} )}
</Col> </Col>

View File

@ -0,0 +1,15 @@
import { Row } from './layout/row'
import { Linkify } from './linkify'
export function TagsList(props: { tags: string[] }) {
const { tags } = props
return (
<Row className="gap-2 flex-wrap">
{tags.map((tag) => (
<div key={tag} className="bg-gray-100 px-1">
<Linkify text={tag} gray />
</div>
))}
</Row>
)
}

View File

@ -7,6 +7,7 @@ import { getRecentComments, listAllComments } from '../../lib/firebase/comments'
import { Contract } from '../../lib/firebase/contracts' import { Contract } from '../../lib/firebase/contracts'
import { getFoldBySlug, getFoldContracts } from '../../lib/firebase/folds' import { getFoldBySlug, getFoldContracts } from '../../lib/firebase/folds'
import { ActivityFeed, findActiveContracts } from '../activity' import { ActivityFeed, findActiveContracts } from '../activity'
import { TagsList } from '../../components/tags-list'
export async function getStaticProps(props: { params: { foldSlug: string } }) { export async function getStaticProps(props: { params: { foldSlug: string } }) {
const { foldSlug } = props.params const { foldSlug } = props.params
@ -50,9 +51,14 @@ export default function FoldPage(props: {
const { fold, activeContracts, activeContractBets, activeContractComments } = const { fold, activeContracts, activeContractBets, activeContractComments } =
props props
const { tags } = fold
return ( return (
<Page> <Page>
<Title text={fold.name} /> <Title text={fold.name} />
<TagsList tags={tags} />
<ActivityFeed <ActivityFeed
contracts={activeContracts} contracts={activeContracts}
contractBets={activeContractBets} contractBets={activeContractBets}