Move contract description out of activity feed

This commit is contained in:
James Grugett 2022-04-07 16:09:19 -05:00
parent 5e8decfa4e
commit 14cef9ffc3
2 changed files with 17 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import BetRow from './bet-row'
import { ContractActivity } from './feed/contract-activity' import { ContractActivity } from './feed/contract-activity'
import { AnswersGraph } from './answers/answers-graph' import { AnswersGraph } from './answers/answers-graph'
import { DPM, FreeResponse, FullContract } from '../../common/contract' import { DPM, FreeResponse, FullContract } from '../../common/contract'
import { ContractDescription } from './feed/feed-items'
export const ContractOverview = (props: { export const ContractOverview = (props: {
contract: Contract contract: Contract
@ -71,6 +72,14 @@ export const ContractOverview = (props: {
{children} {children}
<Spacer h={6} />
<ContractDescription
className="px-2"
contract={contract}
isCreator={isCreator}
/>
<Spacer h={12} /> <Spacer h={12} />
<ContractActivity <ContractActivity

View File

@ -326,8 +326,9 @@ function EditContract(props: {
export function ContractDescription(props: { export function ContractDescription(props: {
contract: Contract contract: Contract
isCreator: boolean isCreator: boolean
className?: string
}) { }) {
const { contract, isCreator } = props const { contract, isCreator, className } = props
const descriptionTimestamp = () => `${dayjs().format('MMM D, h:mma')}: ` const descriptionTimestamp = () => `${dayjs().format('MMM D, h:mma')}: `
const isAdmin = useAdmin() const isAdmin = useAdmin()
@ -348,7 +349,12 @@ export function ContractDescription(props: {
if (!isCreator && !contract.description.trim()) return null if (!isCreator && !contract.description.trim()) return null
return ( return (
<div className="mt-2 whitespace-pre-line break-words text-gray-700"> <div
className={clsx(
'mt-2 whitespace-pre-line break-words text-gray-700',
className
)}
>
<Linkify text={contract.description} /> <Linkify text={contract.description} />
<br /> <br />
{isCreator && ( {isCreator && (
@ -506,7 +512,6 @@ function FeedDescription(props: { contract: Contract }) {
/>{' '} />{' '}
created this market <RelativeTimestamp time={contract.createdTime} /> created this market <RelativeTimestamp time={contract.createdTime} />
</div> </div>
<ContractDescription contract={contract} isCreator={isCreator} />
</div> </div>
</> </>
) )