From f794bb04f516e9411469a8f97079d4962d31ee15 Mon Sep 17 00:00:00 2001 From: gitwoz <177856586+gitwoz@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:42:58 +0700 Subject: [PATCH] feat(wallet): hide LikeCoin section if viewer has no Liker ID --- src/views/Me/Wallet/Balance/LikeCoin.tsx | 40 +++++++----------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/src/views/Me/Wallet/Balance/LikeCoin.tsx b/src/views/Me/Wallet/Balance/LikeCoin.tsx index 5c6f42eeb0..e381faf643 100644 --- a/src/views/Me/Wallet/Balance/LikeCoin.tsx +++ b/src/views/Me/Wallet/Balance/LikeCoin.tsx @@ -2,7 +2,6 @@ import { useQuery } from '@apollo/react-hooks' import classNames from 'classnames' import gql from 'graphql-tag' import React, { useContext } from 'react' -import { FormattedMessage } from 'react-intl' import { ReactComponent as IconLikeCoin } from '@/public/static/icons/24px/likecoin.svg' import { PATHS } from '~/common/enums' @@ -79,6 +78,10 @@ export const LikeCoinBalance = ({ const liker = data?.viewer?.liker const total = liker?.total || 0 + if (!likerId) { + return null + } + if (loading) { return ( @@ -108,36 +111,15 @@ export const LikeCoinBalance = ({ ) } - if (likerId) { - return ( - - - - ) - } - return ( - + ) }