fix(frontend): reformat source files

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-11-30 22:10:23 +01:00 committed by David Mehren
parent e260b77760
commit e390c0dd15
669 changed files with 1741 additions and 2354 deletions

View file

@ -3,12 +3,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { WaitSpinner } from './wait-spinner/wait-spinner'
import type { PropsWithChildren, ReactNode } from 'react'
import React, { Fragment } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { WaitSpinner } from './wait-spinner/wait-spinner'
import { Alert } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
export interface AsyncLoadingBoundaryProps {
loading: boolean

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { createContext, useState } from 'react'
import type { PropsWithChildren } from 'react'

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useMemo } from 'react'
import { useApplicationState } from '../../../hooks/common/use-application-state'
import { ShowIf } from '../show-if/show-if'
import styles from './branding.module.scss'
import { useApplicationState } from '../../../hooks/common/use-application-state'
import React, { useMemo } from 'react'
export interface BrandingProps {
inline?: boolean

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
import { CopyToClipboardButton } from './copy-to-clipboard-button'
import { act, render, screen } from '@testing-library/react'

View file

@ -3,15 +3,14 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute'
import { cypressId } from '../../../../utils/cypress-attribute'
import { ForkAwesomeIcon } from '../../fork-awesome/fork-awesome-icon'
import { useCopyOverlay } from '../hooks/use-copy-overlay'
import React, { Fragment, useRef } from 'react'
import { Button } from 'react-bootstrap'
import type { Variant } from 'react-bootstrap/types'
import { useTranslation } from 'react-i18next'
import { ForkAwesomeIcon } from '../../fork-awesome/fork-awesome-icon'
import { useCopyOverlay } from '../hooks/use-copy-overlay'
import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute'
import { cypressId } from '../../../../utils/cypress-attribute'
export interface CopyToClipboardButtonProps extends PropsWithDataCypressId {
content: string

View file

@ -3,15 +3,14 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { isClientSideRendering } from '../../../../utils/is-client-side-rendering'
import { Logger } from '../../../../utils/logger'
import { ForkAwesomeIcon } from '../../fork-awesome/fork-awesome-icon'
import { ShowIf } from '../../show-if/show-if'
import { CopyToClipboardButton } from '../copy-to-clipboard-button/copy-to-clipboard-button'
import React, { useCallback, useMemo } from 'react'
import { Button, FormControl, InputGroup } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { ForkAwesomeIcon } from '../../fork-awesome/fork-awesome-icon'
import { ShowIf } from '../../show-if/show-if'
import { Logger } from '../../../../utils/logger'
import { isClientSideRendering } from '../../../../utils/is-client-side-rendering'
import { CopyToClipboardButton } from '../copy-to-clipboard-button/copy-to-clipboard-button'
export interface CopyableFieldProps {
content: string

View file

@ -3,16 +3,15 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { isClientSideRendering } from '../../../../utils/is-client-side-rendering'
import { Logger } from '../../../../utils/logger'
import { ShowIf } from '../../show-if/show-if'
import type { ReactElement, RefObject } from 'react'
import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { Overlay, Tooltip } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
import { v4 as uuid } from 'uuid'
import { ShowIf } from '../../show-if/show-if'
import { Logger } from '../../../../utils/logger'
import { isClientSideRendering } from '../../../../utils/is-client-side-rendering'
import { useTimeoutFn } from 'react-use'
import { v4 as uuid } from 'uuid'
const log = new Logger('useCopyOverlay')

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useState } from 'react'
import type { ButtonProps } from 'react-bootstrap'
import { Button } from 'react-bootstrap'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import type { CommonFieldProps } from './fields'
import React from 'react'
import { Form } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useMemo } from 'react'
import type { CommonFieldProps } from './fields'
import React, { useMemo } from 'react'
import { Form } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { ChangeEvent } from 'react'
export interface CommonFieldProps {

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useMemo } from 'react'
import type { CommonFieldProps } from './fields'
import React, { useMemo } from 'react'
import { Form } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useMemo } from 'react'
import type { CommonFieldProps } from './fields'
import React, { useMemo } from 'react'
import { Form } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useMemo } from 'react'
import type { CommonFieldProps } from './fields'
import React, { useMemo } from 'react'
import { Form } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'

View file

@ -3,10 +3,9 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ForkAwesomeIcon } from './fork-awesome-icon'
import type { IconName } from './types'
import { render } from '@testing-library/react'
import { ForkAwesomeIcon } from './fork-awesome-icon'
describe('ForkAwesomeIcon', () => {
const icon: IconName = 'heart'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import type { IconName, IconSize } from './types'
import React from 'react'
export interface ForkAwesomeIconProps {
icon: IconName

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { render } from '@testing-library/react'
import { ForkAwesomeStack } from './fork-awesome-stack'
import type { ForkAwesomeIconProps } from './fork-awesome-icon'
import { ForkAwesomeIcon } from './fork-awesome-icon'
import { ForkAwesomeStack } from './fork-awesome-stack'
import { render } from '@testing-library/react'
import type { ReactElement } from 'react'
describe('ForkAwesomeStack', () => {

View file

@ -3,12 +3,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { ReactElement } from 'react'
import React from 'react'
import type { ForkAwesomeIconProps } from './fork-awesome-icon'
import { ForkAwesomeIcon } from './fork-awesome-icon'
import type { IconSize } from './types'
import type { ReactElement } from 'react'
import React from 'react'
export interface ForkAwesomeStackProps {
size?: IconSize

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { ForkAwesomeIcons } from './fork-awesome-icons'
export type IconName = typeof ForkAwesomeIcons[number]

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useMemo } from 'react'
import LogoBwHorizontal from './logo_text_bw_horizontal.svg'
import LogoColorVertical from './logo_text_color_vertical.svg'
import LogoWbHorizontal from './logo_text_wb_horizontal.svg'
import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
export enum HedgeDocLogoSize {

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { IconName } from '../fork-awesome/types'
import { IconButton } from './icon-button'
import { fireEvent, render, screen } from '@testing-library/react'

View file

@ -3,16 +3,15 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import type { ButtonProps } from 'react-bootstrap'
import { Button } from 'react-bootstrap'
import type { PropsWithDataTestId } from '../../../utils/test-id'
import { testId } from '../../../utils/test-id'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import type { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if'
import styles from './icon-button.module.scss'
import type { PropsWithDataTestId } from '../../../utils/test-id'
import { testId } from '../../../utils/test-id'
import React from 'react'
import type { ButtonProps } from 'react-bootstrap'
import { Button } from 'react-bootstrap'
export interface IconButtonProps extends ButtonProps, PropsWithDataTestId {
icon: IconName

View file

@ -3,10 +3,9 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { render } from '@testing-library/react'
import { TranslatedIconButton } from './translated-icon-button'
import { render } from '@testing-library/react'
describe('TranslatedIconButton', () => {
it('renders heart icon with i18nKey', async () => {

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Trans } from 'react-i18next'
import type { IconButtonProps } from './icon-button'
import { IconButton } from './icon-button'
import React from 'react'
import { Trans } from 'react-i18next'
export interface TranslatedIconButtonProps extends IconButtonProps {
i18nKey: string

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { render } from '@testing-library/react'
import { ExternalLink } from './external-link'
import { render } from '@testing-library/react'
describe('ExternalLink', () => {
const href = 'https://example.com'

View file

@ -3,12 +3,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import type { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if'
import type { LinkWithTextProps } from './types'
import React from 'react'
/**
* An external link.

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { render } from '@testing-library/react'
import { InternalLink } from './internal-link'
import { render } from '@testing-library/react'
describe('InternalLink', () => {
const href = '/test'

View file

@ -3,13 +3,12 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import Link from 'next/link'
import React from 'react'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import type { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if'
import type { LinkWithTextProps } from './types'
import Link from 'next/link'
import React from 'react'
/**
* An internal link.

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { TranslatedExternalLink } from './translated-external-link'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { TranslatedExternalLink } from './translated-external-link'
import { render } from '@testing-library/react'
describe('TranslatedExternalLink', () => {

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { useTranslation } from 'react-i18next'
import { ExternalLink } from './external-link'
import type { TranslatedLinkProps } from './types'
import React from 'react'
import { useTranslation } from 'react-i18next'
/**
* An {@link ExternalLink external link} with translated text.

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { TranslatedInternalLink } from './translated-internal-link'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { TranslatedInternalLink } from './translated-internal-link'
import { render } from '@testing-library/react'
describe('TranslatedInternalLink', () => {

View file

@ -3,11 +3,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { useTranslation } from 'react-i18next'
import { InternalLink } from './internal-link'
import type { TranslatedLinkProps } from './types'
import React from 'react'
import { useTranslation } from 'react-i18next'
/**
* An {@link InternalLink internal link} with translated text.
*

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { TOptions } from 'i18next'
import type { IconName } from '../fork-awesome/fork-awesome-icon'
import type { TOptions } from 'i18next'
interface GeneralLinkProp {
href: string

View file

@ -3,10 +3,9 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import React from 'react'
import { Button } from 'react-bootstrap'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
export interface LockButtonProps {
locked: boolean

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { fireEvent, render, screen } from '@testing-library/react'
import { CommonModal } from './common-modal'
import { fireEvent, render, screen } from '@testing-library/react'
import React from 'react'
describe('CommonModal', () => {

View file

@ -3,17 +3,16 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { PropsWithDataCypressId } from '../../../utils/cypress-attribute'
import { cypressId } from '../../../utils/cypress-attribute'
import { testId } from '../../../utils/test-id'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import type { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if'
import type { PropsWithChildren } from 'react'
import React, { useMemo } from 'react'
import { Modal } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import type { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if'
import type { PropsWithDataCypressId } from '../../../utils/cypress-attribute'
import { cypressId } from '../../../utils/cypress-attribute'
import { testId } from '../../../utils/test-id'
export interface ModalVisibilityProps {
show: boolean

View file

@ -3,10 +3,9 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { render, screen } from '@testing-library/react'
import { DeletionModal } from './deletion-modal'
import { render, screen } from '@testing-library/react'
describe('DeletionModal', () => {
it('renders correctly with deletionButtonI18nKey', async () => {

View file

@ -3,14 +3,13 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { cypressId } from '../../../utils/cypress-attribute'
import type { CommonModalProps } from './common-modal'
import { CommonModal } from './common-modal'
import type { PropsWithChildren } from 'react'
import React from 'react'
import { Button, Modal } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
import type { CommonModalProps } from './common-modal'
import { CommonModal } from './common-modal'
import { cypressId } from '../../../utils/cypress-attribute'
export interface DeletionModalProps extends CommonModalProps {
onConfirm: () => void

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Mock } from 'ts-mockery'
import { fetchMotd } from './fetch-motd'
import { Mock } from 'ts-mockery'
describe('fetch motd', () => {
const motdUrl = 'public/motd.md'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Logger } from '../../../utils/logger'
import { defaultConfig } from '../../../api/common/default-config'
import { Logger } from '../../../utils/logger'
export const MOTD_LOCAL_STORAGE_KEY = 'motd.lastModified'
const log = new Logger('Motd')

View file

@ -3,18 +3,17 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { MotdModal } from './motd-modal'
import { act, render, screen } from '@testing-library/react'
import * as fetchMotdModule from './fetch-motd'
import * as UseBaseUrlModule from '../../../hooks/common/use-base-url'
import { testId } from '../../../utils/test-id'
import * as RenderIframeModule from '../../editor-page/renderer-pane/render-iframe'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import type { CommonModalProps } from '../modals/common-modal'
import * as CommonModalModule from '../modals/common-modal'
import * as fetchMotdModule from './fetch-motd'
import { MotdModal } from './motd-modal'
import { act, render, screen } from '@testing-library/react'
import type { PropsWithChildren } from 'react'
import React from 'react'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import * as RenderIframeModule from '../../editor-page/renderer-pane/render-iframe'
import { testId } from '../../../utils/test-id'
import * as UseBaseUrlModule from '../../../hooks/common/use-base-url'
jest.mock('./fetch-motd')
jest.mock('../modals/common-modal')

View file

@ -3,19 +3,18 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useCallback, useMemo, useEffect, useState } from 'react'
import { Button, Modal } from 'react-bootstrap'
import { CommonModal } from '../modals/common-modal'
import { Trans, useTranslation } from 'react-i18next'
import { fetchMotd, MOTD_LOCAL_STORAGE_KEY } from './fetch-motd'
import { useAsync } from 'react-use'
import { cypressId } from '../../../utils/cypress-attribute'
import { Logger } from '../../../utils/logger'
import { testId } from '../../../utils/test-id'
import { EditorToRendererCommunicatorContextProvider } from '../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
import { RenderIframe } from '../../editor-page/renderer-pane/render-iframe'
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
import { EditorToRendererCommunicatorContextProvider } from '../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
import { cypressId } from '../../../utils/cypress-attribute'
import { CommonModal } from '../modals/common-modal'
import { fetchMotd, MOTD_LOCAL_STORAGE_KEY } from './fetch-motd'
import React, { useCallback, useMemo, useEffect, useState } from 'react'
import { Button, Modal } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
import { useAsync } from 'react-use'
const logger = new Logger('Motd')

View file

@ -3,15 +3,14 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { act, render, screen, waitFor } from '@testing-library/react'
import { CreateNonExistingNoteHint } from './create-non-existing-note-hint'
import * as createNoteWithPrimaryAliasModule from '../../../api/notes'
import type { Note, NoteMetadata } from '../../../api/notes/types'
import { Mock } from 'ts-mockery'
import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter'
import { waitForOtherPromisesToFinish } from '../../../utils/wait-for-other-promises-to-finish'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { CreateNonExistingNoteHint } from './create-non-existing-note-hint'
import { act, render, screen, waitFor } from '@testing-library/react'
import { Mock } from 'ts-mockery'
jest.mock('../../../api/notes')
jest.mock('../../../hooks/common/use-single-string-url-parameter')

View file

@ -3,16 +3,15 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Trans, useTranslation } from 'react-i18next'
import { createNoteWithPrimaryAlias } from '../../../api/notes'
import { useSingleStringUrlParameter } from '../../../hooks/common/use-single-string-url-parameter'
import { testId } from '../../../utils/test-id'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import { ShowIf } from '../show-if/show-if'
import React, { useCallback, useEffect } from 'react'
import { Alert, Button } from 'react-bootstrap'
import { useSingleStringUrlParameter } from '../../../hooks/common/use-single-string-url-parameter'
import { createNoteWithPrimaryAlias } from '../../../api/notes'
import { Trans, useTranslation } from 'react-i18next'
import { useAsyncFn } from 'react-use'
import { ShowIf } from '../show-if/show-if'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import { testId } from '../../../utils/test-id'
export interface CreateNonExistingNoteHintProps {
onNoteCreated: () => void

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useAsyncFn } from 'react-use'
import { getNote } from '../../../../api/notes'
import { setNoteDataFromServer } from '../../../../redux/note-details/methods'
import { useSingleStringUrlParameter } from '../../../../hooks/common/use-single-string-url-parameter'
import { setNoteDataFromServer } from '../../../../redux/note-details/methods'
import { useAsyncFn } from 'react-use'
import type { AsyncState } from 'react-use/lib/useAsyncFn'
/**

View file

@ -3,19 +3,19 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter'
import * as getNoteModule from '../../../api/notes'
import * as setNoteDataFromServerModule from '../../../redux/note-details/methods'
import type { Note } from '../../../api/notes/types'
import { Mock } from 'ts-mockery'
import { render, screen } from '@testing-library/react'
import { NoteLoadingBoundary } from './note-loading-boundary'
import { testId } from '../../../utils/test-id'
import { Fragment } from 'react'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import * as CommonErrorPageModule from '../../error-pages/common-error-page'
import * as LoadingScreenModule from '../../../components/application-loader/loading-screen/loading-screen'
import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter'
import * as setNoteDataFromServerModule from '../../../redux/note-details/methods'
import { testId } from '../../../utils/test-id'
import * as CommonErrorPageModule from '../../error-pages/common-error-page'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import * as CreateNonExistingNoteHintModule from './create-non-existing-note-hint'
import { NoteLoadingBoundary } from './note-loading-boundary'
import { render, screen } from '@testing-library/react'
import { Fragment } from 'react'
import { Mock } from 'ts-mockery'
jest.mock('../../../hooks/common/use-single-string-url-parameter')
jest.mock('../../../api/notes')

View file

@ -3,14 +3,13 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { PropsWithChildren } from 'react'
import React, { Fragment, useEffect } from 'react'
import { useLoadNoteFromServer } from './hooks/use-load-note-from-server'
import { LoadingScreen } from '../../application-loader/loading-screen/loading-screen'
import { CommonErrorPage } from '../../error-pages/common-error-page'
import { CreateNonExistingNoteHint } from './create-non-existing-note-hint'
import { ShowIf } from '../show-if/show-if'
import { CreateNonExistingNoteHint } from './create-non-existing-note-hint'
import { useLoadNoteFromServer } from './hooks/use-load-note-from-server'
import type { PropsWithChildren } from 'react'
import React, { Fragment, useEffect } from 'react'
/**
* Loads the note identified by the note-id in the URL.

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { createNumberRangeArray } from './number-range'
describe('number range', () => {

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
export interface PageItemProps {

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useEffect, useMemo, useState } from 'react'
import { Pagination } from 'react-bootstrap'
import { ShowIf } from '../show-if/show-if'
import { PagerItem } from './pager-item'
import React, { useEffect, useMemo, useState } from 'react'
import { Pagination } from 'react-bootstrap'
export interface PaginationProps {
numberOfPageButtonsToShowAfterAndBeforeCurrent: number

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { PropsWithChildren } from 'react'
import React, { Fragment, useEffect, useMemo } from 'react'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useEffect } from 'react'
import { useRouter } from 'next/router'
import React, { useEffect } from 'react'
/**
* Redirects the user back to the previous URL.

View file

@ -3,12 +3,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import Link from 'next/link'
import React, { useEffect } from 'react'
import { useRouter } from 'next/router'
import { Logger } from '../../utils/logger'
import { testId } from '../../utils/test-id'
import Link from 'next/link'
import { useRouter } from 'next/router'
import React, { useEffect } from 'react'
export interface RedirectProps {
to: string

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { render } from '@testing-library/react'
import { ShowIf } from './show-if'
import { render } from '@testing-library/react'
describe('ShowIf', () => {
it('renders child if condition is true', () => {

View file

@ -3,7 +3,6 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { PropsWithChildren } from 'react'
import React, { Fragment } from 'react'

View file

@ -3,14 +3,14 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { useAsync } from 'react-use'
import { getUser } from '../../../api/users'
import type { UserInfo } from '../../../api/users/types'
import { AsyncLoadingBoundary } from '../async-loading-boundary'
import type { UserAvatarProps } from './user-avatar'
import { UserAvatar } from './user-avatar'
import type { UserInfo } from '../../../api/users/types'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { AsyncLoadingBoundary } from '../async-loading-boundary'
import { useAsync } from 'react-use'
export interface UserAvatarForUsernameProps extends Omit<UserAvatarProps, 'user'> {
username: string | null

View file

@ -3,11 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { UserAvatar } from './user-avatar'
import { render } from '@testing-library/react'
import type { UserInfo } from '../../../api/users/types'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { UserAvatar } from './user-avatar'
import { render } from '@testing-library/react'
describe('UserAvatar', () => {
const user: UserInfo = {

View file

@ -3,15 +3,14 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { useCallback, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { ShowIf } from '../show-if/show-if'
import styles from './user-avatar.module.scss'
import type { UserInfo } from '../../../api/users/types'
import { ShowIf } from '../show-if/show-if'
import defaultAvatar from './default-avatar.png'
import styles from './user-avatar.module.scss'
import React, { useCallback, useMemo } from 'react'
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import type { OverlayInjectedProps } from 'react-bootstrap/Overlay'
import { useTranslation } from 'react-i18next'
export interface UserAvatarProps {
size?: 'sm' | 'lg'

View file

@ -3,9 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import React from 'react'
/**
* Renders a indefinitely spinning spinner.