Move the `AD` badge to be alongside other item info badges (#647)

This commit is contained in:
SatsAllDay 2023-11-20 09:33:59 -05:00 committed by GitHub
parent 4596681fbc
commit 44e12a4b44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import MuteDropdownItem from './mute'
export default function ItemInfo ({
item, pendingSats, full, commentsText = 'comments',
commentTextSingular = 'comment', className, embellishUser, extraInfo, onEdit, editText,
onQuoteReply, nofollow
onQuoteReply, nofollow, extraBadges
}) {
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
const me = useMe()
@ -116,6 +116,7 @@ export default function ItemInfo ({
{' '}<Badge className={styles.newComment} bg={null}>freebie</Badge>
</Link>
)}
{extraBadges}
{canEdit && !item.deletedAt &&
<>
<span> \ </span>

View File

@ -96,7 +96,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
full={full} item={item} pendingSats={pendingSats}
onQuoteReply={replyRef?.current?.quoteReply}
nofollow={nofollow}
embellishUser={Number(item?.user?.id) === AD_USER_ID && <Badge className={styles.newComment} bg={null}>AD</Badge>}
extraBadges={Number(item?.user?.id) === AD_USER_ID && <Badge className={styles.newComment} bg={null}>AD</Badge>}
/>
{belowTitle}
</div>

View File

@ -55,6 +55,10 @@ async function main () {
where: { name: 'anon' }
})
const ad = await prisma.user.findUnique({
where: { name: 'ad' }
})
await prisma.item.create({
data: {
title: 'System76 Developing “Cosmic” Desktop Environment',
@ -178,6 +182,21 @@ async function main () {
}
})
await prisma.item.create({
data: {
title: 'An ad post',
url: 'https://www.google.com',
userId: ad.id,
subName: 'bitcoin',
children: {
create: {
userId: anon.id,
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
}
}
}
})
const bigCommentPost = await prisma.item.create({
data: {
title: 'a discussion post with a lot of comments',