Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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