fix remaining misuses of plural units

This commit is contained in:
keyan 2023-08-08 17:15:30 -05:00
parent da78d244ef
commit b92f63ca88
3 changed files with 7 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import Popover from 'react-bootstrap/Popover'
import { useShowModal } from './modal' import { useShowModal } from './modal'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import { LightningConsumer } from './lightning' import { LightningConsumer } from './lightning'
import { numWithUnits } from '../lib/format'
const getColor = (meSats) => { const getColor = (meSats) => {
if (!meSats || meSats <= 10) { if (!meSats || meSats <= 10) {
@ -211,7 +212,7 @@ export default function UpVote ({ item, className, pendingSats, setPendingSats }
sats = raiseTip - meSats sats = raiseTip - meSats
} }
return [meSats, sats, `${sats} sat${sats > 1 ? 's' : ''}`, getColor(meSats)] return [meSats, sats, numWithUnits(sats, { abbreviate: false }), getColor(meSats)]
}, [item?.meSats, pendingSats, me?.tipDefault, me?.turboDefault]) }, [item?.meSats, pendingSats, me?.tipDefault, me?.turboDefault])
return ( return (

View File

@ -1,6 +1,6 @@
import Link from 'next/link' import Link from 'next/link'
import Image from 'react-bootstrap/Image' import Image from 'react-bootstrap/Image'
import { abbrNum } from '../lib/format' import { abbrNum, numWithUnits } from '../lib/format'
import CowboyHat from './cowboy-hat' import CowboyHat from './cowboy-hat'
import styles from './item.module.css' import styles from './item.module.css'
import userStyles from './user-header.module.css' import userStyles from './user-header.module.css'
@ -14,13 +14,13 @@ const Stacked = ({ user }) => (<span>{abbrNum(user.stacked)} stacked</span>)
const Spent = ({ user }) => (<span>{abbrNum(user.spent)} spent</span>) const Spent = ({ user }) => (<span>{abbrNum(user.spent)} spent</span>)
const Posts = ({ user }) => ( const Posts = ({ user }) => (
<Link href={`/${user.name}/posts`} className='text-reset'> <Link href={`/${user.name}/posts`} className='text-reset'>
{abbrNum(user.nposts)} posts {numWithUnits(user.nposts, { unitSingular: 'post', unitPlural: 'posts' })}
</Link>) </Link>)
const Comments = ({ user }) => ( const Comments = ({ user }) => (
<Link href={`/${user.name}/comments`} className='text-reset'> <Link href={`/${user.name}/comments`} className='text-reset'>
{abbrNum(user.ncomments)} comments {numWithUnits(user.ncomments, { unitSingular: 'comment', unitPlural: 'comments' })}
</Link>) </Link>)
const Referrals = ({ user }) => (<span>{abbrNum(user.referrals)} referrals</span>) const Referrals = ({ user }) => (<span>{numWithUnits(user.referrals, { unitSingular: 'referral', unitPlural: 'referrals' })}</span>)
const Seperator = () => (<span> \ </span>) const Seperator = () => (<span> \ </span>)
const STAT_POS = { const STAT_POS = {

View File

@ -45,7 +45,7 @@ export default function Referrals ({ ssrData }) {
return ( return (
<CenterLayout footerLinks> <CenterLayout footerLinks>
<h4 className='fw-bold text-muted text-center pt-5 pb-3 d-flex align-items-center justify-content-center'> <h4 className='fw-bold text-muted text-center pt-5 pb-3 d-flex align-items-center justify-content-center'>
{totalReferrals} referrals & {numWithUnits(totalSats, { abbreviate: false })} in the last {numWithUnits(totalReferrals, { unitPlural: 'referrals', unitSingular: 'referral' })} & {numWithUnits(totalSats, { abbreviate: false })} in the last
<Select <Select
groupClassName='mb-0 ms-2' groupClassName='mb-0 ms-2'
className='w-auto' className='w-auto'