From b6dc2819046d0fe8274d9b07fd5893bc3401e2c5 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Tue, 3 May 2022 11:44:44 -0400 Subject: [PATCH] display category in market --- web/components/contract/contract-description.tsx | 14 ++++++++++++++ web/components/tags-list.tsx | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web/components/contract/contract-description.tsx b/web/components/contract/contract-description.tsx index dea08c6a..273241e9 100644 --- a/web/components/contract/contract-description.tsx +++ b/web/components/contract/contract-description.tsx @@ -2,6 +2,7 @@ import clsx from 'clsx' import dayjs from 'dayjs' import { useState } from 'react' import Textarea from 'react-expanding-textarea' +import { CATEGORY_LIST } from '../../../common/categories' import { Contract } from '../../../common/contract' import { parseTags } from '../../../common/util/parse' @@ -9,6 +10,7 @@ import { useAdmin } from '../../hooks/use-admin' import { updateContract } from '../../lib/firebase/contracts' import { Row } from '../layout/row' import { Linkify } from '../linkify' +import { TagsList } from '../tags-list' export function ContractDescription(props: { contract: Contract @@ -26,6 +28,7 @@ export function ContractDescription(props: { `${newDescription} ${contract.tags.map((tag) => `#${tag}`).join(' ')}` ) const lowercaseTags = tags.map((tag) => tag.toLowerCase()) + await updateContract(contract.id, { description: newDescription, tags, @@ -35,6 +38,9 @@ export function ContractDescription(props: { if (!isCreator && !contract.description.trim()) return null + const { tags } = contract + const category = tags.find((tag) => CATEGORY_LIST.includes(tag.toLowerCase())) + return (
+ + {category && ( +
+ +
+ )} +
+ {isCreator && ( - {!noLabel &&
Tags
} + {!noLabel &&
{label || 'Tags'}
} {tags.map((tag) => (