Skip to content

Commit

Permalink
refactor(notice-actor-name): update constant with pre-built enum
Browse files Browse the repository at this point in the history
  • Loading branch information
byhow committed May 31, 2024
1 parent d57757e commit ce547fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Notice/NoticeActorName.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gql from 'graphql-tag'
import Link from 'next/link'

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

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

0 comments on commit ce547fc

Please sign in to comment.