Feed container markup cleanup (#173)

* Move FeedContainer stuff into ActivityFeed

* Greatly clean up ActivityFeed container markup
This commit is contained in:
Marshall Polaris 2022-05-10 13:59:19 -07:00 committed by GitHub
parent 167cf20bfc
commit 6c9df223d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 40 deletions

View File

@ -111,7 +111,7 @@ export function AnswersPanel(props: {
<FeedItems
contract={contract}
items={answerItems}
className={''}
className={'pr-2 md:pr-0'}
betRowClassName={''}
/>
)}

View File

@ -17,51 +17,24 @@ export function ActivityFeed(props: {
getContractPath?: (contract: Contract) => string
}) {
const { feed, mode, getContractPath } = props
const user = useUser()
return (
<FeedContainer
feed={feed}
renderItem={({ contract, recentBets, recentComments }) => (
<Col className="divide-y divide-gray-300 bg-white">
{feed.map((item) => (
<ContractActivity
key={item.contract.id}
className="py-6 px-2 sm:px-4"
user={user}
contract={contract}
bets={recentBets}
comments={recentComments}
contract={item.contract}
bets={item.recentBets}
comments={item.recentComments}
mode={mode}
contractPath={getContractPath ? getContractPath(contract) : undefined}
contractPath={
getContractPath ? getContractPath(item.contract) : undefined
}
/>
)}
/>
)
}
function FeedContainer(props: {
feed: {
contract: Contract
recentBets: Bet[]
recentComments: Comment[]
}[]
renderItem: (item: {
contract: Contract
recentBets: Bet[]
recentComments: Comment[]
}) => any
}) {
const { feed, renderItem } = props
return (
<Col className="items-center">
<Col className="w-full max-w-3xl">
<Col className="w-full divide-y divide-gray-300 self-center bg-white">
{feed.map((item) => (
<div key={item.contract.id} className="py-6 px-2 sm:px-4">
{renderItem(item)}
</div>
))}
</Col>
</Col>
))}
</Col>
)
}

View File

@ -65,7 +65,7 @@ export function FeedItems(props: {
useSaveSeenContract(ref, contract)
return (
<div className={clsx('flow-root pr-2 md:pr-0', className)} ref={ref}>
<div className={clsx('flow-root', className)} ref={ref}>
<div className={clsx(tradingAllowed(contract) ? '' : '-mb-6')}>
{items.map((item, activityItemIdx) => (
<div