diff --git a/frontend/src/app/(editor)/profile/page.tsx b/frontend/src/app/(editor)/profile/page.tsx index 428ebb6eb..14a1c5ad6 100644 --- a/frontend/src/app/(editor)/profile/page.tsx +++ b/frontend/src/app/(editor)/profile/page.tsx @@ -7,7 +7,6 @@ */ import { AuthProviderType } from '../../../api/config/types' import { Redirect } from '../../../components/common/redirect' -import { ShowIf } from '../../../components/common/show-if/show-if' import { LandingLayout } from '../../../components/landing-layout/landing-layout' import { ProfileAccessTokens } from '../../../components/profile-page/access-tokens/profile-access-tokens' import { ProfileAccountManagement } from '../../../components/profile-page/account-management/profile-account-management' @@ -35,9 +34,7 @@ const ProfilePage: NextPage = () => { - - - + {userProvider === (AuthProviderType.LOCAL as string) && } 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 c19944370..424e7b24d 100644 --- a/frontend/src/components/application-loader/loading-screen/loading-screen.tsx +++ b/frontend/src/components/application-loader/loading-screen/loading-screen.tsx @@ -1,9 +1,8 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * 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' @@ -27,9 +26,7 @@ export const LoadingScreen: React.FC = ({ errorMessage }) => - - {errorMessage} - + {errorMessage !== undefined && {errorMessage}} ) } 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 f458b29e0..6244807f1 100644 --- a/frontend/src/components/common/copyable/copyable-field/copyable-field.tsx +++ b/frontend/src/components/common/copyable/copyable-field/copyable-field.tsx @@ -1,11 +1,10 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ import { Logger } from '../../../../utils/logger' import { UiIcon } from '../../icons/ui-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' @@ -54,13 +53,13 @@ export const CopyableField: React.FC = ({ content, shareOrig - + {sharingSupported && ( - + )} ) } 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 9a22fd812..f6b6659d5 100644 --- a/frontend/src/components/common/copyable/hooks/use-copy-overlay.tsx +++ b/frontend/src/components/common/copyable/hooks/use-copy-overlay.tsx @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ 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' @@ -64,12 +63,8 @@ export const useCopyOverlay = ( {(props) => ( - - - - - - + {showState === SHOW_STATE.ERROR && } + {showState === SHOW_STATE.SUCCESS && } )} diff --git a/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-horizontal-grey.tsx b/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-horizontal-grey.tsx index b22f50004..7c3f83e9b 100644 --- a/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-horizontal-grey.tsx +++ b/frontend/src/components/common/hedge-doc-logo/hedge-doc-logo-horizontal-grey.tsx @@ -5,7 +5,6 @@ */ import { LogoSize } from './logo-size' import React from 'react' -import { ShowIf } from '../show-if/show-if' interface HedgeDocLogoHorizontalGreyProps { color: 'dark' | 'light' @@ -68,13 +67,13 @@ export const HedgeDocLogoHorizontalGrey: React.FC - + {showText && ( - + )} ) diff --git a/frontend/src/components/common/icon-button/icon-button.tsx b/frontend/src/components/common/icon-button/icon-button.tsx index 046d36c6e..744f4c478 100644 --- a/frontend/src/components/common/icon-button/icon-button.tsx +++ b/frontend/src/components/common/icon-button/icon-button.tsx @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -7,7 +7,6 @@ import { concatCssClasses } from '../../../utils/concat-css-classes' import type { PropsWithDataTestId } from '../../../utils/test-id' import { testId } from '../../../utils/test-id' import { UiIcon } from '../icons/ui-icon' -import { ShowIf } from '../show-if/show-if' import styles from './icon-button.module.scss' import React, { useMemo } from 'react' import type { ButtonProps } from 'react-bootstrap' @@ -52,9 +51,7 @@ export const IconButton: React.FC = ({ - - {children} - + {children !== undefined && {children}} ) } diff --git a/frontend/src/components/common/modals/common-modal.tsx b/frontend/src/components/common/modals/common-modal.tsx index 9bab6992e..84f618b15 100644 --- a/frontend/src/components/common/modals/common-modal.tsx +++ b/frontend/src/components/common/modals/common-modal.tsx @@ -8,7 +8,6 @@ import type { PropsWithDataCypressId } from '../../../utils/cypress-attribute' import { cypressId } from '../../../utils/cypress-attribute' import { testId } from '../../../utils/test-id' import { UiIcon } from '../icons/ui-icon' -import { ShowIf } from '../show-if/show-if' import type { PropsWithChildren, ReactElement } from 'react' import React, { Fragment, useMemo } from 'react' import { Modal } from 'react-bootstrap' @@ -66,25 +65,27 @@ export const CommonModal: React.FC> = ({ return titleI18nKey !== undefined ? : {title} }, [titleI18nKey, title]) + if (!show) { + return null + } + return ( - - - - - - {titleElement} - - {additionalTitleElement ?? } - - {children} - - + + + + + {titleElement} + + {additionalTitleElement ?? } + + {children} + ) } 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 991efc2e5..f898e5ac8 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 @@ -6,7 +6,6 @@ import { createNoteWithPrimaryAlias } from '../../../api/notes' import { testId } from '../../../utils/test-id' import { UiIcon } from '../icons/ui-icon' -import { ShowIf } from '../show-if/show-if' import React, { useCallback, useEffect } from 'react' import { Alert, Button } from 'react-bootstrap' import { @@ -85,9 +84,7 @@ export const CreateNonExistingNoteHint: React.FC className='mx-2' onClick={onClickHandler} {...testId('createNoteButton')}> - - - + {returnState.loading && } 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 37891660f..87b2807be 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 @@ -10,7 +10,6 @@ import { Logger } from '../../../utils/logger' import { LoadingScreen } from '../../application-loader/loading-screen/loading-screen' import { CommonErrorPage } from '../../error-pages/common-error-page' import { CustomAsyncLoadingBoundary } from '../async-loading-boundary/custom-async-loading-boundary' -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' @@ -59,9 +58,9 @@ export const NoteLoadingBoundary: React.FC> = ({ - + {error instanceof ApiError && error.statusCode === 404 && ( - + )} ) }, [error, loadNoteFromServer, noteId]) diff --git a/frontend/src/components/common/pagination/pager-pagination.tsx b/frontend/src/components/common/pagination/pager-pagination.tsx index 97b9d77b4..dafbefc21 100644 --- a/frontend/src/components/common/pagination/pager-pagination.tsx +++ b/frontend/src/components/common/pagination/pager-pagination.tsx @@ -1,9 +1,8 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ -import { ShowIf } from '../show-if/show-if' import { PagerItem } from './pager-item' import React, { useEffect, useMemo, useState } from 'react' import { Pagination } from 'react-bootstrap' @@ -70,17 +69,21 @@ export const PagerPagination: React.FC = ({ return ( - 0}> - - - + {correctedLowerPageIndex > 0 && ( + <> + + + + )} {paginationItemsBefore} {correctedPageIndex + 1} {paginationItemsAfter} - - - - + {correctedUpperPageIndex < lastPageIndex && ( + <> + + + + )} ) } diff --git a/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx b/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx index abe822be6..cf8fe8409 100644 --- a/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx +++ b/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -19,7 +19,6 @@ import type { SetScrollStateMessage } from '../../render-page/window-post-message-communicator/rendering-message' import { CommunicationMessageType } from '../../render-page/window-post-message-communicator/rendering-message' -import { ShowIf } from '../show-if/show-if' import { WaitSpinner } from '../wait-spinner/wait-spinner' import { useEffectOnRenderTypeChange } from './hooks/use-effect-on-render-type-change' import { useForceRenderPageUrlOnIframeLoadCallback } from './hooks/use-force-render-page-url-on-iframe-load-callback' @@ -176,9 +175,7 @@ export const RendererIframe: React.FC = ({ return ( - - - + {!rendererReady && showWaitSpinner && }