From f218496b82ac5325c20d1829052acbbde95fcdf4 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 14 Jan 2023 19:18:13 -0600 Subject: [PATCH] Fix UnauthorizedModal and Navbar --- .../ui/components/modals/unauthorized-modal.tsx | 15 ++++++++------- app/soapbox/features/ui/components/navbar.tsx | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/soapbox/features/ui/components/modals/unauthorized-modal.tsx b/app/soapbox/features/ui/components/modals/unauthorized-modal.tsx index 809abcbda..66d757935 100644 --- a/app/soapbox/features/ui/components/modals/unauthorized-modal.tsx +++ b/app/soapbox/features/ui/components/modals/unauthorized-modal.tsx @@ -4,7 +4,7 @@ import { useHistory } from 'react-router-dom'; import { remoteInteraction } from 'soapbox/actions/interactions'; import { Button, Modal, Stack, Text } from 'soapbox/components/ui'; -import { useAppSelector, useAppDispatch, useFeatures, useInstance } from 'soapbox/hooks'; +import { useAppSelector, useAppDispatch, useFeatures, useInstance, useRegistrationStatus } from 'soapbox/hooks'; import toast from 'soapbox/toast'; const messages = defineMessages({ @@ -30,6 +30,7 @@ const UnauthorizedModal: React.FC = ({ action, onClose, acco const history = useHistory(); const dispatch = useAppDispatch(); const instance = useInstance(); + const { isOpen } = useRegistrationStatus(); const username = useAppSelector(state => state.accounts.get(accountId)?.display_name); const features = useFeatures(); @@ -97,10 +98,10 @@ const UnauthorizedModal: React.FC = ({ action, onClose, acco } - secondaryAction={onRegister} - secondaryText={} + secondaryAction={isOpen ? onRegister : undefined} + secondaryText={isOpen ? : undefined} >
@@ -121,7 +122,7 @@ const UnauthorizedModal: React.FC = ({ action, onClose, acco
- {instance.registrations && ( + {isOpen && ( @@ -141,8 +142,8 @@ const UnauthorizedModal: React.FC = ({ action, onClose, acco onClose={onClickClose} confirmationAction={onLogin} confirmationText={} - secondaryAction={onRegister} - secondaryText={} + secondaryAction={isOpen ? onRegister : undefined} + secondaryText={isOpen ? : undefined} > diff --git a/app/soapbox/features/ui/components/navbar.tsx b/app/soapbox/features/ui/components/navbar.tsx index 953526ee2..0b772f459 100644 --- a/app/soapbox/features/ui/components/navbar.tsx +++ b/app/soapbox/features/ui/components/navbar.tsx @@ -148,7 +148,7 @@ const Navbar = () => { - {!isOpen && ( + {isOpen && (