mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
Adjust editor config (#976)
* Adjust editor config Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
0180c75e55
commit
e12dc523f8
301 changed files with 4393 additions and 3741 deletions
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { DateTime } from 'luxon'
|
||||
import React, { ChangeEvent, FormEvent, Fragment, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
|
@ -86,30 +86,31 @@ export const ProfileAccessTokens: React.FC = () => {
|
|||
<p className='text-start'><Trans i18nKey='profile.accessTokens.info'/></p>
|
||||
<p className='text-start small'><Trans i18nKey='profile.accessTokens.infoDev'/></p>
|
||||
<hr/>
|
||||
<ShowIf condition={accessTokens.length === 0 && !error}>
|
||||
<ShowIf condition={ accessTokens.length === 0 && !error }>
|
||||
<Trans i18nKey='profile.accessTokens.noTokens'/>
|
||||
</ShowIf>
|
||||
<ShowIf condition={error}>
|
||||
<ShowIf condition={ error }>
|
||||
<Trans i18nKey='common.errorOccurred'/>
|
||||
</ShowIf>
|
||||
<ListGroup>
|
||||
{
|
||||
accessTokens.map((token) => {
|
||||
return (
|
||||
<ListGroup.Item className='bg-dark' key={token.created}>
|
||||
<ListGroup.Item className='bg-dark' key={ token.created }>
|
||||
<Row>
|
||||
<Col className='text-start'>
|
||||
{ token.label }
|
||||
</Col>
|
||||
<Col className='text-start text-white-50'>
|
||||
<Trans i18nKey='profile.accessTokens.created' values={{
|
||||
time: DateTime.fromSeconds(token.created).toRelative({
|
||||
style: 'short'
|
||||
})
|
||||
}}/>
|
||||
<Trans i18nKey='profile.accessTokens.created' values={ {
|
||||
time: DateTime.fromSeconds(token.created)
|
||||
.toRelative({
|
||||
style: 'short'
|
||||
})
|
||||
} }/>
|
||||
</Col>
|
||||
<Col xs='auto'>
|
||||
<IconButton icon='trash-o' variant='danger' onClick={() => selectForDeletion(token.created)}/>
|
||||
<IconButton icon='trash-o' variant='danger' onClick={ () => selectForDeletion(token.created) }/>
|
||||
</Col>
|
||||
</Row>
|
||||
</ListGroup.Item>
|
||||
|
@ -118,26 +119,26 @@ export const ProfileAccessTokens: React.FC = () => {
|
|||
}
|
||||
</ListGroup>
|
||||
<hr/>
|
||||
<Form onSubmit={addToken} className='text-left'>
|
||||
<Form onSubmit={ addToken } className='text-left'>
|
||||
<Form.Row>
|
||||
<Col>
|
||||
<Form.Control
|
||||
type='text'
|
||||
size='sm'
|
||||
placeholder={t('profile.accessTokens.label')}
|
||||
value={newTokenLabel}
|
||||
placeholder={ t('profile.accessTokens.label') }
|
||||
value={ newTokenLabel }
|
||||
className='bg-dark text-light'
|
||||
onChange={(event: ChangeEvent<HTMLInputElement>) => setNewTokenLabel(event.target.value)}
|
||||
isValid={newTokenSubmittable}
|
||||
onChange={ (event: ChangeEvent<HTMLInputElement>) => setNewTokenLabel(event.target.value) }
|
||||
isValid={ newTokenSubmittable }
|
||||
required
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={'auto'}>
|
||||
<Col xs={ 'auto' }>
|
||||
<Button
|
||||
type='submit'
|
||||
variant='primary'
|
||||
size='sm'
|
||||
disabled={!newTokenSubmittable}>
|
||||
disabled={ !newTokenSubmittable }>
|
||||
<Trans i18nKey='profile.accessTokens.createToken'/>
|
||||
</Button>
|
||||
</Col>
|
||||
|
@ -146,25 +147,26 @@ export const ProfileAccessTokens: React.FC = () => {
|
|||
</Card.Body>
|
||||
</Card>
|
||||
|
||||
<CommonModal show={showAddedModal} onHide={() => setShowAddedModal(false)} titleI18nKey='profile.modal.addedAccessToken.title'>
|
||||
<CommonModal show={ showAddedModal } onHide={ () => setShowAddedModal(false) }
|
||||
titleI18nKey='profile.modal.addedAccessToken.title'>
|
||||
<Modal.Body>
|
||||
<Trans i18nKey='profile.modal.addedAccessToken.message'/>
|
||||
<br/>
|
||||
<CopyableField content={newTokenSecret}/>
|
||||
<CopyableField content={ newTokenSecret }/>
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant='primary' onClick={() => setShowAddedModal(false)}>
|
||||
<Button variant='primary' onClick={ () => setShowAddedModal(false) }>
|
||||
<Trans i18nKey='common.close'/>
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</CommonModal>
|
||||
|
||||
<DeletionModal
|
||||
onConfirm={deleteToken}
|
||||
deletionButtonI18nKey={'common.delete'}
|
||||
show={showDeleteModal}
|
||||
onHide={() => setShowDeleteModal(false)}
|
||||
titleI18nKey={'profile.modal.deleteAccessToken.title'}>
|
||||
onConfirm={ deleteToken }
|
||||
deletionButtonI18nKey={ 'common.delete' }
|
||||
show={ showDeleteModal }
|
||||
onHide={ () => setShowDeleteModal(false) }
|
||||
titleI18nKey={ 'profile.modal.deleteAccessToken.title' }>
|
||||
<Trans i18nKey='profile.modal.deleteAccessToken.message'/>
|
||||
</DeletionModal>
|
||||
</Fragment>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment } from 'react'
|
||||
import { Col, Row } from 'react-bootstrap'
|
||||
|
@ -21,16 +21,16 @@ export const ProfilePage: React.FC = () => {
|
|||
|
||||
if (!userProvider) {
|
||||
return (
|
||||
<Redirect to={'/login'}/>
|
||||
<Redirect to={ '/login' }/>
|
||||
)
|
||||
}
|
||||
|
||||
return <Fragment>
|
||||
<div className="my-3">
|
||||
<Row className="h-100 flex justify-content-center">
|
||||
<Col lg={6}>
|
||||
<Col lg={ 6 }>
|
||||
<ProfileDisplayName/>
|
||||
<ShowIf condition={userProvider === LoginProvider.INTERNAL}>
|
||||
<ShowIf condition={ userProvider === LoginProvider.INTERNAL }>
|
||||
<ProfileChangePassword/>
|
||||
</ShowIf>
|
||||
<ProfileAccessTokens/>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment, useEffect, useRef, useState } from 'react'
|
||||
import { Button, Card, Modal } from 'react-bootstrap'
|
||||
|
@ -19,13 +19,13 @@ export const ProfileAccountManagement: React.FC = () => {
|
|||
const [countdown, setCountdown] = useState(0)
|
||||
const interval = useRef<NodeJS.Timeout>()
|
||||
|
||||
const stopCountdown = ():void => {
|
||||
const stopCountdown = (): void => {
|
||||
if (interval.current) {
|
||||
clearTimeout(interval.current)
|
||||
}
|
||||
}
|
||||
|
||||
const startCountdown = ():void => {
|
||||
const startCountdown = (): void => {
|
||||
interval.current = setInterval(() => {
|
||||
setCountdown((oldValue) => oldValue - 1)
|
||||
}, 1000)
|
||||
|
@ -63,28 +63,28 @@ export const ProfileAccountManagement: React.FC = () => {
|
|||
<Card className="bg-dark mb-4">
|
||||
<Card.Body>
|
||||
<Card.Title><Trans i18nKey="profile.accountManagement"/></Card.Title>
|
||||
<Button variant="secondary" block href={getApiUrl() + '/me/export'} className="mb-2">
|
||||
<ForkAwesomeIcon icon="cloud-download" fixedWidth={true} className="mx-2"/>
|
||||
<Button variant="secondary" block href={ getApiUrl() + '/me/export' } className="mb-2">
|
||||
<ForkAwesomeIcon icon="cloud-download" fixedWidth={ true } className="mx-2"/>
|
||||
<Trans i18nKey="profile.exportUserData"/>
|
||||
</Button>
|
||||
<Button variant="danger" block onClick={handleModalOpen}>
|
||||
<ForkAwesomeIcon icon="trash" fixedWidth={true} className="mx-2"/>
|
||||
<Button variant="danger" block onClick={ handleModalOpen }>
|
||||
<ForkAwesomeIcon icon="trash" fixedWidth={ true } className="mx-2"/>
|
||||
<Trans i18nKey="profile.deleteUser"/>
|
||||
</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
|
||||
<Modal show={showDeleteModal} onHide={handleModalClose} animation={true}>
|
||||
<Modal show={ showDeleteModal } onHide={ handleModalClose } animation={ true }>
|
||||
<Modal.Body className="text-dark">
|
||||
<h3 dir="auto"><Trans i18nKey="profile.modal.deleteUser.message"/></h3>
|
||||
<Trans i18nKey="profile.modal.deleteUser.subMessage"/>
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant="secondary" onClick={handleModalClose}>
|
||||
<Button variant="secondary" onClick={ handleModalClose }>
|
||||
<Trans i18nKey="common.close"/>
|
||||
</Button>
|
||||
<Button variant="danger" onClick={deleteUserAccount} disabled={!deletionButtonActive}>
|
||||
{deletionButtonActive ? <Trans i18nKey={'profile.modal.deleteUser.title'}/> : countdown}
|
||||
<Button variant="danger" onClick={ deleteUserAccount } disabled={ !deletionButtonActive }>
|
||||
{ deletionButtonActive ? <Trans i18nKey={ 'profile.modal.deleteUser.title' }/> : countdown }
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { ChangeEvent, FormEvent, useState } from 'react'
|
||||
import { Button, Card, Form } from 'react-bootstrap'
|
||||
|
@ -39,7 +39,7 @@ export const ProfileChangePassword: React.FC = () => {
|
|||
<Card className="bg-dark mb-4">
|
||||
<Card.Body>
|
||||
<Card.Title><Trans i18nKey="profile.changePassword.title"/></Card.Title>
|
||||
<Form onSubmit={updatePasswordSubmit} className="text-left">
|
||||
<Form onSubmit={ updatePasswordSubmit } className="text-left">
|
||||
<Form.Group controlId="oldPassword">
|
||||
<Form.Label><Trans i18nKey="profile.changePassword.old"/></Form.Label>
|
||||
<Form.Control
|
||||
|
@ -47,7 +47,7 @@ export const ProfileChangePassword: React.FC = () => {
|
|||
size="sm"
|
||||
className="bg-dark text-light"
|
||||
required
|
||||
onChange={(event) => setOldPassword(event.target.value)}
|
||||
onChange={ (event) => setOldPassword(event.target.value) }
|
||||
/>
|
||||
</Form.Group>
|
||||
<Form.Group controlId="newPassword">
|
||||
|
@ -57,8 +57,8 @@ export const ProfileChangePassword: React.FC = () => {
|
|||
size="sm"
|
||||
className="bg-dark text-light"
|
||||
required
|
||||
onChange={onChangeNewPassword}
|
||||
isValid={newPasswordValid}
|
||||
onChange={ onChangeNewPassword }
|
||||
isValid={ newPasswordValid }
|
||||
/>
|
||||
<Form.Text><Trans i18nKey="profile.changePassword.info"/></Form.Text>
|
||||
</Form.Group>
|
||||
|
@ -69,16 +69,16 @@ export const ProfileChangePassword: React.FC = () => {
|
|||
size="sm"
|
||||
className="bg-dark text-light"
|
||||
required
|
||||
onChange={onChangeNewPasswordAgain}
|
||||
isValid={newPasswordAgainValid}
|
||||
isInvalid={newPasswordAgain !== '' && !newPasswordAgainValid}
|
||||
onChange={ onChangeNewPasswordAgain }
|
||||
isValid={ newPasswordAgainValid }
|
||||
isInvalid={ newPasswordAgain !== '' && !newPasswordAgainValid }
|
||||
/>
|
||||
</Form.Group>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={!newPasswordValid || !newPasswordAgainValid}>
|
||||
disabled={ !newPasswordValid || !newPasswordAgainValid }>
|
||||
<Trans i18nKey="common.save"/>
|
||||
</Button>
|
||||
</Form>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { ChangeEvent, FormEvent, useEffect, useState } from 'react'
|
||||
import { Alert, Button, Card, Form } from 'react-bootstrap'
|
||||
|
@ -27,7 +27,7 @@ export const ProfileDisplayName: React.FC = () => {
|
|||
}, [userName])
|
||||
|
||||
if (!userName) {
|
||||
return <Alert variant={'danger'}>User not logged in</Alert>
|
||||
return <Alert variant={ 'danger' }>User not logged in</Alert>
|
||||
}
|
||||
|
||||
const changeNameField = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
|
@ -41,7 +41,8 @@ export const ProfileDisplayName: React.FC = () => {
|
|||
}
|
||||
|
||||
const changeNameSubmit = (event: FormEvent) => {
|
||||
doAsyncChange().catch(() => setError(true))
|
||||
doAsyncChange()
|
||||
.catch(() => setError(true))
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
|
@ -51,18 +52,18 @@ export const ProfileDisplayName: React.FC = () => {
|
|||
<Card.Title>
|
||||
<Trans i18nKey="profile.userProfile"/>
|
||||
</Card.Title>
|
||||
<Form onSubmit={changeNameSubmit} className="text-left">
|
||||
<Form onSubmit={ changeNameSubmit } className="text-left">
|
||||
<Form.Group controlId="displayName">
|
||||
<Form.Label><Trans i18nKey="profile.displayName"/></Form.Label>
|
||||
<Form.Control
|
||||
type="text"
|
||||
size="sm"
|
||||
placeholder={t('profile.displayName')}
|
||||
value={displayName}
|
||||
placeholder={ t('profile.displayName') }
|
||||
value={ displayName }
|
||||
className="bg-dark text-light"
|
||||
onChange={changeNameField}
|
||||
isValid={submittable}
|
||||
isInvalid={error}
|
||||
onChange={ changeNameField }
|
||||
isValid={ submittable }
|
||||
isInvalid={ error }
|
||||
required
|
||||
/>
|
||||
<Form.Text><Trans i18nKey="profile.displayNameInfo"/></Form.Text>
|
||||
|
@ -71,7 +72,7 @@ export const ProfileDisplayName: React.FC = () => {
|
|||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={!submittable}>
|
||||
disabled={ !submittable }>
|
||||
<Trans i18nKey="common.save"/>
|
||||
</Button>
|
||||
</Form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue