Skip to content

Commit

Permalink
feat(notice-actor-name): use truncated name when the length is over 20
Browse files Browse the repository at this point in the history
also fixes PR-13

re: #4497
  • Loading branch information
byhow committed May 31, 2024
1 parent 0f705cc commit d57757e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Notice/NoticeActorName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gql from 'graphql-tag'
import Link from 'next/link'

import { TEST_ID } from '~/common/enums'
import { toPath } from '~/common/utils'
import { toPath, truncate } from '~/common/utils'
import { NoticeActorNameUserFragment } from '~/gql/graphql'

import styles from './styles.module.css'
Expand All @@ -27,7 +27,9 @@ const NoticeActorName = ({
className={styles.displayName}
data-test-id={TEST_ID.NOTICE_USER_DISPLAY_NAME}
>
{user.displayName}
{user.displayName && user.displayName.length > 20
? truncate(user.displayName, 8, 8)
: user.displayName}
</a>
</Link>
)
Expand Down

0 comments on commit d57757e

Please sign in to comment.