Just show first names to save space

This commit is contained in:
Ian Philips 2022-07-06 07:51:32 -06:00
parent 83a02c4b20
commit 434b8b9dbe
3 changed files with 11 additions and 10 deletions

View File

@ -19,7 +19,7 @@ export default function NotificationsIcon(props: { className?: string }) {
useEffect(() => { useEffect(() => {
if (!privateUser) return if (!privateUser) return
if (Date.now() - (privateUser.lastTimeCheckedBonuses ?? 0) > 60 * 1000) if (Date.now() - (privateUser.lastTimeCheckedBonuses ?? 0) > 65 * 1000)
requestBonuses({}).catch((error) => { requestBonuses({}).catch((error) => {
console.log("couldn't get bonuses:", error.message) console.log("couldn't get bonuses:", error.message)
}) })

View File

@ -45,15 +45,16 @@ export function UserLink(props: {
username: string username: string
showUsername?: boolean showUsername?: boolean
className?: string className?: string
justFirstName?: boolean
}) { }) {
const { name, username, showUsername, className } = props const { name, username, showUsername, className, justFirstName } = props
return ( return (
<SiteLink <SiteLink
href={`/${username}`} href={`/${username}`}
className={clsx('z-10 truncate', className)} className={clsx('z-10 truncate', className)}
> >
{name} {justFirstName ? name.split(' ')[0] : name}
{showUsername && ` (@${username})`} {showUsername && ` (@${username})`}
</SiteLink> </SiteLink>
) )

View File

@ -783,13 +783,12 @@ function NotificationItem(props: {
<Row className={'items-center text-sm text-gray-500 sm:justify-start'}> <Row className={'items-center text-sm text-gray-500 sm:justify-start'}>
<div className={'line-clamp-1 flex-1 overflow-hidden sm:flex'}> <div className={'line-clamp-1 flex-1 overflow-hidden sm:flex'}>
<div className={'flex pl-1 sm:pl-0'}> <div className={'flex pl-1 sm:pl-0'}>
{sourceType != 'bonus' && ( <UserLink
<UserLink name={sourceUserName || ''}
name={sourceUserName || ''} username={sourceUserUsername || ''}
username={sourceUserUsername || ''} className={'mr-0 flex-shrink-0'}
className={'mr-0 flex-shrink-0'} justFirstName={true}
/> />
)}
<div className={'inline-flex overflow-hidden text-ellipsis pl-1'}> <div className={'inline-flex overflow-hidden text-ellipsis pl-1'}>
<span className={'flex-shrink-0'}> <span className={'flex-shrink-0'}>
{sourceType && {sourceType &&
@ -845,6 +844,7 @@ function NotificationItem(props: {
name={sourceUserName || ''} name={sourceUserName || ''}
username={sourceUserUsername || ''} username={sourceUserUsername || ''}
className={'mr-0 flex-shrink-0'} className={'mr-0 flex-shrink-0'}
justFirstName={true}
/> />
)} )}
<div className={'inline-flex overflow-hidden text-ellipsis pl-1'}> <div className={'inline-flex overflow-hidden text-ellipsis pl-1'}>