diff --git a/web/chat/relationship-prompt/relationship-prompt-button.js b/web/chat/relationship-prompt/relationship-prompt-button.js --- a/web/chat/relationship-prompt/relationship-prompt-button.js +++ b/web/chat/relationship-prompt/relationship-prompt-button.js @@ -13,10 +13,11 @@ +icon: IconDefinition, +buttonColor: ButtonColor, +onClick: () => void, + +isLoading: boolean, +className?: string, }; function RelationshipPromptButton(props: Props): React.Node { - const { text, icon, buttonColor, onClick, className } = props; + const { text, icon, buttonColor, onClick, isLoading, className } = props; const buttonClassName = classnames(css.promptButton, className); @@ -27,12 +28,13 @@ buttonColor={buttonColor} onClick={onClick} className={buttonClassName} + disabled={isLoading} >

{text}

), - [buttonClassName, buttonColor, icon, onClick, text], + [buttonClassName, buttonColor, icon, isLoading, onClick, text], ); return relationshipPromptButton; diff --git a/web/chat/relationship-prompt/relationship-prompt.js b/web/chat/relationship-prompt/relationship-prompt.js --- a/web/chat/relationship-prompt/relationship-prompt.js +++ b/web/chat/relationship-prompt/relationship-prompt.js @@ -26,6 +26,12 @@ const { otherUserInfo, callbacks: { blockUser, unblockUser, friendUser, unfriendUser }, + loaders: { + isLoadingBlockUser, + isLoadingUnblockUser, + isLoadingFriendUser, + isLoadingUnfriendUser, + }, } = useRelationshipPrompt( threadInfo, undefined, @@ -42,10 +48,11 @@ return ( ); @@ -56,10 +63,11 @@ return ( ); @@ -67,16 +75,18 @@ return ( ); @@ -84,10 +94,11 @@ return ( ); @@ -95,16 +106,18 @@ return ( ); diff --git a/web/modals/user-profile/user-profile-action-buttons.react.js b/web/modals/user-profile/user-profile-action-buttons.react.js --- a/web/modals/user-profile/user-profile-action-buttons.react.js +++ b/web/modals/user-profile/user-profile-action-buttons.react.js @@ -22,6 +22,7 @@ const { otherUserInfo, callbacks: { friendUser, unfriendUser }, + loaders: { isLoadingFriendUser, isLoadingUnfriendUser }, } = useRelationshipPrompt(threadInfo); const userProfileActionButtons = React.useMemo(() => { @@ -45,17 +46,19 @@

@@ -70,10 +73,11 @@ return (
@@ -83,16 +87,24 @@ return (
); - }, [otherUserInfo, friendUser, threadInfo, unfriendUser]); + }, [ + otherUserInfo, + friendUser, + isLoadingFriendUser, + threadInfo, + unfriendUser, + isLoadingUnfriendUser, + ]); return userProfileActionButtons; }