diff --git a/frontend/cypress/e2e/deleteNote.spec.ts b/frontend/cypress/e2e/deleteNote.spec.ts index 06eedbbe4..a32b654e5 100644 --- a/frontend/cypress/e2e/deleteNote.spec.ts +++ b/frontend/cypress/e2e/deleteNote.spec.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { testNoteId } from '../support/visit-test-editor' describe('Delete note', () => { diff --git a/frontend/cypress/e2e/document-read-only-page.spec.ts b/frontend/cypress/e2e/document-read-only-page.spec.ts index 18d83e9ba..27ccbca5a 100644 --- a/frontend/cypress/e2e/document-read-only-page.spec.ts +++ b/frontend/cypress/e2e/document-read-only-page.spec.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { PAGE_MODE } from '../support/visit' describe('Document read only page', () => { diff --git a/frontend/cypress/e2e/documentTitle.spec.ts b/frontend/cypress/e2e/documentTitle.spec.ts index 8db4821f7..dd8545c83 100644 --- a/frontend/cypress/e2e/documentTitle.spec.ts +++ b/frontend/cypress/e2e/documentTitle.spec.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { branding } from '../support/config' const title = 'This is a test title' diff --git a/frontend/cypress/e2e/language.spec.ts b/frontend/cypress/e2e/language.spec.ts index 813521737..07511175c 100644 --- a/frontend/cypress/e2e/language.spec.ts +++ b/frontend/cypress/e2e/language.spec.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { languages } from '../fixtures/languages' describe('Languages', () => { diff --git a/frontend/cypress/e2e/signInButton.spec.ts b/frontend/cypress/e2e/signInButton.spec.ts index d267fc9e1..2a72d7bd3 100644 --- a/frontend/cypress/e2e/signInButton.spec.ts +++ b/frontend/cypress/e2e/signInButton.spec.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { AuthProvider } from '../../src/api/config/types' import { AuthProviderType } from '../../src/api/config/types' diff --git a/frontend/cypress/e2e/slideshow-only-page.spec.ts b/frontend/cypress/e2e/slideshow-only-page.spec.ts index 42febfe7b..60c437b51 100644 --- a/frontend/cypress/e2e/slideshow-only-page.spec.ts +++ b/frontend/cypress/e2e/slideshow-only-page.spec.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { PAGE_MODE } from '../support/visit' describe('Slideshow only page', () => { diff --git a/frontend/cypress/support/config.ts b/frontend/cypress/support/config.ts index eb9d6e947..e978c9136 100644 --- a/frontend/cypress/support/config.ts +++ b/frontend/cypress/support/config.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { AuthProviderType } from '../../src/api/config/types' declare namespace Cypress { diff --git a/frontend/cypress/support/e2e.ts b/frontend/cypress/support/e2e.ts index 2f446feba..a6d2acdd4 100644 --- a/frontend/cypress/support/e2e.ts +++ b/frontend/cypress/support/e2e.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - // *********************************************************** // This example support/index.ts is processed and // loaded automatically before your test files. @@ -18,13 +17,12 @@ // You can read more here: // https://on.cypress.io/configuration // *********************************************************** - -import 'cypress-commands' import './check-links' import './config' import './fill' import './get-by-id' import './get-iframe-content' import './logout' -import './visit-test-editor' import './visit' +import './visit-test-editor' +import 'cypress-commands' diff --git a/frontend/cypress/support/get-iframe-content.ts b/frontend/cypress/support/get-iframe-content.ts index d8838c617..c1220e0a7 100644 --- a/frontend/cypress/support/get-iframe-content.ts +++ b/frontend/cypress/support/get-iframe-content.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { RendererType } from '../../src/components/render-page/window-post-message-communicator/rendering-message' declare namespace Cypress { diff --git a/frontend/cypress/support/visit.ts b/frontend/cypress/support/visit.ts index 9812bcb86..201bb15fa 100644 --- a/frontend/cypress/support/visit.ts +++ b/frontend/cypress/support/visit.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { testNoteId } from './visit-test-editor' declare namespace Cypress { diff --git a/frontend/src/api/alias/index.ts b/frontend/src/api/alias/index.ts index fa31f44b7..1662a94af 100644 --- a/frontend/src/api/alias/index.ts +++ b/frontend/src/api/alias/index.ts @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { Alias, NewAliasDto, PrimaryAliasDto } from './types' +import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-request-builder' -import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import type { Alias, NewAliasDto, PrimaryAliasDto } from './types' /** * Adds an alias to an existing note. diff --git a/frontend/src/api/auth/ldap.ts b/frontend/src/api/auth/ldap.ts index a3456a3d6..ea1250922 100644 --- a/frontend/src/api/auth/ldap.ts +++ b/frontend/src/api/auth/ldap.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' import type { LoginDto } from './types' import { AuthError } from './types' -import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' /** * Requests to log in a user via LDAP credentials. diff --git a/frontend/src/api/auth/local.ts b/frontend/src/api/auth/local.ts index 2bf7becf2..ce2a58abd 100644 --- a/frontend/src/api/auth/local.ts +++ b/frontend/src/api/auth/local.ts @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { ChangePasswordDto, LoginDto, RegisterDto } from './types' -import { AuthError, RegisterError } from './types' import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-request-builder' +import type { ChangePasswordDto, LoginDto, RegisterDto } from './types' +import { AuthError, RegisterError } from './types' /** * Requests to do a local login with a provided username and password. diff --git a/frontend/src/api/common/api-request-builder/api-request-builder-with-body.ts b/frontend/src/api/common/api-request-builder/api-request-builder-with-body.ts index 23bdc0ab0..4ba8a0d67 100644 --- a/frontend/src/api/common/api-request-builder/api-request-builder-with-body.ts +++ b/frontend/src/api/common/api-request-builder/api-request-builder-with-body.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { ApiRequestBuilder } from './api-request-builder' /** diff --git a/frontend/src/api/common/api-request-builder/api-request-builder.ts b/frontend/src/api/common/api-request-builder/api-request-builder.ts index fac7cf269..0e7975b4f 100644 --- a/frontend/src/api/common/api-request-builder/api-request-builder.ts +++ b/frontend/src/api/common/api-request-builder/api-request-builder.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import deepmerge from 'deepmerge' -import { defaultConfig, defaultHeaders } from '../default-config' import { ApiResponse } from '../api-response' +import { defaultConfig, defaultHeaders } from '../default-config' +import deepmerge from 'deepmerge' /** * Builder to construct and execute a call to the HTTP API. diff --git a/frontend/src/api/common/api-request-builder/delete-api-request-builder.test.ts b/frontend/src/api/common/api-request-builder/delete-api-request-builder.test.ts index 28561337d..44413b2b8 100644 --- a/frontend/src/api/common/api-request-builder/delete-api-request-builder.test.ts +++ b/frontend/src/api/common/api-request-builder/delete-api-request-builder.test.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { expectFetch } from './test-utils/expect-fetch' import { DeleteApiRequestBuilder } from './delete-api-request-builder' +import { expectFetch } from './test-utils/expect-fetch' describe('DeleteApiRequestBuilder', () => { let originalFetch: typeof global['fetch'] diff --git a/frontend/src/api/common/api-request-builder/get-api-request-builder.test.ts b/frontend/src/api/common/api-request-builder/get-api-request-builder.test.ts index a37196adf..bd024484c 100644 --- a/frontend/src/api/common/api-request-builder/get-api-request-builder.test.ts +++ b/frontend/src/api/common/api-request-builder/get-api-request-builder.test.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { expectFetch } from './test-utils/expect-fetch' import { GetApiRequestBuilder } from './get-api-request-builder' +import { expectFetch } from './test-utils/expect-fetch' describe('GetApiRequestBuilder', () => { let originalFetch: typeof global['fetch'] diff --git a/frontend/src/api/common/api-request-builder/get-api-request-builder.ts b/frontend/src/api/common/api-request-builder/get-api-request-builder.ts index ce995effa..fe7e966ea 100644 --- a/frontend/src/api/common/api-request-builder/get-api-request-builder.ts +++ b/frontend/src/api/common/api-request-builder/get-api-request-builder.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { ApiRequestBuilder } from './api-request-builder' import type { ApiResponse } from '../api-response' +import { ApiRequestBuilder } from './api-request-builder' /** * Builder to construct a GET request to the API. diff --git a/frontend/src/api/common/api-request-builder/post-api-request-builder.test.ts b/frontend/src/api/common/api-request-builder/post-api-request-builder.test.ts index 1b5a4a637..47880ba86 100644 --- a/frontend/src/api/common/api-request-builder/post-api-request-builder.test.ts +++ b/frontend/src/api/common/api-request-builder/post-api-request-builder.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { PostApiRequestBuilder } from './post-api-request-builder' import { expectFetch } from './test-utils/expect-fetch' diff --git a/frontend/src/api/common/api-request-builder/put-api-request-builder.test.ts b/frontend/src/api/common/api-request-builder/put-api-request-builder.test.ts index f653612d7..4720a651c 100644 --- a/frontend/src/api/common/api-request-builder/put-api-request-builder.test.ts +++ b/frontend/src/api/common/api-request-builder/put-api-request-builder.test.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { expectFetch } from './test-utils/expect-fetch' import { PutApiRequestBuilder } from './put-api-request-builder' +import { expectFetch } from './test-utils/expect-fetch' describe('PutApiRequestBuilder', () => { let originalFetch: typeof global['fetch'] diff --git a/frontend/src/api/common/api-request-builder/test-utils/expect-fetch.ts b/frontend/src/api/common/api-request-builder/test-utils/expect-fetch.ts index e8c1d522a..d3e192213 100644 --- a/frontend/src/api/common/api-request-builder/test-utils/expect-fetch.ts +++ b/frontend/src/api/common/api-request-builder/test-utils/expect-fetch.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { defaultConfig } from '../../default-config' import { Mock } from 'ts-mockery' diff --git a/frontend/src/api/common/api-response.test.ts b/frontend/src/api/common/api-response.test.ts index 2f037d0d7..fd3811036 100644 --- a/frontend/src/api/common/api-response.test.ts +++ b/frontend/src/api/common/api-response.test.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { Mock } from 'ts-mockery' import { ApiResponse } from './api-response' +import { Mock } from 'ts-mockery' describe('ApiResponse', () => { it('getResponse returns input response', () => { diff --git a/frontend/src/api/config/index.ts b/frontend/src/api/config/index.ts index 8d45d73eb..a93e5f81f 100644 --- a/frontend/src/api/config/index.ts +++ b/frontend/src/api/config/index.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { Config } from './types' import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' +import type { Config } from './types' /** * Fetches the frontend config from the backend. diff --git a/frontend/src/api/group/index.ts b/frontend/src/api/group/index.ts index ccfd754d5..88ed99bb5 100644 --- a/frontend/src/api/group/index.ts +++ b/frontend/src/api/group/index.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { GroupInfo } from './types' import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' +import type { GroupInfo } from './types' /** * Retrieves information about a group with a given name. diff --git a/frontend/src/api/history/index.ts b/frontend/src/api/history/index.ts index 2921fd655..3ef125d11 100644 --- a/frontend/src/api/history/index.ts +++ b/frontend/src/api/history/index.ts @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { ChangePinStatusDto, HistoryEntry, HistoryEntryPutDto } from './types' +import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-request-builder' -import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import type { ChangePinStatusDto, HistoryEntry, HistoryEntryPutDto } from './types' /** * Fetches the remote history for the user from the server. diff --git a/frontend/src/api/me/index.ts b/frontend/src/api/me/index.ts index 07937d20c..7ca88e50b 100644 --- a/frontend/src/api/me/index.ts +++ b/frontend/src/api/me/index.ts @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' +import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' import type { MediaUpload } from '../media/types' import type { ChangeDisplayNameDto, LoginUserInfo } from './types' -import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' -import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' -import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' /** * Returns metadata about the currently signed-in user from the API. diff --git a/frontend/src/api/media/index.ts b/frontend/src/api/media/index.ts index b9b3fe314..c5474337d 100644 --- a/frontend/src/api/media/index.ts +++ b/frontend/src/api/media/index.ts @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { ImageProxyRequestDto, ImageProxyResponse, MediaUpload } from './types' -import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' +import type { ImageProxyRequestDto, ImageProxyResponse, MediaUpload } from './types' /** * Requests an image-proxy URL from the backend for a given image URL. diff --git a/frontend/src/api/notes/index.ts b/frontend/src/api/notes/index.ts index ab23b67f0..22e898b50 100644 --- a/frontend/src/api/notes/index.ts +++ b/frontend/src/api/notes/index.ts @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { Note, NoteDeletionOptions, NoteMetadata } from './types' -import type { MediaUpload } from '../media/types' +import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' -import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import type { MediaUpload } from '../media/types' +import type { Note, NoteDeletionOptions, NoteMetadata } from './types' /** * Retrieves the content and metadata about the specified note. diff --git a/frontend/src/api/permissions/index.ts b/frontend/src/api/permissions/index.ts index 2a7837693..0135397f4 100644 --- a/frontend/src/api/permissions/index.ts +++ b/frontend/src/api/permissions/index.ts @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-request-builder' import type { NotePermissions } from '../notes/types' import type { OwnerChangeDto, PermissionSetDto } from './types' -import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-request-builder' -import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' /** * Sets the owner of a note. diff --git a/frontend/src/api/revisions/index.ts b/frontend/src/api/revisions/index.ts index 45e0c97a2..62b98f941 100644 --- a/frontend/src/api/revisions/index.ts +++ b/frontend/src/api/revisions/index.ts @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { RevisionDetails, RevisionMetadata } from './types' -import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' +import type { RevisionDetails, RevisionMetadata } from './types' /** * Retrieves a note revision while using a cache for often retrieved revisions. diff --git a/frontend/src/api/revisions/types.ts b/frontend/src/api/revisions/types.ts index cb227e97e..0be666033 100644 --- a/frontend/src/api/revisions/types.ts +++ b/frontend/src/api/revisions/types.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { NoteEdit } from '../notes/types' export interface RevisionDetails extends RevisionMetadata { diff --git a/frontend/src/api/tokens/index.ts b/frontend/src/api/tokens/index.ts index 608c38ad5..fd335aee9 100644 --- a/frontend/src/api/tokens/index.ts +++ b/frontend/src/api/tokens/index.ts @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { AccessToken, AccessTokenWithSecret, CreateAccessTokenDto } from './types' +import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder' -import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder' +import type { AccessToken, AccessTokenWithSecret, CreateAccessTokenDto } from './types' /** * Retrieves the access tokens for the current user. diff --git a/frontend/src/api/users/index.ts b/frontend/src/api/users/index.ts index e022b2cca..d785d2f73 100644 --- a/frontend/src/api/users/index.ts +++ b/frontend/src/api/users/index.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { UserInfo } from './types' import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder' +import type { UserInfo } from './types' /** * Retrieves information about a specific user while using a cache to avoid many requests for the same username. diff --git a/frontend/src/components/application-loader/application-loader.tsx b/frontend/src/components/application-loader/application-loader.tsx index 828cf5ab8..cdc0a993f 100644 --- a/frontend/src/components/application-loader/application-loader.tsx +++ b/frontend/src/components/application-loader/application-loader.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React, { Fragment, Suspense, useMemo } from 'react' +import { Logger } from '../../utils/logger' +import { ApplicationLoaderError } from './application-loader-error' import { createSetUpTaskList } from './initializers' import { LoadingScreen } from './loading-screen/loading-screen' -import { Logger } from '../../utils/logger' +import type { PropsWithChildren } from 'react' +import React, { Fragment, Suspense, useMemo } from 'react' import { useAsync } from 'react-use' -import { ApplicationLoaderError } from './application-loader-error' const log = new Logger('ApplicationLoader') diff --git a/frontend/src/components/application-loader/initializers/fetch-frontend-config.ts b/frontend/src/components/application-loader/initializers/fetch-frontend-config.ts index e34ee2592..ffdc6cf71 100644 --- a/frontend/src/components/application-loader/initializers/fetch-frontend-config.ts +++ b/frontend/src/components/application-loader/initializers/fetch-frontend-config.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { getConfig } from '../../../api/config' import { setConfig } from '../../../redux/config/methods' diff --git a/frontend/src/components/application-loader/initializers/index.ts b/frontend/src/components/application-loader/initializers/index.ts index b0331fccc..f2c7f55a1 100644 --- a/frontend/src/components/application-loader/initializers/index.ts +++ b/frontend/src/components/application-loader/initializers/index.ts @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { setUpI18n } from './setupI18n' import { refreshHistoryState } from '../../../redux/history/methods' +import { Logger } from '../../../utils/logger' +import { isDevMode, isTestMode } from '../../../utils/test-modes' import { fetchAndSetUser } from '../../login-page/auth/utils' import { fetchFrontendConfig } from './fetch-frontend-config' import { loadDarkMode } from './load-dark-mode' -import { isDevMode, isTestMode } from '../../../utils/test-modes' -import { Logger } from '../../../utils/logger' +import { setUpI18n } from './setupI18n' const logger = new Logger('Application Loader') diff --git a/frontend/src/components/application-loader/initializers/load-dark-mode.ts b/frontend/src/components/application-loader/initializers/load-dark-mode.ts index fe558719f..39682ecad 100644 --- a/frontend/src/components/application-loader/initializers/load-dark-mode.ts +++ b/frontend/src/components/application-loader/initializers/load-dark-mode.ts @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { setDarkModePreference } from '../../../redux/dark-mode/methods' -import { Logger } from '../../../utils/logger' -import { isClientSideRendering } from '../../../utils/is-client-side-rendering' -import { DarkModePreference } from '../../../redux/dark-mode/types' import { DARK_MODE_LOCAL_STORAGE_KEY } from '../../../hooks/common/use-apply-dark-mode' +import { setDarkModePreference } from '../../../redux/dark-mode/methods' +import { DarkModePreference } from '../../../redux/dark-mode/types' +import { isClientSideRendering } from '../../../utils/is-client-side-rendering' +import { Logger } from '../../../utils/logger' const logger = new Logger('Dark mode initializer') diff --git a/frontend/src/components/application-loader/initializers/setupI18n.ts b/frontend/src/components/application-loader/initializers/setupI18n.ts index 7a3e0b621..427c1996c 100644 --- a/frontend/src/components/application-loader/initializers/setupI18n.ts +++ b/frontend/src/components/application-loader/initializers/setupI18n.ts @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { isDevMode } from '../../../utils/test-modes' import type { ResourceKey } from 'i18next' import i18n, { use as i18nUse } from 'i18next' import LanguageDetector from 'i18next-browser-languagedetector' import resourcesToBackend from 'i18next-resources-to-backend' import { Settings } from 'luxon' import { initReactI18next } from 'react-i18next' -import { isDevMode } from '../../../utils/test-modes' /** * Set up the internationalisation framework i18n. diff --git a/frontend/src/components/application-loader/loading-screen/icon-row.tsx b/frontend/src/components/application-loader/loading-screen/icon-row.tsx index 6c4562b08..215701ce2 100644 --- a/frontend/src/components/application-loader/loading-screen/icon-row.tsx +++ b/frontend/src/components/application-loader/loading-screen/icon-row.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' import { createNumberRangeArray } from '../../common/number-range/number-range' -import { RandomIcon } from './random-icon' import styles from './animations.module.scss' +import { RandomIcon } from './random-icon' +import React, { useMemo } from 'react' /** * Shows a number of {@link RandomIcon random icons in a row}. diff --git a/frontend/src/components/application-loader/loading-screen/loading-animation.tsx b/frontend/src/components/application-loader/loading-screen/loading-animation.tsx index 0a34610e3..bfe0ba9af 100644 --- a/frontend/src/components/application-loader/loading-screen/loading-animation.tsx +++ b/frontend/src/components/application-loader/loading-screen/loading-animation.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import styles from './animations.module.scss' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { IconRow } from './icon-row' import { createNumberRangeArray } from '../../common/number-range/number-range' +import styles from './animations.module.scss' +import { IconRow } from './icon-row' +import React, { useMemo } from 'react' export interface HedgeDocLogoProps { error: boolean diff --git a/frontend/src/components/application-loader/loading-screen/loading-screen.tsx b/frontend/src/components/application-loader/loading-screen/loading-screen.tsx index 3dafb3966..b6822ce72 100644 --- a/frontend/src/components/application-loader/loading-screen/loading-screen.tsx +++ b/frontend/src/components/application-loader/loading-screen/loading-screen.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ShowIf } from '../../common/show-if/show-if' +import styles from '../application-loader.module.scss' +import { LoadingAnimation } from './loading-animation' import type { ReactElement } from 'react' import React from 'react' import { Alert } from 'react-bootstrap' -import { LoadingAnimation } from './loading-animation' -import { ShowIf } from '../../common/show-if/show-if' -import styles from '../application-loader.module.scss' export interface LoadingScreenProps { errorMessage?: string | ReactElement diff --git a/frontend/src/components/application-loader/loading-screen/random-icon.tsx b/frontend/src/components/application-loader/loading-screen/random-icon.tsx index 27dcb29bf..ed342e59f 100644 --- a/frontend/src/components/application-loader/loading-screen/random-icon.tsx +++ b/frontend/src/components/application-loader/loading-screen/random-icon.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useEffect, useState } from 'react' -import type { IconName } from '../../common/fork-awesome/types' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import type { IconName } from '../../common/fork-awesome/types' import styles from './animations.module.scss' +import React, { useEffect, useState } from 'react' const elements: IconName[] = [ 'file-text', diff --git a/frontend/src/components/common/async-loading-boundary.tsx b/frontend/src/components/common/async-loading-boundary.tsx index bdb48ec0a..fc2fd7761 100644 --- a/frontend/src/components/common/async-loading-boundary.tsx +++ b/frontend/src/components/common/async-loading-boundary.tsx @@ -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 diff --git a/frontend/src/components/common/base-url/base-url-context-provider.tsx b/frontend/src/components/common/base-url/base-url-context-provider.tsx index cc8741054..a8d9eb228 100644 --- a/frontend/src/components/common/base-url/base-url-context-provider.tsx +++ b/frontend/src/components/common/base-url/base-url-context-provider.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import React, { createContext, useState } from 'react' import type { PropsWithChildren } from 'react' diff --git a/frontend/src/components/common/branding/branding.tsx b/frontend/src/components/common/branding/branding.tsx index 587871bd0..a4dadb513 100644 --- a/frontend/src/components/common/branding/branding.tsx +++ b/frontend/src/components/common/branding/branding.tsx @@ -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 diff --git a/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.test.tsx b/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.test.tsx index 94cde501f..a314291e4 100644 --- a/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.test.tsx +++ b/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.test.tsx @@ -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' diff --git a/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx b/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx index d891f982b..7d4a785bc 100644 --- a/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx +++ b/frontend/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx @@ -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 diff --git a/frontend/src/components/common/copyable/copyable-field/copyable-field.tsx b/frontend/src/components/common/copyable/copyable-field/copyable-field.tsx index d11442946..cf0487b89 100644 --- a/frontend/src/components/common/copyable/copyable-field/copyable-field.tsx +++ b/frontend/src/components/common/copyable/copyable-field/copyable-field.tsx @@ -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 diff --git a/frontend/src/components/common/copyable/hooks/use-copy-overlay.tsx b/frontend/src/components/common/copyable/hooks/use-copy-overlay.tsx index b064bc918..c75b85ee7 100644 --- a/frontend/src/components/common/copyable/hooks/use-copy-overlay.tsx +++ b/frontend/src/components/common/copyable/hooks/use-copy-overlay.tsx @@ -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') diff --git a/frontend/src/components/common/countdown-button/countdown-button.tsx b/frontend/src/components/common/countdown-button/countdown-button.tsx index 6e80c562a..47b6da386 100644 --- a/frontend/src/components/common/countdown-button/countdown-button.tsx +++ b/frontend/src/components/common/countdown-button/countdown-button.tsx @@ -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' diff --git a/frontend/src/components/common/fields/current-password-field.tsx b/frontend/src/components/common/fields/current-password-field.tsx index 07647a345..229c3f78d 100644 --- a/frontend/src/components/common/fields/current-password-field.tsx +++ b/frontend/src/components/common/fields/current-password-field.tsx @@ -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' diff --git a/frontend/src/components/common/fields/display-name-field.tsx b/frontend/src/components/common/fields/display-name-field.tsx index 4fd7a177c..1f8357614 100644 --- a/frontend/src/components/common/fields/display-name-field.tsx +++ b/frontend/src/components/common/fields/display-name-field.tsx @@ -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' diff --git a/frontend/src/components/common/fields/fields.ts b/frontend/src/components/common/fields/fields.ts index 67df47d90..f06366948 100644 --- a/frontend/src/components/common/fields/fields.ts +++ b/frontend/src/components/common/fields/fields.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { ChangeEvent } from 'react' export interface CommonFieldProps { diff --git a/frontend/src/components/common/fields/new-password-field.tsx b/frontend/src/components/common/fields/new-password-field.tsx index c8f156939..d4563c713 100644 --- a/frontend/src/components/common/fields/new-password-field.tsx +++ b/frontend/src/components/common/fields/new-password-field.tsx @@ -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' diff --git a/frontend/src/components/common/fields/password-again-field.tsx b/frontend/src/components/common/fields/password-again-field.tsx index e98e72daf..317ca858a 100644 --- a/frontend/src/components/common/fields/password-again-field.tsx +++ b/frontend/src/components/common/fields/password-again-field.tsx @@ -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' diff --git a/frontend/src/components/common/fields/username-field.tsx b/frontend/src/components/common/fields/username-field.tsx index ff28cb6f1..4edf0b548 100644 --- a/frontend/src/components/common/fields/username-field.tsx +++ b/frontend/src/components/common/fields/username-field.tsx @@ -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' diff --git a/frontend/src/components/common/fork-awesome/fork-awesome-icon.test.tsx b/frontend/src/components/common/fork-awesome/fork-awesome-icon.test.tsx index d2b7bbd49..cb123a4db 100644 --- a/frontend/src/components/common/fork-awesome/fork-awesome-icon.test.tsx +++ b/frontend/src/components/common/fork-awesome/fork-awesome-icon.test.tsx @@ -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' diff --git a/frontend/src/components/common/fork-awesome/fork-awesome-icon.tsx b/frontend/src/components/common/fork-awesome/fork-awesome-icon.tsx index c37f602a3..ff3747576 100644 --- a/frontend/src/components/common/fork-awesome/fork-awesome-icon.tsx +++ b/frontend/src/components/common/fork-awesome/fork-awesome-icon.tsx @@ -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 diff --git a/frontend/src/components/common/fork-awesome/fork-awesome-stack.test.tsx b/frontend/src/components/common/fork-awesome/fork-awesome-stack.test.tsx index fd1466545..4718e814a 100644 --- a/frontend/src/components/common/fork-awesome/fork-awesome-stack.test.tsx +++ b/frontend/src/components/common/fork-awesome/fork-awesome-stack.test.tsx @@ -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', () => { diff --git a/frontend/src/components/common/fork-awesome/fork-awesome-stack.tsx b/frontend/src/components/common/fork-awesome/fork-awesome-stack.tsx index 499b17359..5982be39c 100644 --- a/frontend/src/components/common/fork-awesome/fork-awesome-stack.tsx +++ b/frontend/src/components/common/fork-awesome/fork-awesome-stack.tsx @@ -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 diff --git a/frontend/src/components/common/fork-awesome/types.d.ts b/frontend/src/components/common/fork-awesome/types.d.ts index d8899cf52..eed14a266 100644 --- a/frontend/src/components/common/fork-awesome/types.d.ts +++ b/frontend/src/components/common/fork-awesome/types.d.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { ForkAwesomeIcons } from './fork-awesome-icons' export type IconName = typeof ForkAwesomeIcons[number] diff --git a/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx b/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx index a6df499cf..6e01b87ee 100644 --- a/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx +++ b/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx @@ -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 { diff --git a/frontend/src/components/common/icon-button/icon-button.test.tsx b/frontend/src/components/common/icon-button/icon-button.test.tsx index a63c110ec..435becb68 100644 --- a/frontend/src/components/common/icon-button/icon-button.test.tsx +++ b/frontend/src/components/common/icon-button/icon-button.test.tsx @@ -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' diff --git a/frontend/src/components/common/icon-button/icon-button.tsx b/frontend/src/components/common/icon-button/icon-button.tsx index 4428e9527..6c9bea858 100644 --- a/frontend/src/components/common/icon-button/icon-button.tsx +++ b/frontend/src/components/common/icon-button/icon-button.tsx @@ -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 diff --git a/frontend/src/components/common/icon-button/translated-icon-button.test.tsx b/frontend/src/components/common/icon-button/translated-icon-button.test.tsx index 5ea28ad05..559be43b6 100644 --- a/frontend/src/components/common/icon-button/translated-icon-button.test.tsx +++ b/frontend/src/components/common/icon-button/translated-icon-button.test.tsx @@ -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 () => { diff --git a/frontend/src/components/common/icon-button/translated-icon-button.tsx b/frontend/src/components/common/icon-button/translated-icon-button.tsx index 62a71f80b..8fa14f0a7 100644 --- a/frontend/src/components/common/icon-button/translated-icon-button.tsx +++ b/frontend/src/components/common/icon-button/translated-icon-button.tsx @@ -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 diff --git a/frontend/src/components/common/links/external-link.test.tsx b/frontend/src/components/common/links/external-link.test.tsx index 8218933aa..66a61195a 100644 --- a/frontend/src/components/common/links/external-link.test.tsx +++ b/frontend/src/components/common/links/external-link.test.tsx @@ -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' diff --git a/frontend/src/components/common/links/external-link.tsx b/frontend/src/components/common/links/external-link.tsx index 6bfb1ccf0..e293ad28b 100644 --- a/frontend/src/components/common/links/external-link.tsx +++ b/frontend/src/components/common/links/external-link.tsx @@ -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. diff --git a/frontend/src/components/common/links/internal-link.test.tsx b/frontend/src/components/common/links/internal-link.test.tsx index e6145cb5c..c81fba1ed 100644 --- a/frontend/src/components/common/links/internal-link.test.tsx +++ b/frontend/src/components/common/links/internal-link.test.tsx @@ -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' diff --git a/frontend/src/components/common/links/internal-link.tsx b/frontend/src/components/common/links/internal-link.tsx index f7378209f..557d59a31 100644 --- a/frontend/src/components/common/links/internal-link.tsx +++ b/frontend/src/components/common/links/internal-link.tsx @@ -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. diff --git a/frontend/src/components/common/links/translated-external-link.test.tsx b/frontend/src/components/common/links/translated-external-link.test.tsx index e4dd54155..1ecb65641 100644 --- a/frontend/src/components/common/links/translated-external-link.test.tsx +++ b/frontend/src/components/common/links/translated-external-link.test.tsx @@ -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', () => { diff --git a/frontend/src/components/common/links/translated-external-link.tsx b/frontend/src/components/common/links/translated-external-link.tsx index 099d37a36..f393e3358 100644 --- a/frontend/src/components/common/links/translated-external-link.tsx +++ b/frontend/src/components/common/links/translated-external-link.tsx @@ -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. diff --git a/frontend/src/components/common/links/translated-internal-link.test.tsx b/frontend/src/components/common/links/translated-internal-link.test.tsx index fe6616747..2c158092d 100644 --- a/frontend/src/components/common/links/translated-internal-link.test.tsx +++ b/frontend/src/components/common/links/translated-internal-link.test.tsx @@ -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', () => { diff --git a/frontend/src/components/common/links/translated-internal-link.tsx b/frontend/src/components/common/links/translated-internal-link.tsx index 79e7083e2..25b84ed7d 100644 --- a/frontend/src/components/common/links/translated-internal-link.tsx +++ b/frontend/src/components/common/links/translated-internal-link.tsx @@ -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. * diff --git a/frontend/src/components/common/links/types.d.ts b/frontend/src/components/common/links/types.d.ts index dd69fbadc..1422205f5 100644 --- a/frontend/src/components/common/links/types.d.ts +++ b/frontend/src/components/common/links/types.d.ts @@ -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 diff --git a/frontend/src/components/common/lock-button/lock-button.tsx b/frontend/src/components/common/lock-button/lock-button.tsx index 116ecb632..e7a6fc699 100644 --- a/frontend/src/components/common/lock-button/lock-button.tsx +++ b/frontend/src/components/common/lock-button/lock-button.tsx @@ -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 diff --git a/frontend/src/components/common/modals/common-modal.test.tsx b/frontend/src/components/common/modals/common-modal.test.tsx index b241b7bf6..736fd64ee 100644 --- a/frontend/src/components/common/modals/common-modal.test.tsx +++ b/frontend/src/components/common/modals/common-modal.test.tsx @@ -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', () => { diff --git a/frontend/src/components/common/modals/common-modal.tsx b/frontend/src/components/common/modals/common-modal.tsx index 9524fb8b1..eb64fea89 100644 --- a/frontend/src/components/common/modals/common-modal.tsx +++ b/frontend/src/components/common/modals/common-modal.tsx @@ -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 diff --git a/frontend/src/components/common/modals/deletion-moadal.test.tsx b/frontend/src/components/common/modals/deletion-moadal.test.tsx index a4026fc92..f4bcafee2 100644 --- a/frontend/src/components/common/modals/deletion-moadal.test.tsx +++ b/frontend/src/components/common/modals/deletion-moadal.test.tsx @@ -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 () => { diff --git a/frontend/src/components/common/modals/deletion-modal.tsx b/frontend/src/components/common/modals/deletion-modal.tsx index d7f0ec9db..432c223cf 100644 --- a/frontend/src/components/common/modals/deletion-modal.tsx +++ b/frontend/src/components/common/modals/deletion-modal.tsx @@ -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 diff --git a/frontend/src/components/common/motd-modal/fetch-motd.test.ts b/frontend/src/components/common/motd-modal/fetch-motd.test.ts index 1227125fe..5e44e9a2d 100644 --- a/frontend/src/components/common/motd-modal/fetch-motd.test.ts +++ b/frontend/src/components/common/motd-modal/fetch-motd.test.ts @@ -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' diff --git a/frontend/src/components/common/motd-modal/fetch-motd.ts b/frontend/src/components/common/motd-modal/fetch-motd.ts index b2be7f4d7..6f6d9d36c 100644 --- a/frontend/src/components/common/motd-modal/fetch-motd.ts +++ b/frontend/src/components/common/motd-modal/fetch-motd.ts @@ -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') diff --git a/frontend/src/components/common/motd-modal/motd-modal.test.tsx b/frontend/src/components/common/motd-modal/motd-modal.test.tsx index 0682fff61..49cf7ebf4 100644 --- a/frontend/src/components/common/motd-modal/motd-modal.test.tsx +++ b/frontend/src/components/common/motd-modal/motd-modal.test.tsx @@ -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') diff --git a/frontend/src/components/common/motd-modal/motd-modal.tsx b/frontend/src/components/common/motd-modal/motd-modal.tsx index 946b099fb..edb44caff 100644 --- a/frontend/src/components/common/motd-modal/motd-modal.tsx +++ b/frontend/src/components/common/motd-modal/motd-modal.tsx @@ -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') diff --git a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx index 8f6acecc5..8357d1505 100644 --- a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx +++ b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx @@ -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') diff --git a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.tsx b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.tsx index e63313ad9..27e6f747e 100644 --- a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.tsx +++ b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.tsx @@ -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 diff --git a/frontend/src/components/common/note-loading-boundary/hooks/use-load-note-from-server.ts b/frontend/src/components/common/note-loading-boundary/hooks/use-load-note-from-server.ts index 76a4d1c16..85a0809af 100644 --- a/frontend/src/components/common/note-loading-boundary/hooks/use-load-note-from-server.ts +++ b/frontend/src/components/common/note-loading-boundary/hooks/use-load-note-from-server.ts @@ -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' /** diff --git a/frontend/src/components/common/note-loading-boundary/note-loading-boundary.test.tsx b/frontend/src/components/common/note-loading-boundary/note-loading-boundary.test.tsx index 19b6d3825..b820ec930 100644 --- a/frontend/src/components/common/note-loading-boundary/note-loading-boundary.test.tsx +++ b/frontend/src/components/common/note-loading-boundary/note-loading-boundary.test.tsx @@ -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') diff --git a/frontend/src/components/common/note-loading-boundary/note-loading-boundary.tsx b/frontend/src/components/common/note-loading-boundary/note-loading-boundary.tsx index c23442774..779e8e7a5 100644 --- a/frontend/src/components/common/note-loading-boundary/note-loading-boundary.tsx +++ b/frontend/src/components/common/note-loading-boundary/note-loading-boundary.tsx @@ -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. diff --git a/frontend/src/components/common/number-range/number-range.test.ts b/frontend/src/components/common/number-range/number-range.test.ts index c8d365ce9..45d9e7a56 100644 --- a/frontend/src/components/common/number-range/number-range.test.ts +++ b/frontend/src/components/common/number-range/number-range.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { createNumberRangeArray } from './number-range' describe('number range', () => { diff --git a/frontend/src/components/common/pagination/pager-item.tsx b/frontend/src/components/common/pagination/pager-item.tsx index b48207190..831413c1e 100644 --- a/frontend/src/components/common/pagination/pager-item.tsx +++ b/frontend/src/components/common/pagination/pager-item.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import React from 'react' export interface PageItemProps { diff --git a/frontend/src/components/common/pagination/pager-pagination.tsx b/frontend/src/components/common/pagination/pager-pagination.tsx index 62fec631d..97b9d77b4 100644 --- a/frontend/src/components/common/pagination/pager-pagination.tsx +++ b/frontend/src/components/common/pagination/pager-pagination.tsx @@ -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 diff --git a/frontend/src/components/common/pagination/pager.tsx b/frontend/src/components/common/pagination/pager.tsx index c95c1174d..177e08eec 100644 --- a/frontend/src/components/common/pagination/pager.tsx +++ b/frontend/src/components/common/pagination/pager.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { PropsWithChildren } from 'react' import React, { Fragment, useEffect, useMemo } from 'react' diff --git a/frontend/src/components/common/redirect-back.tsx b/frontend/src/components/common/redirect-back.tsx index a71586f5f..e12bd30db 100644 --- a/frontend/src/components/common/redirect-back.tsx +++ b/frontend/src/components/common/redirect-back.tsx @@ -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. diff --git a/frontend/src/components/common/redirect.tsx b/frontend/src/components/common/redirect.tsx index 78e550866..b7a75fbc2 100644 --- a/frontend/src/components/common/redirect.tsx +++ b/frontend/src/components/common/redirect.tsx @@ -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 diff --git a/frontend/src/components/common/show-if/show-if.test.tsx b/frontend/src/components/common/show-if/show-if.test.tsx index b849882b1..b1fe7c667 100644 --- a/frontend/src/components/common/show-if/show-if.test.tsx +++ b/frontend/src/components/common/show-if/show-if.test.tsx @@ -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', () => { diff --git a/frontend/src/components/common/show-if/show-if.tsx b/frontend/src/components/common/show-if/show-if.tsx index 4ef7d6d95..e6257fff3 100644 --- a/frontend/src/components/common/show-if/show-if.tsx +++ b/frontend/src/components/common/show-if/show-if.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { PropsWithChildren } from 'react' import React, { Fragment } from 'react' diff --git a/frontend/src/components/common/user-avatar/user-avatar-for-username.tsx b/frontend/src/components/common/user-avatar/user-avatar-for-username.tsx index 9098f01da..0c3a9a170 100644 --- a/frontend/src/components/common/user-avatar/user-avatar-for-username.tsx +++ b/frontend/src/components/common/user-avatar/user-avatar-for-username.tsx @@ -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 { username: string | null diff --git a/frontend/src/components/common/user-avatar/user-avatar.test.tsx b/frontend/src/components/common/user-avatar/user-avatar.test.tsx index 21e412ed8..3e8f75bad 100644 --- a/frontend/src/components/common/user-avatar/user-avatar.test.tsx +++ b/frontend/src/components/common/user-avatar/user-avatar.test.tsx @@ -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 = { diff --git a/frontend/src/components/common/user-avatar/user-avatar.tsx b/frontend/src/components/common/user-avatar/user-avatar.tsx index f123f6f1d..e69853e40 100644 --- a/frontend/src/components/common/user-avatar/user-avatar.tsx +++ b/frontend/src/components/common/user-avatar/user-avatar.tsx @@ -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' diff --git a/frontend/src/components/common/wait-spinner/wait-spinner.tsx b/frontend/src/components/common/wait-spinner/wait-spinner.tsx index 6ba6c8f13..22d571780 100644 --- a/frontend/src/components/common/wait-spinner/wait-spinner.tsx +++ b/frontend/src/components/common/wait-spinner/wait-spinner.tsx @@ -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. diff --git a/frontend/src/components/document-read-only-page/document-infobar.tsx b/frontend/src/components/document-read-only-page/document-infobar.tsx index 06b3753e4..7b40aa2b2 100644 --- a/frontend/src/components/document-read-only-page/document-infobar.tsx +++ b/frontend/src/components/document-read-only-page/document-infobar.tsx @@ -3,14 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useApplicationState } from '../../hooks/common/use-application-state' import { InternalLink } from '../common/links/internal-link' import { ShowIf } from '../common/show-if/show-if' -import styles from './document-infobar.module.scss' -import { useApplicationState } from '../../hooks/common/use-application-state' import { NoteInfoLineCreated } from '../editor-page/document-bar/note-info/note-info-line-created' import { NoteInfoLineUpdated } from '../editor-page/document-bar/note-info/note-info-line-updated' +import styles from './document-infobar.module.scss' +import React from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders an info bar with metadata about the current note. diff --git a/frontend/src/components/document-read-only-page/document-read-only-page-content.tsx b/frontend/src/components/document-read-only-page/document-read-only-page-content.tsx index ea273b52a..29baf8a11 100644 --- a/frontend/src/components/document-read-only-page/document-read-only-page-content.tsx +++ b/frontend/src/components/document-read-only-page/document-read-only-page-content.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { useTranslation } from 'react-i18next' +import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter' import { updateNoteTitleByFirstHeading } from '../../redux/note-details/methods' -import { DocumentInfobar } from './document-infobar' +import { setRendererStatus } from '../../redux/renderer-status/methods' import { RenderIframe } from '../editor-page/renderer-pane/render-iframe' import { RendererType } from '../render-page/window-post-message-communicator/rendering-message' -import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter' -import { setRendererStatus } from '../../redux/renderer-status/methods' +import { DocumentInfobar } from './document-infobar' +import React, { Fragment } from 'react' +import { useTranslation } from 'react-i18next' /** * Renders the read-only version of a note with a header bar that contains information about the note. diff --git a/frontend/src/components/editor-page/app-bar/app-bar.tsx b/frontend/src/components/editor-page/app-bar/app-bar.tsx index 6aa6e8e68..16c4468ea 100644 --- a/frontend/src/components/editor-page/app-bar/app-bar.tsx +++ b/frontend/src/components/editor-page/app-bar/app-bar.tsx @@ -3,20 +3,19 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Nav, Navbar } from 'react-bootstrap' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { NoteType } from '../../../redux/note-details/types/note-details' import { ShowIf } from '../../common/show-if/show-if' import { SignInButton } from '../../landing-layout/navigation/sign-in-button' import { UserDropdown } from '../../landing-layout/navigation/user-dropdown' +import { SettingsButton } from '../../layout/settings-dialog/settings-button' import { HelpButton } from './help-button/help-button' import { NavbarBranding } from './navbar-branding' -import { SlideModeButton } from './slide-mode-button' -import { ReadOnlyModeButton } from './read-only-mode-button' import { NewNoteButton } from './new-note-button' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { NoteType } from '../../../redux/note-details/types/note-details' -import { SettingsButton } from '../../layout/settings-dialog/settings-button' +import { ReadOnlyModeButton } from './read-only-mode-button' +import { SlideModeButton } from './slide-mode-button' +import React from 'react' +import { Nav, Navbar } from 'react-bootstrap' export enum AppBarMode { BASIC, diff --git a/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-line.tsx b/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-line.tsx index d9d4a0ba0..44757dab8 100644 --- a/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-line.tsx +++ b/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-line.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Suspense, useEffect, useMemo } from 'react' +import type { TaskCheckedEventPayload } from '../../../../extensions/extra-integrations/task-list/event-emitting-task-list-checkbox' +import { TaskListCheckboxAppExtension } from '../../../../extensions/extra-integrations/task-list/task-list-checkbox-app-extension' import { WaitSpinner } from '../../../common/wait-spinner/wait-spinner' import { eventEmitterContext } from '../../../markdown-renderer/hooks/use-extension-event-emitter' import EventEmitter2 from 'eventemitter2' -import type { TaskCheckedEventPayload } from '../../../../extensions/extra-integrations/task-list/event-emitting-task-list-checkbox' -import { TaskListCheckboxAppExtension } from '../../../../extensions/extra-integrations/task-list/task-list-checkbox-app-extension' +import React, { Suspense, useEffect, useMemo } from 'react' export interface CheatsheetLineProps { markdown: string diff --git a/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-tab-content.tsx b/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-tab-content.tsx index 00c32501e..f0ed3ec26 100644 --- a/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-tab-content.tsx +++ b/frontend/src/components/editor-page/app-bar/help-button/cheatsheet-tab-content.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { CheatsheetLine } from './cheatsheet-line' +import styles from './cheatsheet.module.scss' import React, { useMemo, useState } from 'react' import { Table } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { CheatsheetLine } from './cheatsheet-line' -import styles from './cheatsheet.module.scss' /** * Renders the content of the cheat sheet for the {@link HelpModal}. diff --git a/frontend/src/components/editor-page/app-bar/help-button/help-button.tsx b/frontend/src/components/editor-page/app-bar/help-button/help-button.tsx index 2f784896d..51a2a8fbc 100644 --- a/frontend/src/components/editor-page/app-bar/help-button/help-button.tsx +++ b/frontend/src/components/editor-page/app-bar/help-button/help-button.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import { cypressId } from '../../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { HelpModal } from './help-modal' import React, { Fragment } from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' -import { HelpModal } from './help-modal' -import { cypressId } from '../../../../utils/cypress-attribute' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' /** * Renders the button to open the {@link HelpModal}. diff --git a/frontend/src/components/editor-page/app-bar/help-button/help-modal.tsx b/frontend/src/components/editor-page/app-bar/help-button/help-modal.tsx index a36f9468d..497d31f3c 100644 --- a/frontend/src/components/editor-page/app-bar/help-button/help-modal.tsx +++ b/frontend/src/components/editor-page/app-bar/help-button/help-modal.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { Button, Modal } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' -import React, { useMemo, useState } from 'react' import type { ModalVisibilityProps } from '../../../common/modals/common-modal' import { CommonModal } from '../../../common/modals/common-modal' -import { ShortcutTabContent } from './shortcuts-tab-content' -import { LinksTabContent } from './links-tab-content' import { CheatsheetTabContent } from './cheatsheet-tab-content' +import { LinksTabContent } from './links-tab-content' +import { ShortcutTabContent } from './shortcuts-tab-content' +import React, { useMemo, useState } from 'react' +import { Button, Modal } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' export enum HelpTabStatus { Cheatsheet = 'cheatsheet.title', diff --git a/frontend/src/components/editor-page/app-bar/help-button/links-tab-content.tsx b/frontend/src/components/editor-page/app-bar/help-button/links-tab-content.tsx index ebb2b9057..fb8fb1164 100644 --- a/frontend/src/components/editor-page/app-bar/help-button/links-tab-content.tsx +++ b/frontend/src/components/editor-page/app-bar/help-button/links-tab-content.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Col, Row } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' import links from '../../../../links.json' import { TranslatedExternalLink } from '../../../common/links/translated-external-link' import { TranslatedInternalLink } from '../../../common/links/translated-internal-link' +import React from 'react' +import { Col, Row } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a bunch of links, where further help can be requested. diff --git a/frontend/src/components/editor-page/app-bar/help-button/shortcuts-tab-content.tsx b/frontend/src/components/editor-page/app-bar/help-button/shortcuts-tab-content.tsx index e95d967ea..4d259dda1 100644 --- a/frontend/src/components/editor-page/app-bar/help-button/shortcuts-tab-content.tsx +++ b/frontend/src/components/editor-page/app-bar/help-button/shortcuts-tab-content.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { isMac } from '../../utils' import React, { Fragment, useMemo } from 'react' import { Card, ListGroup, Row } from 'react-bootstrap' import { Trans } from 'react-i18next' -import { isMac } from '../../utils' /** * Renders a list of shortcuts usable in HedgeDoc. diff --git a/frontend/src/components/editor-page/app-bar/navbar-branding.tsx b/frontend/src/components/editor-page/app-bar/navbar-branding.tsx index 2bf1f3d82..9380587d5 100644 --- a/frontend/src/components/editor-page/app-bar/navbar-branding.tsx +++ b/frontend/src/components/editor-page/app-bar/navbar-branding.tsx @@ -3,10 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Navbar } from 'react-bootstrap' -import Link from 'next/link' import { useDarkModeState } from '../../../hooks/common/use-dark-mode-state' import { Branding } from '../../common/branding/branding' import { @@ -14,6 +10,9 @@ import { HedgeDocLogoType, HedgeDocLogoWithText } from '../../common/hedge-doc-logo/hedge-doc-logo-with-text' +import Link from 'next/link' +import React from 'react' +import { Navbar } from 'react-bootstrap' /** * Renders the branding for the {@link AppBar} diff --git a/frontend/src/components/editor-page/app-bar/new-note-button.tsx b/frontend/src/components/editor-page/app-bar/new-note-button.tsx index 1ea2a782c..939b0a821 100644 --- a/frontend/src/components/editor-page/app-bar/new-note-button.tsx +++ b/frontend/src/components/editor-page/app-bar/new-note-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { Trans, useTranslation } from 'react-i18next' -import { Button } from 'react-bootstrap' import Link from 'next/link' +import React from 'react' +import { Button } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a button to create a new note. diff --git a/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx b/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx index d0f07504b..cf1e5c720 100644 --- a/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx +++ b/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import Link from 'next/link' import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { useTranslation } from 'react-i18next' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import Link from 'next/link' /** * Button that links to the read-only version of a note. diff --git a/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx b/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx index c0b51c91b..773a3e4ff 100644 --- a/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx +++ b/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import Link from 'next/link' import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { useTranslation } from 'react-i18next' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import Link from 'next/link' /** * Button that links to the slide-show presentation of the current note. diff --git a/frontend/src/components/editor-page/change-content-context/change-content-context.tsx b/frontend/src/components/editor-page/change-content-context/change-content-context.tsx index 92806032f..89db4a878 100644 --- a/frontend/src/components/editor-page/change-content-context/change-content-context.tsx +++ b/frontend/src/components/editor-page/change-content-context/change-content-context.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React, { createContext, useContext, useState } from 'react' -import { Optional } from '@mrdrogdrog/optional' -import type { EditorView } from '@codemirror/view' import type { ContentEdits } from '../editor-pane/tool-bar/formatters/types/changes' import type { CursorSelection } from '../editor-pane/tool-bar/formatters/types/cursor-selection' +import type { EditorView } from '@codemirror/view' +import { Optional } from '@mrdrogdrog/optional' +import type { PropsWithChildren } from 'react' +import React, { createContext, useContext, useState } from 'react' export type CodeMirrorReference = EditorView | undefined type SetCodeMirrorReference = (value: CodeMirrorReference) => void diff --git a/frontend/src/components/editor-page/change-content-context/use-change-editor-content-callback.tsx b/frontend/src/components/editor-page/change-content-context/use-change-editor-content-callback.tsx index a887e231d..732f6646b 100644 --- a/frontend/src/components/editor-page/change-content-context/use-change-editor-content-callback.tsx +++ b/frontend/src/components/editor-page/change-content-context/use-change-editor-content-callback.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' -import { Optional } from '@mrdrogdrog/optional' +import type { CursorSelection } from '../editor-pane/tool-bar/formatters/types/cursor-selection' import type { ContentFormatter } from './change-content-context' import { useCodeMirrorReference } from './change-content-context' -import type { CursorSelection } from '../editor-pane/tool-bar/formatters/types/cursor-selection' import type { EditorView } from '@codemirror/view' +import { Optional } from '@mrdrogdrog/optional' +import { useMemo } from 'react' /** * Changes the content of the given CodeMirror view using the given formatter function. diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.test.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.test.tsx index 244c1775f..480023e74 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.test.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.test.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import * as AliasModule from '../../../../api/alias' +import * as useApplicationStateModule from '../../../../hooks/common/use-application-state' +import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods' +import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' +import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary' +import { AliasesAddForm } from './aliases-add-form' import { render, act, screen } from '@testing-library/react' import testEvent from '@testing-library/user-event' import React from 'react' -import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' -import * as AliasModule from '../../../../api/alias' -import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods' -import * as useApplicationStateModule from '../../../../hooks/common/use-application-state' -import { AliasesAddForm } from './aliases-add-form' -import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary' jest.mock('../../../../api/alias') jest.mock('../../../../redux/note-details/methods') diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.tsx index 1d302dcc0..4ed473e18 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-add-form.tsx @@ -3,17 +3,17 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import { addAlias } from '../../../../api/alias' +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { useOnInputChange } from '../../../../hooks/common/use-on-input-change' +import { updateMetadata } from '../../../../redux/note-details/methods' +import { testId } from '../../../../utils/test-id' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' import type { FormEvent } from 'react' import React, { useCallback, useMemo, useState } from 'react' import { Button, Form, InputGroup } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import { useTranslation } from 'react-i18next' -import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { addAlias } from '../../../../api/alias' -import { updateMetadata } from '../../../../redux/note-details/methods' -import { useOnInputChange } from '../../../../hooks/common/use-on-input-change' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' -import { testId } from '../../../../utils/test-id' const validAliasRegex = /^[a-z0-9_-]*$/ diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.test.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.test.tsx index 7866fb009..e17558a66 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.test.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.test.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import * as AliasModule from '../../../../api/alias' +import type { Alias } from '../../../../api/alias/types' +import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods' +import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' +import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary' +import { AliasesListEntry } from './aliases-list-entry' import { render, act, screen } from '@testing-library/react' import React from 'react' -import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' -import type { Alias } from '../../../../api/alias/types' -import { AliasesListEntry } from './aliases-list-entry' -import * as AliasModule from '../../../../api/alias' -import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods' -import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary' jest.mock('../../../../api/alias') jest.mock('../../../../redux/note-details/methods') diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.tsx index f5893908f..beb8cedf9 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-list-entry.tsx @@ -3,16 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useCallback } from 'react' +import { deleteAlias, markAliasAsPrimary } from '../../../../api/alias' +import type { Alias } from '../../../../api/alias/types' +import { updateMetadata } from '../../../../redux/note-details/methods' +import { testId } from '../../../../utils/test-id' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../../common/show-if/show-if' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import React, { useCallback } from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ShowIf } from '../../../common/show-if/show-if' -import type { Alias } from '../../../../api/alias/types' -import { deleteAlias, markAliasAsPrimary } from '../../../../api/alias' -import { updateMetadata } from '../../../../redux/note-details/methods' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' -import { testId } from '../../../../utils/test-id' export interface AliasesListEntryProps { alias: Alias diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-list.test.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-list.test.tsx index ee6668432..77721bc80 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-list.test.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-list.test.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { render } from '@testing-library/react' -import React from 'react' -import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' import type { Alias } from '../../../../api/alias/types' import * as useApplicationStateModule from '../../../../hooks/common/use-application-state' +import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' +import { AliasesList } from './aliases-list' import * as AliasesListEntryModule from './aliases-list-entry' import type { AliasesListEntryProps } from './aliases-list-entry' -import { AliasesList } from './aliases-list' +import { render } from '@testing-library/react' +import React from 'react' jest.mock('../../../../hooks/common/use-application-state') jest.mock('./aliases-list-entry') diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-list.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-list.tsx index 32e9fc007..284d9513c 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-list.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-list.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useMemo } from 'react' import { useApplicationState } from '../../../../hooks/common/use-application-state' import type { ApplicationState } from '../../../../redux/application-state' import { AliasesListEntry } from './aliases-list-entry' +import React, { Fragment, useMemo } from 'react' /** * Renders the list of aliases. diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.test.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.test.tsx index a0b519043..c9384d1b5 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.test.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.test.tsx @@ -3,16 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import type { CommonModalProps } from '../../../common/modals/common-modal' +import * as CommonModalModule from '../../../common/modals/common-modal' +import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' +import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary' +import * as AliasesAddFormModule from './aliases-add-form' +import * as AliasesListModule from './aliases-list' +import { AliasesModal } from './aliases-modal' import { render } from '@testing-library/react' import React from 'react' import type { PropsWithChildren } from 'react' -import type { CommonModalProps } from '../../../common/modals/common-modal' -import * as CommonModalModule from '../../../common/modals/common-modal' -import * as AliasesListModule from './aliases-list' -import * as AliasesAddFormModule from './aliases-add-form' -import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary' -import { AliasesModal } from './aliases-modal' -import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' jest.mock('./aliases-list') jest.mock('./aliases-add-form') diff --git a/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.tsx b/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.tsx index e2276f7fc..73783b20b 100644 --- a/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.tsx +++ b/frontend/src/components/editor-page/document-bar/aliases/aliases-modal.tsx @@ -3,13 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React from 'react' -import { ListGroup, ListGroupItem, Modal } from 'react-bootstrap' import type { CommonModalProps } from '../../../common/modals/common-modal' import { CommonModal } from '../../../common/modals/common-modal' -import { Trans, useTranslation } from 'react-i18next' -import { AliasesList } from './aliases-list' import { AliasesAddForm } from './aliases-add-form' +import { AliasesList } from './aliases-list' +import React from 'react' +import { ListGroup, ListGroupItem, Modal } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Component that holds a modal containing a list of aliases associated with the current note. diff --git a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-contributors.tsx b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-contributors.tsx index 86d629643..9cccf3567 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-contributors.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-contributors.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { NoteInfoLine } from './note-info-line' +import { UnitalicBoldContent } from './unitalic-bold-content' import React from 'react' import { Trans } from 'react-i18next' -import { UnitalicBoldContent } from './unitalic-bold-content' -import { NoteInfoLine } from './note-info-line' -import { useApplicationState } from '../../../../hooks/common/use-application-state' /** * Renders an info line about the number of contributors for the note. diff --git a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-created.tsx b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-created.tsx index b19d49013..8219c98e1 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-created.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-created.tsx @@ -3,13 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useMemo } from 'react' -import { Trans } from 'react-i18next' +import { useApplicationState } from '../../../../hooks/common/use-application-state' import { NoteInfoLine } from './note-info-line' import type { NoteInfoTimeLineProps } from './note-info-time-line' -import { useApplicationState } from '../../../../hooks/common/use-application-state' import { UnitalicBoldTimeFromNow } from './utils/unitalic-bold-time-from-now' import { DateTime } from 'luxon' +import React, { useMemo } from 'react' +import { Trans } from 'react-i18next' /** * Renders an info line about the creation of the current note. diff --git a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-updated.tsx b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-updated.tsx index 95b7dffc1..23bc97236 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-updated.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-updated.tsx @@ -3,15 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useMemo } from 'react' -import { Trans, useTranslation } from 'react-i18next' -import { NoteInfoLine } from './note-info-line' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username' +import { NoteInfoLine } from './note-info-line' import type { NoteInfoTimeLineProps } from './note-info-time-line' import { UnitalicBoldTimeFromNow } from './utils/unitalic-bold-time-from-now' import { UnitalicBoldTrans } from './utils/unitalic-bold-trans' -import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username' import { DateTime } from 'luxon' +import React, { useMemo } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders an info line about the last update of the current note. diff --git a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-word-count.tsx b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-word-count.tsx index ac871289c..3d874816a 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/note-info-line-word-count.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/note-info-line-word-count.tsx @@ -3,19 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { cypressId } from '../../../../utils/cypress-attribute' +import { ShowIf } from '../../../common/show-if/show-if' +import { useEditorReceiveHandler } from '../../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler' +import type { OnWordCountCalculatedMessage } from '../../../render-page/window-post-message-communicator/rendering-message' +import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' +import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider' +import { NoteInfoLine } from './note-info-line' +import { UnitalicBoldContent } from './unitalic-bold-content' import type { PropsWithChildren } from 'react' import React, { useCallback, useEffect, useState } from 'react' import { Trans, useTranslation } from 'react-i18next' -import { ShowIf } from '../../../common/show-if/show-if' -import { NoteInfoLine } from './note-info-line' -import { UnitalicBoldContent } from './unitalic-bold-content' -import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider' -import type { OnWordCountCalculatedMessage } from '../../../render-page/window-post-message-communicator/rendering-message' -import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' -import { useEditorReceiveHandler } from '../../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler' -import { cypressId } from '../../../../utils/cypress-attribute' -import { useApplicationState } from '../../../../hooks/common/use-application-state' /** * Creates a new info line for the document information dialog that holds the diff --git a/frontend/src/components/editor-page/document-bar/note-info/note-info-line.tsx b/frontend/src/components/editor-page/document-bar/note-info/note-info-line.tsx index 3a7fbf2c9..48b66746d 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/note-info-line.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/note-info-line.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React from 'react' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import type { IconName } from '../../../common/fork-awesome/types' +import type { PropsWithChildren } from 'react' +import React from 'react' export interface NoteInfoLineProps { icon: IconName diff --git a/frontend/src/components/editor-page/document-bar/note-info/note-info-modal.tsx b/frontend/src/components/editor-page/document-bar/note-info/note-info-modal.tsx index 1ff6ebcd3..56fbc2dde 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/note-info-modal.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/note-info-modal.tsx @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../../utils/cypress-attribute' +import type { ModalVisibilityProps } from '../../../common/modals/common-modal' +import { CommonModal } from '../../../common/modals/common-modal' +import { NoteInfoLineContributors } from './note-info-line-contributors' +import { NoteInfoLineCreated } from './note-info-line-created' +import { NoteInfoLineUpdated } from './note-info-line-updated' +import { NoteInfoLineWordCount } from './note-info-line-word-count' import React from 'react' import { ListGroup, Modal } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import type { ModalVisibilityProps } from '../../../common/modals/common-modal' -import { CommonModal } from '../../../common/modals/common-modal' -import { NoteInfoLineWordCount } from './note-info-line-word-count' -import { cypressId } from '../../../../utils/cypress-attribute' -import { NoteInfoLineCreated } from './note-info-line-created' -import { NoteInfoLineUpdated } from './note-info-line-updated' -import { NoteInfoLineContributors } from './note-info-line-contributors' /** * Modal that shows informational data about the current note. diff --git a/frontend/src/components/editor-page/document-bar/note-info/time-from-now.tsx b/frontend/src/components/editor-page/document-bar/note-info/time-from-now.tsx index 462fc7f78..78d5cfafb 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/time-from-now.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/time-from-now.tsx @@ -3,9 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { DateTime } from 'luxon' - import React from 'react' export interface TimeFromNowProps { diff --git a/frontend/src/components/editor-page/document-bar/note-info/unitalic-bold-content.tsx b/frontend/src/components/editor-page/document-bar/note-info/unitalic-bold-content.tsx index 3afa5a205..44dcdb3e1 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/unitalic-bold-content.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/unitalic-bold-content.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React from 'react' import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute' import { cypressId } from '../../../../utils/cypress-attribute' +import type { PropsWithChildren } from 'react' +import React from 'react' export interface UnitalicBoldContentProps extends PropsWithDataCypressId { text?: string | number diff --git a/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-time-from-now.tsx b/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-time-from-now.tsx index 76f67bad7..36b694ba9 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-time-from-now.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-time-from-now.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import type { TimeFromNowProps } from '../time-from-now' import { TimeFromNow } from '../time-from-now' import { UnitalicBoldContent } from '../unitalic-bold-content' +import React from 'react' export const UnitalicBoldTimeFromNow: React.FC = ({ time }) => { return ( diff --git a/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-trans.tsx b/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-trans.tsx index c3aa88897..a85e5874d 100644 --- a/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-trans.tsx +++ b/frontend/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-trans.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { UnitalicBoldContent } from '../unitalic-bold-content' import React from 'react' import { Trans } from 'react-i18next' -import { UnitalicBoldContent } from '../unitalic-bold-content' export interface UnitalicBoldTransProps { i18nKey?: string diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-add-entry-field.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-add-entry-field.tsx index 7bd1b65f2..26c15e263 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-add-entry-field.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-add-entry-field.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useOnInputChange } from '../../../../hooks/common/use-on-input-change' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import React, { useCallback, useState } from 'react' import { Button, FormControl, InputGroup } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' -import { useOnInputChange } from '../../../../hooks/common/use-on-input-change' import { useTranslation } from 'react-i18next' export interface PermissionAddEntryFieldProps { diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-entry-buttons.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-entry-buttons.tsx index 6377fde80..7cae24e78 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-entry-buttons.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-entry-buttons.tsx @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useMemo } from 'react' -import { Button, ToggleButtonGroup } from 'react-bootstrap' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import { AccessLevel } from './types' +import React, { useMemo } from 'react' +import { Button, ToggleButtonGroup } from 'react-bootstrap' import { useTranslation } from 'react-i18next' interface PermissionEntryButtonI18nKeys { diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-entry-special-group.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-entry-special-group.tsx index eab3ace6f..f8f50cd99 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-entry-special-group.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-entry-special-group.tsx @@ -3,15 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useCallback, useMemo } from 'react' -import { useTranslation } from 'react-i18next' -import { AccessLevel, SpecialGroup } from './types' -import { Button, ToggleButtonGroup } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import { removeGroupPermission, setGroupPermission } from '../../../../api/permissions' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { AccessLevel, SpecialGroup } from './types' +import React, { useCallback, useMemo } from 'react' +import { Button, ToggleButtonGroup } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' export interface PermissionEntrySpecialGroupProps { level: AccessLevel diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-entry-user.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-entry-user.tsx index 515debb41..da5647e71 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-entry-user.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-entry-user.tsx @@ -3,18 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useCallback } from 'react' -import { UserAvatar } from '../../../common/user-avatar/user-avatar' import type { NoteUserPermissionEntry } from '../../../../api/notes/types' -import { PermissionEntryButtons, PermissionType } from './permission-entry-buttons' -import { AccessLevel } from './types' -import { useAsync } from 'react-use' -import { getUser } from '../../../../api/users' -import { ShowIf } from '../../../common/show-if/show-if' import { removeUserPermission, setUserPermission } from '../../../../api/permissions' +import { getUser } from '../../../../api/users' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods' +import { ShowIf } from '../../../common/show-if/show-if' +import { UserAvatar } from '../../../common/user-avatar/user-avatar' import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { PermissionEntryButtons, PermissionType } from './permission-entry-buttons' +import { AccessLevel } from './types' +import React, { useCallback } from 'react' +import { useAsync } from 'react-use' export interface PermissionEntryUserProps { entry: NoteUserPermissionEntry diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-modal.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-modal.tsx index 4954a7cb9..469538bff 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-modal.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-modal.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Modal } from 'react-bootstrap' import type { ModalVisibilityProps } from '../../../common/modals/common-modal' import { CommonModal } from '../../../common/modals/common-modal' import { PermissionSectionOwner } from './permission-section-owner' -import { PermissionSectionUsers } from './permission-section-users' import { PermissionSectionSpecialGroups } from './permission-section-special-groups' +import { PermissionSectionUsers } from './permission-section-users' +import React from 'react' +import { Modal } from 'react-bootstrap' /** * Modal for viewing and managing the permissions of the note. diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-owner-change.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-owner-change.tsx index 30f11b328..46de1aa27 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-owner-change.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-owner-change.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' import { useOnInputChange } from '../../../../hooks/common/use-on-input-change' -import { Button, FormControl, InputGroup } from 'react-bootstrap' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import React, { useCallback, useMemo, useState } from 'react' +import { Button, FormControl, InputGroup } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' export interface PermissionOwnerChangeProps { onConfirmOwnerChange: (newOwner: string) => void diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-owner-info.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-owner-info.tsx index 2377bac4a..5e6755821 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-owner-info.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-owner-info.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' +import { useApplicationState } from '../../../../hooks/common/use-application-state' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username' +import React, { Fragment } from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username' export interface PermissionOwnerInfoProps { onEditOwner: () => void diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-section-owner.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-section-owner.tsx index ac5073725..4f038c9a2 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-section-owner.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-section-owner.tsx @@ -3,14 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { Fragment, useCallback, useState } from 'react' -import { Trans } from 'react-i18next' -import { PermissionOwnerChange } from './permission-owner-change' -import { PermissionOwnerInfo } from './permission-owner-info' import { setNoteOwner } from '../../../../api/permissions' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods' import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { PermissionOwnerChange } from './permission-owner-change' +import { PermissionOwnerInfo } from './permission-owner-info' +import React, { Fragment, useCallback, useState } from 'react' +import { Trans } from 'react-i18next' /** * Section in the permissions modal for managing the owner of a note. diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-section-special-groups.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-section-special-groups.tsx index 16befff5c..433e4575f 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-section-special-groups.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-section-special-groups.tsx @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { Fragment, useMemo } from 'react' -import { Trans, useTranslation } from 'react-i18next' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { PermissionEntrySpecialGroup } from './permission-entry-special-group' import { AccessLevel, SpecialGroup } from './types' +import React, { Fragment, useMemo } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Section of the permission modal for managing special group access to the note. diff --git a/frontend/src/components/editor-page/document-bar/permissions/permission-section-users.tsx b/frontend/src/components/editor-page/document-bar/permissions/permission-section-users.tsx index c17d93292..5d5c1e824 100644 --- a/frontend/src/components/editor-page/document-bar/permissions/permission-section-users.tsx +++ b/frontend/src/components/editor-page/document-bar/permissions/permission-section-users.tsx @@ -3,14 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { Fragment, useCallback, useMemo } from 'react' -import { Trans, useTranslation } from 'react-i18next' -import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { PermissionEntryUser } from './permission-entry-user' -import { PermissionAddEntryField } from './permission-add-entry-field' import { setUserPermission } from '../../../../api/permissions' +import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods' import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { PermissionAddEntryField } from './permission-add-entry-field' +import { PermissionEntryUser } from './permission-entry-user' +import React, { Fragment, useCallback, useMemo } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Section of the permission modal for managing user access to the note. diff --git a/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.test.ts b/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.test.ts index 562bfd62d..e907931d2 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.test.ts +++ b/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { invertUnifiedPatch } from './invert-unified-patch' import { parsePatch } from 'diff' diff --git a/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.ts b/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.ts index 724a1e97e..80698adbf 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.ts +++ b/frontend/src/components/editor-page/document-bar/revisions/invert-unified-patch.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { Hunk, ParsedDiff } from 'diff' /** diff --git a/frontend/src/components/editor-page/document-bar/revisions/revision-list-entry.tsx b/frontend/src/components/editor-page/document-bar/revisions/revision-list-entry.tsx index f5b41a9d0..ea752c418 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/revision-list-entry.tsx +++ b/frontend/src/components/editor-page/document-bar/revisions/revision-list-entry.tsx @@ -3,20 +3,19 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { RevisionMetadata } from '../../../../api/revisions/types' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../../common/show-if/show-if' +import { UserAvatar } from '../../../common/user-avatar/user-avatar' +import { WaitSpinner } from '../../../common/wait-spinner/wait-spinner' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import styles from './revision-list-entry.module.scss' +import { getUserDataForRevision } from './utils' import { DateTime } from 'luxon' import React, { useMemo } from 'react' import { ListGroup } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' -import { UserAvatar } from '../../../common/user-avatar/user-avatar' -import styles from './revision-list-entry.module.scss' -import type { RevisionMetadata } from '../../../../api/revisions/types' -import { getUserDataForRevision } from './utils' import { useAsync } from 'react-use' -import { ShowIf } from '../../../common/show-if/show-if' -import { WaitSpinner } from '../../../common/wait-spinner/wait-spinner' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' export interface RevisionListEntryProps { active: boolean diff --git a/frontend/src/components/editor-page/document-bar/revisions/revision-list.tsx b/frontend/src/components/editor-page/document-bar/revisions/revision-list.tsx index 52c69d65e..f89281294 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/revision-list.tsx +++ b/frontend/src/components/editor-page/document-bar/revisions/revision-list.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import { RevisionListEntry } from './revision-list-entry' -import { useAsync } from 'react-use' import { getAllRevisions } from '../../../../api/revisions' import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { ListGroup } from 'react-bootstrap' import { AsyncLoadingBoundary } from '../../../common/async-loading-boundary' +import { RevisionListEntry } from './revision-list-entry' import { DateTime } from 'luxon' +import React, { useMemo } from 'react' +import { ListGroup } from 'react-bootstrap' +import { useAsync } from 'react-use' export interface RevisionListProps { selectedRevisionId?: number diff --git a/frontend/src/components/editor-page/document-bar/revisions/revision-modal-footer.tsx b/frontend/src/components/editor-page/document-bar/revisions/revision-modal-footer.tsx index 1b32e1655..77950e0ce 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/revision-modal-footer.tsx +++ b/frontend/src/components/editor-page/document-bar/revisions/revision-modal-footer.tsx @@ -3,14 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import { getRevision } from '../../../../api/revisions' +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import type { ModalVisibilityProps } from '../../../common/modals/common-modal' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { downloadRevision } from './utils' import React, { useCallback } from 'react' import { Button, Modal } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { downloadRevision } from './utils' -import type { ModalVisibilityProps } from '../../../common/modals/common-modal' -import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { getRevision } from '../../../../api/revisions' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' export interface RevisionModalFooterProps { selectedRevisionId?: number diff --git a/frontend/src/components/editor-page/document-bar/revisions/revision-modal.tsx b/frontend/src/components/editor-page/document-bar/revisions/revision-modal.tsx index 2e6d39484..6f1e4d032 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/revision-modal.tsx +++ b/frontend/src/components/editor-page/document-bar/revisions/revision-modal.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { ModalVisibilityProps } from '../../../common/modals/common-modal' +import { CommonModal } from '../../../common/modals/common-modal' +import { RevisionList } from './revision-list' +import { RevisionModalFooter } from './revision-modal-footer' +import styles from './revision-modal.module.scss' +import { RevisionViewer } from './revision-viewer' import React, { useState } from 'react' import { Col, Modal, Row } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import type { ModalVisibilityProps } from '../../../common/modals/common-modal' -import { CommonModal } from '../../../common/modals/common-modal' -import styles from './revision-modal.module.scss' -import { RevisionModalFooter } from './revision-modal-footer' -import { RevisionViewer } from './revision-viewer' -import { RevisionList } from './revision-list' /** * Modal that shows the available revisions and allows for comparison between them. diff --git a/frontend/src/components/editor-page/document-bar/revisions/revision-viewer.tsx b/frontend/src/components/editor-page/document-bar/revisions/revision-viewer.tsx index 204f6c4eb..23509b294 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/revision-viewer.tsx +++ b/frontend/src/components/editor-page/document-bar/revisions/revision-viewer.tsx @@ -3,16 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { useMemo } from 'react' -import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer' -import { useAsync } from 'react-use' import { getRevision } from '../../../../api/revisions' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state' import { AsyncLoadingBoundary } from '../../../common/async-loading-boundary' -import { applyPatch, parsePatch } from 'diff' import { invertUnifiedPatch } from './invert-unified-patch' import { Optional } from '@mrdrogdrog/optional' +import { applyPatch, parsePatch } from 'diff' +import React, { useMemo } from 'react' +import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer' +import { useAsync } from 'react-use' export interface RevisionViewerProps { selectedRevisionId?: number diff --git a/frontend/src/components/editor-page/document-bar/revisions/utils.ts b/frontend/src/components/editor-page/document-bar/revisions/utils.ts index 8a063158e..f9a76bdfe 100644 --- a/frontend/src/components/editor-page/document-bar/revisions/utils.ts +++ b/frontend/src/components/editor-page/document-bar/revisions/utils.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { RevisionDetails } from '../../../../api/revisions/types' import { getUser } from '../../../../api/users' import type { UserInfo } from '../../../../api/users/types' diff --git a/frontend/src/components/editor-page/document-bar/share/share-modal.tsx b/frontend/src/components/editor-page/document-bar/share/share-modal.tsx index 219aea7d1..275bf96e6 100644 --- a/frontend/src/components/editor-page/document-bar/share/share-modal.tsx +++ b/frontend/src/components/editor-page/document-bar/share/share-modal.tsx @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Modal } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { useBaseUrl } from '../../../../hooks/common/use-base-url' +import { NoteType } from '../../../../redux/note-details/types/note-details' import { CopyableField } from '../../../common/copyable/copyable-field/copyable-field' import type { ModalVisibilityProps } from '../../../common/modals/common-modal' import { CommonModal } from '../../../common/modals/common-modal' import { ShowIf } from '../../../common/show-if/show-if' -import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { NoteType } from '../../../../redux/note-details/types/note-details' -import { useBaseUrl } from '../../../../hooks/common/use-base-url' +import React from 'react' +import { Modal } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a modal which provides shareable URLs of this note. diff --git a/frontend/src/components/editor-page/editor-document-renderer/editor-document-renderer.tsx b/frontend/src/components/editor-page/editor-document-renderer/editor-document-renderer.tsx index bde90f2ea..e3b9a1f54 100644 --- a/frontend/src/components/editor-page/editor-document-renderer/editor-document-renderer.tsx +++ b/frontend/src/components/editor-page/editor-document-renderer/editor-document-renderer.tsx @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import type { RenderIframeProps } from '../renderer-pane/render-iframe' -import { RenderIframe } from '../renderer-pane/render-iframe' +import { useApplicationState } from '../../../hooks/common/use-application-state' import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter' import { NoteType } from '../../../redux/note-details/types/note-details' -import { useApplicationState } from '../../../hooks/common/use-application-state' +import { setRendererStatus } from '../../../redux/renderer-status/methods' import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message' +import type { RenderIframeProps } from '../renderer-pane/render-iframe' +import { RenderIframe } from '../renderer-pane/render-iframe' import { useOnScrollWithLineOffset } from './hooks/use-on-scroll-with-line-offset' import { useScrollStateWithoutLineOffset } from './hooks/use-scroll-state-without-line-offset' -import { setRendererStatus } from '../../../redux/renderer-status/methods' +import React from 'react' export type EditorDocumentRendererProps = Omit< RenderIframeProps, diff --git a/frontend/src/components/editor-page/editor-document-renderer/hooks/use-on-scroll-with-line-offset.ts b/frontend/src/components/editor-page/editor-document-renderer/hooks/use-on-scroll-with-line-offset.ts index 0dc0ef016..a86ebacc1 100644 --- a/frontend/src/components/editor-page/editor-document-renderer/hooks/use-on-scroll-with-line-offset.ts +++ b/frontend/src/components/editor-page/editor-document-renderer/hooks/use-on-scroll-with-line-offset.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { ScrollState } from '../../synced-scroll/scroll-props' import { getGlobalState } from '../../../../redux' -import { useMemo } from 'react' +import type { ScrollState } from '../../synced-scroll/scroll-props' import type { ScrollCallback } from '../../synced-scroll/scroll-props' +import { useMemo } from 'react' /** * Adjusts the given onScroll callback to include the frontmatter line offset. diff --git a/frontend/src/components/editor-page/editor-document-renderer/hooks/use-scroll-state-without-line-offset.ts b/frontend/src/components/editor-page/editor-document-renderer/hooks/use-scroll-state-without-line-offset.ts index 689fa3d6f..d9f192773 100644 --- a/frontend/src/components/editor-page/editor-document-renderer/hooks/use-scroll-state-without-line-offset.ts +++ b/frontend/src/components/editor-page/editor-document-renderer/hooks/use-scroll-state-without-line-offset.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { useApplicationState } from '../../../../hooks/common/use-application-state' import type { ScrollState } from '../../synced-scroll/scroll-props' import { useMemo } from 'react' diff --git a/frontend/src/components/editor-page/editor-page-content.tsx b/frontend/src/components/editor-page/editor-page-content.tsx index 1f4bedf02..37e3b668f 100644 --- a/frontend/src/components/editor-page/editor-page-content.tsx +++ b/frontend/src/components/editor-page/editor-page-content.tsx @@ -3,27 +3,26 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { useTranslation } from 'react-i18next' +import { useApplicationState } from '../../hooks/common/use-application-state' import { useApplyDarkMode } from '../../hooks/common/use-apply-dark-mode' import { updateNoteTitleByFirstHeading } from '../../redux/note-details/methods' +import { Logger } from '../../utils/logger' import { MotdModal } from '../common/motd-modal/motd-modal' +import { NoteAndAppTitleHead } from '../layout/note-and-app-title-head' +import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox' +import { ExtensionEventEmitterProvider } from '../markdown-renderer/hooks/use-extension-event-emitter' import { AppBar, AppBarMode } from './app-bar/app-bar' +import { ChangeEditorContentContextProvider } from './change-content-context/change-content-context' +import { EditorDocumentRenderer } from './editor-document-renderer/editor-document-renderer' +import { EditorPane } from './editor-pane/editor-pane' +import { useComponentsFromAppExtensions } from './editor-pane/hooks/use-components-from-app-extensions' +import { useUpdateLocalHistoryEntry } from './hooks/use-update-local-history-entry' import { Sidebar } from './sidebar/sidebar' import { Splitter } from './splitter/splitter' import type { DualScrollState, ScrollState } from './synced-scroll/scroll-props' -import { useUpdateLocalHistoryEntry } from './hooks/use-update-local-history-entry' -import { useApplicationState } from '../../hooks/common/use-application-state' -import { EditorDocumentRenderer } from './editor-document-renderer/editor-document-renderer' -import { Logger } from '../../utils/logger' -import { NoteAndAppTitleHead } from '../layout/note-and-app-title-head' import equal from 'fast-deep-equal' -import { EditorPane } from './editor-pane/editor-pane' -import { ChangeEditorContentContextProvider } from './change-content-context/change-content-context' -import { ExtensionEventEmitterProvider } from '../markdown-renderer/hooks/use-extension-event-emitter' -import { useComponentsFromAppExtensions } from './editor-pane/hooks/use-components-from-app-extensions' -import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox' +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { useTranslation } from 'react-i18next' export enum ScrollSource { EDITOR = 'editor', diff --git a/frontend/src/components/editor-page/editor-pane/editor-pane.tsx b/frontend/src/components/editor-page/editor-pane/editor-pane.tsx index 9f7cfe887..a57533bbc 100644 --- a/frontend/src/components/editor-page/editor-pane/editor-pane.tsx +++ b/frontend/src/components/editor-page/editor-pane/editor-pane.tsx @@ -3,44 +3,43 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import type { ScrollProps } from '../synced-scroll/scroll-props' -import { StatusBar } from './status-bar/status-bar' -import { ToolBar } from './tool-bar/tool-bar' import { useApplicationState } from '../../../hooks/common/use-application-state' -import { MaxLengthWarning } from './max-length-warning/max-length-warning' -import ReactCodeMirror from '@uiw/react-codemirror' -import { useApplyScrollState } from './hooks/use-apply-scroll-state' -import styles from './extended-codemirror/codemirror.module.scss' -import { oneDark } from '@codemirror/theme-one-dark' -import { useTranslation } from 'react-i18next' -import { useCodeMirrorScrollWatchExtension } from './hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension' -import { useCodeMirrorFileInsertExtension } from './hooks/code-mirror-extensions/use-code-mirror-file-insert-extension' -import { markdown, markdownLanguage } from '@codemirror/lang-markdown' -import { EditorView } from '@codemirror/view' -import { autocompletion } from '@codemirror/autocomplete' +import { useDarkModeState } from '../../../hooks/common/use-dark-mode-state' import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute' -import { languages } from '@codemirror/language-data' -import { useCursorActivityCallback } from './hooks/use-cursor-activity-callback' +import { findLanguageByCodeBlockName } from '../../markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name' import { useCodeMirrorReference, useSetCodeMirrorReference } from '../change-content-context/change-content-context' -import { useCodeMirrorTablePasteExtension } from './hooks/table-paste/use-code-mirror-table-paste-extension' +import type { ScrollProps } from '../synced-scroll/scroll-props' +import styles from './extended-codemirror/codemirror.module.scss' +import { useCodeMirrorFileInsertExtension } from './hooks/code-mirror-extensions/use-code-mirror-file-insert-extension' +import { useCodeMirrorScrollWatchExtension } from './hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension' import { useOnImageUploadFromRenderer } from './hooks/image-upload-from-renderer/use-on-image-upload-from-renderer' -import { useCodeMirrorYjsExtension } from './hooks/yjs/use-code-mirror-yjs-extension' -import { useYDoc } from './hooks/yjs/use-y-doc' +import { useCodeMirrorTablePasteExtension } from './hooks/table-paste/use-code-mirror-table-paste-extension' +import { useApplyScrollState } from './hooks/use-apply-scroll-state' +import { useCursorActivityCallback } from './hooks/use-cursor-activity-callback' import { useAwareness } from './hooks/yjs/use-awareness' -import { useWebsocketConnection } from './hooks/yjs/use-websocket-connection' import { useBindYTextToRedux } from './hooks/yjs/use-bind-y-text-to-redux' +import { useCodeMirrorYjsExtension } from './hooks/yjs/use-code-mirror-yjs-extension' import { useInsertNoteContentIntoYTextInMockModeEffect } from './hooks/yjs/use-insert-note-content-into-y-text-in-mock-mode-effect' -import { useOnFirstEditorUpdateExtension } from './hooks/yjs/use-on-first-editor-update-extension' -import { useOnMetadataUpdated } from './hooks/yjs/use-on-metadata-updated' import { useIsConnectionSynced } from './hooks/yjs/use-is-connection-synced' import { useMarkdownContentYText } from './hooks/yjs/use-markdown-content-y-text' -import { lintGutter } from '@codemirror/lint' -import { useLinter } from './linter/linter' +import { useOnFirstEditorUpdateExtension } from './hooks/yjs/use-on-first-editor-update-extension' +import { useOnMetadataUpdated } from './hooks/yjs/use-on-metadata-updated' import { useOnNoteDeleted } from './hooks/yjs/use-on-note-deleted' -import { findLanguageByCodeBlockName } from '../../markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name' -import { useDarkModeState } from '../../../hooks/common/use-dark-mode-state' +import { useWebsocketConnection } from './hooks/yjs/use-websocket-connection' +import { useYDoc } from './hooks/yjs/use-y-doc' +import { useLinter } from './linter/linter' +import { MaxLengthWarning } from './max-length-warning/max-length-warning' +import { StatusBar } from './status-bar/status-bar' +import { ToolBar } from './tool-bar/tool-bar' +import { autocompletion } from '@codemirror/autocomplete' +import { markdown, markdownLanguage } from '@codemirror/lang-markdown' +import { languages } from '@codemirror/language-data' +import { lintGutter } from '@codemirror/lint' +import { oneDark } from '@codemirror/theme-one-dark' +import { EditorView } from '@codemirror/view' +import ReactCodeMirror from '@uiw/react-codemirror' +import React, { useMemo } from 'react' +import { useTranslation } from 'react-i18next' /** * Renders the text editor pane of the editor. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-file-insert-extension.ts b/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-file-insert-extension.ts index 13d203b12..8fe6ba9c6 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-file-insert-extension.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-file-insert-extension.ts @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' -import { EditorView } from '@codemirror/view' -import type { Extension } from '@codemirror/state' import { useHandleUpload } from '../use-handle-upload' +import type { Extension } from '@codemirror/state' +import { EditorView } from '@codemirror/view' import { Optional } from '@mrdrogdrog/optional' +import { useMemo } from 'react' const calculateCursorPositionInEditor = (view: EditorView, event: MouseEvent): number => { return Optional.ofNullable(event.pageX) diff --git a/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension.ts b/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension.ts index be6f9567d..b0a32e4d4 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useCallback, useMemo } from 'react' import type { ScrollState } from '../../../synced-scroll/scroll-props' -import { EditorView } from '@codemirror/view' import type { Extension } from '@codemirror/state' +import { EditorView } from '@codemirror/view' +import { useCallback, useMemo } from 'react' export type OnScrollCallback = ((scrollState: ScrollState) => void) | undefined diff --git a/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/find-regex-match-in-text.test.ts b/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/find-regex-match-in-text.test.ts index f0ce20956..d4795fe5e 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/find-regex-match-in-text.test.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/find-regex-match-in-text.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { findRegexMatchInText } from './find-regex-match-in-text' describe('find regex index in line', function () { diff --git a/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/use-on-image-upload-from-renderer.ts b/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/use-on-image-upload-from-renderer.ts index 7b55d3087..c6e7a97c0 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/use-on-image-upload-from-renderer.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/image-upload-from-renderer/use-on-image-upload-from-renderer.ts @@ -3,18 +3,17 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { getGlobalState } from '../../../../../redux' +import { Logger } from '../../../../../utils/logger' import { useEditorReceiveHandler } from '../../../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler' import type { ImageUploadMessage } from '../../../../render-page/window-post-message-communicator/rendering-message' import { CommunicationMessageType } from '../../../../render-page/window-post-message-communicator/rendering-message' -import { useCallback } from 'react' -import { getGlobalState } from '../../../../../redux' -import { Logger } from '../../../../../utils/logger' +import { useCodeMirrorReference } from '../../../change-content-context/change-content-context' +import type { CursorSelection } from '../../tool-bar/formatters/types/cursor-selection' +import { useHandleUpload } from '../use-handle-upload' import { findRegexMatchInText } from './find-regex-match-in-text' import { Optional } from '@mrdrogdrog/optional' -import { useHandleUpload } from '../use-handle-upload' -import type { CursorSelection } from '../../tool-bar/formatters/types/cursor-selection' -import { useCodeMirrorReference } from '../../../change-content-context/change-content-context' +import { useCallback } from 'react' const log = new Logger('useOnImageUpload') const imageWithPlaceholderLinkRegex = /!\[([^\]]*)]\(https:\/\/([^)]*)\)/g diff --git a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/codefenceDetection.test.ts b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/codefenceDetection.test.ts index 61e503707..63a5af4ae 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/codefenceDetection.test.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/codefenceDetection.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { isCursorInCodeFence } from './codefenceDetection' describe('Check whether cursor is in codefence', () => { diff --git a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.test.ts b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.test.ts index 4682907e3..682b024dd 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.test.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { convertClipboardTableToMarkdown, isTable } from './table-extractor' describe('isTable detection: ', () => { diff --git a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.ts b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.ts index c1f1ad401..a854e5cc9 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/table-extractor.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { createNumberRangeArray } from '../../../../common/number-range/number-range' /** diff --git a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/use-code-mirror-table-paste-extension.ts b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/use-code-mirror-table-paste-extension.ts index 1f702c2aa..315dd7b28 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/table-paste/use-code-mirror-table-paste-extension.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/table-paste/use-code-mirror-table-paste-extension.ts @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' -import { EditorView } from '@codemirror/view' -import type { Extension } from '@codemirror/state' import { useApplicationState } from '../../../../../hooks/common/use-application-state' import { changeEditorContent } from '../../../change-content-context/use-change-editor-content-callback' -import { Optional } from '@mrdrogdrog/optional' import { replaceSelection } from '../../tool-bar/formatters/replace-selection' -import { convertClipboardTableToMarkdown, isTable } from './table-extractor' import { isCursorInCodeFence } from './codefenceDetection' +import { convertClipboardTableToMarkdown, isTable } from './table-extractor' +import type { Extension } from '@codemirror/state' +import { EditorView } from '@codemirror/view' +import { Optional } from '@mrdrogdrog/optional' +import { useMemo } from 'react' /** * Creates a {@link Extension code mirror extension} that handles the smart table detection on paste-from-clipboard events. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/use-apply-scroll-state.ts b/frontend/src/components/editor-page/editor-pane/hooks/use-apply-scroll-state.ts index d2f36c548..19e992ba1 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/use-apply-scroll-state.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/use-apply-scroll-state.ts @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect, useRef } from 'react' +import { Logger } from '../../../../utils/logger' +import { useCodeMirrorReference } from '../../change-content-context/change-content-context' import type { ScrollState } from '../../synced-scroll/scroll-props' import { EditorView } from '@codemirror/view' import equal from 'fast-deep-equal' -import { useCodeMirrorReference } from '../../change-content-context/change-content-context' -import { Logger } from '../../../../utils/logger' +import { useEffect, useRef } from 'react' const logger = new Logger('useApplyScrollState') diff --git a/frontend/src/components/editor-page/editor-pane/hooks/use-components-from-app-extensions.tsx b/frontend/src/components/editor-page/editor-pane/hooks/use-components-from-app-extensions.tsx index 56386c991..02681cdd6 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/use-components-from-app-extensions.tsx +++ b/frontend/src/components/editor-page/editor-pane/hooks/use-components-from-app-extensions.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' import type { ReactElement } from 'react' import React, { Fragment, useMemo } from 'react' -import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' /** * Generator react elements for components that are generated by the used {@link AppExtension app extensions}. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/use-cursor-activity-callback.ts b/frontend/src/components/editor-page/editor-pane/hooks/use-cursor-activity-callback.ts index 6f387cea5..90fedfbe0 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/use-cursor-activity-callback.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/use-cursor-activity-callback.ts @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo, useRef } from 'react' import { updateCursorPositions } from '../../../../redux/note-details/methods' +import type { Extension, SelectionRange } from '@codemirror/state' import type { ViewUpdate } from '@codemirror/view' import { EditorView } from '@codemirror/view' -import type { Extension, SelectionRange } from '@codemirror/state' +import { useMemo, useRef } from 'react' /** * Provides a callback for codemirror that handles cursor changes. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/use-handle-upload.tsx b/frontend/src/components/editor-page/editor-pane/hooks/use-handle-upload.tsx index 883af2ed9..30b24d84f 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/use-handle-upload.tsx +++ b/frontend/src/components/editor-page/editor-pane/hooks/use-handle-upload.tsx @@ -3,19 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { uploadFile } from '../../../../api/media' import { getGlobalState } from '../../../../redux' import { supportedMimeTypes } from '../../../common/upload-image-mimetypes' -import { t } from 'i18next' -import { useCallback } from 'react' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import type { ContentFormatter } from '../../change-content-context/change-content-context' import { changeEditorContent } from '../../change-content-context/use-change-editor-content-callback' -import { replaceSelection } from '../tool-bar/formatters/replace-selection' import { replaceInContent } from '../tool-bar/formatters/replace-in-content' +import { replaceSelection } from '../tool-bar/formatters/replace-selection' import type { CursorSelection } from '../tool-bar/formatters/types/cursor-selection' import type { EditorView } from '@codemirror/view' -import type { ContentFormatter } from '../../change-content-context/change-content-context' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { t } from 'i18next' +import { useCallback } from 'react' /** * @param view the codemirror instance that is used to insert the Markdown code diff --git a/frontend/src/components/editor-page/editor-pane/hooks/use-line-based-position.ts b/frontend/src/components/editor-page/editor-pane/hooks/use-line-based-position.ts index 7bc648fb3..cd8815e36 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/use-line-based-position.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/use-line-based-position.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { useMemo } from 'react' export interface LineBasedPosition { line: number diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/mock-connection.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/mock-connection.ts index 79f6b3bdb..957a0ae1d 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/mock-connection.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/mock-connection.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { YDocMessageTransporter } from '@hedgedoc/realtime' -import type { Doc } from 'yjs' -import type { Awareness } from 'y-protocols/awareness' import { MARKDOWN_CONTENT_CHANNEL_NAME } from './use-markdown-content-y-text' +import { YDocMessageTransporter } from '@hedgedoc/realtime' +import type { Awareness } from 'y-protocols/awareness' +import type { Doc } from 'yjs' /** * A mocked connection that doesn't send or receive any data and is instantly ready. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-awareness.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-awareness.ts index 25812ccc5..12ffb91a8 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-awareness.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-awareness.ts @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { Awareness } from 'y-protocols/awareness' -import { useEffect, useMemo } from 'react' +import { useApplicationState } from '../../../../../hooks/common/use-application-state' import { addOnlineUser, removeOnlineUser } from '../../../../../redux/realtime/methods' import { ActiveIndicatorStatus } from '../../../../../redux/realtime/types' -import { useApplicationState } from '../../../../../hooks/common/use-application-state' -import type { Doc } from 'yjs' import { Logger } from '../../../../../utils/logger' +import { useEffect, useMemo } from 'react' +import { Awareness } from 'y-protocols/awareness' +import type { Doc } from 'yjs' const ownAwarenessClientId = -1 diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-bind-y-text-to-redux.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-bind-y-text-to-redux.ts index 72307d375..7437fec08 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-bind-y-text-to-redux.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-bind-y-text-to-redux.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect } from 'react' import { setNoteContent } from '../../../../../redux/note-details/methods' +import { useEffect } from 'react' import type { YText } from 'yjs/dist/src/types/YText' /** diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-code-mirror-yjs-extension.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-code-mirror-yjs-extension.ts index fe677c5de..7dcf30b03 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-code-mirror-yjs-extension.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-code-mirror-yjs-extension.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' import type { Extension } from '@codemirror/state' +import { useMemo } from 'react' import { yCollab } from 'y-codemirror.next' import type { Awareness } from 'y-protocols/awareness' import type { YText } from 'yjs/dist/src/types/YText' diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-insert-note-content-into-y-text-in-mock-mode-effect.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-insert-note-content-into-y-text-in-mock-mode-effect.ts index e956779e9..d963c72ca 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-insert-note-content-into-y-text-in-mock-mode-effect.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-insert-note-content-into-y-text-in-mock-mode-effect.ts @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect } from 'react' -import { isMockMode } from '../../../../../utils/test-modes' import { getGlobalState } from '../../../../../redux' -import type { YDocMessageTransporter } from '@hedgedoc/realtime' +import { isMockMode } from '../../../../../utils/test-modes' import { MockConnection } from './mock-connection' +import type { YDocMessageTransporter } from '@hedgedoc/realtime' +import { useEffect } from 'react' /** * When in mock mode this effect inserts the current markdown content into the yDoc of the given connection to simulate a sync from the server. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-is-connection-synced.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-is-connection-synced.ts index eff8962d3..78b239bb3 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-is-connection-synced.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-is-connection-synced.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect, useState } from 'react' import type { YDocMessageTransporter } from '@hedgedoc/realtime' +import { useEffect, useState } from 'react' /** * Checks if the given message transporter has received at least one full synchronisation. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-markdown-content-y-text.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-markdown-content-y-text.ts index 2a1f67303..982dada4d 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-markdown-content-y-text.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-markdown-content-y-text.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { Doc } from 'yjs' import { useMemo } from 'react' +import type { Doc } from 'yjs' import type { YText } from 'yjs/dist/src/types/YText' export const MARKDOWN_CONTENT_CHANNEL_NAME = 'markdownContent' diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-first-editor-update-extension.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-first-editor-update-extension.ts index e7de33f3e..d6ff59bcf 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-first-editor-update-extension.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-first-editor-update-extension.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo, useState } from 'react' -import { EditorView } from '@codemirror/view' import type { Extension } from '@codemirror/state' +import { EditorView } from '@codemirror/view' +import { useMemo, useState } from 'react' /** * Provides an extension that checks when the code mirror, that loads the extension, has its first update. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-metadata-updated.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-metadata-updated.ts index 0718a5646..c8682be64 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-metadata-updated.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-metadata-updated.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { updateMetadata } from '../../../../../redux/note-details/methods' import type { YDocMessageTransporter } from '@hedgedoc/realtime' import { MessageType } from '@hedgedoc/realtime' -import { updateMetadata } from '../../../../../redux/note-details/methods' import { useCallback, useEffect } from 'react' /** diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts index 12a6e8726..52d47d2e7 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../../../hooks/common/use-application-state' +import { Logger } from '../../../../../utils/logger' +import { useUiNotifications } from '../../../../notifications/ui-notification-boundary' import type { YDocMessageTransporter } from '@hedgedoc/realtime' import { MessageType } from '@hedgedoc/realtime' -import { useCallback, useEffect } from 'react' import { useRouter } from 'next/router' -import { Logger } from '../../../../../utils/logger' -import { useApplicationState } from '../../../../../hooks/common/use-application-state' -import { useUiNotifications } from '../../../../notifications/ui-notification-boundary' +import { useCallback, useEffect } from 'react' const logger = new Logger('UseOnNoteDeleted') diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-connection.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-connection.ts index cd85269b5..80c2a80ee 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-connection.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-connection.ts @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { WebsocketConnection } from './websocket-connection' -import { useEffect, useMemo } from 'react' -import { useWebsocketUrl } from './use-websocket-url' -import type { Doc } from 'yjs' -import type { Awareness } from 'y-protocols/awareness' import { isMockMode } from '../../../../../utils/test-modes' import { MockConnection } from './mock-connection' +import { useWebsocketUrl } from './use-websocket-url' +import { WebsocketConnection } from './websocket-connection' import type { YDocMessageTransporter } from '@hedgedoc/realtime' +import { useEffect, useMemo } from 'react' +import type { Awareness } from 'y-protocols/awareness' +import type { Doc } from 'yjs' /** * Creates a {@link WebsocketConnection websocket connection handler } that handles the realtime communication with the backend. diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-url.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-url.ts index e71f077d8..ad5930690 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-url.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-websocket-url.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' -import { isMockMode } from '../../../../../utils/test-modes' import { useApplicationState } from '../../../../../hooks/common/use-application-state' import { useBaseUrl } from '../../../../../hooks/common/use-base-url' +import { isMockMode } from '../../../../../utils/test-modes' +import { useMemo } from 'react' const LOCAL_FALLBACK_URL = 'ws://localhost:8080/realtime/' diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-y-doc.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-y-doc.ts index 6dd6756c5..89c3d1bae 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-y-doc.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-y-doc.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { Doc } from 'yjs' import { useEffect, useMemo } from 'react' +import { Doc } from 'yjs' /** * Creates a new {@link Doc y-doc}. diff --git a/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.spec.ts b/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.spec.ts index 0ca365259..6a91a538b 100644 --- a/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.spec.ts +++ b/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.spec.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: AGPL-3.0-only */ import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' -import type { Diagnostic } from '@codemirror/lint' -import { mockEditorView } from './single-line-regex-linter.spec' import { FrontmatterLinter } from './frontmatter-linter' +import { mockEditorView } from './single-line-regex-linter.spec' +import type { Diagnostic } from '@codemirror/lint' import { t } from 'i18next' const testFrontmatterLinter = ( diff --git a/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.ts b/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.ts index 1d917fb16..b72aca101 100644 --- a/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.ts +++ b/frontend/src/components/editor-page/editor-pane/linter/frontmatter-linter.ts @@ -3,13 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { Linter } from './linter' -import type { EditorView } from '@codemirror/view' -import type { Diagnostic } from '@codemirror/lint' import { extractFrontmatter } from '../../../../redux/note-details/frontmatter-extractor/extractor' -import { load } from 'js-yaml' import type { RawNoteFrontmatter } from '../../../../redux/note-details/raw-note-frontmatter-parser/types' +import type { Linter } from './linter' +import type { Diagnostic } from '@codemirror/lint' +import type { EditorView } from '@codemirror/view' import { t } from 'i18next' +import { load } from 'js-yaml' /** * Creates a {@link Linter linter} for the yaml frontmatter. diff --git a/frontend/src/components/editor-page/editor-pane/linter/linter.ts b/frontend/src/components/editor-page/editor-pane/linter/linter.ts index 577269f98..2376703d9 100644 --- a/frontend/src/components/editor-page/editor-pane/linter/linter.ts +++ b/frontend/src/components/editor-page/editor-pane/linter/linter.ts @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' +import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state' +import { FrontmatterLinter } from './frontmatter-linter' import type { Diagnostic } from '@codemirror/lint' import { linter } from '@codemirror/lint' -import { useMemo } from 'react' import type { Extension } from '@codemirror/state' import type { EditorView } from '@codemirror/view' -import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' -import { FrontmatterLinter } from './frontmatter-linter' -import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state' +import { useMemo } from 'react' /** * The Linter interface. diff --git a/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.spec.ts b/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.spec.ts index 9eacdde3a..6f0d82a3a 100644 --- a/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.spec.ts +++ b/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.spec.ts @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' import { SingleLineRegexLinter } from './single-line-regex-linter' import type { Diagnostic } from '@codemirror/lint' -import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' +import type { EditorState, Text } from '@codemirror/state' import type { EditorView } from '@codemirror/view' import { Mock } from 'ts-mockery' -import type { EditorState, Text } from '@codemirror/state' export const mockEditorView = (content: string): EditorView => { const docMock = Mock.of() diff --git a/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.ts b/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.ts index 3613c76fe..c659fe434 100644 --- a/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.ts +++ b/frontend/src/components/editor-page/editor-pane/linter/single-line-regex-linter.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { Linter } from './linter' -import type { EditorView } from '@codemirror/view' import type { Diagnostic } from '@codemirror/lint' +import type { EditorView } from '@codemirror/view' import { t } from 'i18next' interface LineWithStartIndex { diff --git a/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning-modal.tsx b/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning-modal.tsx index f6988496e..b1733fcc5 100644 --- a/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning-modal.tsx +++ b/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning-modal.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { cypressId } from '../../../../utils/cypress-attribute' +import type { ModalVisibilityProps } from '../../../common/modals/common-modal' +import { CommonModal } from '../../../common/modals/common-modal' import React from 'react' import { Button, Modal } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import type { ModalVisibilityProps } from '../../../common/modals/common-modal' -import { CommonModal } from '../../../common/modals/common-modal' -import { cypressId } from '../../../../utils/cypress-attribute' -import { useApplicationState } from '../../../../hooks/common/use-application-state' /** * Shows a modal that informs the user that the document is too long. diff --git a/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning.tsx b/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning.tsx index f3d4437b0..b582b3dd7 100644 --- a/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning.tsx +++ b/frontend/src/components/editor-page/editor-pane/max-length-warning/max-length-warning.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useEffect, useRef } from 'react' -import { MaxLengthWarningModal } from './max-length-warning-modal' -import { useNoteMarkdownContent } from '../../../../hooks/common/use-note-markdown-content' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import { useNoteMarkdownContent } from '../../../../hooks/common/use-note-markdown-content' +import { MaxLengthWarningModal } from './max-length-warning-modal' +import React, { useEffect, useRef } from 'react' /** * Watches the length of the document and shows a warning modal to the user if the document length exceeds the configured value. diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/cursor-position-info.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/cursor-position-info.tsx index 1ef9e755b..a7bdb11b3 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/cursor-position-info.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/cursor-position-info.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useLineBasedFromPosition } from '../hooks/use-line-based-position' import React, { useMemo } from 'react' import { Trans } from 'react-i18next' -import { useLineBasedFromPosition } from '../hooks/use-line-based-position' /** * Renders a translated text that shows the given cursor position. diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/number-of-lines-in-document-info.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/number-of-lines-in-document-info.tsx index 328c2e41f..f5e323a05 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/number-of-lines-in-document-info.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/number-of-lines-in-document-info.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../../hooks/common/use-application-state' import React, { useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' -import { useApplicationState } from '../../../../hooks/common/use-application-state' /** * Renders a translated text that shows the number of lines in the document. diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/remaining-characters-info.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/remaining-characters-info.tsx index ff890b360..e34f55f4f 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/remaining-characters-info.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/remaining-characters-info.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import { cypressId } from '../../../../utils/cypress-attribute' -import { Trans, useTranslation } from 'react-i18next' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { cypressId } from '../../../../utils/cypress-attribute' +import React, { useMemo } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a translated text that shows the number of remaining characters. diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/selected-characters.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/selected-characters.tsx index 7c9ba41f6..d2e9f3626 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/selected-characters.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/selected-characters.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useMemo } from 'react' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { SeparatorDash } from './separator-dash' +import React, { Fragment, useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' /** diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/selected-lines.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/selected-lines.tsx index d5c1c0821..99526a24f 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/selected-lines.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/selected-lines.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useMemo } from 'react' -import { SeparatorDash } from './separator-dash' -import { Trans, useTranslation } from 'react-i18next' import { useLineBasedFromPosition, useLineBasedToPosition } from '../hooks/use-line-based-position' +import { SeparatorDash } from './separator-dash' +import React, { Fragment, useMemo } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Shows the total number of selected lines. diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/selection-info.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/selection-info.tsx index fe53055de..9b34c52d1 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/selection-info.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/selection-info.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import React, { useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/separator-dash.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/separator-dash.tsx index f25792db8..0b4ab9e98 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/separator-dash.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/separator-dash.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import React, { Fragment } from 'react' /** diff --git a/frontend/src/components/editor-page/editor-pane/status-bar/status-bar.tsx b/frontend/src/components/editor-page/editor-pane/status-bar/status-bar.tsx index 5b244b584..eeb821c47 100644 --- a/frontend/src/components/editor-page/editor-pane/status-bar/status-bar.tsx +++ b/frontend/src/components/editor-page/editor-pane/status-bar/status-bar.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { RemainingCharactersInfo } from './remaining-characters-info' -import { NumberOfLinesInDocumentInfo } from './number-of-lines-in-document-info' import { CursorPositionInfo } from './cursor-position-info' -import { SeparatorDash } from './separator-dash' +import { NumberOfLinesInDocumentInfo } from './number-of-lines-in-document-info' +import { RemainingCharactersInfo } from './remaining-characters-info' import { SelectedCharacters } from './selected-characters' import { SelectedLines } from './selected-lines' +import { SeparatorDash } from './separator-dash' +import React from 'react' /** * Shows additional information about the document length and the current selection. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/bold-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/bold-button.tsx index 7557fa5fb..d95e0c384 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/bold-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/bold-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to make the selection in the {@link Editor editor} bold. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/check-list-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/check-list-button.tsx index 97dddb54f..4029984be 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/check-list-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/check-list-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { prependLinesOfSelection } from '../formatters/prepend-lines-of-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to create a checklist in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/code-fence-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/code-fence-button.tsx index 2d3a0ab17..a346c18f1 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/code-fence-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/code-fence-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { changeCursorsToWholeLineIfNoToCursor } from '../formatters/utils/change-cursors-to-whole-line-if-no-to-cursor' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to create a code fence in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/collapsible-block-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/collapsible-block-button.tsx index e853c87f3..7749eab0b 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/collapsible-block-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/collapsible-block-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' -import { changeCursorsToWholeLineIfNoToCursor } from '../formatters/utils/change-cursors-to-whole-line-if-no-to-cursor' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { changeCursorsToWholeLineIfNoToCursor } from '../formatters/utils/change-cursors-to-whole-line-if-no-to-cursor' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to create a spoiler section in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/comment-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/comment-button.tsx index 5b8f55e41..7bfad486a 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/comment-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/comment-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { replaceSelection } from '../formatters/replace-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to create a comment in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/header-level-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/header-level-button.tsx index f74a86127..8d9d96654 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/header-level-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/header-level-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { prependLinesOfSelection } from '../formatters/prepend-lines-of-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to add a header in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/highlight-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/highlight-button.tsx index da71ff3d2..85abe6783 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/highlight-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/highlight-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button that highlights the selection in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/horizontal-line-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/horizontal-line-button.tsx index deb0c88e2..c33983ad3 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/horizontal-line-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/horizontal-line-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { replaceSelection } from '../formatters/replace-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to insert a horizontal line in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/image-link-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/image-link-button.tsx index 1ad4521f9..7498e5875 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/image-link-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/image-link-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { addLink } from '../formatters/add-link' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to insert an image in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/italic-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/italic-button.tsx index 50de66450..c97d45d12 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/italic-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/italic-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to make the selection in the {@link Editor editor} italic. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/link-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/link-button.tsx index 4723969ec..84421b22f 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/link-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/link-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { addLink } from '../formatters/add-link' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to insert a link in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/ordered-list-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/ordered-list-button.tsx index 086941472..0c2ccb6a6 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/ordered-list-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/ordered-list-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { prependLinesOfSelection } from '../formatters/prepend-lines-of-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to insert an ordered list in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/quotes-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/quotes-button.tsx index 4d89fa0e1..8e1437f5b 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/quotes-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/quotes-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { prependLinesOfSelection } from '../formatters/prepend-lines-of-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to insert a quotation in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/strikethrough-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/strikethrough-button.tsx index 12acf90f9..c5edca5a3 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/strikethrough-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/strikethrough-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to strike through the selection in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/subscript-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/subscript-button.tsx index 6792f5c29..3459a43ff 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/subscript-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/subscript-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to format the selection in the {@link Editor editor} as subscript. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/superscript-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/superscript-button.tsx index f2117dd3a..eb3313548 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/superscript-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/superscript-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to format the selection in the {@link Editor editor} as superscript. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/underline-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/underline-button.tsx index 76ba98ae8..b554a83af 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/underline-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/underline-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' -import { wrapSelection } from '../formatters/wrap-selection' import type { ContentFormatter } from '../../../change-content-context/change-content-context' +import { wrapSelection } from '../formatters/wrap-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to underline the selection in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/unordered-list-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/unordered-list-button.tsx index 5b6e2b5bf..7adfc7a6b 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/unordered-list-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/buttons/unordered-list-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToolbarButton } from '../toolbar-button' import type { ContentFormatter } from '../../../change-content-context/change-content-context' import { prependLinesOfSelection } from '../formatters/prepend-lines-of-selection' +import { ToolbarButton } from '../toolbar-button' +import React, { useCallback } from 'react' /** * Renders a button to insert an unordered list in the {@link Editor editor}. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx index cf49027a0..c29e5fb61 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx @@ -3,19 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback, useRef, useState } from 'react' -import { Button, Overlay } from 'react-bootstrap' -import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { EmojiPickerPopover } from './emoji-picker-popover' import { cypressId } from '../../../../../utils/cypress-attribute' -import type { EmojiClickEventDetail } from 'emoji-picker-element/shared' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' import { useChangeEditorContentCallback } from '../../../change-content-context/use-change-editor-content-callback' import { replaceSelection } from '../formatters/replace-selection' -import { extractEmojiShortCode } from './extract-emoji-short-code' +import { EmojiPickerPopover } from './emoji-picker-popover' import styles from './emoji-picker.module.scss' +import { extractEmojiShortCode } from './extract-emoji-short-code' +import type { EmojiClickEventDetail } from 'emoji-picker-element/shared' +import React, { Fragment, useCallback, useRef, useState } from 'react' +import { Button, Overlay } from 'react-bootstrap' import type { OverlayInjectedProps } from 'react-bootstrap/Overlay' +import { useTranslation } from 'react-i18next' /** * Renders a button to open the emoji picker. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-popover.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-popover.tsx index c8639078b..348979cda 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-popover.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker-popover.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import fontStyles from '../../../../../../global-styles/variables.module.scss' +import { useDarkModeState } from '../../../../../hooks/common/use-dark-mode-state' +import { ForkAwesomeIcons } from '../../../../common/fork-awesome/fork-awesome-icons' +import styles from './emoji-picker.module.scss' +import forkawesomeIcon from './forkawesome.png' import { Picker } from 'emoji-picker-element' import type { CustomEmoji, EmojiClickEvent, EmojiClickEventDetail } from 'emoji-picker-element/shared' import React, { useEffect, useRef } from 'react' -import { useDarkModeState } from '../../../../../hooks/common/use-dark-mode-state' -import styles from './emoji-picker.module.scss' -import forkawesomeIcon from './forkawesome.png' -import { ForkAwesomeIcons } from '../../../../common/fork-awesome/fork-awesome-icons' -import fontStyles from '../../../../../../global-styles/variables.module.scss' import { Popover } from 'react-bootstrap' import type { PopoverProps } from 'react-bootstrap/Popover' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/extract-emoji-short-code.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/extract-emoji-short-code.ts index a3c71a2a3..e918f9cda 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/extract-emoji-short-code.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/emoji-picker/extract-emoji-short-code.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { EmojiClickEventDetail, NativeEmoji } from 'emoji-picker-element/shared' /** diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.test.ts index bf47e25ea..760d4e77b 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { addLink } from './add-link' import type { ContentEdits } from './changes' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.ts index cc0dac23b..ee009e42f 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/add-link.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { CursorSelection } from './types/cursor-selection' import type { ContentEdits } from './types/changes' +import type { CursorSelection } from './types/cursor-selection' const beforeDescription = '[' const afterDescriptionBeforeLink = '](' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.test.ts index 196395f1d..aa7c6b743 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { prependLinesOfSelection } from './prepend-lines-of-selection' import type { ContentEdits } from './types/changes' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.ts index 8aa788c8e..de8641b14 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/prepend-lines-of-selection.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { ContentEdits } from './types/changes' import type { CursorSelection } from './types/cursor-selection' import { searchForEndOfLine, searchForStartOfLine } from './utils/change-cursors-to-whole-line-if-no-to-cursor' -import type { ContentEdits } from './types/changes' /** * Creates a copy of the given markdown content lines but modifies the whole selected lines. diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-in-content.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-in-content.ts index 3b3c30454..6ee25e971 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-in-content.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-in-content.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { ContentEdits } from './types/changes' import { Optional } from '@mrdrogdrog/optional' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.test.ts index f8e44292a..8da97f971 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.test.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { replaceSelection } from './replace-selection' import type { ContentEdits } from './changes' +import { replaceSelection } from './replace-selection' describe('replace selection', () => { it('inserts a text after the from-cursor if no to-cursor is present', () => { diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.ts index 79f1d6dd9..da416b714 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/replace-selection.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { ContentEdits } from './types/changes' import type { CursorSelection } from './types/cursor-selection' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.test.ts index d9061aa63..65ed0c603 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.test.ts @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { CursorSelection } from '../types/cursor-selection' import { changeCursorsToWholeLineIfNoToCursor, searchForEndOfLine, searchForStartOfLine } from './change-cursors-to-whole-line-if-no-to-cursor' -import type { CursorSelection } from '../types/cursor-selection' describe('changeCursorsToWholeLineIfNoToCursor', () => { it(`returns the given selection if to cursor is present`, () => { diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.ts index c6e1cc776..87c642a99 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/utils/change-cursors-to-whole-line-if-no-to-cursor.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { CursorSelection } from '../types/cursor-selection' /** diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.test.ts index 2fa281523..bd17689f2 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.test.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { wrapSelection } from './wrap-selection' import type { ContentEdits } from './types/changes' +import { wrapSelection } from './wrap-selection' describe('wrap selection', () => { it(`doesn't modify any line if no to-cursor is present`, () => { diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.ts index 1b5c54953..8fb9ee2ab 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/formatters/wrap-selection.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { ContentEdits } from './types/changes' import type { CursorSelection } from './types/cursor-selection' diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.test.ts index 8eca4cd94..7fba19226 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { createMarkdownTable } from './create-markdown-table' describe('create markdown table', () => { diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.tsx index a68af2a1a..c893f105a 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/create-markdown-table.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { createNumberRangeArray } from '../../../../common/number-range/number-range' /** diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/custom-table-size-modal.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/custom-table-size-modal.tsx index d57c889ce..c9213b0ca 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/custom-table-size-modal.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/custom-table-size-modal.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { CommonModal } from '../../../../common/modals/common-modal' +import type { TableSize } from './table-size-picker-popover' import type { ChangeEvent } from 'react' import React, { useCallback, useEffect, useState } from 'react' import { Button, Form, ModalFooter } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { CommonModal } from '../../../../common/modals/common-modal' -import type { TableSize } from './table-size-picker-popover' -import { cypressId } from '../../../../../utils/cypress-attribute' export interface CustomTableSizeModalProps { showModal: boolean diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-picker-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-picker-button.tsx index 5bbe653b6..b7edae4a5 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-picker-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-picker-button.tsx @@ -3,19 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { useChangeEditorContentCallback } from '../../../change-content-context/use-change-editor-content-callback' +import { replaceSelection } from '../formatters/replace-selection' +import { createMarkdownTable } from './create-markdown-table' +import { CustomTableSizeModal } from './custom-table-size-modal' +import './table-picker.module.scss' +import { TableSizePickerPopover } from './table-size-picker-popover' import React, { Fragment, useCallback, useMemo, useRef, useState } from 'react' import { Button, Overlay } from 'react-bootstrap' -import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { cypressId } from '../../../../../utils/cypress-attribute' -import { TableSizePickerPopover } from './table-size-picker-popover' -import { CustomTableSizeModal } from './custom-table-size-modal' import type { OverlayInjectedProps } from 'react-bootstrap/Overlay' -import { replaceSelection } from '../formatters/replace-selection' -import { useChangeEditorContentCallback } from '../../../change-content-context/use-change-editor-content-callback' -import { createMarkdownTable } from './create-markdown-table' -import './table-picker.module.scss' +import { useTranslation } from 'react-i18next' enum PickerMode { INVISIBLE, diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-picker-popover.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-picker-popover.tsx index cb311dfff..c0a67a464 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-picker-popover.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-picker-popover.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useMemo, useState } from 'react' -import { createNumberRangeArray } from '../../../../common/number-range/number-range' -import { Button, Popover } from 'react-bootstrap' -import { TableSizeText } from './table-size-text' -import { Trans, useTranslation } from 'react-i18next' import { cypressAttribute, cypressId } from '../../../../../utils/cypress-attribute' import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import type { PopoverProps } from 'react-bootstrap/Popover' +import { createNumberRangeArray } from '../../../../common/number-range/number-range' import styles from './table-picker.module.scss' +import { TableSizeText } from './table-size-text' +import React, { useCallback, useMemo, useState } from 'react' +import { Button, Popover } from 'react-bootstrap' +import type { PopoverProps } from 'react-bootstrap/Popover' +import { Trans, useTranslation } from 'react-i18next' export interface TableSizePickerPopoverProps extends PopoverProps { onShowCustomSizeModal: () => void diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-text.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-text.tsx index be572876a..a5219ef57 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-text.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/table-picker/table-size-text.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { TableSize } from './table-size-picker-popover' import React, { useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' -import type { TableSize } from './table-size-picker-popover' export interface TableSizeProps { tableSize?: TableSize diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/tool-bar.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/tool-bar.tsx index c8281a3c6..258396672 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/tool-bar.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/tool-bar.tsx @@ -3,30 +3,29 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, Suspense } from 'react' -import { ButtonGroup, ButtonToolbar } from 'react-bootstrap' -import { TablePickerButton } from './table-picker/table-picker-button' -import styles from './tool-bar.module.scss' -import { UploadImageButton } from './upload-image-button/upload-image-button' import { BoldButton } from './buttons/bold-button' +import { CheckListButton } from './buttons/check-list-button' +import { CodeFenceButton } from './buttons/code-fence-button' +import { CollapsibleBlockButton } from './buttons/collapsible-block-button' +import { CommentButton } from './buttons/comment-button' +import { HeaderLevelButton } from './buttons/header-level-button' +import { HighlightButton } from './buttons/highlight-button' +import { HorizontalLineButton } from './buttons/horizontal-line-button' +import { ImageLinkButton } from './buttons/image-link-button' import { ItalicButton } from './buttons/italic-button' -import { UnderlineButton } from './buttons/underline-button' +import { LinkButton } from './buttons/link-button' +import { OrderedListButton } from './buttons/ordered-list-button' +import { QuotesButton } from './buttons/quotes-button' import { StrikethroughButton } from './buttons/strikethrough-button' import { SubscriptButton } from './buttons/subscript-button' import { SuperscriptButton } from './buttons/superscript-button' -import { HighlightButton } from './buttons/highlight-button' -import { HeaderLevelButton } from './buttons/header-level-button' -import { CodeFenceButton } from './buttons/code-fence-button' -import { QuotesButton } from './buttons/quotes-button' +import { UnderlineButton } from './buttons/underline-button' import { UnorderedListButton } from './buttons/unordered-list-button' -import { OrderedListButton } from './buttons/ordered-list-button' -import { CheckListButton } from './buttons/check-list-button' -import { LinkButton } from './buttons/link-button' -import { ImageLinkButton } from './buttons/image-link-button' -import { HorizontalLineButton } from './buttons/horizontal-line-button' -import { CollapsibleBlockButton } from './buttons/collapsible-block-button' -import { CommentButton } from './buttons/comment-button' +import { TablePickerButton } from './table-picker/table-picker-button' +import styles from './tool-bar.module.scss' +import { UploadImageButton } from './upload-image-button/upload-image-button' +import React, { Fragment, Suspense } from 'react' +import { ButtonGroup, ButtonToolbar } from 'react-bootstrap' const EmojiPickerButton = React.lazy(() => import('./emoji-picker/emoji-picker-button')) diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/toolbar-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/toolbar-button.tsx index 90bc80ca1..1cb22768c 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/toolbar-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/toolbar-button.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useMemo } from 'react' -import { Button } from 'react-bootstrap' import { cypressId } from '../../../../utils/cypress-attribute' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import type { IconName } from '../../../common/fork-awesome/types' -import { useTranslation } from 'react-i18next' -import { useChangeEditorContentCallback } from '../../change-content-context/use-change-editor-content-callback' import type { ContentFormatter } from '../../change-content-context/change-content-context' +import { useChangeEditorContentCallback } from '../../change-content-context/use-change-editor-content-callback' +import React, { useCallback, useMemo } from 'react' +import { Button } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' export interface ToolbarButtonProps { i18nKey: string diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/extract-selected-text.test.ts b/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/extract-selected-text.test.ts index 0bb0c3293..9dfc8743c 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/extract-selected-text.test.ts +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/extract-selected-text.test.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { extractSelectedText } from './extract-selected-text' import type { EditorState, SelectionRange } from '@codemirror/state' import { Mock } from 'ts-mockery' -import { extractSelectedText } from './extract-selected-text' describe('extract selected text', () => { const mockContent = "I'm a mock content!" diff --git a/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/upload-image-button.tsx b/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/upload-image-button.tsx index 5b3c1d8d4..0fb1929ca 100644 --- a/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/upload-image-button.tsx +++ b/frontend/src/components/editor-page/editor-pane/tool-bar/upload-image-button/upload-image-button.tsx @@ -3,20 +3,19 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../../../utils/cypress-attribute' +import { Logger } from '../../../../../utils/logger' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../../../common/show-if/show-if' +import { acceptedMimeTypes } from '../../../../common/upload-image-mimetypes' +import { useCodeMirrorReference } from '../../../change-content-context/change-content-context' +import { UploadInput } from '../../../sidebar/upload-input' +import { useHandleUpload } from '../../hooks/use-handle-upload' +import { extractSelectedText } from './extract-selected-text' +import { Optional } from '@mrdrogdrog/optional' import React, { Fragment, useCallback, useRef } from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { UploadInput } from '../../../sidebar/upload-input' -import { acceptedMimeTypes } from '../../../../common/upload-image-mimetypes' -import { cypressId } from '../../../../../utils/cypress-attribute' -import { useHandleUpload } from '../../hooks/use-handle-upload' -import { ShowIf } from '../../../../common/show-if/show-if' -import { useCodeMirrorReference } from '../../../change-content-context/change-content-context' -import { extractSelectedText } from './extract-selected-text' -import { Optional } from '@mrdrogdrog/optional' -import { Logger } from '../../../../../utils/logger' const logger = new Logger('Upload image button') diff --git a/frontend/src/components/editor-page/hooks/use-update-local-history-entry.ts b/frontend/src/components/editor-page/hooks/use-update-local-history-entry.ts index 6a28cb222..ee195474c 100644 --- a/frontend/src/components/editor-page/hooks/use-update-local-history-entry.ts +++ b/frontend/src/components/editor-page/hooks/use-update-local-history-entry.ts @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import equal from 'fast-deep-equal' -import { useEffect, useRef } from 'react' -import { getGlobalState } from '../../../redux' -import { updateLocalHistoryEntry } from '../../../redux/history/methods' -import { useApplicationState } from '../../../hooks/common/use-application-state' import type { HistoryEntryWithOrigin } from '../../../api/history/types' import { HistoryEntryOrigin } from '../../../api/history/types' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { getGlobalState } from '../../../redux' +import { updateLocalHistoryEntry } from '../../../redux/history/methods' +import equal from 'fast-deep-equal' +import { useEffect, useRef } from 'react' /** * An effect that uses information of the current note state to update a local {@link HistoryEntryWithOrigin history entry}. diff --git a/frontend/src/components/editor-page/render-context/editor-to-renderer-communicator-context-provider.tsx b/frontend/src/components/editor-page/render-context/editor-to-renderer-communicator-context-provider.tsx index 1e2237abc..a3b4fbf2e 100644 --- a/frontend/src/components/editor-page/render-context/editor-to-renderer-communicator-context-provider.tsx +++ b/frontend/src/components/editor-page/render-context/editor-to-renderer-communicator-context-provider.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ORIGIN, useBaseUrl } from '../../../hooks/common/use-base-url' +import { EditorToRendererCommunicator } from '../../render-page/window-post-message-communicator/editor-to-renderer-communicator' import type { PropsWithChildren } from 'react' import React, { createContext, useContext, useEffect, useMemo } from 'react' -import { EditorToRendererCommunicator } from '../../render-page/window-post-message-communicator/editor-to-renderer-communicator' import { v4 as uuid } from 'uuid' -import { ORIGIN, useBaseUrl } from '../../../hooks/common/use-base-url' const EditorToRendererCommunicatorContext = createContext(undefined) diff --git a/frontend/src/components/editor-page/render-context/renderer-to-editor-communicator-context-provider.tsx b/frontend/src/components/editor-page/render-context/renderer-to-editor-communicator-context-provider.tsx index bcd6ca632..ff12d58a2 100644 --- a/frontend/src/components/editor-page/render-context/renderer-to-editor-communicator-context-provider.tsx +++ b/frontend/src/components/editor-page/render-context/renderer-to-editor-communicator-context-provider.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React, { createContext, useContext, useEffect, useMemo } from 'react' -import { RendererToEditorCommunicator } from '../../render-page/window-post-message-communicator/renderer-to-editor-communicator' -import { CommunicationMessageType } from '../../render-page/window-post-message-communicator/rendering-message' import { ORIGIN, useBaseUrl } from '../../../hooks/common/use-base-url' import { useSingleStringUrlParameter } from '../../../hooks/common/use-single-string-url-parameter' +import { RendererToEditorCommunicator } from '../../render-page/window-post-message-communicator/renderer-to-editor-communicator' +import { CommunicationMessageType } from '../../render-page/window-post-message-communicator/rendering-message' +import type { PropsWithChildren } from 'react' +import React, { createContext, useContext, useEffect, useMemo } from 'react' const RendererToEditorCommunicatorContext = createContext(undefined) diff --git a/frontend/src/components/editor-page/renderer-pane/hooks/use-effect-on-render-type-change.ts b/frontend/src/components/editor-page/renderer-pane/hooks/use-effect-on-render-type-change.ts index a011afb8a..8000b0423 100644 --- a/frontend/src/components/editor-page/renderer-pane/hooks/use-effect-on-render-type-change.ts +++ b/frontend/src/components/editor-page/renderer-pane/hooks/use-effect-on-render-type-change.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect, useRef } from 'react' import type { RendererType } from '../../../render-page/window-post-message-communicator/rendering-message' +import { useEffect, useRef } from 'react' /** * Execute the given reload callback if the given render type changes. diff --git a/frontend/src/components/editor-page/renderer-pane/hooks/use-force-render-page-url-on-iframe-load-callback.ts b/frontend/src/components/editor-page/renderer-pane/hooks/use-force-render-page-url-on-iframe-load-callback.ts index f1f4cdc67..541c1442c 100644 --- a/frontend/src/components/editor-page/renderer-pane/hooks/use-force-render-page-url-on-iframe-load-callback.ts +++ b/frontend/src/components/editor-page/renderer-pane/hooks/use-force-render-page-url-on-iframe-load-callback.ts @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ORIGIN, useBaseUrl } from '../../../../hooks/common/use-base-url' +import { Logger } from '../../../../utils/logger' +import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider' import type { RefObject } from 'react' import { useCallback, useEffect, useMemo, useRef } from 'react' -import { Logger } from '../../../../utils/logger' -import { ORIGIN, useBaseUrl } from '../../../../hooks/common/use-base-url' -import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider' const log = new Logger('IframeLoader') diff --git a/frontend/src/components/editor-page/renderer-pane/hooks/use-send-dark-mode-status-to-renderer.ts b/frontend/src/components/editor-page/renderer-pane/hooks/use-send-dark-mode-status-to-renderer.ts index 38b4d9a2f..88d859538 100644 --- a/frontend/src/components/editor-page/renderer-pane/hooks/use-send-dark-mode-status-to-renderer.ts +++ b/frontend/src/components/editor-page/renderer-pane/hooks/use-send-dark-mode-status-to-renderer.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useMemo } from 'react' -import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' -import { useSendToRenderer } from '../../../render-page/window-post-message-communicator/hooks/use-send-to-renderer' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { useSendToRenderer } from '../../../render-page/window-post-message-communicator/hooks/use-send-to-renderer' +import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' +import { useMemo } from 'react' /** * Sends the current dark mode setting to the renderer. diff --git a/frontend/src/components/editor-page/renderer-pane/hooks/use-send-markdown-to-renderer.ts b/frontend/src/components/editor-page/renderer-pane/hooks/use-send-markdown-to-renderer.ts index 92a5d4c50..141338bd4 100644 --- a/frontend/src/components/editor-page/renderer-pane/hooks/use-send-markdown-to-renderer.ts +++ b/frontend/src/components/editor-page/renderer-pane/hooks/use-send-markdown-to-renderer.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { useSendToRenderer } from '../../../render-page/window-post-message-communicator/hooks/use-send-to-renderer' -import { useMemo } from 'react' import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' +import { useMemo } from 'react' /** * Sends the given markdown content to the renderer. diff --git a/frontend/src/components/editor-page/renderer-pane/hooks/use-send-scroll-state.ts b/frontend/src/components/editor-page/renderer-pane/hooks/use-send-scroll-state.ts index af06a49a7..cd5f07e79 100644 --- a/frontend/src/components/editor-page/renderer-pane/hooks/use-send-scroll-state.ts +++ b/frontend/src/components/editor-page/renderer-pane/hooks/use-send-scroll-state.ts @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect, useRef } from 'react' -import type { ScrollState } from '../../synced-scroll/scroll-props' -import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' -import equal from 'fast-deep-equal' -import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message' +import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider' +import type { ScrollState } from '../../synced-scroll/scroll-props' +import equal from 'fast-deep-equal' +import { useEffect, useRef } from 'react' /** * Sends the given {@link ScrollState scroll state} to the renderer if the content changed. diff --git a/frontend/src/components/editor-page/renderer-pane/render-iframe.tsx b/frontend/src/components/editor-page/renderer-pane/render-iframe.tsx index 08691a236..3464c2c83 100644 --- a/frontend/src/components/editor-page/renderer-pane/render-iframe.tsx +++ b/frontend/src/components/editor-page/renderer-pane/render-iframe.tsx @@ -3,9 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute' +import { Logger } from '../../../utils/logger' import { isTestMode } from '../../../utils/test-modes' +import { ShowIf } from '../../common/show-if/show-if' +import { WaitSpinner } from '../../common/wait-spinner/wait-spinner' +import { useExtensionEventEmitter } from '../../markdown-renderer/hooks/use-extension-event-emitter' import type { RendererProps } from '../../render-page/markdown-document' +import { useEditorReceiveHandler } from '../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler' import type { ExtensionEvent, OnFirstHeadingChangeMessage, @@ -15,17 +20,12 @@ import type { } from '../../render-page/window-post-message-communicator/rendering-message' import { CommunicationMessageType } from '../../render-page/window-post-message-communicator/rendering-message' import { useEditorToRendererCommunicator } from '../render-context/editor-to-renderer-communicator-context-provider' +import { useEffectOnRenderTypeChange } from './hooks/use-effect-on-render-type-change' import { useForceRenderPageUrlOnIframeLoadCallback } from './hooks/use-force-render-page-url-on-iframe-load-callback' -import { useEditorReceiveHandler } from '../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler' import { useSendDarkModeStatusToRenderer } from './hooks/use-send-dark-mode-status-to-renderer' import { useSendMarkdownToRenderer } from './hooks/use-send-markdown-to-renderer' import { useSendScrollState } from './hooks/use-send-scroll-state' -import { Logger } from '../../../utils/logger' -import { useEffectOnRenderTypeChange } from './hooks/use-effect-on-render-type-change' -import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute' -import { ShowIf } from '../../common/show-if/show-if' -import { WaitSpinner } from '../../common/wait-spinner/wait-spinner' -import { useExtensionEventEmitter } from '../../markdown-renderer/hooks/use-extension-event-emitter' +import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react' export interface RenderIframeProps extends RendererProps { rendererType: RendererType diff --git a/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-modal.tsx b/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-modal.tsx index 2517371d5..33e25c0b3 100644 --- a/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-modal.tsx +++ b/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-modal.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { cypressId } from '../../../../utils/cypress-attribute' -import { Trans } from 'react-i18next' -import { DeletionModal } from '../../../common/modals/deletion-modal' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { cypressId } from '../../../../utils/cypress-attribute' import type { ModalVisibilityProps } from '../../../common/modals/common-modal' +import { DeletionModal } from '../../../common/modals/deletion-modal' +import React from 'react' +import { Trans } from 'react-i18next' export interface DeleteHistoryNoteModalProps { modalTitleI18nKey?: string diff --git a/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-sidebar-entry.tsx index 4cf28807a..65e4f492a 100644 --- a/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/delete-note-sidebar-entry/delete-note-sidebar-entry.tsx @@ -3,20 +3,19 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { deleteNote } from '../../../../api/notes' +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import { cypressId } from '../../../../utils/cypress-attribute' +import { Logger } from '../../../../utils/logger' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import { SidebarButton } from '../sidebar-button/sidebar-button' +import type { SpecificSidebarEntryProps } from '../types' +import { DeleteNoteModal } from './delete-note-modal' +import { useRouter } from 'next/router' import type { PropsWithChildren } from 'react' import React, { Fragment, useCallback } from 'react' import { Trans, useTranslation } from 'react-i18next' -import { SidebarButton } from '../sidebar-button/sidebar-button' -import type { SpecificSidebarEntryProps } from '../types' -import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { cypressId } from '../../../../utils/cypress-attribute' -import { deleteNote } from '../../../../api/notes' -import { DeleteNoteModal } from './delete-note-modal' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' -import { useRouter } from 'next/router' -import { Logger } from '../../../../utils/logger' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' const logger = new Logger('note-deletion') diff --git a/frontend/src/components/editor-page/sidebar/sidebar-button/sidebar-button.tsx b/frontend/src/components/editor-page/sidebar/sidebar-button/sidebar-button.tsx index 747d7a013..61154be09 100644 --- a/frontend/src/components/editor-page/sidebar/sidebar-button/sidebar-button.tsx +++ b/frontend/src/components/editor-page/sidebar/sidebar-button/sidebar-button.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React from 'react' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import type { IconName } from '../../../common/fork-awesome/types' import { ShowIf } from '../../../common/show-if/show-if' import type { SidebarEntryProps } from '../types' import styles from './sidebar-button.module.scss' +import type { PropsWithChildren } from 'react' +import React from 'react' /** * A button that should be rendered in the sidebar. diff --git a/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.tsx b/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.tsx index 05b7947e3..50ed9858d 100644 --- a/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.tsx +++ b/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React from 'react' import type { SidebarMenuProps } from '../types' import styles from './sidebar-menu.module.scss' +import type { PropsWithChildren } from 'react' +import React from 'react' /** * Renders a sidebar menu. diff --git a/frontend/src/components/editor-page/sidebar/sidebar.tsx b/frontend/src/components/editor-page/sidebar/sidebar.tsx index 5cb65cbbc..a1ef206ff 100644 --- a/frontend/src/components/editor-page/sidebar/sidebar.tsx +++ b/frontend/src/components/editor-page/sidebar/sidebar.tsx @@ -3,13 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useRef, useState } from 'react' -import { useClickAway } from 'react-use' import { DeleteNoteSidebarEntry } from './delete-note-sidebar-entry/delete-note-sidebar-entry' -import { NoteInfoSidebarEntry } from './specific-sidebar-entries/note-info-sidebar-entry' +import { AliasesSidebarEntry } from './specific-sidebar-entries/aliases-sidebar-entry' import { ExportMenuSidebarMenu } from './specific-sidebar-entries/export-menu-sidebar-menu' import { ImportMenuSidebarMenu } from './specific-sidebar-entries/import-menu-sidebar-menu' +import { NoteInfoSidebarEntry } from './specific-sidebar-entries/note-info-sidebar-entry' import { PermissionsSidebarEntry } from './specific-sidebar-entries/permissions-sidebar-entry' import { PinNoteSidebarEntry } from './specific-sidebar-entries/pin-note-sidebar-entry' import { RevisionSidebarEntry } from './specific-sidebar-entries/revision-sidebar-entry' @@ -17,7 +15,8 @@ import { ShareSidebarEntry } from './specific-sidebar-entries/share-sidebar-entr import styles from './style/sidebar.module.scss' import { DocumentSidebarMenuSelection } from './types' import { UsersOnlineSidebarMenu } from './users-online-sidebar-menu/users-online-sidebar-menu' -import { AliasesSidebarEntry } from './specific-sidebar-entries/aliases-sidebar-entry' +import React, { useCallback, useRef, useState } from 'react' +import { useClickAway } from 'react-use' /** * Renders the sidebar for the editor. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry.tsx index afc0175d3..1dfeb2f1a 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import { AliasesModal } from '../../document-bar/aliases/aliases-modal' +import { SidebarButton } from '../sidebar-button/sidebar-button' +import type { SpecificSidebarEntryProps } from '../types' import React, { Fragment } from 'react' import { Trans, useTranslation } from 'react-i18next' -import type { SpecificSidebarEntryProps } from '../types' -import { SidebarButton } from '../sidebar-button/sidebar-button' -import { AliasesModal } from '../../document-bar/aliases/aliases-modal' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' /** * Component that shows a button in the editor sidebar for opening the aliases modal. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-markdown-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-markdown-sidebar-entry.tsx index dce66bee2..1f54b6e1f 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-markdown-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-markdown-sidebar-entry.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import sanitize from 'sanitize-filename' +import { useNoteMarkdownContent } from '../../../../hooks/common/use-note-markdown-content' import { getGlobalState } from '../../../../redux' -import { Trans, useTranslation } from 'react-i18next' +import { cypressId } from '../../../../utils/cypress-attribute' import { download } from '../../../common/download/download' import { SidebarButton } from '../sidebar-button/sidebar-button' -import { useNoteMarkdownContent } from '../../../../hooks/common/use-note-markdown-content' -import { cypressId } from '../../../../utils/cypress-attribute' +import React, { useCallback } from 'react' +import { Trans, useTranslation } from 'react-i18next' +import sanitize from 'sanitize-filename' /** * Editor sidebar entry for exporting the markdown content into a local file. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-menu-sidebar-menu.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-menu-sidebar-menu.tsx index 86f98df54..2ae37fa41 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-menu-sidebar-menu.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/export-menu-sidebar-menu.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback } from 'react' -import { Trans, useTranslation } from 'react-i18next' -import { ExportMarkdownSidebarEntry } from './export-markdown-sidebar-entry' +import { cypressId } from '../../../../utils/cypress-attribute' import { SidebarButton } from '../sidebar-button/sidebar-button' import { SidebarMenu } from '../sidebar-menu/sidebar-menu' import type { SpecificSidebarMenuProps } from '../types' import { DocumentSidebarMenuSelection } from '../types' -import { cypressId } from '../../../../utils/cypress-attribute' +import { ExportMarkdownSidebarEntry } from './export-markdown-sidebar-entry' +import React, { Fragment, useCallback } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders the export menu for the sidebar. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-markdown-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-markdown-sidebar-entry.tsx index f0bea9d7e..d4fe74c76 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-markdown-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-markdown-sidebar-entry.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback, useRef } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { cypressId } from '../../../../utils/cypress-attribute' +import { FileContentFormat, readFile } from '../../../../utils/read-file' +import { ShowIf } from '../../../common/show-if/show-if' +import { useChangeEditorContentCallback } from '../../change-content-context/use-change-editor-content-callback' import { SidebarButton } from '../sidebar-button/sidebar-button' import { UploadInput } from '../upload-input' -import { cypressId } from '../../../../utils/cypress-attribute' -import { useChangeEditorContentCallback } from '../../change-content-context/use-change-editor-content-callback' -import { ShowIf } from '../../../common/show-if/show-if' -import { FileContentFormat, readFile } from '../../../../utils/read-file' +import React, { Fragment, useCallback, useRef } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a sidebar entry that allows to import the content of markdown files into the currently opened note. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-menu-sidebar-menu.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-menu-sidebar-menu.tsx index 045e1ea5a..bf706cdb9 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-menu-sidebar-menu.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/import-menu-sidebar-menu.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback } from 'react' -import { Trans, useTranslation } from 'react-i18next' -import { ImportMarkdownSidebarEntry } from './import-markdown-sidebar-entry' +import { cypressId } from '../../../../utils/cypress-attribute' import { SidebarButton } from '../sidebar-button/sidebar-button' import { SidebarMenu } from '../sidebar-menu/sidebar-menu' import type { SpecificSidebarMenuProps } from '../types' import { DocumentSidebarMenuSelection } from '../types' -import { cypressId } from '../../../../utils/cypress-attribute' +import { ImportMarkdownSidebarEntry } from './import-markdown-sidebar-entry' +import React, { Fragment, useCallback } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders the import menu for the sidebar. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/note-info-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/note-info-sidebar-entry.tsx index 578744f9a..1e425a6f7 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/note-info-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/note-info-sidebar-entry.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import { cypressId } from '../../../../utils/cypress-attribute' import { NoteInfoModal } from '../../document-bar/note-info/note-info-modal' import { SidebarButton } from '../sidebar-button/sidebar-button' import type { SpecificSidebarEntryProps } from '../types' -import { cypressId } from '../../../../utils/cypress-attribute' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import React, { Fragment } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Sidebar entry that allows to open the {@link NoteInfoModal} containing information about the current note. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/permissions-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/permissions-sidebar-entry.tsx index f4b6f9958..d8f2041f9 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/permissions-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/permissions-sidebar-entry.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' import { PermissionModal } from '../../document-bar/permissions/permission-modal' import { SidebarButton } from '../sidebar-button/sidebar-button' import type { SpecificSidebarEntryProps } from '../types' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import React, { Fragment } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a button to open the permission modal for the sidebar. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/pin-note-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/pin-note-sidebar-entry.tsx index 8680eb8be..704d324a9 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/pin-note-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/pin-note-sidebar-entry.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useMemo } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useApplicationState } from '../../../../hooks/common/use-application-state' +import { toggleHistoryEntryPinning } from '../../../../redux/history/methods' +import { useUiNotifications } from '../../../notifications/ui-notification-boundary' import { SidebarButton } from '../sidebar-button/sidebar-button' import type { SpecificSidebarEntryProps } from '../types' -import { toggleHistoryEntryPinning } from '../../../../redux/history/methods' -import { useApplicationState } from '../../../../hooks/common/use-application-state' import styles from './pin-note-sidebar-entry.module.css' -import { useUiNotifications } from '../../../notifications/ui-notification-boundary' +import React, { useCallback, useMemo } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Sidebar entry button that toggles the pinned status of the current note in the history. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revision-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revision-sidebar-entry.tsx index cfa8e49a3..a0c0452b7 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revision-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revision-sidebar-entry.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Trans } from 'react-i18next' +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' import { RevisionModal } from '../../document-bar/revisions/revision-modal' import { SidebarButton } from '../sidebar-button/sidebar-button' import type { SpecificSidebarEntryProps } from '../types' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import React, { Fragment } from 'react' +import { Trans } from 'react-i18next' /** * Renders a button to open the revision modal for the sidebar. diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/share-sidebar-entry.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/share-sidebar-entry.tsx index a9a4ead6d..c741fdb36 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/share-sidebar-entry.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/share-sidebar-entry.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useBooleanState } from '../../../../hooks/common/use-boolean-state' import { ShareModal } from '../../document-bar/share/share-modal' import { SidebarButton } from '../sidebar-button/sidebar-button' import type { SpecificSidebarEntryProps } from '../types' -import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import React, { Fragment } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a button to open the share modal for the sidebar. diff --git a/frontend/src/components/editor-page/sidebar/types.ts b/frontend/src/components/editor-page/sidebar/types.ts index e36defe15..d664be4e9 100644 --- a/frontend/src/components/editor-page/sidebar/types.ts +++ b/frontend/src/components/editor-page/sidebar/types.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { RefObject } from 'react' -import type { IconName } from '../../common/fork-awesome/types' import type { PropsWithDataCypressId } from '../../../utils/cypress-attribute' +import type { IconName } from '../../common/fork-awesome/types' +import type { RefObject } from 'react' export interface SpecificSidebarEntryProps { className?: string diff --git a/frontend/src/components/editor-page/sidebar/upload-input.tsx b/frontend/src/components/editor-page/sidebar/upload-input.tsx index f5eb59379..152276a5b 100644 --- a/frontend/src/components/editor-page/sidebar/upload-input.tsx +++ b/frontend/src/components/editor-page/sidebar/upload-input.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { MutableRefObject } from 'react' -import React, { useCallback, useEffect, useRef } from 'react' -import { Logger } from '../../../utils/logger' import type { PropsWithDataCypressId } from '../../../utils/cypress-attribute' import { cypressId } from '../../../utils/cypress-attribute' +import { Logger } from '../../../utils/logger' +import type { MutableRefObject } from 'react' +import React, { useCallback, useEffect, useRef } from 'react' const log = new Logger('UploadInput') diff --git a/frontend/src/components/editor-page/sidebar/user-line/user-line.tsx b/frontend/src/components/editor-page/sidebar/user-line/user-line.tsx index e146d4da0..5815746b3 100644 --- a/frontend/src/components/editor-page/sidebar/user-line/user-line.tsx +++ b/frontend/src/components/editor-page/sidebar/user-line/user-line.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' +import type { ActiveIndicatorStatus } from '../../../../redux/realtime/types' +import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username' import { ActiveIndicator } from '../users-online-sidebar-menu/active-indicator' import styles from './user-line.module.scss' -import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username' -import type { ActiveIndicatorStatus } from '../../../../redux/realtime/types' +import React from 'react' export interface UserLineProps { username: string | null diff --git a/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/active-indicator.tsx b/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/active-indicator.tsx index 9cd6edf24..758eb2f4f 100644 --- a/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/active-indicator.tsx +++ b/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/active-indicator.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import styles from './active-indicator.module.scss' import type { ActiveIndicatorStatus } from '../../../../redux/realtime/types' +import styles from './active-indicator.module.scss' +import React from 'react' export interface ActiveIndicatorProps { status: ActiveIndicatorStatus diff --git a/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/users-online-sidebar-menu.tsx b/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/users-online-sidebar-menu.tsx index 4441b478f..b9aec7ece 100644 --- a/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/users-online-sidebar-menu.tsx +++ b/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/users-online-sidebar-menu.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback, useEffect, useMemo, useRef } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useApplicationState } from '../../../../hooks/common/use-application-state' import { SidebarButton } from '../sidebar-button/sidebar-button' import { SidebarMenu } from '../sidebar-menu/sidebar-menu' import type { SpecificSidebarMenuProps } from '../types' import { DocumentSidebarMenuSelection } from '../types' -import styles from './online-counter.module.scss' import { UserLine } from '../user-line/user-line' -import { useApplicationState } from '../../../../hooks/common/use-application-state' +import styles from './online-counter.module.scss' +import React, { Fragment, useCallback, useEffect, useMemo, useRef } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Sidebar menu that contains the list of currently online users in the current note session. diff --git a/frontend/src/components/editor-page/splitter/hooks/use-keyboard-shortcuts.ts b/frontend/src/components/editor-page/splitter/hooks/use-keyboard-shortcuts.ts index 9e46b44d6..b6330ea57 100644 --- a/frontend/src/components/editor-page/splitter/hooks/use-keyboard-shortcuts.ts +++ b/frontend/src/components/editor-page/splitter/hooks/use-keyboard-shortcuts.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { useEffect } from 'react' /** diff --git a/frontend/src/components/editor-page/splitter/split-divider/split-divider.tsx b/frontend/src/components/editor-page/splitter/split-divider/split-divider.tsx index a5701469a..013a4b6fb 100644 --- a/frontend/src/components/editor-page/splitter/split-divider/split-divider.tsx +++ b/frontend/src/components/editor-page/splitter/split-divider/split-divider.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import styles from './split-divider.module.scss' import { testId } from '../../../../utils/test-id' -import { Button } from 'react-bootstrap' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import styles from './split-divider.module.scss' +import React from 'react' +import { Button } from 'react-bootstrap' export enum DividerButtonsShift { SHIFT_TO_LEFT = 'shift-left', diff --git a/frontend/src/components/editor-page/splitter/splitter.test.tsx b/frontend/src/components/editor-page/splitter/splitter.test.tsx index ff49532a8..f571ea1a1 100644 --- a/frontend/src/components/editor-page/splitter/splitter.test.tsx +++ b/frontend/src/components/editor-page/splitter/splitter.test.tsx @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { fireEvent, render, screen } from '@testing-library/react' import { Splitter } from './splitter' +import { fireEvent, render, screen } from '@testing-library/react' import { Mock } from 'ts-mockery' describe('Splitter', () => { diff --git a/frontend/src/components/editor-page/splitter/splitter.tsx b/frontend/src/components/editor-page/splitter/splitter.tsx index 5a187d0d6..8fed39793 100644 --- a/frontend/src/components/editor-page/splitter/splitter.tsx +++ b/frontend/src/components/editor-page/splitter/splitter.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { ReactElement, TouchEvent, MouseEvent } from 'react' -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { DividerButtonsShift, SplitDivider } from './split-divider/split-divider' -import styles from './splitter.module.scss' import { ShowIf } from '../../common/show-if/show-if' import { useKeyboardShortcuts } from './hooks/use-keyboard-shortcuts' +import { DividerButtonsShift, SplitDivider } from './split-divider/split-divider' +import styles from './splitter.module.scss' +import type { ReactElement, TouchEvent, MouseEvent } from 'react' +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' export interface SplitterProps { left?: ReactElement diff --git a/frontend/src/components/editor-page/synced-scroll/utils.ts b/frontend/src/components/editor-page/synced-scroll/utils.ts index 2ddb38d71..5dd0098a0 100644 --- a/frontend/src/components/editor-page/synced-scroll/utils.ts +++ b/frontend/src/components/editor-page/synced-scroll/utils.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { LineMarkerPosition } from '../../markdown-renderer/extensions/linemarker/types' /** diff --git a/frontend/src/components/editor-page/table-of-contents/table-of-contents.test.tsx b/frontend/src/components/editor-page/table-of-contents/table-of-contents.test.tsx index 6ae9850b5..c8df398a8 100644 --- a/frontend/src/components/editor-page/table-of-contents/table-of-contents.test.tsx +++ b/frontend/src/components/editor-page/table-of-contents/table-of-contents.test.tsx @@ -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 { TableOfContents } from './table-of-contents' +import { render } from '@testing-library/react' import type { TocAst } from 'markdown-it-toc-done-right' describe('Table of contents', () => { diff --git a/frontend/src/components/editor-page/table-of-contents/table-of-contents.tsx b/frontend/src/components/editor-page/table-of-contents/table-of-contents.tsx index b43892b4a..5564ca8a4 100644 --- a/frontend/src/components/editor-page/table-of-contents/table-of-contents.tsx +++ b/frontend/src/components/editor-page/table-of-contents/table-of-contents.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { TocAst } from 'markdown-it-toc-done-right' -import React from 'react' -import { Trans, useTranslation } from 'react-i18next' import { ShowIf } from '../../common/show-if/show-if' import styles from './table-of-contents.module.scss' import { useBuildReactDomFromTocAst } from './use-build-react-dom-from-toc-ast' +import type { TocAst } from 'markdown-it-toc-done-right' +import React from 'react' +import { Trans, useTranslation } from 'react-i18next' export interface TableOfContentsProps { ast: TocAst diff --git a/frontend/src/components/editor-page/table-of-contents/use-build-react-dom-from-toc-ast.tsx b/frontend/src/components/editor-page/table-of-contents/use-build-react-dom-from-toc-ast.tsx index 9cb80cf66..c2839cf2d 100644 --- a/frontend/src/components/editor-page/table-of-contents/use-build-react-dom-from-toc-ast.tsx +++ b/frontend/src/components/editor-page/table-of-contents/use-build-react-dom-from-toc-ast.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ShowIf } from '../../common/show-if/show-if' +import { JumpAnchor } from '../../markdown-renderer/extensions/link-replacer/jump-anchor' +import { tocSlugify } from './toc-slugify' import type { TocAst } from 'markdown-it-toc-done-right' import type { ReactElement } from 'react' import React, { Fragment, useMemo } from 'react' -import { ShowIf } from '../../common/show-if/show-if' -import { tocSlugify } from './toc-slugify' -import { JumpAnchor } from '../../markdown-renderer/extensions/link-replacer/jump-anchor' /** * Generates a React DOM part for the table of contents from the given AST of the document. diff --git a/frontend/src/components/editor-page/utils.ts b/frontend/src/components/editor-page/utils.ts index b7682f99c..9a7c2c873 100644 --- a/frontend/src/components/editor-page/utils.ts +++ b/frontend/src/components/editor-page/utils.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { isClientSideRendering } from '../../utils/is-client-side-rendering' /** diff --git a/frontend/src/components/error-boundary/error-boundary.tsx b/frontend/src/components/error-boundary/error-boundary.tsx index d8f4bed96..c3167dc73 100644 --- a/frontend/src/components/error-boundary/error-boundary.tsx +++ b/frontend/src/components/error-boundary/error-boundary.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { ErrorInfo, PropsWithChildren, ReactNode } from 'react' -import React, { Component } from 'react' -import { Button, Container } from 'react-bootstrap' import links from '../../links.json' +import { Logger } from '../../utils/logger' import frontendVersion from '../../version.json' import { ForkAwesomeIcon } from '../common/fork-awesome/fork-awesome-icon' import { ExternalLink } from '../common/links/external-link' -import { Logger } from '../../utils/logger' +import type { ErrorInfo, PropsWithChildren, ReactNode } from 'react' +import React, { Component } from 'react' +import { Button, Container } from 'react-bootstrap' const log = new Logger('ErrorBoundary') diff --git a/frontend/src/components/error-pages/common-error-page.tsx b/frontend/src/components/error-pages/common-error-page.tsx index 681154bf6..d345d5a49 100644 --- a/frontend/src/components/error-pages/common-error-page.tsx +++ b/frontend/src/components/error-pages/common-error-page.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ShowIf } from '../common/show-if/show-if' +import { LandingLayout } from '../landing-layout/landing-layout' import type { PropsWithChildren } from 'react' import React from 'react' -import { LandingLayout } from '../landing-layout/landing-layout' import { Trans, useTranslation } from 'react-i18next' -import { ShowIf } from '../common/show-if/show-if' export interface CommonErrorPageProps { titleI18nKey: string diff --git a/frontend/src/components/history-page/entry-menu/delete-note-item.tsx b/frontend/src/components/history-page/entry-menu/delete-note-item.tsx index fd572409a..af26d8fe0 100644 --- a/frontend/src/components/history-page/entry-menu/delete-note-item.tsx +++ b/frontend/src/components/history-page/entry-menu/delete-note-item.tsx @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import { DropdownItemWithDeletionModal } from './dropdown-item-with-deletion-modal' +import React from 'react' export interface DeleteNoteItemProps { onConfirm: () => void diff --git a/frontend/src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx b/frontend/src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx index cce7d426a..91d4fe2df 100644 --- a/frontend/src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx +++ b/frontend/src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback } from 'react' -import { Dropdown } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' +import { useBooleanState } from '../../../hooks/common/use-boolean-state' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import type { IconName } from '../../common/fork-awesome/types' import type { DeleteHistoryNoteModalProps } from '../../editor-page/sidebar/delete-note-sidebar-entry/delete-note-modal' import { DeleteNoteModal } from '../../editor-page/sidebar/delete-note-sidebar-entry/delete-note-modal' -import { useBooleanState } from '../../../hooks/common/use-boolean-state' +import React, { Fragment, useCallback } from 'react' +import { Dropdown } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' export interface DropdownItemWithDeletionModalProps { onConfirm: () => void diff --git a/frontend/src/components/history-page/entry-menu/entry-menu.tsx b/frontend/src/components/history-page/entry-menu/entry-menu.tsx index c02952495..773757090 100644 --- a/frontend/src/components/history-page/entry-menu/entry-menu.tsx +++ b/frontend/src/components/history-page/entry-menu/entry-menu.tsx @@ -3,18 +3,17 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Dropdown } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' +import { HistoryEntryOrigin } from '../../../api/history/types' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { cypressId } from '../../../utils/cypress-attribute' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { ShowIf } from '../../common/show-if/show-if' import { DeleteNoteItem } from './delete-note-item' import styles from './entry-menu.module.scss' import { RemoveNoteEntryItem } from './remove-note-entry-item' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { cypressId } from '../../../utils/cypress-attribute' -import { HistoryEntryOrigin } from '../../../api/history/types' +import React from 'react' +import { Dropdown } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' export interface EntryMenuProps { id: string diff --git a/frontend/src/components/history-page/entry-menu/remove-note-entry-item.tsx b/frontend/src/components/history-page/entry-menu/remove-note-entry-item.tsx index cdfdd4848..f129deac8 100644 --- a/frontend/src/components/history-page/entry-menu/remove-note-entry-item.tsx +++ b/frontend/src/components/history-page/entry-menu/remove-note-entry-item.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { DropdownItemWithDeletionModal } from './dropdown-item-with-deletion-modal' import { cypressId } from '../../../utils/cypress-attribute' +import { DropdownItemWithDeletionModal } from './dropdown-item-with-deletion-modal' +import React from 'react' export interface RemoveNoteEntryItemProps { onConfirm: () => void diff --git a/frontend/src/components/history-page/history-card/history-card-list.tsx b/frontend/src/components/history-page/history-card/history-card-list.tsx index fbcd5bbc9..4584891e9 100644 --- a/frontend/src/components/history-page/history-card/history-card-list.tsx +++ b/frontend/src/components/history-page/history-card/history-card-list.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import { Row } from 'react-bootstrap' import { Pager } from '../../common/pagination/pager' import type { HistoryEntriesProps, HistoryEventHandlers } from '../history-content/history-content' import { HistoryCard } from './history-card' +import React, { useMemo } from 'react' +import { Row } from 'react-bootstrap' /** * Renders a paginated list of history entry cards. diff --git a/frontend/src/components/history-page/history-card/history-card.tsx b/frontend/src/components/history-page/history-card/history-card.tsx index d7f9a57c8..0ef7223d9 100644 --- a/frontend/src/components/history-page/history-card/history-card.tsx +++ b/frontend/src/components/history-page/history-card/history-card.tsx @@ -3,19 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { DateTime } from 'luxon' -import React, { useCallback, useMemo } from 'react' -import { Badge, Card } from 'react-bootstrap' +import { cypressId } from '../../../utils/cypress-attribute' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { EntryMenu } from '../entry-menu/entry-menu' import type { HistoryEntryProps, HistoryEventHandlers } from '../history-content/history-content' import { PinButton } from '../pin-button/pin-button' +import { useHistoryEntryTitle } from '../use-history-entry-title' import { formatHistoryDate } from '../utils' import styles from './history-card.module.scss' -import { useHistoryEntryTitle } from '../use-history-entry-title' -import { cypressId } from '../../../utils/cypress-attribute' +import { DateTime } from 'luxon' import Link from 'next/link' +import React, { useCallback, useMemo } from 'react' +import { Badge, Card } from 'react-bootstrap' /** * Renders a history entry as a card. diff --git a/frontend/src/components/history-page/history-content/history-content.tsx b/frontend/src/components/history-page/history-content/history-content.tsx index f1875c711..f1bd332bc 100644 --- a/frontend/src/components/history-page/history-content/history-content.tsx +++ b/frontend/src/components/history-page/history-content/history-content.tsx @@ -3,21 +3,20 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment, useCallback, useMemo, useState } from 'react' -import { Alert, Col, Row } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' +import type { HistoryEntryWithOrigin } from '../../../api/history/types' +import { deleteNote } from '../../../api/notes' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { removeHistoryEntry, toggleHistoryEntryPinning } from '../../../redux/history/methods' import { PagerPagination } from '../../common/pagination/pager-pagination' +import { useUiNotifications } from '../../notifications/ui-notification-boundary' import { HistoryCardList } from '../history-card/history-card-list' import { HistoryTable } from '../history-table/history-table' import { ViewStateEnum } from '../history-toolbar/history-toolbar' -import { removeHistoryEntry, toggleHistoryEntryPinning } from '../../../redux/history/methods' -import { deleteNote } from '../../../api/notes' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { sortAndFilterEntries } from '../utils' import { useHistoryToolbarState } from '../history-toolbar/toolbar-context/use-history-toolbar-state' -import type { HistoryEntryWithOrigin } from '../../../api/history/types' -import { useUiNotifications } from '../../notifications/ui-notification-boundary' +import { sortAndFilterEntries } from '../utils' +import React, { Fragment, useCallback, useMemo, useState } from 'react' +import { Alert, Col, Row } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' type OnEntryClick = (entryId: string) => void diff --git a/frontend/src/components/history-page/history-table/history-table-row.tsx b/frontend/src/components/history-page/history-table/history-table-row.tsx index 3ca4e70b8..ce8daff9d 100644 --- a/frontend/src/components/history-page/history-table/history-table-row.tsx +++ b/frontend/src/components/history-page/history-table/history-table-row.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { Badge } from 'react-bootstrap' +import { cypressId } from '../../../utils/cypress-attribute' import { EntryMenu } from '../entry-menu/entry-menu' import type { HistoryEntryProps, HistoryEventHandlers } from '../history-content/history-content' import { PinButton } from '../pin-button/pin-button' -import { formatHistoryDate } from '../utils' import { useHistoryEntryTitle } from '../use-history-entry-title' -import { cypressId } from '../../../utils/cypress-attribute' +import { formatHistoryDate } from '../utils' import Link from 'next/link' +import React, { useCallback } from 'react' +import { Badge } from 'react-bootstrap' /** * Renders a history entry as a table row. diff --git a/frontend/src/components/history-page/history-table/history-table.tsx b/frontend/src/components/history-page/history-table/history-table.tsx index 3cf8ce813..e55f3f6c4 100644 --- a/frontend/src/components/history-page/history-table/history-table.tsx +++ b/frontend/src/components/history-page/history-table/history-table.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import { Table } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' +import { cypressId } from '../../../utils/cypress-attribute' import { Pager } from '../../common/pagination/pager' import type { HistoryEntriesProps, HistoryEventHandlers } from '../history-content/history-content' import { HistoryTableRow } from './history-table-row' import styles from './history-table.module.scss' -import { cypressId } from '../../../utils/cypress-attribute' +import React, { useMemo } from 'react' +import { Table } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a paginated table of history entries. diff --git a/frontend/src/components/history-page/history-toolbar/clear-history-button.tsx b/frontend/src/components/history-page/history-toolbar/clear-history-button.tsx index 9c6b2b7d8..fa9ea95c4 100644 --- a/frontend/src/components/history-page/history-toolbar/clear-history-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/clear-history-button.tsx @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useBooleanState } from '../../../hooks/common/use-boolean-state' +import { deleteAllHistoryEntries } from '../../../redux/history/methods' +import { cypressId } from '../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { DeletionModal } from '../../common/modals/deletion-modal' +import { useUiNotifications } from '../../notifications/ui-notification-boundary' +import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' import React, { Fragment, useCallback } from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { DeletionModal } from '../../common/modals/deletion-modal' -import { deleteAllHistoryEntries } from '../../../redux/history/methods' -import { cypressId } from '../../../utils/cypress-attribute' -import { useBooleanState } from '../../../hooks/common/use-boolean-state' -import { useUiNotifications } from '../../notifications/ui-notification-boundary' -import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' /** * Renders a button to clear the complete history of the user. diff --git a/frontend/src/components/history-page/history-toolbar/export-history-button.tsx b/frontend/src/components/history-page/history-toolbar/export-history-button.tsx index 96848f80d..a2592f19c 100644 --- a/frontend/src/components/history-page/history-toolbar/export-history-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/export-history-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { downloadHistory } from '../../../redux/history/methods' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import React from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { downloadHistory } from '../../../redux/history/methods' /** * Renders a button to export the history. diff --git a/frontend/src/components/history-page/history-toolbar/history-refresh-button.tsx b/frontend/src/components/history-page/history-toolbar/history-refresh-button.tsx index f5d373ab6..c89572b01 100644 --- a/frontend/src/components/history-page/history-toolbar/history-refresh-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/history-refresh-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { useTranslation } from 'react-i18next' -import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' /** * Fetches the current history from the server. diff --git a/frontend/src/components/history-page/history-toolbar/history-toolbar-state.d.ts b/frontend/src/components/history-page/history-toolbar/history-toolbar-state.d.ts index ef9ac200d..0ac949e78 100644 --- a/frontend/src/components/history-page/history-toolbar/history-toolbar-state.d.ts +++ b/frontend/src/components/history-page/history-toolbar/history-toolbar-state.d.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { SortModeEnum } from '../sort-button/sort-button' import type { ViewStateEnum } from './history-toolbar' diff --git a/frontend/src/components/history-page/history-toolbar/history-toolbar.tsx b/frontend/src/components/history-page/history-toolbar/history-toolbar.tsx index e319213bb..31e64624c 100644 --- a/frontend/src/components/history-page/history-toolbar/history-toolbar.tsx +++ b/frontend/src/components/history-page/history-toolbar/history-toolbar.tsx @@ -3,27 +3,26 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { HistoryEntryOrigin } from '../../../api/history/types' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { importHistoryEntries, setHistoryEntries } from '../../../redux/history/methods' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../common/show-if/show-if' +import { useUiNotifications } from '../../notifications/ui-notification-boundary' +import { ClearHistoryButton } from './clear-history-button' +import { ExportHistoryButton } from './export-history-button' +import { HistoryRefreshButton } from './history-refresh-button' +import { HistoryViewModeToggleButton } from './history-view-mode-toggle-button' +import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' +import { ImportHistoryButton } from './import-history-button' +import { KeywordSearchInput } from './keyword-search-input' +import { SortByLastVisitedButton } from './sort-by-last-visited-button' +import { SortByTitleButton } from './sort-by-title-button' +import { TagSelectionInput } from './tag-selection-input' +import { useSyncToolbarStateToUrlEffect } from './toolbar-context/use-sync-toolbar-state-to-url-effect' import React, { useCallback } from 'react' import { Button, Col } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { ShowIf } from '../../common/show-if/show-if' -import { ClearHistoryButton } from './clear-history-button' -import { ExportHistoryButton } from './export-history-button' -import { ImportHistoryButton } from './import-history-button' -import { importHistoryEntries, setHistoryEntries } from '../../../redux/history/methods' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { KeywordSearchInput } from './keyword-search-input' -import { TagSelectionInput } from './tag-selection-input' -import { HistoryRefreshButton } from './history-refresh-button' -import { SortByTitleButton } from './sort-by-title-button' -import { SortByLastVisitedButton } from './sort-by-last-visited-button' -import { HistoryViewModeToggleButton } from './history-view-mode-toggle-button' -import { useSyncToolbarStateToUrlEffect } from './toolbar-context/use-sync-toolbar-state-to-url-effect' -import { HistoryEntryOrigin } from '../../../api/history/types' -import { useUiNotifications } from '../../notifications/ui-notification-boundary' -import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' export enum ViewStateEnum { CARD, diff --git a/frontend/src/components/history-page/history-toolbar/history-view-mode-toggle-button.tsx b/frontend/src/components/history-page/history-toolbar/history-view-mode-toggle-button.tsx index c5e53b9fc..5714c36b3 100644 --- a/frontend/src/components/history-page/history-toolbar/history-view-mode-toggle-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/history-view-mode-toggle-button.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { ViewStateEnum } from './history-toolbar' +import { useHistoryToolbarState } from './toolbar-context/use-history-toolbar-state' import React, { useCallback } from 'react' import { Button, ToggleButtonGroup } from 'react-bootstrap' -import { cypressId } from '../../../utils/cypress-attribute' -import { ViewStateEnum } from './history-toolbar' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { useHistoryToolbarState } from './toolbar-context/use-history-toolbar-state' /** * Toggles the view mode of the history entries between list and card view. diff --git a/frontend/src/components/history-page/history-toolbar/hooks/use-safe-refresh-history-state.tsx b/frontend/src/components/history-page/history-toolbar/hooks/use-safe-refresh-history-state.tsx index 9372a31ba..129d59dd6 100644 --- a/frontend/src/components/history-page/history-toolbar/hooks/use-safe-refresh-history-state.tsx +++ b/frontend/src/components/history-page/history-toolbar/hooks/use-safe-refresh-history-state.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { refreshHistoryState } from '../../../../redux/history/methods' import { useUiNotifications } from '../../../notifications/ui-notification-boundary' import { useCallback } from 'react' -import { refreshHistoryState } from '../../../../redux/history/methods' /** * Tries to refresh the history from the backend and shows notification if that request fails. diff --git a/frontend/src/components/history-page/history-toolbar/import-history-button.tsx b/frontend/src/components/history-page/history-toolbar/import-history-button.tsx index 4d18d1510..bee1bfc63 100644 --- a/frontend/src/components/history-page/history-toolbar/import-history-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/import-history-button.tsx @@ -3,19 +3,18 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { HistoryEntryWithOrigin } from '../../../api/history/types' +import { HistoryEntryOrigin } from '../../../api/history/types' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { convertV1History, importHistoryEntries, mergeHistoryEntries } from '../../../redux/history/methods' +import type { HistoryExportJson, V1HistoryEntry } from '../../../redux/history/types' +import { cypressId } from '../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { useUiNotifications } from '../../notifications/ui-notification-boundary' +import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' import React, { useCallback, useRef, useState } from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import type { HistoryExportJson, V1HistoryEntry } from '../../../redux/history/types' -import { convertV1History, importHistoryEntries, mergeHistoryEntries } from '../../../redux/history/methods' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { cypressId } from '../../../utils/cypress-attribute' -import type { HistoryEntryWithOrigin } from '../../../api/history/types' -import { HistoryEntryOrigin } from '../../../api/history/types' -import { useUiNotifications } from '../../notifications/ui-notification-boundary' -import { useSafeRefreshHistoryStateCallback } from './hooks/use-safe-refresh-history-state' /** * Button that lets the user select a history JSON file and uploads imports that into the history. diff --git a/frontend/src/components/history-page/history-toolbar/keyword-search-input.tsx b/frontend/src/components/history-page/history-toolbar/keyword-search-input.tsx index 46cc287f3..af0cef20e 100644 --- a/frontend/src/components/history-page/history-toolbar/keyword-search-input.tsx +++ b/frontend/src/components/history-page/history-toolbar/keyword-search-input.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { useTranslation } from 'react-i18next' -import { FormControl } from 'react-bootstrap' import { useOnInputChange } from '../../../hooks/common/use-on-input-change' import { useHistoryToolbarState } from './toolbar-context/use-history-toolbar-state' +import React from 'react' +import { FormControl } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' /** * A text input that is used to filter history entries for specific keywords. diff --git a/frontend/src/components/history-page/history-toolbar/sort-by-last-visited-button.tsx b/frontend/src/components/history-page/history-toolbar/sort-by-last-visited-button.tsx index 54569e27d..b0654824b 100644 --- a/frontend/src/components/history-page/history-toolbar/sort-by-last-visited-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/sort-by-last-visited-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' import { SortButton, SortModeEnum } from '../sort-button/sort-button' -import { Trans, useTranslation } from 'react-i18next' import { useHistoryToolbarState } from './toolbar-context/use-history-toolbar-state' +import React, { useCallback } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Controls if history entries should be sorted by the last visited date. diff --git a/frontend/src/components/history-page/history-toolbar/sort-by-title-button.tsx b/frontend/src/components/history-page/history-toolbar/sort-by-title-button.tsx index c3eff3dfc..92d457d70 100644 --- a/frontend/src/components/history-page/history-toolbar/sort-by-title-button.tsx +++ b/frontend/src/components/history-page/history-toolbar/sort-by-title-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' import { SortButton, SortModeEnum } from '../sort-button/sort-button' -import { Trans, useTranslation } from 'react-i18next' import { useHistoryToolbarState } from './toolbar-context/use-history-toolbar-state' +import React, { useCallback } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Controls if history entries should be sorted by title. diff --git a/frontend/src/components/history-page/history-toolbar/tag-selection-input.tsx b/frontend/src/components/history-page/history-toolbar/tag-selection-input.tsx index 39a6ef878..00fa215fc 100644 --- a/frontend/src/components/history-page/history-toolbar/tag-selection-input.tsx +++ b/frontend/src/components/history-page/history-toolbar/tag-selection-input.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback, useMemo } from 'react' import { useApplicationState } from '../../../hooks/common/use-application-state' -import { useTranslation } from 'react-i18next' -import { Typeahead } from 'react-bootstrap-typeahead' import { useHistoryToolbarState } from './toolbar-context/use-history-toolbar-state' +import React, { useCallback, useMemo } from 'react' +import { Typeahead } from 'react-bootstrap-typeahead' import type { Option } from 'react-bootstrap-typeahead/types/types' +import { useTranslation } from 'react-i18next' /** * Renders an input field that filters history entries by selected tags. diff --git a/frontend/src/components/history-page/history-toolbar/toolbar-context/history-toolbar-state-context-provider.tsx b/frontend/src/components/history-page/history-toolbar/toolbar-context/history-toolbar-state-context-provider.tsx index d067f4d19..ad3d54073 100644 --- a/frontend/src/components/history-page/history-toolbar/toolbar-context/history-toolbar-state-context-provider.tsx +++ b/frontend/src/components/history-page/history-toolbar/toolbar-context/history-toolbar-state-context-provider.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React, { createContext, useState } from 'react' -import type { HistoryToolbarStateWithDispatcher } from './toolbar-context' +import { useArrayStringUrlParameter } from '../../../../hooks/common/use-array-string-url-parameter' +import { useSingleStringUrlParameter } from '../../../../hooks/common/use-single-string-url-parameter' import { SortModeEnum } from '../../sort-button/sort-button' import { ViewStateEnum } from '../history-toolbar' -import { useSingleStringUrlParameter } from '../../../../hooks/common/use-single-string-url-parameter' -import { useArrayStringUrlParameter } from '../../../../hooks/common/use-array-string-url-parameter' import type { HistoryToolbarState } from '../history-toolbar-state' +import type { HistoryToolbarStateWithDispatcher } from './toolbar-context' +import type { PropsWithChildren } from 'react' +import React, { createContext, useState } from 'react' export const historyToolbarStateContext = createContext(undefined) diff --git a/frontend/src/components/history-page/history-toolbar/toolbar-context/toolbar-context.d.ts b/frontend/src/components/history-page/history-toolbar/toolbar-context/toolbar-context.d.ts index af6feabb9..e63c0e27f 100644 --- a/frontend/src/components/history-page/history-toolbar/toolbar-context/toolbar-context.d.ts +++ b/frontend/src/components/history-page/history-toolbar/toolbar-context/toolbar-context.d.ts @@ -3,8 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { Dispatch, SetStateAction } from 'react' import type { HistoryToolbarState } from '../history-toolbar-state' +import type { Dispatch, SetStateAction } from 'react' export type HistoryToolbarStateWithDispatcher = [HistoryToolbarState, Dispatch>] diff --git a/frontend/src/components/history-page/history-toolbar/toolbar-context/use-history-toolbar-state.tsx b/frontend/src/components/history-page/history-toolbar/toolbar-context/use-history-toolbar-state.tsx index c667b9892..8764a8ac6 100644 --- a/frontend/src/components/history-page/history-toolbar/toolbar-context/use-history-toolbar-state.tsx +++ b/frontend/src/components/history-page/history-toolbar/toolbar-context/use-history-toolbar-state.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { historyToolbarStateContext } from './history-toolbar-state-context-provider' +import type { HistoryToolbarStateWithDispatcher } from './toolbar-context' import { Optional } from '@mrdrogdrog/optional' import { useContext } from 'react' -import type { HistoryToolbarStateWithDispatcher } from './toolbar-context' -import { historyToolbarStateContext } from './history-toolbar-state-context-provider' /** * Receives a {@link React.Context react context} for the history toolbar state. diff --git a/frontend/src/components/history-page/history-toolbar/toolbar-context/use-sync-toolbar-state-to-url-effect.ts b/frontend/src/components/history-page/history-toolbar/toolbar-context/use-sync-toolbar-state-to-url-effect.ts index ed5c78eeb..c65f66bc5 100644 --- a/frontend/src/components/history-page/history-toolbar/toolbar-context/use-sync-toolbar-state-to-url-effect.ts +++ b/frontend/src/components/history-page/history-toolbar/toolbar-context/use-sync-toolbar-state-to-url-effect.ts @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { useEffect } from 'react' +import { useArrayStringUrlParameter } from '../../../../hooks/common/use-array-string-url-parameter' +import { useSingleStringUrlParameter } from '../../../../hooks/common/use-single-string-url-parameter' +import { Logger } from '../../../../utils/logger' +import { useHistoryToolbarState } from './use-history-toolbar-state' import equal from 'fast-deep-equal' import { useRouter } from 'next/router' -import { Logger } from '../../../../utils/logger' -import { useSingleStringUrlParameter } from '../../../../hooks/common/use-single-string-url-parameter' -import { useArrayStringUrlParameter } from '../../../../hooks/common/use-array-string-url-parameter' -import { useHistoryToolbarState } from './use-history-toolbar-state' +import { useEffect } from 'react' const logger = new Logger('useSyncToolbarStateToUrl') diff --git a/frontend/src/components/history-page/pin-button/pin-button.tsx b/frontend/src/components/history-page/pin-button/pin-button.tsx index c99f8c396..8d27f7a79 100644 --- a/frontend/src/components/history-page/pin-button/pin-button.tsx +++ b/frontend/src/components/history-page/pin-button/pin-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Button } from 'react-bootstrap' +import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import styles from './pin-button.module.scss' -import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute' +import React from 'react' +import { Button } from 'react-bootstrap' export interface PinButtonProps { isPinned: boolean diff --git a/frontend/src/components/history-page/sort-button/sort-button.tsx b/frontend/src/components/history-page/sort-button/sort-button.tsx index c32c0b7af..bf94364c8 100644 --- a/frontend/src/components/history-page/sort-button/sort-button.tsx +++ b/frontend/src/components/history-page/sort-button/sort-button.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import type { ButtonProps } from 'react-bootstrap' import type { IconName } from '../../common/fork-awesome/types' import { IconButton } from '../../common/icon-button/icon-button' +import React from 'react' +import type { ButtonProps } from 'react-bootstrap' export enum SortModeEnum { up = 1, diff --git a/frontend/src/components/history-page/use-history-entry-title.ts b/frontend/src/components/history-page/use-history-entry-title.ts index 595b4c8b6..1a0a51652 100644 --- a/frontend/src/components/history-page/use-history-entry-title.ts +++ b/frontend/src/components/history-page/use-history-entry-title.ts @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import type { HistoryEntryWithOrigin } from '../../api/history/types' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import type { HistoryEntryWithOrigin } from '../../api/history/types' /** * Hook that returns the title of a note in the history if present or the translation for "untitled" otherwise. diff --git a/frontend/src/components/history-page/utils.ts b/frontend/src/components/history-page/utils.ts index 0248687de..4995b984f 100644 --- a/frontend/src/components/history-page/utils.ts +++ b/frontend/src/components/history-page/utils.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { DateTime } from 'luxon' -import { SortModeEnum } from './sort-button/sort-button' -import type { HistoryToolbarState } from './history-toolbar/history-toolbar-state' import type { HistoryEntryWithOrigin } from '../../api/history/types' +import type { HistoryToolbarState } from './history-toolbar/history-toolbar-state' +import { SortModeEnum } from './sort-button/sort-button' +import { DateTime } from 'luxon' /** * Parses a given ISO formatted date string and outputs it as a date and time string. diff --git a/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx b/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx index 3ee722e54..1bff49e88 100644 --- a/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx +++ b/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Button } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' import { useApplicationState } from '../../../hooks/common/use-application-state' +import { cypressId } from '../../../utils/cypress-attribute' import { ShowIf } from '../../common/show-if/show-if' import { SignInButton } from '../../landing-layout/navigation/sign-in-button' import './cover-buttons.module.scss' -import { cypressId } from '../../../utils/cypress-attribute' import Link from 'next/link' +import React from 'react' +import { Button } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' export const CoverButtons: React.FC = () => { useTranslation() diff --git a/frontend/src/components/intro-page/intro-custom-content.tsx b/frontend/src/components/intro-page/intro-custom-content.tsx index cc5fa3289..391934be7 100644 --- a/frontend/src/components/intro-page/intro-custom-content.tsx +++ b/frontend/src/components/intro-page/intro-custom-content.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useEffect } from 'react' +import { Logger } from '../../utils/logger' +import { AsyncLoadingBoundary } from '../common/async-loading-boundary' import { RenderIframe } from '../editor-page/renderer-pane/render-iframe' import { RendererType } from '../render-page/window-post-message-communicator/rendering-message' import { fetchFrontPageContent } from './requests' -import { Logger } from '../../utils/logger' +import React, { useEffect } from 'react' import { useAsync } from 'react-use' -import { AsyncLoadingBoundary } from '../common/async-loading-boundary' const logger = new Logger('Intro Content') diff --git a/frontend/src/components/intro-page/requests.ts b/frontend/src/components/intro-page/requests.ts index d518705ae..627be3c9a 100644 --- a/frontend/src/components/intro-page/requests.ts +++ b/frontend/src/components/intro-page/requests.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { defaultConfig } from '../../api/common/default-config' /** diff --git a/frontend/src/components/landing-layout/footer/footer.tsx b/frontend/src/components/landing-layout/footer/footer.tsx index 671c60c35..a30c97191 100644 --- a/frontend/src/components/landing-layout/footer/footer.tsx +++ b/frontend/src/components/landing-layout/footer/footer.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import { PoweredByLinks } from './powered-by-links' import { SocialLink } from './social-links' +import React from 'react' /** * Renders the footer. diff --git a/frontend/src/components/landing-layout/footer/powered-by-links.tsx b/frontend/src/components/landing-layout/footer/powered-by-links.tsx index baf39f1a4..2f72545b5 100644 --- a/frontend/src/components/landing-layout/footer/powered-by-links.tsx +++ b/frontend/src/components/landing-layout/footer/powered-by-links.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Trans, useTranslation } from 'react-i18next' +import { useApplicationState } from '../../../hooks/common/use-application-state' import links from '../../../links.json' import { ExternalLink } from '../../common/links/external-link' import { TranslatedExternalLink } from '../../common/links/translated-external-link' import { TranslatedInternalLink } from '../../common/links/translated-internal-link' import { VersionInfoLink } from './version-info/version-info-link' -import { useApplicationState } from '../../../hooks/common/use-application-state' +import React, { Fragment } from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a powered-by link. diff --git a/frontend/src/components/landing-layout/footer/social-links.tsx b/frontend/src/components/landing-layout/footer/social-links.tsx index 18bcbeb80..fa6f8134d 100644 --- a/frontend/src/components/landing-layout/footer/social-links.tsx +++ b/frontend/src/components/landing-layout/footer/social-links.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { Trans, useTranslation } from 'react-i18next' import links from '../../../links.json' import { ExternalLink } from '../../common/links/external-link' +import React from 'react' +import { Trans, useTranslation } from 'react-i18next' /** * Renders links to the social networks. diff --git a/frontend/src/components/landing-layout/footer/version-info/version-info-link.tsx b/frontend/src/components/landing-layout/footer/version-info/version-info-link.tsx index 01fb06d13..a95217f11 100644 --- a/frontend/src/components/landing-layout/footer/version-info/version-info-link.tsx +++ b/frontend/src/components/landing-layout/footer/version-info/version-info-link.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Trans } from 'react-i18next' -import { VersionInfoModal } from './version-info-modal' -import { cypressId } from '../../../../utils/cypress-attribute' import { useBooleanState } from '../../../../hooks/common/use-boolean-state' +import { cypressId } from '../../../../utils/cypress-attribute' +import { VersionInfoModal } from './version-info-modal' +import React, { Fragment } from 'react' import { Button } from 'react-bootstrap' +import { Trans } from 'react-i18next' /** * Renders a link for the version info and the {@link VersionInfoModal}. diff --git a/frontend/src/components/landing-layout/footer/version-info/version-info-modal-column.tsx b/frontend/src/components/landing-layout/footer/version-info/version-info-modal-column.tsx index 6783a4562..8aa8cdd65 100644 --- a/frontend/src/components/landing-layout/footer/version-info/version-info-modal-column.tsx +++ b/frontend/src/components/landing-layout/footer/version-info/version-info-modal-column.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import { CopyableField } from '../../../common/copyable/copyable-field/copyable-field' import { TranslatedExternalLink } from '../../../common/links/translated-external-link' import { ShowIf } from '../../../common/show-if/show-if' -import { Trans, useTranslation } from 'react-i18next' +import React from 'react' import { Col } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' export interface VersionInfoModalColumnProps { titleI18nKey: string diff --git a/frontend/src/components/landing-layout/footer/version-info/version-info-modal.tsx b/frontend/src/components/landing-layout/footer/version-info/version-info-modal.tsx index 4f0ee466e..c1cae94a8 100644 --- a/frontend/src/components/landing-layout/footer/version-info/version-info-modal.tsx +++ b/frontend/src/components/landing-layout/footer/version-info/version-info-modal.tsx @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import type { CommonModalProps } from '../../../common/modals/common-modal' -import { CommonModal } from '../../../common/modals/common-modal' -import { Modal, Row } from 'react-bootstrap' -import { VersionInfoModalColumn } from './version-info-modal-column' -import frontendVersion from '../../../../version.json' -import links from '../../../../links.json' import type { BackendVersion } from '../../../../api/config/types' import { useApplicationState } from '../../../../hooks/common/use-application-state' +import links from '../../../../links.json' import { cypressId } from '../../../../utils/cypress-attribute' +import frontendVersion from '../../../../version.json' +import type { CommonModalProps } from '../../../common/modals/common-modal' +import { CommonModal } from '../../../common/modals/common-modal' +import { VersionInfoModalColumn } from './version-info-modal-column' +import React, { useMemo } from 'react' +import { Modal, Row } from 'react-bootstrap' /** * Renders a modal with the version information. diff --git a/frontend/src/components/landing-layout/landing-layout.tsx b/frontend/src/components/landing-layout/landing-layout.tsx index 5e52ce4ac..42eeacd34 100644 --- a/frontend/src/components/landing-layout/landing-layout.tsx +++ b/frontend/src/components/landing-layout/landing-layout.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React, { Fragment } from 'react' -import { Container } from 'react-bootstrap' import { MotdModal } from '../common/motd-modal/motd-modal' import { Footer } from './footer/footer' import { HeaderBar } from './navigation/header-bar/header-bar' +import type { PropsWithChildren } from 'react' +import React, { Fragment } from 'react' +import { Container } from 'react-bootstrap' /** * Renders the layout for both intro and history page. diff --git a/frontend/src/components/landing-layout/navigation/header-bar/header-bar.tsx b/frontend/src/components/landing-layout/navigation/header-bar/header-bar.tsx index 0849558cd..6e04abbdf 100644 --- a/frontend/src/components/landing-layout/navigation/header-bar/header-bar.tsx +++ b/frontend/src/components/landing-layout/navigation/header-bar/header-bar.tsx @@ -3,18 +3,17 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' -import { Navbar } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { HeaderNavLink } from './header-nav-link' +import { cypressId } from '../../../../utils/cypress-attribute' +import { SettingsButton } from '../../../layout/settings-dialog/settings-button' import { NewGuestNoteButton } from '../new-guest-note-button' import { NewUserNoteButton } from '../new-user-note-button' import { SignInButton } from '../sign-in-button' import { UserDropdown } from '../user-dropdown' -import { cypressId } from '../../../../utils/cypress-attribute' -import { SettingsButton } from '../../../layout/settings-dialog/settings-button' +import { HeaderNavLink } from './header-nav-link' +import React, { Fragment } from 'react' +import { Navbar } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a header bar for the intro and history page. diff --git a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx b/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx index 7eb53f625..aa9a45395 100644 --- a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx +++ b/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import Link from 'next/link' -import type { PropsWithChildren } from 'react' -import React, { useMemo } from 'react' -import { Nav } from 'react-bootstrap' import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute' import { cypressId } from '../../../../utils/cypress-attribute' import styles from './header-nav-link.module.scss' +import Link from 'next/link' import { useRouter } from 'next/router' +import type { PropsWithChildren } from 'react' +import React, { useMemo } from 'react' +import { Nav } from 'react-bootstrap' export interface HeaderNavLinkProps extends PropsWithDataCypressId { to: string diff --git a/frontend/src/components/landing-layout/navigation/new-guest-note-button.tsx b/frontend/src/components/landing-layout/navigation/new-guest-note-button.tsx index b00f189c9..7046ec221 100644 --- a/frontend/src/components/landing-layout/navigation/new-guest-note-button.tsx +++ b/frontend/src/components/landing-layout/navigation/new-guest-note-button.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import Link from 'next/link' import React from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { cypressId } from '../../../utils/cypress-attribute' -import Link from 'next/link' /** * Renders a button to create a new note as a guest. diff --git a/frontend/src/components/landing-layout/navigation/new-user-note-button.tsx b/frontend/src/components/landing-layout/navigation/new-user-note-button.tsx index 72bbbfabb..aaf75085f 100644 --- a/frontend/src/components/landing-layout/navigation/new-user-note-button.tsx +++ b/frontend/src/components/landing-layout/navigation/new-user-note-button.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import Link from 'next/link' import React from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { cypressId } from '../../../utils/cypress-attribute' -import Link from 'next/link' /** * Renders a button to create a new note as a logged in user. diff --git a/frontend/src/components/landing-layout/navigation/sign-in-button.tsx b/frontend/src/components/landing-layout/navigation/sign-in-button.tsx index 0513eaa6c..1f943ed36 100644 --- a/frontend/src/components/landing-layout/navigation/sign-in-button.tsx +++ b/frontend/src/components/landing-layout/navigation/sign-in-button.tsx @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { cypressId } from '../../../utils/cypress-attribute' +import { ShowIf } from '../../common/show-if/show-if' +import { filterOneClickProviders } from '../../login-page/auth/utils' +import { getOneClickProviderMetadata } from '../../login-page/auth/utils/get-one-click-provider-metadata' +import Link from 'next/link' import React, { useMemo } from 'react' import { Button } from 'react-bootstrap' import type { ButtonProps } from 'react-bootstrap/Button' import { Trans, useTranslation } from 'react-i18next' -import { ShowIf } from '../../common/show-if/show-if' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { cypressId } from '../../../utils/cypress-attribute' -import Link from 'next/link' -import { filterOneClickProviders } from '../../login-page/auth/utils' -import { getOneClickProviderMetadata } from '../../login-page/auth/utils/get-one-click-provider-metadata' export type SignInButtonProps = Omit diff --git a/frontend/src/components/landing-layout/navigation/sign-out-dropdown-button.tsx b/frontend/src/components/landing-layout/navigation/sign-out-dropdown-button.tsx index 2d833ef7a..b5dd9b961 100644 --- a/frontend/src/components/landing-layout/navigation/sign-out-dropdown-button.tsx +++ b/frontend/src/components/landing-layout/navigation/sign-out-dropdown-button.tsx @@ -3,15 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' +import { doLogout } from '../../../api/auth' import { clearUser } from '../../../redux/user/methods' import { cypressId } from '../../../utils/cypress-attribute' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { Trans, useTranslation } from 'react-i18next' -import { Dropdown } from 'react-bootstrap' -import { doLogout } from '../../../api/auth' import { useUiNotifications } from '../../notifications/ui-notification-boundary' +import React, { useCallback } from 'react' +import { Dropdown } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' /** * Renders a sign-out button as a dropdown item for the user-dropdown. diff --git a/frontend/src/components/landing-layout/navigation/user-dropdown.tsx b/frontend/src/components/landing-layout/navigation/user-dropdown.tsx index a04930005..3c00f9252 100644 --- a/frontend/src/components/landing-layout/navigation/user-dropdown.tsx +++ b/frontend/src/components/landing-layout/navigation/user-dropdown.tsx @@ -3,16 +3,15 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { cypressId } from '../../../utils/cypress-attribute' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { UserAvatar } from '../../common/user-avatar/user-avatar' +import { SignOutDropdownButton } from './sign-out-dropdown-button' +import Link from 'next/link' import React from 'react' import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { UserAvatar } from '../../common/user-avatar/user-avatar' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { cypressId } from '../../../utils/cypress-attribute' -import { SignOutDropdownButton } from './sign-out-dropdown-button' -import Link from 'next/link' /** * Renders a dropdown menu with user-relevant actions. diff --git a/frontend/src/components/layout/base-head.tsx b/frontend/src/components/layout/base-head.tsx index b7ce7ed94..59f2e9f89 100644 --- a/frontend/src/components/layout/base-head.tsx +++ b/frontend/src/components/layout/base-head.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import Head from 'next/head' import { useAppTitle } from '../../hooks/common/use-app-title' -import { FavIcon } from './fav-icon' import { useBaseUrl } from '../../hooks/common/use-base-url' +import { FavIcon } from './fav-icon' +import Head from 'next/head' +import React from 'react' /** * Sets basic browser meta tags. diff --git a/frontend/src/components/layout/fav-icon.tsx b/frontend/src/components/layout/fav-icon.tsx index ef39709a1..2128e0a2d 100644 --- a/frontend/src/components/layout/fav-icon.tsx +++ b/frontend/src/components/layout/fav-icon.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import React, { Fragment } from 'react' /** diff --git a/frontend/src/components/layout/note-and-app-title-head.tsx b/frontend/src/components/layout/note-and-app-title-head.tsx index 5dee63694..ca290b9aa 100644 --- a/frontend/src/components/layout/note-and-app-title-head.tsx +++ b/frontend/src/components/layout/note-and-app-title-head.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { useAppTitle } from '../../hooks/common/use-app-title' +import { useNoteTitle } from '../../hooks/common/use-note-title' import Head from 'next/head' import React, { useMemo } from 'react' -import { useNoteTitle } from '../../hooks/common/use-note-title' -import { useAppTitle } from '../../hooks/common/use-app-title' /** * Sets the note and app title for the browser window diff --git a/frontend/src/components/layout/settings-dialog/editor/editor-settings-tab-content.tsx b/frontend/src/components/layout/settings-dialog/editor/editor-settings-tab-content.tsx index cf67cb21f..6da42bb60 100644 --- a/frontend/src/components/layout/settings-dialog/editor/editor-settings-tab-content.tsx +++ b/frontend/src/components/layout/settings-dialog/editor/editor-settings-tab-content.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { ListGroup } from 'react-bootstrap' -import { useTranslation } from 'react-i18next' import { SettingLine } from '../utils/setting-line' import { LigatureSettingButtonGroup } from './ligature-setting-button-group' import { SmartPasteSettingButtonGroup } from './smart-paste-setting-button-group' import { SyncScrollSettingButtonGroup } from './sync-scroll-setting-button-group' +import React from 'react' +import { ListGroup } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' /** * Shows the editor specific settings. diff --git a/frontend/src/components/layout/settings-dialog/editor/ligature-setting-button-group.tsx b/frontend/src/components/layout/settings-dialog/editor/ligature-setting-button-group.tsx index b58143df5..f5dd4ad28 100644 --- a/frontend/src/components/layout/settings-dialog/editor/ligature-setting-button-group.tsx +++ b/frontend/src/components/layout/settings-dialog/editor/ligature-setting-button-group.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { OnOffButtonGroup } from '../utils/on-off-button-group' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setEditorLigatures } from '../../../../redux/editor/methods' +import { OnOffButtonGroup } from '../utils/on-off-button-group' +import React from 'react' /** * Allows to change if ligatures should be used or not in the editor. diff --git a/frontend/src/components/layout/settings-dialog/editor/smart-paste-setting-button-group.tsx b/frontend/src/components/layout/settings-dialog/editor/smart-paste-setting-button-group.tsx index e6f248181..cb0ad8779 100644 --- a/frontend/src/components/layout/settings-dialog/editor/smart-paste-setting-button-group.tsx +++ b/frontend/src/components/layout/settings-dialog/editor/smart-paste-setting-button-group.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { OnOffButtonGroup } from '../utils/on-off-button-group' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setEditorSmartPaste } from '../../../../redux/editor/methods' +import { OnOffButtonGroup } from '../utils/on-off-button-group' +import React from 'react' /** * Allows to change if smart paste should be used in the editor. diff --git a/frontend/src/components/layout/settings-dialog/editor/sync-scroll-setting-button-group.tsx b/frontend/src/components/layout/settings-dialog/editor/sync-scroll-setting-button-group.tsx index b615c6651..c2ac75db5 100644 --- a/frontend/src/components/layout/settings-dialog/editor/sync-scroll-setting-button-group.tsx +++ b/frontend/src/components/layout/settings-dialog/editor/sync-scroll-setting-button-group.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { OnOffButtonGroup } from '../utils/on-off-button-group' import { useApplicationState } from '../../../../hooks/common/use-application-state' import { setEditorSyncScroll } from '../../../../redux/editor/methods' +import { OnOffButtonGroup } from '../utils/on-off-button-group' +import React from 'react' /** * Allows to change if editor and rendering should scroll in sync. diff --git a/frontend/src/components/layout/settings-dialog/global/dark-mode-setting-button-group.tsx b/frontend/src/components/layout/settings-dialog/global/dark-mode-setting-button-group.tsx index fa7721fa4..22f0e7fc8 100644 --- a/frontend/src/components/layout/settings-dialog/global/dark-mode-setting-button-group.tsx +++ b/frontend/src/components/layout/settings-dialog/global/dark-mode-setting-button-group.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useCallback } from 'react' -import { ToggleButtonGroup } from 'react-bootstrap' import { useApplicationState } from '../../../../hooks/common/use-application-state' -import { SettingsToggleButton } from '../utils/settings-toggle-button' import { setDarkModePreference } from '../../../../redux/dark-mode/methods' import { DarkModePreference } from '../../../../redux/dark-mode/types' +import { SettingsToggleButton } from '../utils/settings-toggle-button' +import React, { useCallback } from 'react' +import { ToggleButtonGroup } from 'react-bootstrap' /** * Allows to change if the app should enforce dark mode, light mode or let the browser decide. diff --git a/frontend/src/components/layout/settings-dialog/global/global-settings-tab-content.tsx b/frontend/src/components/layout/settings-dialog/global/global-settings-tab-content.tsx index 5060c3455..6466fba4c 100644 --- a/frontend/src/components/layout/settings-dialog/global/global-settings-tab-content.tsx +++ b/frontend/src/components/layout/settings-dialog/global/global-settings-tab-content.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' -import { DarkModeSettingButtonGroup } from './dark-mode-setting-button-group' -import { ListGroup } from 'react-bootstrap' -import { LanguagePicker } from './language-picker' import { SettingLine } from '../utils/setting-line' +import { DarkModeSettingButtonGroup } from './dark-mode-setting-button-group' +import { LanguagePicker } from './language-picker' +import React from 'react' +import { ListGroup } from 'react-bootstrap' /** * Contains global settings that influence every page of the app. diff --git a/frontend/src/components/layout/settings-dialog/global/language-picker.tsx b/frontend/src/components/layout/settings-dialog/global/language-picker.tsx index 9b07988d8..fae07707a 100644 --- a/frontend/src/components/layout/settings-dialog/global/language-picker.tsx +++ b/frontend/src/components/layout/settings-dialog/global/language-picker.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { cypressId } from '../../../../utils/cypress-attribute' +import { Logger } from '../../../../utils/logger' import { Settings } from 'luxon' import React, { useCallback, useMemo } from 'react' import { Form } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { Logger } from '../../../../utils/logger' -import { cypressId } from '../../../../utils/cypress-attribute' const log = new Logger('LanguagePicker') const languages = { diff --git a/frontend/src/components/layout/settings-dialog/settings-button.tsx b/frontend/src/components/layout/settings-dialog/settings-button.tsx index f7d17e9cc..7fda07b73 100644 --- a/frontend/src/components/layout/settings-dialog/settings-button.tsx +++ b/frontend/src/components/layout/settings-dialog/settings-button.tsx @@ -3,13 +3,12 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { Fragment } from 'react' import { useBooleanState } from '../../../hooks/common/use-boolean-state' +import { cypressId } from '../../../utils/cypress-attribute' import { IconButton } from '../../common/icon-button/icon-button' import { SettingsModal } from './settings-modal' +import React, { Fragment } from 'react' import type { ButtonProps } from 'react-bootstrap' -import { cypressId } from '../../../utils/cypress-attribute' export type SettingsButtonProps = Omit /** diff --git a/frontend/src/components/layout/settings-dialog/settings-modal.tsx b/frontend/src/components/layout/settings-dialog/settings-modal.tsx index 3a5ef6d2d..12f15ab9b 100644 --- a/frontend/src/components/layout/settings-dialog/settings-modal.tsx +++ b/frontend/src/components/layout/settings-dialog/settings-modal.tsx @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import type { CommonModalProps } from '../../common/modals/common-modal' import { CommonModal } from '../../common/modals/common-modal' -import { Modal, Tab, Tabs } from 'react-bootstrap' -import { t } from 'i18next' -import { GlobalSettingsTabContent } from './global/global-settings-tab-content' import { EditorSettingsTabContent } from './editor/editor-settings-tab-content' +import { GlobalSettingsTabContent } from './global/global-settings-tab-content' +import { t } from 'i18next' +import React from 'react' +import { Modal, Tab, Tabs } from 'react-bootstrap' /** * Shows global and scope specific settings diff --git a/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.test.tsx b/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.test.tsx index 24ce6897c..ae9d7c2e9 100644 --- a/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.test.tsx +++ b/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.test.tsx @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { act, render, screen } from '@testing-library/react' -import { OnOffButtonGroup } from './on-off-button-group' import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n' +import { OnOffButtonGroup } from './on-off-button-group' +import { act, render, screen } from '@testing-library/react' describe('Settings On-Off Button Group', () => { beforeAll(mockI18n) diff --git a/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.tsx b/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.tsx index 5b04c8bba..3ff74d5a6 100644 --- a/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.tsx +++ b/frontend/src/components/layout/settings-dialog/utils/on-off-button-group.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { testId } from '../../../../utils/test-id' +import { SettingsToggleButton } from './settings-toggle-button' import React, { useCallback, useMemo } from 'react' import { ToggleButtonGroup } from 'react-bootstrap' -import { SettingsToggleButton } from './settings-toggle-button' -import { testId } from '../../../../utils/test-id' enum OnOffState { ON, diff --git a/frontend/src/components/layout/settings-dialog/utils/setting-line.tsx b/frontend/src/components/layout/settings-dialog/utils/setting-line.tsx index 8fb2abf01..947898c06 100644 --- a/frontend/src/components/layout/settings-dialog/utils/setting-line.tsx +++ b/frontend/src/components/layout/settings-dialog/utils/setting-line.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { PropsWithChildren } from 'react' import React from 'react' import { Col, ListGroup, Row } from 'react-bootstrap' diff --git a/frontend/src/components/layout/settings-dialog/utils/settings-toggle-button.tsx b/frontend/src/components/layout/settings-dialog/utils/settings-toggle-button.tsx index d005560a9..074a9bc31 100644 --- a/frontend/src/components/layout/settings-dialog/utils/settings-toggle-button.tsx +++ b/frontend/src/components/layout/settings-dialog/utils/settings-toggle-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import type { PropsWithDataTestId } from '../../../../utils/test-id' import React, { useCallback, useMemo } from 'react' import type { ButtonProps } from 'react-bootstrap' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import type { PropsWithDataTestId } from '../../../../utils/test-id' type DarkModeToggleButtonProps = Omit & PropsWithDataTestId & { diff --git a/frontend/src/components/login-page/auth/auth-error/auth-error.tsx b/frontend/src/components/login-page/auth/auth-error/auth-error.tsx index d7c4525de..deac11245 100644 --- a/frontend/src/components/login-page/auth/auth-error/auth-error.tsx +++ b/frontend/src/components/login-page/auth/auth-error/auth-error.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' import { AuthError as AuthErrorType } from '../../../../api/auth/types' -import { Trans, useTranslation } from 'react-i18next' +import React, { useMemo } from 'react' import { Alert } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' export interface AuthErrorProps { error?: AuthErrorType diff --git a/frontend/src/components/login-page/auth/fields/fields.ts b/frontend/src/components/login-page/auth/fields/fields.ts index 5bd9892e0..26707be5a 100644 --- a/frontend/src/components/login-page/auth/fields/fields.ts +++ b/frontend/src/components/login-page/auth/fields/fields.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { ChangeEvent } from 'react' export interface AuthFieldProps { diff --git a/frontend/src/components/login-page/auth/fields/password-field.tsx b/frontend/src/components/login-page/auth/fields/password-field.tsx index a6662754d..663daba62 100644 --- a/frontend/src/components/login-page/auth/fields/password-field.tsx +++ b/frontend/src/components/login-page/auth/fields/password-field.tsx @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import type { AuthFieldProps } from './fields' +import React from 'react' import { Form } from 'react-bootstrap' import { useTranslation } from 'react-i18next' diff --git a/frontend/src/components/login-page/auth/fields/username-field.tsx b/frontend/src/components/login-page/auth/fields/username-field.tsx index d8241ee8a..fb33c1c85 100644 --- a/frontend/src/components/login-page/auth/fields/username-field.tsx +++ b/frontend/src/components/login-page/auth/fields/username-field.tsx @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import type { AuthFieldProps } from './fields' +import React from 'react' import { Form } from 'react-bootstrap' import { useTranslation } from 'react-i18next' diff --git a/frontend/src/components/login-page/auth/social-link-button/social-link-button.tsx b/frontend/src/components/login-page/auth/social-link-button/social-link-button.tsx index 34f7fe069..3204f92a6 100644 --- a/frontend/src/components/login-page/auth/social-link-button/social-link-button.tsx +++ b/frontend/src/components/login-page/auth/social-link-button/social-link-button.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type { PropsWithChildren } from 'react' -import React from 'react' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import type { IconName } from '../../../common/fork-awesome/types' import styles from './social-link-button.module.scss' +import type { PropsWithChildren } from 'react' +import React from 'react' export interface SocialButtonProps { backgroundClass: string diff --git a/frontend/src/components/login-page/auth/utils.ts b/frontend/src/components/login-page/auth/utils.ts index ed7844ca6..14acb8c9b 100644 --- a/frontend/src/components/login-page/auth/utils.ts +++ b/frontend/src/components/login-page/auth/utils.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { getMe } from '../../../api/me' -import { setUser } from '../../../redux/user/methods' import type { AuthProvider } from '../../../api/config/types' import { authProviderTypeOneClick } from '../../../api/config/types' +import { getMe } from '../../../api/me' +import { setUser } from '../../../redux/user/methods' /** * Fetches metadata about the currently signed-in user from the API and stores it into the redux. diff --git a/frontend/src/components/login-page/auth/utils/get-one-click-provider-metadata.ts b/frontend/src/components/login-page/auth/utils/get-one-click-provider-metadata.ts index 266e30aec..92f53ee61 100644 --- a/frontend/src/components/login-page/auth/utils/get-one-click-provider-metadata.ts +++ b/frontend/src/components/login-page/auth/utils/get-one-click-provider-metadata.ts @@ -5,9 +5,9 @@ */ import type { AuthProvider } from '../../../../api/config/types' import { AuthProviderType } from '../../../../api/config/types' +import { Logger } from '../../../../utils/logger' import type { IconName } from '../../../common/fork-awesome/types' import styles from '../via-one-click.module.scss' -import { Logger } from '../../../../utils/logger' export interface OneClickMetadata { name: string diff --git a/frontend/src/components/login-page/auth/via-ldap.tsx b/frontend/src/components/login-page/auth/via-ldap.tsx index f3de071d5..ca5feef4e 100644 --- a/frontend/src/components/login-page/auth/via-ldap.tsx +++ b/frontend/src/components/login-page/auth/via-ldap.tsx @@ -3,19 +3,17 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { doLdapLogin } from '../../../api/auth/ldap' +import { AuthError as AuthErrorType } from '../../../api/auth/types' +import { useOnInputChange } from '../../../hooks/common/use-on-input-change' +import { AuthError } from './auth-error/auth-error' +import { PasswordField } from './fields/password-field' +import { UsernameField } from './fields/username-field' +import { fetchAndSetUser } from './utils' import type { FormEvent } from 'react' import React, { useCallback, useState } from 'react' import { Button, Card, Form } from 'react-bootstrap' - import { Trans, useTranslation } from 'react-i18next' -import { doLdapLogin } from '../../../api/auth/ldap' -import { fetchAndSetUser } from './utils' -import { AuthError as AuthErrorType } from '../../../api/auth/types' -import { UsernameField } from './fields/username-field' -import { PasswordField } from './fields/password-field' -import { AuthError } from './auth-error/auth-error' -import { useOnInputChange } from '../../../hooks/common/use-on-input-change' export interface ViaLdapProps { providerName: string diff --git a/frontend/src/components/login-page/auth/via-local.tsx b/frontend/src/components/login-page/auth/via-local.tsx index e9ba5b699..50478899f 100644 --- a/frontend/src/components/login-page/auth/via-local.tsx +++ b/frontend/src/components/login-page/auth/via-local.tsx @@ -3,21 +3,20 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { doLocalLogin } from '../../../api/auth/local' +import { AuthError as AuthErrorType } from '../../../api/auth/types' +import { useApplicationState } from '../../../hooks/common/use-application-state' +import { useOnInputChange } from '../../../hooks/common/use-on-input-change' +import { ShowIf } from '../../common/show-if/show-if' +import { AuthError } from './auth-error/auth-error' +import { PasswordField } from './fields/password-field' +import { UsernameField } from './fields/username-field' +import { fetchAndSetUser } from './utils' +import Link from 'next/link' import type { FormEvent } from 'react' import React, { useCallback, useState } from 'react' import { Button, Card, Form } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { doLocalLogin } from '../../../api/auth/local' -import { ShowIf } from '../../common/show-if/show-if' -import { fetchAndSetUser } from './utils' -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { AuthError as AuthErrorType } from '../../../api/auth/types' -import { UsernameField } from './fields/username-field' -import { PasswordField } from './fields/password-field' -import { AuthError } from './auth-error/auth-error' -import Link from 'next/link' -import { useOnInputChange } from '../../../hooks/common/use-on-input-change' /** * Renders the local login box with username and password field and the optional button for registering a new user. diff --git a/frontend/src/components/login-page/auth/via-one-click.tsx b/frontend/src/components/login-page/auth/via-one-click.tsx index ed3a54754..203110e6c 100644 --- a/frontend/src/components/login-page/auth/via-one-click.tsx +++ b/frontend/src/components/login-page/auth/via-one-click.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useMemo } from 'react' -import { SocialLinkButton } from './social-link-button/social-link-button' import type { AuthProvider, AuthProviderWithCustomName } from '../../../api/config/types' +import { SocialLinkButton } from './social-link-button/social-link-button' import { getOneClickProviderMetadata } from './utils/get-one-click-provider-metadata' +import React, { useMemo } from 'react' export interface ViaOneClickProps { provider: AuthProvider diff --git a/frontend/src/components/markdown-renderer/common-markdown-renderer-props.ts b/frontend/src/components/markdown-renderer/common-markdown-renderer-props.ts index 84f25ba23..8dbe707d2 100644 --- a/frontend/src/components/markdown-renderer/common-markdown-renderer-props.ts +++ b/frontend/src/components/markdown-renderer/common-markdown-renderer-props.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import type { Ref } from 'react' export interface CommonMarkdownRendererProps { diff --git a/frontend/src/components/markdown-renderer/document-markdown-renderer.tsx b/frontend/src/components/markdown-renderer/document-markdown-renderer.tsx index da54f047c..cff07a872 100644 --- a/frontend/src/components/markdown-renderer/document-markdown-renderer.tsx +++ b/frontend/src/components/markdown-renderer/document-markdown-renderer.tsx @@ -3,18 +3,17 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React, { useEffect, useMemo, useRef } from 'react' -import { useConvertMarkdownToReactDom } from './hooks/use-convert-markdown-to-react-dom' -import { useTranslation } from 'react-i18next' -import { useCalculateLineMarkerPosition } from './utils/calculate-line-marker-positions' -import { useExtractFirstHeadline } from './hooks/use-extract-first-headline' -import type { CommonMarkdownRendererProps } from './common-markdown-renderer-props' -import { useMarkdownExtensions } from './hooks/use-markdown-extensions' import { cypressId } from '../../utils/cypress-attribute' +import type { CommonMarkdownRendererProps } from './common-markdown-renderer-props' import { HeadlineAnchorsMarkdownExtension } from './extensions/headline-anchors-markdown-extension' -import type { LineMarkerPosition } from './extensions/linemarker/types' import type { LineMarkers } from './extensions/linemarker/add-line-marker-markdown-it-plugin' +import type { LineMarkerPosition } from './extensions/linemarker/types' +import { useConvertMarkdownToReactDom } from './hooks/use-convert-markdown-to-react-dom' +import { useExtractFirstHeadline } from './hooks/use-extract-first-headline' +import { useMarkdownExtensions } from './hooks/use-markdown-extensions' +import { useCalculateLineMarkerPosition } from './utils/calculate-line-marker-positions' +import React, { useEffect, useMemo, useRef } from 'react' +import { useTranslation } from 'react-i18next' export interface DocumentMarkdownRendererProps extends CommonMarkdownRendererProps { onLineMarkerPositionChanged?: (lineMarkerPosition: LineMarkerPosition[]) => void diff --git a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-plugin.ts b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-plugin.ts index b13b5e694..b68afcd11 100644 --- a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-plugin.ts +++ b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-plugin.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { parseCodeBlockParameters } from './code-block-parameters' +import { Optional } from '@mrdrogdrog/optional' import type MarkdownIt from 'markdown-it' import type { RuleCore } from 'markdown-it/lib/parser_core' -import { Optional } from '@mrdrogdrog/optional' -import { parseCodeBlockParameters } from './code-block-parameters' const ruleName = 'code-highlighter' diff --git a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-renderer-extension.ts b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-renderer-extension.ts index a3e4b9788..88cc1eddb 100644 --- a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-renderer-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-renderer-extension.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type MarkdownIt from 'markdown-it' -import { codeBlockMarkdownPlugin } from './code-block-markdown-plugin' import type { ComponentReplacer } from '../../../replace-components/component-replacer' import { MarkdownRendererExtension } from '../markdown-renderer-extension' +import { codeBlockMarkdownPlugin } from './code-block-markdown-plugin' +import type MarkdownIt from 'markdown-it' /** * A {@link MarkdownRendererExtension markdown extension} that is used for code fence replacements. diff --git a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-parameters.test.ts b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-parameters.test.ts index d0b39dc63..d34f9b5f6 100644 --- a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-parameters.test.ts +++ b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-parameters.test.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { parseCodeBlockParameters } from './code-block-parameters' describe('Code block parameter parsing', () => { diff --git a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.test.ts b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.test.ts index 7fc277380..1f7c262d0 100644 --- a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.test.ts +++ b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.test.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { findLanguageByCodeBlockName } from './find-language-by-code-block-name' -import { Mock } from 'ts-mockery' import type { LanguageDescription } from '@codemirror/language' +import { Mock } from 'ts-mockery' describe('filter language name', () => { const mockedLanguage1 = Mock.of({ name: 'Mocky', alias: ['mocky'] }) diff --git a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.ts b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.ts index 28501776a..46655bf32 100644 --- a/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.ts +++ b/frontend/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name.ts @@ -3,10 +3,9 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { Optional } from '@mrdrogdrog/optional' -import type { LanguageDescription } from '@codemirror/language' import { parseCodeBlockParameters } from './code-block-parameters' +import type { LanguageDescription } from '@codemirror/language' +import { Optional } from '@mrdrogdrog/optional' /** * Finds the {@link LanguageDescription code mirror language descriptions} that matches the given language name or any alias. diff --git a/frontend/src/components/markdown-renderer/extensions/base/markdown-renderer-extension.ts b/frontend/src/components/markdown-renderer/extensions/base/markdown-renderer-extension.ts index 6c9b2e6f8..5c29c4958 100644 --- a/frontend/src/components/markdown-renderer/extensions/base/markdown-renderer-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/base/markdown-renderer-extension.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import type EventEmitter2 from 'eventemitter2' -import type MarkdownIt from 'markdown-it' import type { NodeProcessor } from '../../node-preprocessors/node-processor' import type { ComponentReplacer } from '../../replace-components/component-replacer' +import type EventEmitter2 from 'eventemitter2' +import type MarkdownIt from 'markdown-it' /** * Base class for Markdown extensions. diff --git a/frontend/src/components/markdown-renderer/extensions/debugger-markdown-extension.ts b/frontend/src/components/markdown-renderer/extensions/debugger-markdown-extension.ts index 37c2a5639..e498fa3c1 100644 --- a/frontend/src/components/markdown-renderer/extensions/debugger-markdown-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/debugger-markdown-extension.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { MarkdownRendererExtension } from './base/markdown-renderer-extension' -import type MarkdownIt from 'markdown-it' import { Logger } from '../../../utils/logger' import { isDevMode } from '../../../utils/test-modes' +import { MarkdownRendererExtension } from './base/markdown-renderer-extension' +import type MarkdownIt from 'markdown-it' const log = new Logger('DebuggerMarkdownExtension') diff --git a/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.test.tsx b/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.test.tsx index 9b80f57c7..fcedfc162 100644 --- a/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.test.tsx +++ b/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.test.tsx @@ -3,12 +3,11 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import React from 'react' import { mockI18n } from '../../test-utils/mock-i18n' -import { render } from '@testing-library/react' import { TestMarkdownRenderer } from '../../test-utils/test-markdown-renderer' import { EmojiMarkdownExtension } from './emoji-markdown-extension' +import { render } from '@testing-library/react' +import React from 'react' describe('Emoji Markdown Extension', () => { beforeAll(async () => { diff --git a/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.ts b/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.ts index 6fd290617..6bdcc52a8 100644 --- a/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.ts @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { MarkdownRendererExtension } from '../base/markdown-renderer-extension' +import { combinedEmojiData } from './mapping' import type MarkdownIt from 'markdown-it' import emoji from 'markdown-it-emoji/bare' -import { combinedEmojiData } from './mapping' /** * Adds support for utf-8 emojis. diff --git a/frontend/src/components/markdown-renderer/extensions/emoji/mapping.ts b/frontend/src/components/markdown-renderer/extensions/emoji/mapping.ts index b545202cf..793463483 100644 --- a/frontend/src/components/markdown-renderer/extensions/emoji/mapping.ts +++ b/frontend/src/components/markdown-renderer/extensions/emoji/mapping.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import emojiData from 'emoji-picker-element-data/en/emojibase/data.json' import { ForkAwesomeIcons } from '../../../common/fork-awesome/fork-awesome-icons' +import emojiData from 'emoji-picker-element-data/en/emojibase/data.json' interface EmojiEntry { shortcodes: string[] diff --git a/frontend/src/components/markdown-renderer/extensions/generic-syntax-markdown-extension.ts b/frontend/src/components/markdown-renderer/extensions/generic-syntax-markdown-extension.ts index ad7b3e8f1..f2393ab39 100644 --- a/frontend/src/components/markdown-renderer/extensions/generic-syntax-markdown-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/generic-syntax-markdown-extension.ts @@ -3,17 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { MarkdownRendererExtension } from './base/markdown-renderer-extension' +import { imageSize } from '@hedgedoc/markdown-it-plugins' import type MarkdownIt from 'markdown-it' import abbreviation from 'markdown-it-abbr' import definitionList from 'markdown-it-deflist' -import subscript from 'markdown-it-sub' -import superscript from 'markdown-it-sup' +import footnote from 'markdown-it-footnote' import inserted from 'markdown-it-ins' import marked from 'markdown-it-mark' -import footnote from 'markdown-it-footnote' -import { imageSize } from '@hedgedoc/markdown-it-plugins' +import subscript from 'markdown-it-sub' +import superscript from 'markdown-it-sup' /** * Adds some common markdown syntaxes to the markdown rendering. diff --git a/frontend/src/components/markdown-renderer/extensions/headline-anchors-markdown-extension.ts b/frontend/src/components/markdown-renderer/extensions/headline-anchors-markdown-extension.ts index 8f0917f68..92e3fb588 100644 --- a/frontend/src/components/markdown-renderer/extensions/headline-anchors-markdown-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/headline-anchors-markdown-extension.ts @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - import { MarkdownRendererExtension } from './base/markdown-renderer-extension' import type MarkdownIt from 'markdown-it' import anchor from 'markdown-it-anchor' diff --git a/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-markdown-extension.ts b/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-markdown-extension.ts index c8059c4d7..21600c2d1 100644 --- a/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-markdown-extension.ts +++ b/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-markdown-extension.ts @@ -3,9 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - -import { MarkdownRendererExtension } from '../base/markdown-renderer-extension' import type { ComponentReplacer } from '../../replace-components/component-replacer' +import { MarkdownRendererExtension } from '../base/markdown-renderer-extension' import { IframeCapsuleReplacer } from './iframe-capsule-replacer' /** diff --git a/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-replacer.tsx b/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-replacer.tsx index 855c6a2c0..27d8a6d85 100644 --- a/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-replacer.tsx +++ b/frontend/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-replacer.tsx @@ -3,11 +3,10 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ - +import { ClickShield } from '../../replace-components/click-shield/click-shield' import type { NativeRenderer, NodeReplacement, SubNodeTransform } from '../../replace-components/component-replacer' import { ComponentReplacer, DO_NOT_REPLACE } from '../../replace-components/component-replacer' import type { Element } from 'domhandler' -import { ClickShield } from '../../replace-components/click-shield/click-shield' /** * Capsules