Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open OnBoardingModal for modals requiring a membership #4859

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions packages/ui/src/app/GlobalModals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const MODAL_WITH_CLOSE_CONFIRMATION: ModalNames[] = [
]

export const GlobalModals = () => {
const { modal, hideModal, currentModalMachine, showModal, modalData, isClosing } = useModal()
const { modal, hideModal, currentModalMachine, showModal, isClosing } = useModal()
const { active: activeMember } = useMyMemberships()
const { status } = useTransactionStatus()
const Modal = useMemo(() => (modal && modal in modals ? memo(() => modals[modal as ModalNames]) : null), [modal])
Expand All @@ -235,12 +235,8 @@ export const GlobalModals = () => {
const potentialFallback = useGlobalModalHandler(currentModalMachine, hideModal)

if (modal && !GUEST_ACCESSIBLE_MODALS.includes(modal as ModalNames) && !activeMember) {
showModal<SwitchMemberModalCall>({
modal: 'SwitchMember',
data: {
originalModalName: modal as ModalNames,
originalModalData: modalData,
},
showModal({
modal: 'OnBoardingModal',
})
return null
}
Expand Down
10 changes: 3 additions & 7 deletions packages/ui/test/council/modals/AnnounceCandidacyModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,12 @@ describe('UI: Announce Candidacy Modal', () => {

renderModal()

const switchMemberModalCall = {
modal: 'SwitchMember',
data: {
originalModalName: 'AnnounceCandidateModal',
originalModalData: null,
},
const onBoardingModalCall = {
modal: 'OnBoardingModal',
}

expect(showModal).toBeCalledTimes(1)
expect(showModal).toBeCalledWith({ ...switchMemberModalCall })
expect(showModal).toBeCalledWith({ ...onBoardingModalCall })
})

it('Transaction fee', async () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/ui/test/forum/modals/CreateThreadModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ describe('CreateThreadModal', () => {
useMyMemberships.active = undefined
renderModal()
expect(useModal.showModal).toBeCalledWith({
modal: 'SwitchMember',
data: {
originalModalName: 'CreateThreadModal',
originalModalData: useModal.modalData,
},
modal: 'OnBoardingModal',
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,7 @@ describe('UI: ApplyForRoleModal', () => {
await renderModal()

expect(showModal).toBeCalledWith({
modal: 'SwitchMember',
data: {
originalModalData: modalData,
originalModalName: 'ApplyForRoleModal',
},
modal: 'OnBoardingModal',
})
showModal.mockClear()
})
Expand Down
Loading