From aaffc564243e3226e014cc385aaf413309ac3fbc Mon Sep 17 00:00:00 2001 From: enes Date: Thu, 14 Nov 2024 11:31:13 +0100 Subject: [PATCH] refactor(reactions): use dots loader and block interaction while loading --- src/components/Internal/Reactions.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/Internal/Reactions.tsx b/src/components/Internal/Reactions.tsx index 4e69f13..d990429 100644 --- a/src/components/Internal/Reactions.tsx +++ b/src/components/Internal/Reactions.tsx @@ -1,3 +1,4 @@ +import { Dots } from 'components/Spinner' import { useReactions } from 'hooks' import { Addressable } from 'types' @@ -19,15 +20,13 @@ export const Reactions = ({ addressable }: ReactionsProps) => { aTag: addressable.aTag }) - if (!isDataLoaded) return null - return ( <>
handleReaction(true)} + onClick={isDataLoaded ? () => handleReaction(true) : undefined} >
{
-

{likesCount}

+

+ {isDataLoaded ? likesCount : } +

@@ -50,7 +51,7 @@ export const Reactions = ({ addressable }: ReactionsProps) => { className={`IBMSMSMBSS_Details_Card IBMSMSMBSS_D_CReactDown ${ hasReactedNegatively ? 'IBMSMSMBSS_D_CRDActive' : '' }`} - onClick={() => handleReaction()} + onClick={isDataLoaded ? () => handleReaction() : undefined} >
{
-

{disLikesCount}

+

+ {isDataLoaded ? disLikesCount : } +