From 04942655519c5c5dde6e552882c09a4edf350be7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 12 May 2024 15:56:25 -0500 Subject: [PATCH] Navbar: hide login form in standalone mode --- src/features/ui/components/navbar.tsx | 152 +++++++++++++------------- 1 file changed, 78 insertions(+), 74 deletions(-) diff --git a/src/features/ui/components/navbar.tsx b/src/features/ui/components/navbar.tsx index 384690f10..d21a0d9f9 100644 --- a/src/features/ui/components/navbar.tsx +++ b/src/features/ui/components/navbar.tsx @@ -10,7 +10,8 @@ import { openSidebar } from 'soapbox/actions/sidebar'; import SiteLogo from 'soapbox/components/site-logo'; import { Avatar, Button, Form, HStack, IconButton, Input, Tooltip } from 'soapbox/components/ui'; import Search from 'soapbox/features/compose/components/search'; -import { useAppDispatch, useFeatures, useOwnAccount, useRegistrationStatus } from 'soapbox/hooks'; +import { useAppDispatch, useAppSelector, useFeatures, useOwnAccount, useRegistrationStatus } from 'soapbox/hooks'; +import { isStandalone } from 'soapbox/utils/state'; import ProfileDropdown from './profile-dropdown'; @@ -28,6 +29,7 @@ const Navbar = () => { const dispatch = useAppDispatch(); const intl = useIntl(); const features = useFeatures(); + const standalone = useAppSelector(isStandalone); const { isOpen } = useRegistrationStatus(); const { account } = useOwnAccount(); const node = useRef(null); @@ -103,83 +105,85 @@ const Navbar = () => { )} - - {account ? ( -
- - - -
- ) : ( - <> - {features.nostrSignup ? ( -
- -
- ) : ( -
- setUsername(event.target.value)} - type='text' - placeholder={intl.formatMessage(features.logInWithUsername ? messages.username : messages.email)} - className='max-w-[200px]' - /> - - setPassword(event.target.value)} - type='password' - placeholder={intl.formatMessage(messages.password)} - className='max-w-[200px]' - /> - - - - - - + {!standalone && ( + + {account ? ( +
+ + + +
+ ) : ( + <> + {features.nostrSignup ? ( +
+ +
+ ) : ( + + setUsername(event.target.value)} + type='text' + placeholder={intl.formatMessage(features.logInWithUsername ? messages.username : messages.email)} + className='max-w-[200px]' + /> + + setPassword(event.target.value)} + type='password' + placeholder={intl.formatMessage(messages.password)} + className='max-w-[200px]' + /> + + + + + + + + + + )} +
- - )} - -
- - - {(isOpen) && ( - - )} -
- - )} - + + {(isOpen) && ( + + )} +
+ + )} +
+ )}