add boost badge fix #1860

This commit is contained in:
k00b 2025-02-03 19:50:20 -06:00
parent 9885bcf209
commit ee8fe6e72a
2 changed files with 14 additions and 3 deletions

View File

@ -25,6 +25,8 @@ import { decodeProxyUrl, IMGPROXY_URL_REGEXP, parseInternalLinks } from '@/lib/u
import ItemPopover from './item-popover' import ItemPopover from './item-popover'
import { useMe } from './me' import { useMe } from './me'
import Boost from './boost-button' import Boost from './boost-button'
import { useShowModal } from './modal'
import { BoostHelp } from './adv-post-form'
function onItemClick (e, router, item) { function onItemClick (e, router, item) {
const viewedAt = commentsViewedAt(item) const viewedAt = commentsViewedAt(item)
@ -87,10 +89,11 @@ function ItemLink ({ url, rel }) {
export default function Item ({ export default function Item ({
item, rank, belowTitle, right, full, children, itemClassName, item, rank, belowTitle, right, full, children, itemClassName,
onQuoteReply, pinnable, setDisableRetry, disableRetry onQuoteReply, pinnable, setDisableRetry, disableRetry, ad
}) { }) {
const titleRef = useRef() const titleRef = useRef()
const router = useRouter() const router = useRouter()
const showModal = useShowModal()
const media = mediaType({ url: item.url, imgproxyUrls: item.imgproxyUrls }) const media = mediaType({ url: item.url, imgproxyUrls: item.imgproxyUrls })
const MediaIcon = media === 'video' ? VideoIcon : ImageIcon const MediaIcon = media === 'video' ? VideoIcon : ImageIcon
@ -138,7 +141,15 @@ export default function Item ({
full={full} item={item} full={full} item={item}
onQuoteReply={onQuoteReply} onQuoteReply={onQuoteReply}
pinnable={pinnable} pinnable={pinnable}
extraBadges={Number(item?.user?.id) === USER_ID.ad && <Badge className={styles.newComment} bg={null}>AD</Badge>} extraBadges={ad &&
<>{' '}
<Badge
className={classNames(styles.newComment, 'pointer')}
bg={null} onClick={() => showModal(() => <BoostHelp />)}
>
top boost
</Badge>
</>}
setDisableRetry={setDisableRetry} setDisableRetry={setDisableRetry}
disableRetry={disableRetry} disableRetry={disableRetry}
/> />

View File

@ -138,7 +138,7 @@ export default function Rewards ({ ssrData }) {
<div className='fw-bold text-muted pb-2'> <div className='fw-bold text-muted pb-2'>
top boost this month top boost this month
</div> </div>
<ListItem item={ad} /> <ListItem item={ad} ad />
</div>} </div>}
<Row className='pb-3'> <Row className='pb-3'>
<Col lg={leaderboard?.users && 5}> <Col lg={leaderboard?.users && 5}>