diff --git a/frontend/src/app/(editor)/@appBar/cheatsheet/page.tsx b/frontend/src/app/(editor)/@appBar/cheatsheet/page.tsx new file mode 100644 index 000000000..888d185f2 --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/cheatsheet/page.tsx @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export default function AppBar() { + return null +} diff --git a/frontend/src/app/(editor)/@appBar/default.tsx b/frontend/src/app/(editor)/@appBar/default.tsx new file mode 100644 index 000000000..826a13d7f --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/default.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { BaseAppBar } from '../../../components/layout/app-bar/base-app-bar' +import React from 'react' + +export default function AppBar() { + return +} diff --git a/frontend/src/app/(editor)/@appBar/history/page.tsx b/frontend/src/app/(editor)/@appBar/history/page.tsx new file mode 100644 index 000000000..0e5065ad6 --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/history/page.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import React from 'react' +import { BaseAppBar } from '../../../../components/layout/app-bar/base-app-bar' + +export default function AppBar() { + return History +} diff --git a/frontend/src/app/(editor)/@appBar/intro/page.tsx b/frontend/src/app/(editor)/@appBar/intro/page.tsx new file mode 100644 index 000000000..64a74d30f --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/intro/page.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import React from 'react' +import { BaseAppBar } from '../../../../components/layout/app-bar/base-app-bar' + +export default function AppBar() { + return Landing +} diff --git a/frontend/src/app/(editor)/@appBar/login/page.tsx b/frontend/src/app/(editor)/@appBar/login/page.tsx new file mode 100644 index 000000000..1929d6a3a --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/login/page.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import React from 'react' +import { BaseAppBar } from '../../../../components/layout/app-bar/base-app-bar' + +export default function AppBar() { + return Login +} diff --git a/frontend/src/components/layout/app-bar/__snapshots__/editor-app-bar.spec.tsx.snap b/frontend/src/app/(editor)/@appBar/n/[noteId]/__snapshots__/editor-app-bar.spec.tsx.snap similarity index 85% rename from frontend/src/components/layout/app-bar/__snapshots__/editor-app-bar.spec.tsx.snap rename to frontend/src/app/(editor)/@appBar/n/[noteId]/__snapshots__/editor-app-bar.spec.tsx.snap index b9416557c..e2cae6dc6 100644 --- a/frontend/src/components/layout/app-bar/__snapshots__/editor-app-bar.spec.tsx.snap +++ b/frontend/src/app/(editor)/@appBar/n/[noteId]/__snapshots__/editor-app-bar.spec.tsx.snap @@ -30,13 +30,13 @@ exports[`app bar contains note title and read-only marker when having only read
- BootstrapIconMock_Lock - - + + BootstrapIconMock_Lock + Note Title Test
@@ -55,7 +55,7 @@ exports[`app bar contains note title when editor is synced 1`] = `
Note Title Test diff --git a/frontend/src/components/layout/app-bar/editor-app-bar.spec.tsx b/frontend/src/app/(editor)/@appBar/n/[noteId]/editor-app-bar.spec.tsx similarity index 85% rename from frontend/src/components/layout/app-bar/editor-app-bar.spec.tsx rename to frontend/src/app/(editor)/@appBar/n/[noteId]/editor-app-bar.spec.tsx index e0b49a004..6e9f05b98 100644 --- a/frontend/src/components/layout/app-bar/editor-app-bar.spec.tsx +++ b/frontend/src/app/(editor)/@appBar/n/[noteId]/editor-app-bar.spec.tsx @@ -3,16 +3,16 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import * as UseApplicationStateModule from '../../../hooks/common/use-application-state' -import type { ApplicationState } from '../../../redux/application-state' -import { mockI18n } from '../../../test-utils/mock-i18n' +import * as UseApplicationStateModule from '../../../../../hooks/common/use-application-state' +import type { ApplicationState } from '../../../../../redux/application-state' +import { mockI18n } from '../../../../../test-utils/mock-i18n' import { EditorAppBar } from './editor-app-bar' import type { NoteGroupPermissionEntry, NoteUserPermissionEntry } from '@hedgedoc/commons' import { render } from '@testing-library/react' import type { PropsWithChildren } from 'react' import React from 'react' -jest.mock('./base-app-bar', () => ({ +jest.mock('../../../../../components/layout/app-bar/base-app-bar', () => ({ __esModule: true, BaseAppBar: ({ children }: PropsWithChildren) => (
@@ -22,7 +22,7 @@ jest.mock('./base-app-bar', () => ({
) })) -jest.mock('../../../hooks/common/use-application-state') +jest.mock('../../../../../hooks/common/use-application-state') const mockedCommonAppState = { noteDetails: { diff --git a/frontend/src/components/layout/app-bar/editor-app-bar.tsx b/frontend/src/app/(editor)/@appBar/n/[noteId]/editor-app-bar.tsx similarity index 52% rename from frontend/src/components/layout/app-bar/editor-app-bar.tsx rename to frontend/src/app/(editor)/@appBar/n/[noteId]/editor-app-bar.tsx index 8237e1f62..648b16794 100644 --- a/frontend/src/components/layout/app-bar/editor-app-bar.tsx +++ b/frontend/src/app/(editor)/@appBar/n/[noteId]/editor-app-bar.tsx @@ -1,12 +1,14 @@ +'use client' + /* * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { RealtimeConnectionAlert } from '../../editor-page/realtime-connection-alert/realtime-connection-alert' -import { NoteTitleElement } from './app-bar-elements/note-title-element/note-title-element' -import { BaseAppBar } from './base-app-bar' +import { RealtimeConnectionAlert } from '../../../../../components/editor-page/realtime-connection-alert/realtime-connection-alert' +import { NoteTitleElement } from '../../../../../components/layout/app-bar/app-bar-elements/note-title-element/note-title-element' +import { BaseAppBar } from '../../../../../components/layout/app-bar/base-app-bar' +import { useApplicationState } from '../../../../../hooks/common/use-application-state' import React from 'react' /** diff --git a/frontend/src/app/(editor)/@appBar/n/[noteId]/page.tsx b/frontend/src/app/(editor)/@appBar/n/[noteId]/page.tsx new file mode 100644 index 000000000..904f9785d --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/n/[noteId]/page.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { EditorAppBar } from './editor-app-bar' +import React from 'react' + +export default function AppBar() { + return +} diff --git a/frontend/src/app/(editor)/@appBar/not-found.tsx b/frontend/src/app/(editor)/@appBar/not-found.tsx new file mode 100644 index 000000000..826a13d7f --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/not-found.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { BaseAppBar } from '../../../components/layout/app-bar/base-app-bar' +import React from 'react' + +export default function AppBar() { + return +} diff --git a/frontend/src/app/(editor)/@appBar/p/[noteId]/page.tsx b/frontend/src/app/(editor)/@appBar/p/[noteId]/page.tsx new file mode 100644 index 000000000..888d185f2 --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/p/[noteId]/page.tsx @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export default function AppBar() { + return null +} diff --git a/frontend/src/app/(editor)/@appBar/profile/page.tsx b/frontend/src/app/(editor)/@appBar/profile/page.tsx new file mode 100644 index 000000000..a4e5b0fef --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/profile/page.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import React from 'react' +import { BaseAppBar } from '../../../../components/layout/app-bar/base-app-bar' + +export default function AppBar() { + return Profile +} diff --git a/frontend/src/app/(editor)/@appBar/register/page.tsx b/frontend/src/app/(editor)/@appBar/register/page.tsx new file mode 100644 index 000000000..82a867ce0 --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/register/page.tsx @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import React from 'react' +import { BaseAppBar } from '../../../../components/layout/app-bar/base-app-bar' + +export default function AppBar() { + return Register +} diff --git a/frontend/src/app/(editor)/@appBar/s/[noteId]/page.tsx b/frontend/src/app/(editor)/@appBar/s/[noteId]/page.tsx new file mode 100644 index 000000000..b2e39bed7 --- /dev/null +++ b/frontend/src/app/(editor)/@appBar/s/[noteId]/page.tsx @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { NoteTitleElement } from '../../../../../components/layout/app-bar/app-bar-elements/note-title-element/note-title-element' +import { BaseAppBar } from '../../../../../components/layout/app-bar/base-app-bar' +import React from 'react' + +export default function AppBar() { + return ( + + + + ) +} diff --git a/frontend/src/app/(editor)/history/page.tsx b/frontend/src/app/(editor)/history/page.tsx index 7305fc41c..4c55aedf8 100644 --- a/frontend/src/app/(editor)/history/page.tsx +++ b/frontend/src/app/(editor)/history/page.tsx @@ -13,7 +13,7 @@ import { LandingLayout } from '../../../components/landing-layout/landing-layout import type { NextPage } from 'next' import React, { useEffect } from 'react' import { Row } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' +import { useTranslation } from 'react-i18next' /** * The page that shows the local and remote note history. @@ -29,9 +29,6 @@ const HistoryPage: NextPage = () => { return ( -

- -

diff --git a/frontend/src/app/(editor)/intro/page.tsx b/frontend/src/app/(editor)/intro/page.tsx index d4834e825..3207285ef 100644 --- a/frontend/src/app/(editor)/intro/page.tsx +++ b/frontend/src/app/(editor)/intro/page.tsx @@ -9,7 +9,6 @@ import { CustomBranding } from '../../../components/common/custom-branding/custo import { HedgeDocLogoVertical } from '../../../components/common/hedge-doc-logo/hedge-doc-logo-vertical' import { LogoSize } from '../../../components/common/hedge-doc-logo/logo-size' import { EditorToRendererCommunicatorContextProvider } from '../../../components/editor-page/render-context/editor-to-renderer-communicator-context-provider' -import { CoverButtons } from '../../../components/intro-page/cover-buttons/cover-buttons' import { IntroCustomContent } from '../../../components/intro-page/intro-custom-content' import { LandingLayout } from '../../../components/landing-layout/landing-layout' import type { NextPage } from 'next' @@ -33,7 +32,6 @@ const IntroPage: NextPage = () => {
-
diff --git a/frontend/src/app/(editor)/layout.tsx b/frontend/src/app/(editor)/layout.tsx index b303fb35e..6f20497b2 100644 --- a/frontend/src/app/(editor)/layout.tsx +++ b/frontend/src/app/(editor)/layout.tsx @@ -14,12 +14,17 @@ import { StoreProvider } from '../../redux/store-provider' import { baseUrlFromEnvExtractor } from '../../utils/base-url-from-env-extractor' import { configureLuxon } from '../../utils/configure-luxon' import type { Metadata } from 'next' +import type { PropsWithChildren } from 'react' import React from 'react' import { getConfig } from '../../api/config' configureLuxon() -export default async function RootLayout({ children }: { children: React.ReactNode }) { +interface RootLayoutProps extends PropsWithChildren { + appBar: React.ReactNode +} + +export default async function RootLayout({ children, appBar }: RootLayoutProps) { const baseUrls = baseUrlFromEnvExtractor.extractBaseUrls() const frontendConfig = await getConfig(baseUrls.editor) @@ -35,7 +40,12 @@ export default async function RootLayout({ children }: { children: React.ReactNo - {children} + +
+ {appBar} + {children} +
+
diff --git a/frontend/src/app/(editor)/s/[noteId]/page.tsx b/frontend/src/app/(editor)/s/[noteId]/page.tsx index bcd6702d7..b1d6aae99 100644 --- a/frontend/src/app/(editor)/s/[noteId]/page.tsx +++ b/frontend/src/app/(editor)/s/[noteId]/page.tsx @@ -9,7 +9,6 @@ import { NoteLoadingBoundary } from '../../../../components/common/note-loading- import { DocumentReadOnlyPageContent } from '../../../../components/document-read-only-page/document-read-only-page-content' import { useNoteAndAppTitle } from '../../../../components/editor-page/head-meta-properties/use-note-and-app-title' import { EditorToRendererCommunicatorContextProvider } from '../../../../components/editor-page/render-context/editor-to-renderer-communicator-context-provider' -import { BaseAppBar } from '../../../../components/layout/app-bar/base-app-bar' import type { NextPage } from 'next' import React from 'react' @@ -26,10 +25,7 @@ const DocumentReadOnlyPage: NextPage = ({ params }) => { return ( -
- - -
+
) diff --git a/frontend/src/components/editor-page/editor-page-content.tsx b/frontend/src/components/editor-page/editor-page-content.tsx index b53bd7ff9..4e3de05d5 100644 --- a/frontend/src/components/editor-page/editor-page-content.tsx +++ b/frontend/src/components/editor-page/editor-page-content.tsx @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { EditorAppBar } from '../layout/app-bar/editor-app-bar' import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox' import { ExtensionEventEmitterProvider } from '../markdown-renderer/hooks/use-extension-event-emitter' import { ChangeEditorContentContextProvider } from './change-content-context/codemirror-reference-context' @@ -69,16 +68,13 @@ export const EditorPageContent: React.FC = () => { {editorExtensionComponents} -
- -
- - -
+
+ +
diff --git a/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.module.scss b/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.module.scss index 936fae4b9..52e868f68 100644 --- a/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.module.scss +++ b/frontend/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.module.scss @@ -20,6 +20,5 @@ & > div { background: var(--bs-body-bg); - box-shadow: inset 0 7px 7px -6px #bbbbbb; } } diff --git a/frontend/src/components/intro-page/cover-buttons/cover-buttons.module.scss b/frontend/src/components/intro-page/cover-buttons/cover-buttons.module.scss deleted file mode 100644 index 7c4e9b317..000000000 --- a/frontend/src/components/intro-page/cover-buttons/cover-buttons.module.scss +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -.cover-button { - min-width: 200px; -} diff --git a/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx b/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx deleted file mode 100644 index 48486650f..000000000 --- a/frontend/src/components/intro-page/cover-buttons/cover-buttons.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ -import { useApplicationState } from '../../../hooks/common/use-application-state' -import { SignInButton } from '../../landing-layout/navigation/sign-in-button' -import styles from './cover-buttons.module.scss' -import React from 'react' - -export const CoverButtons: React.FC = () => { - const userExists = useApplicationState((state) => !!state.user) - - if (userExists) { - return null - } - - return ( -
- -
- ) -} diff --git a/frontend/src/components/landing-layout/landing-layout.tsx b/frontend/src/components/landing-layout/landing-layout.tsx index d500f9472..19afb7e56 100644 --- a/frontend/src/components/landing-layout/landing-layout.tsx +++ b/frontend/src/components/landing-layout/landing-layout.tsx @@ -3,8 +3,6 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { BaseAppBar } from '../layout/app-bar/base-app-bar' -import { HeaderBar } from './navigation/header-bar/header-bar' import type { PropsWithChildren } from 'react' import React from 'react' import { Container } from 'react-bootstrap' @@ -16,14 +14,10 @@ import { Container } from 'react-bootstrap' */ export const LandingLayout: React.FC = ({ children }) => { return ( -
- - - -
-
{children}
-
-
-
+ +
+
{children}
+
+
) } 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 deleted file mode 100644 index d4561a1e3..000000000 --- a/frontend/src/components/landing-layout/navigation/header-bar/header-bar.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ -import { cypressId } from '../../../../utils/cypress-attribute' -import { HeaderNavLink } from './header-nav-link' -import React from 'react' -import { Navbar } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' - -/** - * Renders a header bar for the intro and history page. - */ -const HeaderBar: React.FC = () => { - useTranslation() - - return ( - -
- - - - - - -
-
- ) -} - -export { HeaderBar } diff --git a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.module.scss b/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.module.scss deleted file mode 100644 index 634ccc304..000000000 --- a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.module.scss +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -.link { - border-bottom: 2px solid transparent -} - -.active { - border-bottom-color: var(--bs-primary); -} 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 deleted file mode 100644 index 7281be3a8..000000000 --- a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ -import { concatCssClasses } from '../../../../utils/concat-css-classes' -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 { usePathname } from 'next/navigation' -import type { PropsWithChildren } from 'react' -import React, { useMemo } from 'react' -import { Nav } from 'react-bootstrap' - -export interface HeaderNavLinkProps extends PropsWithDataCypressId { - to: string -} - -/** - * Renders a link for the navigation top bar. - * - * @param to The target url - * @param children The react elements inside of link for more description - * @param props Other navigation item props - */ -export const HeaderNavLink: React.FC> = ({ to, children, ...props }) => { - const pathname = usePathname() - - const className = useMemo(() => { - return concatCssClasses( - { - [styles.active]: pathname === to - }, - 'nav-link', - styles.link - ) - }, [pathname, to]) - - return ( - - - {children} - - - ) -} diff --git a/frontend/src/components/layout/app-bar/app-bar-elements/branding-element.tsx b/frontend/src/components/layout/app-bar/app-bar-elements/branding-element.tsx index 47ffc431b..f4743ffec 100644 --- a/frontend/src/components/layout/app-bar/app-bar-elements/branding-element.tsx +++ b/frontend/src/components/layout/app-bar/app-bar-elements/branding-element.tsx @@ -4,12 +4,13 @@ * SPDX-License-Identifier: AGPL-3.0-only */ import { useDarkModeState } from '../../../../hooks/dark-mode/use-dark-mode-state' -import { BrandingSeparatorDash } from '../../../common/custom-branding/branding-separator-dash' import { CustomBranding } from '../../../common/custom-branding/custom-branding' import { HedgeDocLogoHorizontalGrey } from '../../../common/hedge-doc-logo/hedge-doc-logo-horizontal-grey' import { LogoSize } from '../../../common/hedge-doc-logo/logo-size' +import { BrandingSeparatorDash } from './branding-separator-dash' import Link from 'next/link' import React from 'react' +import { Navbar } from 'react-bootstrap' /** * Renders the HedgeDoc branding and branding customizations for the app bar. @@ -18,14 +19,16 @@ export const BrandingElement: React.FC = () => { const darkModeActivated = useDarkModeState() return ( - -
- -
- - - + + + + + + + ) } diff --git a/frontend/src/components/common/custom-branding/branding-separator-dash.tsx b/frontend/src/components/layout/app-bar/app-bar-elements/branding-separator-dash.tsx similarity index 80% rename from frontend/src/components/common/custom-branding/branding-separator-dash.tsx rename to frontend/src/components/layout/app-bar/app-bar-elements/branding-separator-dash.tsx index 2327b55cd..a4c0d09ff 100644 --- a/frontend/src/components/common/custom-branding/branding-separator-dash.tsx +++ b/frontend/src/components/layout/app-bar/app-bar-elements/branding-separator-dash.tsx @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { useBrandingDetails } from './use-branding-details' +import { useBrandingDetails } from '../../../common/custom-branding/use-branding-details' import React from 'react' /** diff --git a/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/help-dropdown.tsx b/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/help-dropdown.tsx index 4b0b8780f..5e4943834 100644 --- a/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/help-dropdown.tsx +++ b/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/help-dropdown.tsx @@ -22,7 +22,7 @@ export const HelpDropdown: React.FC = () => { return ( - + diff --git a/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/history-button.tsx b/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/history-button.tsx new file mode 100644 index 000000000..4e27af3c0 --- /dev/null +++ b/frontend/src/components/layout/app-bar/app-bar-elements/help-dropdown/history-button.tsx @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import React from 'react' +import { Button } from 'react-bootstrap' +import { Trans, useTranslation } from 'react-i18next' +import Link from 'next/link' + +/** + * A button that links to the history page. + */ +export const HistoryButton: React.FC = () => { + useTranslation() + + return ( + + + + ) +} diff --git a/frontend/src/components/layout/app-bar/app-bar-elements/note-title-element/note-title-element.tsx b/frontend/src/components/layout/app-bar/app-bar-elements/note-title-element/note-title-element.tsx index 845e5d937..38f224986 100644 --- a/frontend/src/components/layout/app-bar/app-bar-elements/note-title-element/note-title-element.tsx +++ b/frontend/src/components/layout/app-bar/app-bar-elements/note-title-element/note-title-element.tsx @@ -1,3 +1,5 @@ +'use client' + /* * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * @@ -8,7 +10,7 @@ import { useNoteTitle } from '../../../../../hooks/common/use-note-title' import { useTranslatedText } from '../../../../../hooks/common/use-translated-text' import { UiIcon } from '../../../../common/icons/ui-icon' import { ShowIf } from '../../../../common/show-if/show-if' -import React, { Fragment } from 'react' +import React from 'react' import { Lock as IconLock } from 'react-bootstrap-icons' /** @@ -20,13 +22,13 @@ export const NoteTitleElement: React.FC = () => { const readOnlyLabel = useTranslatedText('appbar.editor.readOnly') return ( - + - + - {noteTitle} - + {noteTitle} + ) } diff --git a/frontend/src/components/layout/app-bar/app-bar-elements/user-element.tsx b/frontend/src/components/layout/app-bar/app-bar-elements/user-element.tsx index 1b66280d7..e4f0809ab 100644 --- a/frontend/src/components/layout/app-bar/app-bar-elements/user-element.tsx +++ b/frontend/src/components/layout/app-bar/app-bar-elements/user-element.tsx @@ -13,5 +13,5 @@ import React from 'react' */ export const UserElement: React.FC = () => { const userExists = useApplicationState((state) => !!state.user) - return userExists ? : + return userExists ? : } diff --git a/frontend/src/components/layout/app-bar/base-app-bar.tsx b/frontend/src/components/layout/app-bar/base-app-bar.tsx index 9a1db3f5e..65b238fd5 100644 --- a/frontend/src/components/layout/app-bar/base-app-bar.tsx +++ b/frontend/src/components/layout/app-bar/base-app-bar.tsx @@ -1,3 +1,5 @@ +'use client' + /* * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * @@ -8,30 +10,31 @@ import { SettingsButton } from '../../global-dialogs/settings-dialog/settings-bu import { BrandingElement } from './app-bar-elements/branding-element' import { HelpDropdown } from './app-bar-elements/help-dropdown/help-dropdown' import { UserElement } from './app-bar-elements/user-element' +import styles from './navbar.module.scss' import type { PropsWithChildren } from 'react' import React from 'react' -import { Col, Nav, Navbar } from 'react-bootstrap' +import { Nav, Navbar } from 'react-bootstrap' +import { HistoryButton } from './app-bar-elements/help-dropdown/history-button' /** * Renders the base app bar with branding, help, settings user elements. */ export const BaseAppBar: React.FC = ({ children }) => { return ( - - + +
+ ) } diff --git a/frontend/src/components/layout/app-bar/navbar.module.scss b/frontend/src/components/layout/app-bar/navbar.module.scss new file mode 100644 index 000000000..bf5d36d5a --- /dev/null +++ b/frontend/src/components/layout/app-bar/navbar.module.scss @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +.side { + flex: 1 1 0; +} + +.center { + display: flex; + justify-content: center; + flex: 2 1 0; +} + +.history { + flex: 2 2 0; +} + +.navbar { + height: 48px; +} diff --git a/frontend/src/components/render-page/hooks/use-on-height-change.ts b/frontend/src/components/render-page/hooks/use-on-height-change.ts index f1b9b9d6f..ab327541a 100644 --- a/frontend/src/components/render-page/hooks/use-on-height-change.ts +++ b/frontend/src/components/render-page/hooks/use-on-height-change.ts @@ -5,7 +5,7 @@ */ import useResizeObserver from '@react-hook/resize-observer' import type { RefObject } from 'react' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' /** * Monitors the height of the referenced {@link HTMLElement} and executes the callback on change. @@ -18,6 +18,7 @@ export const useOnHeightChange = ( onHeightChange: undefined | ((value: number) => void) ): void => { const [rendererSize, setRendererSize] = useState(0) + const lastPostedSize = useRef(0) useResizeObserver(elementRef, (entry) => { setRendererSize(entry.contentRect.height) }) @@ -29,6 +30,10 @@ export const useOnHeightChange = ( setRendererSize(value) }, [elementRef]) useEffect(() => { + if (lastPostedSize.current === rendererSize) { + return + } + lastPostedSize.current = rendererSize onHeightChange?.(rendererSize + 1) - }, [rendererSize, onHeightChange]) + }) }