Skip to content

Commit d4c7701

Browse files
committed
Use bot icon as badge
1 parent c5b50d7 commit d4c7701

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

components/badge.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import CowboyHatIcon from '@/svgs/cowboy.svg'
55
import AnonIcon from '@/svgs/spy-fill.svg'
66
import GunIcon from '@/svgs/revolver.svg'
77
import HorseIcon from '@/svgs/horse.svg'
8+
import BotIcon from '@/svgs/robot-2-fill.svg'
89
import { numWithUnits } from '@/lib/format'
910
import { USER_ID } from '@/lib/constants'
1011
import classNames from 'classnames'
1112

12-
export default function Badges ({ user, badge, className = 'ms-1', badgeClassName, spacingClassName = 'ms-1', height = 16, width = 16 }) {
13+
export default function Badges ({ user, badge, bot, className = 'ms-1', badgeClassName, spacingClassName = 'ms-1', height = 16, width = 16 }) {
1314
if (!user || Number(user.id) === USER_ID.ad) return null
1415
if (Number(user.id) === USER_ID.anon) {
1516
return (
@@ -46,6 +47,13 @@ export default function Badges ({ user, badge, className = 'ms-1', badgeClassNam
4647
})
4748
}
4849

50+
if (bot) {
51+
badges.push({
52+
icon: BotIcon,
53+
overlayText: 'posted as bot'
54+
})
55+
}
56+
4957
if (badges.length === 0) return null
5058

5159
return (

components/item-info.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default function ItemInfo ({
134134
{showUser &&
135135
<Link href={`/${item.user.name}`}>
136136
<UserPopover name={item.user.name}>@{item.user.name}</UserPopover>
137-
<Badges badgeClassName='fill-grey' spacingClassName='ms-xs' height={12} width={12} user={item.user} />
137+
<Badges badgeClassName='fill-grey' spacingClassName='ms-xs' height={12} width={12} user={item.user} bot={item.apiKey} />
138138
{embellishUser}
139139
</Link>}
140140
<span> </span>
@@ -166,9 +166,6 @@ export default function ItemInfo ({
166166
{' '}<Badge className={styles.newComment} bg={null}>freebie</Badge>
167167
</Link>
168168
)}
169-
{(item.apiKey &&
170-
<>{' '}<Badge className={styles.newComment} bg={null}>bot</Badge></>
171-
)}
172169
{extraBadges}
173170
{
174171
showActionDropdown &&

svgs/robot-2-fill.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)