From 4550c26230eae846b3bc7ac3bfb0e80fe6785082 Mon Sep 17 00:00:00 2001 From: Kiryl Budnik Date: Wed, 6 Sep 2023 21:44:24 +0300 Subject: [PATCH] show creating step until common member is created --- .../MembershipRequestModal/MembershipRequestModal.tsx | 6 +++--- src/pages/common/providers/CommonData/CommonData.tsx | 5 +---- src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx | 7 +++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestModal.tsx b/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestModal.tsx index b491a096e6..f9c980749a 100644 --- a/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestModal.tsx +++ b/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestModal.tsx @@ -51,7 +51,7 @@ const INIT_DATA: IMembershipRequestData = { interface IProps extends Pick { common: Common; governance: Governance; - shouldShowLoadingAfterSuccessfulCreation?: boolean; + showLoadingAfterSuccessfulCreation?: boolean; onCreationStageReach?: (reached: boolean) => void; onRequestCreated?: () => void; } @@ -69,7 +69,7 @@ export function MembershipRequestModal(props: IProps) { onClose, common, governance, - shouldShowLoadingAfterSuccessfulCreation = false, + showLoadingAfterSuccessfulCreation = false, onCreationStageReach, onRequestCreated, } = props; @@ -189,7 +189,7 @@ export function MembershipRequestModal(props: IProps) { /> ); case MembershipRequestStage.Created: - return shouldShowLoadingAfterSuccessfulCreation ? ( + return showLoadingAfterSuccessfulCreation && isAutomaticAcceptance ? ( = (props) => { onClose={handleCommonJoinModalClose} common={common} governance={governance} - shouldShowLoadingAfterSuccessfulCreation={ - governance.proposals[ProposalsTypes.MEMBER_ADMITTANCE]?.global - .votingDuration === 0 - } onRequestCreated={handleCommonJoinRequestCreated} + showLoadingAfterSuccessfulCreation /> = ( [getCommonPagePath, handleFeedItemClick], ); + useEffect(() => { + if (commonMember && isCommonJoinModalOpen) { + onCommonJoinModalClose(); + } + }, [commonMember?.id]); + useEffect(() => { if (!outerGovernance && selectedItemCommonData?.id) { fetchGovernance(selectedItemCommonData.id); @@ -805,6 +811,7 @@ const FeedLayout: ForwardRefRenderFunction = ( onClose={onCommonJoinModalClose} common={outerCommon} governance={governance} + showLoadingAfterSuccessfulCreation />