Skip to content

Commit

Permalink
Move the AD badge to be alongside other item info badges (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
SatsAllDay authored Nov 20, 2023
1 parent 4596681 commit 44e12a4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/item-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -116,6 +116,7 @@ export default function ItemInfo ({
{' '}<Badge className={styles.newComment} bg={null}>freebie</Badge>
</Link>
)}
{extraBadges}
{canEdit && !item.deletedAt &&
<>
<span> \ </span>
Expand Down
2 changes: 1 addition & 1 deletion components/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
19 changes: 19 additions & 0 deletions prisma/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 44e12a4

Please sign in to comment.