mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
Add prettier for codestyle and re-format everything (#1294)
This commit is contained in:
parent
8b78154075
commit
0aae1f70d2
319 changed files with 4809 additions and 3936 deletions
|
@ -21,30 +21,31 @@ const HeaderBar: React.FC = () => {
|
|||
const userExists = useSelector((state: ApplicationState) => !!state.user)
|
||||
|
||||
return (
|
||||
<Navbar className="justify-content-between">
|
||||
<div className="nav header-nav">
|
||||
<HeaderNavLink to="/intro" id='navLinkIntro'>
|
||||
<Trans i18nKey="landing.navigation.intro"/>
|
||||
<Navbar className='justify-content-between'>
|
||||
<div className='nav header-nav'>
|
||||
<HeaderNavLink to='/intro' id='navLinkIntro'>
|
||||
<Trans i18nKey='landing.navigation.intro' />
|
||||
</HeaderNavLink>
|
||||
<HeaderNavLink to="/history" id='navLinkHistory'>
|
||||
<Trans i18nKey="landing.navigation.history"/>
|
||||
<HeaderNavLink to='/history' id='navLinkHistory'>
|
||||
<Trans i18nKey='landing.navigation.history' />
|
||||
</HeaderNavLink>
|
||||
</div>
|
||||
<div className="d-inline-flex">
|
||||
{ !userExists
|
||||
? <Fragment>
|
||||
<span className={ 'mx-1 d-flex' }>
|
||||
<NewGuestNoteButton/>
|
||||
</span>
|
||||
<SignInButton size="sm"/>
|
||||
<div className='d-inline-flex'>
|
||||
{!userExists ? (
|
||||
<Fragment>
|
||||
<span className={'mx-1 d-flex'}>
|
||||
<NewGuestNoteButton />
|
||||
</span>
|
||||
<SignInButton size='sm' />
|
||||
</Fragment>
|
||||
: <Fragment>
|
||||
<span className={ 'mx-1 d-flex' }>
|
||||
<NewUserNoteButton/>
|
||||
</span>
|
||||
<UserDropdown/>
|
||||
) : (
|
||||
<Fragment>
|
||||
<span className={'mx-1 d-flex'}>
|
||||
<NewUserNoteButton />
|
||||
</span>
|
||||
<UserDropdown />
|
||||
</Fragment>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
</Navbar>
|
||||
)
|
||||
|
|
|
@ -16,8 +16,10 @@ export interface HeaderNavLinkProps {
|
|||
export const HeaderNavLink: React.FC<HeaderNavLinkProps> = ({ to, id, children }) => {
|
||||
return (
|
||||
<Nav.Item>
|
||||
<LinkContainer to={ to }>
|
||||
<Nav.Link id={ id } className="text-light" href={ to }>{ children }</Nav.Link>
|
||||
<LinkContainer to={to}>
|
||||
<Nav.Link id={id} className='text-light' href={to}>
|
||||
{children}
|
||||
</Nav.Link>
|
||||
</LinkContainer>
|
||||
</Nav.Item>
|
||||
)
|
||||
|
|
|
@ -13,15 +13,13 @@ import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
|||
export const NewGuestNoteButton: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<LinkContainer to={ '/new' } title={ t('landing.navigation.newGuestNote') }>
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
className="d-inline-flex align-items-center">
|
||||
<ForkAwesomeIcon icon="plus" className="mx-1"/>
|
||||
<LinkContainer to={'/new'} title={t('landing.navigation.newGuestNote')}>
|
||||
<Button variant='primary' size='sm' className='d-inline-flex align-items-center'>
|
||||
<ForkAwesomeIcon icon='plus' className='mx-1' />
|
||||
<span>
|
||||
<Trans i18nKey='landing.navigation.newGuestNote'/>
|
||||
<Trans i18nKey='landing.navigation.newGuestNote' />
|
||||
</span>
|
||||
</Button>
|
||||
</LinkContainer>)
|
||||
</LinkContainer>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -13,14 +13,11 @@ import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
|||
export const NewUserNoteButton: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<LinkContainer to={ '/new' } title={ t('landing.navigation.newNote') }>
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
className="d-inline-flex align-items-center">
|
||||
<ForkAwesomeIcon icon="plus" className="mx-1"/>
|
||||
<LinkContainer to={'/new'} title={t('landing.navigation.newNote')}>
|
||||
<Button variant='primary' size='sm' className='d-inline-flex align-items-center'>
|
||||
<ForkAwesomeIcon icon='plus' className='mx-1' />
|
||||
<span>
|
||||
<Trans i18nKey='landing.navigation.newNote'/>
|
||||
<Trans i18nKey='landing.navigation.newNote' />
|
||||
</span>
|
||||
</Button>
|
||||
</LinkContainer>
|
||||
|
|
|
@ -25,24 +25,21 @@ export const SignInButton: React.FC<SignInButtonProps> = ({ variant, ...props })
|
|||
|
||||
const loginLink = useMemo(() => {
|
||||
const activeProviders = Object.entries(authProviders)
|
||||
.filter((entry: [string, boolean]) => entry[1])
|
||||
.map(entry => entry[0])
|
||||
const activeOneClickProviders = activeProviders.filter(entry => !INTERACTIVE_LOGIN_METHODS.includes(entry))
|
||||
.filter((entry: [string, boolean]) => entry[1])
|
||||
.map((entry) => entry[0])
|
||||
const activeOneClickProviders = activeProviders.filter((entry) => !INTERACTIVE_LOGIN_METHODS.includes(entry))
|
||||
|
||||
if (activeProviders.length === 1 && activeOneClickProviders.length === 1) {
|
||||
return `${ getApiUrl() }auth/${ activeOneClickProviders[0] }`
|
||||
return `${getApiUrl()}auth/${activeOneClickProviders[0]}`
|
||||
}
|
||||
return '/login'
|
||||
}, [authProviders])
|
||||
|
||||
return (
|
||||
<ShowIf condition={ authEnabled }>
|
||||
<LinkContainer to={ loginLink } title={ t('login.signIn') }>
|
||||
<Button
|
||||
data-cy={ 'sign-in-button' }
|
||||
variant={ variant || 'success' }
|
||||
{ ...props }>
|
||||
<Trans i18nKey="login.signIn"/>
|
||||
<ShowIf condition={authEnabled}>
|
||||
<LinkContainer to={loginLink} title={t('login.signIn')}>
|
||||
<Button data-cy={'sign-in-button'} variant={variant || 'success'} {...props}>
|
||||
<Trans i18nKey='login.signIn' />
|
||||
</Button>
|
||||
</LinkContainer>
|
||||
</ShowIf>
|
||||
|
|
|
@ -25,31 +25,32 @@ export const UserDropdown: React.FC = () => {
|
|||
|
||||
return (
|
||||
<Dropdown alignRight>
|
||||
<Dropdown.Toggle size="sm" variant="dark" id="dropdown-user" className={ 'd-flex align-items-center' }>
|
||||
<UserAvatar name={ user.name } photo={ user.photo }/>
|
||||
<Dropdown.Toggle size='sm' variant='dark' id='dropdown-user' className={'d-flex align-items-center'}>
|
||||
<UserAvatar name={user.name} photo={user.photo} />
|
||||
</Dropdown.Toggle>
|
||||
|
||||
<Dropdown.Menu className='text-start'>
|
||||
<LinkContainer to={ '/n/features' }>
|
||||
<LinkContainer to={'/n/features'}>
|
||||
<Dropdown.Item dir='auto'>
|
||||
<ForkAwesomeIcon icon="bolt" fixedWidth={ true } className="mx-2"/>
|
||||
<Trans i18nKey="editor.help.documents.features"/>
|
||||
<ForkAwesomeIcon icon='bolt' fixedWidth={true} className='mx-2' />
|
||||
<Trans i18nKey='editor.help.documents.features' />
|
||||
</Dropdown.Item>
|
||||
</LinkContainer>
|
||||
<LinkContainer to={ '/profile' }>
|
||||
<LinkContainer to={'/profile'}>
|
||||
<Dropdown.Item dir='auto'>
|
||||
<ForkAwesomeIcon icon="user" fixedWidth={ true } className="mx-2"/>
|
||||
<Trans i18nKey="profile.userProfile"/>
|
||||
<ForkAwesomeIcon icon='user' fixedWidth={true} className='mx-2' />
|
||||
<Trans i18nKey='profile.userProfile' />
|
||||
</Dropdown.Item>
|
||||
</LinkContainer>
|
||||
<Dropdown.Item
|
||||
dir='auto'
|
||||
onClick={ () => {
|
||||
onClick={() => {
|
||||
clearUser()
|
||||
} }>
|
||||
<ForkAwesomeIcon icon="sign-out" fixedWidth={ true } className="mx-2"/>
|
||||
<Trans i18nKey="login.signOut"/>
|
||||
}}>
|
||||
<ForkAwesomeIcon icon='sign-out' fixedWidth={true} className='mx-2' />
|
||||
<Trans i18nKey='login.signOut' />
|
||||
</Dropdown.Item>
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>)
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue