Skip to content

Commit

Permalink
render "reply" or "replies", "comment" or "comments" depending on the…
Browse files Browse the repository at this point in the history
… count (singular or plural) (#382)

Co-authored-by: Keyan <[email protected]>
  • Loading branch information
SatsAllDay and huumn authored Aug 8, 2023
1 parent 6e05cd3 commit 9941bc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions components/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default function Comment ({
item={item}
pendingSats={pendingSats}
commentsText='replies'
commentTextSingular='reply'
className={`${itemStyles.other} ${styles.other}`}
embellishUser={op && <Badge bg='boost' className={`ms-1 ${styles.op} bg-opacity-75`}>OP</Badge>}
extraInfo={
Expand Down
4 changes: 2 additions & 2 deletions components/item-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import BookmarkDropdownItem from './bookmark'
import SubscribeDropdownItem from './subscribe'
import { CopyLinkDropdownItem } from './share'

export default function ItemInfo ({ item, pendingSats, full, commentsText, className, embellishUser, extraInfo, onEdit, editText }) {
export default function ItemInfo ({ item, pendingSats, full, commentsText, commentTextSingular, className, embellishUser, extraInfo, onEdit, editText }) {
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
const me = useMe()
const router = useRouter()
Expand Down Expand Up @@ -58,7 +58,7 @@ export default function ItemInfo ({ item, pendingSats, full, commentsText, class
}
}} title={numWithUnits(item.commentSats)} className='text-reset position-relative'
>
{item.ncomments} {commentsText || 'comments'}
{item.ncomments} {item.ncomments === 1 ? commentTextSingular || 'comment' : commentsText || 'comments'}
{hasNewComments &&
<span className={styles.notification}>
<span className='invisible'>{' '}</span>
Expand Down

0 comments on commit 9941bc6

Please sign in to comment.