Correct use selector (#515)

This commit is contained in:
mrdrogdrog 2020-08-30 21:24:34 +02:00 committed by GitHub
parent 971421925a
commit a41d3d1515
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 74 additions and 205 deletions

View file

@ -19,7 +19,7 @@ import { NavbarBranding } from './navbar-branding'
export const AppBar: React.FC = () => {
const { t } = useTranslation()
const { id } = useParams<EditorPathParams>()
const user = useSelector((state: ApplicationState) => state.user)
const userExists = useSelector((state: ApplicationState) => !!state.user)
return (
<Navbar bg={'light'}>
@ -39,10 +39,10 @@ export const AppBar: React.FC = () => {
<Button className="mx-2" size="sm" variant="primary">
<ForkAwesomeIcon icon="plus"/> <Trans i18nKey="editor.documentBar.new"/>
</Button>
<ShowIf condition={!user}>
<ShowIf condition={!userExists}>
<SignInButton size={'sm'} />
</ShowIf>
<ShowIf condition={!!user}>
<ShowIf condition={userExists}>
<UserDropdown />
</ShowIf>
</Nav>