From 3aa87cc26fd58836b82c067b58a47e08e30a7784 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Thu, 4 Jun 2020 00:18:50 +0800
Subject: refactor(front): Make codes lint-clean!

---
 Timeline/ClientApp/src/user/UserInfoCard.tsx | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

(limited to 'Timeline/ClientApp/src/user/UserInfoCard.tsx')

diff --git a/Timeline/ClientApp/src/user/UserInfoCard.tsx b/Timeline/ClientApp/src/user/UserInfoCard.tsx
index 280cddce..3f812a8b 100644
--- a/Timeline/ClientApp/src/user/UserInfoCard.tsx
+++ b/Timeline/ClientApp/src/user/UserInfoCard.tsx
@@ -39,6 +39,7 @@ const UserInfoCard: React.FC<UserInfoCardProps> = (props) => {
     props.timeline.owner._links.avatar
   );
 
+  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
   const containerRef = React.useRef<HTMLDivElement>(null!);
 
   const notifyHeight = React.useCallback((): void => {
@@ -59,17 +60,6 @@ const UserInfoCard: React.FC<UserInfoCardProps> = (props) => {
     (): void => setManageDropdownOpen((old) => !old),
     []
   );
-  const onManageProperty = React.useCallback(
-    (): void => onManage!('property'),
-    [onManage]
-  );
-  const onManageAvatar = React.useCallback((): void => onManage!('avatar'), [
-    onManage,
-  ]);
-  const onManageNickname = React.useCallback(
-    (): void => onManage!('nickname'),
-    [onManage]
-  );
 
   return (
     <div
@@ -93,19 +83,19 @@ const UserInfoCard: React.FC<UserInfoCardProps> = (props) => {
         {t(timelineVisibilityTooltipTranslationMap[props.timeline.visibility])}
       </small>
       <div className="text-right mt-2">
-        {props.onManage != null ? (
+        {onManage != null ? (
           <Dropdown isOpen={manageDropdownOpen} toggle={toggleManageDropdown}>
             <DropdownToggle outline color="primary">
               {t('timeline.manage')}
             </DropdownToggle>
             <DropdownMenu>
-              <DropdownItem onClick={onManageNickname}>
+              <DropdownItem onClick={() => onManage('nickname')}>
                 {t('timeline.manageItem.nickname')}
               </DropdownItem>
-              <DropdownItem onClick={onManageAvatar}>
+              <DropdownItem onClick={() => onManage('avatar')}>
                 {t('timeline.manageItem.avatar')}
               </DropdownItem>
-              <DropdownItem onClick={onManageProperty}>
+              <DropdownItem onClick={() => onManage('property')}>
                 {t('timeline.manageItem.property')}
               </DropdownItem>
               <DropdownItem onClick={props.onMember}>
-- 
cgit v1.2.3

