From ce547fcba50dbbd8b510f1664ad0d0595e70d2c1 Mon Sep 17 00:00:00 2001 From: byhow Date: Thu, 30 May 2024 20:32:01 -0700 Subject: [PATCH] refactor(notice-actor-name): update constant with pre-built enum --- src/components/Notice/NoticeActorName.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Notice/NoticeActorName.tsx b/src/components/Notice/NoticeActorName.tsx index 274bf3a150..3badf0500d 100644 --- a/src/components/Notice/NoticeActorName.tsx +++ b/src/components/Notice/NoticeActorName.tsx @@ -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' @@ -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}