diff --git a/locales/en.json b/locales/en.json index dd0bbc97c..d923f4efe 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1,7 +1,8 @@ { "app": { "slogan": "The best platform to write and share markdown.", - "title": "Collaborative markdown notes" + "title": "Collaborative markdown notes", + "icon": "HedgeDoc logo with text" }, "notificationTest": { "title": "Test", diff --git a/src/components/application-loader/application-loader.module.scss b/src/components/application-loader/application-loader.module.scss index c501781ae..b9466ec1e 100644 --- a/src/components/application-loader/application-loader.module.scss +++ b/src/components/application-loader/application-loader.module.scss @@ -5,8 +5,6 @@ */ .loader { - @import "./animations.scss"; - height: 100%; width: 100%; diff --git a/src/components/application-loader/application-loader.tsx b/src/components/application-loader/application-loader.tsx index 7519af3ff..687504f2b 100644 --- a/src/components/application-loader/application-loader.tsx +++ b/src/components/application-loader/application-loader.tsx @@ -7,7 +7,7 @@ import React, { Suspense } from 'react' import { useBackendBaseUrl } from '../../hooks/common/use-backend-base-url' import { createSetUpTaskList } from './initializers' -import { LoadingScreen } from './loading-screen' +import { LoadingScreen } from './loading-screen/loading-screen' import { useCustomizeAssetsUrl } from '../../hooks/common/use-customize-assets-url' import { Logger } from '../../utils/logger' import { useAsync } from 'react-use' diff --git a/src/components/application-loader/initializers/fetch-motd.ts b/src/components/application-loader/initializers/fetch-motd.ts index 6720b4864..b764e0a1f 100644 --- a/src/components/application-loader/initializers/fetch-motd.ts +++ b/src/components/application-loader/initializers/fetch-motd.ts @@ -46,12 +46,11 @@ export const fetchMotd = async (customizeAssetsUrl: string): Promise => { return } - const motdText = await response.text() - const lastModified = response.headers.get('Last-Modified') || response.headers.get('etag') if (!lastModified) { log.warn("'Last-Modified' or 'Etag' not found for motd.txt!") } + const motdText = await response.text() setMotd(motdText, lastModified) } diff --git a/src/components/application-loader/loading-screen/animated-hedge-doc-logo/animated-hedge-doc-logo.tsx b/src/components/application-loader/loading-screen/animated-hedge-doc-logo/animated-hedge-doc-logo.tsx new file mode 100644 index 000000000..74661f69c --- /dev/null +++ b/src/components/application-loader/loading-screen/animated-hedge-doc-logo/animated-hedge-doc-logo.tsx @@ -0,0 +1,35 @@ +/* + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import React from 'react' +import LogoColor from '../../../common/hedge-doc-logo/logo_color.svg' +import styles from './animations.module.scss' + +export interface HedgeDocLogoProps { + animation: AnimationType +} + +export enum AnimationType { + JUMP = 'animation-jump', + SHAKE = 'animation-shake' +} + +/** + * Shows an animated hedgedoc logo. + * + * @param animation The name of the animation + */ +export const AnimatedHedgeDocLogo: React.FC = ({ animation }) => { + return ( + + ) +} diff --git a/src/components/application-loader/animations.scss b/src/components/application-loader/loading-screen/animated-hedge-doc-logo/animations.module.scss similarity index 80% rename from src/components/application-loader/animations.scss rename to src/components/application-loader/loading-screen/animated-hedge-doc-logo/animations.module.scss index 288a53d21..9370c9ab7 100644 --- a/src/components/application-loader/animations.scss +++ b/src/components/application-loader/loading-screen/animated-hedge-doc-logo/animations.module.scss @@ -4,15 +4,6 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -@keyframes animation-roll { - 0% { - transform: translateX(calc(-100vw / 2 - 100%)) rotateZ(0deg); - } - 100% { - transform: translateX(calc(100vw / 2 + 100%)) rotateZ(720deg); - } -} - @keyframes animation-jump { 0% { transform: scale(1, 1) translateY(0); @@ -73,14 +64,6 @@ } } -.animation-roll { - transform-origin: center center; - animation-duration: 4s; - animation-iteration-count: infinite; - animation-name: animation-roll; - animation-timing-function: linear; -} - .animation-jump { transform-origin: bottom; animation-duration: 2s; diff --git a/src/components/application-loader/loading-screen.tsx b/src/components/application-loader/loading-screen/loading-screen.tsx similarity index 66% rename from src/components/application-loader/loading-screen.tsx rename to src/components/application-loader/loading-screen/loading-screen.tsx index 48ecca106..69f2891ee 100644 --- a/src/components/application-loader/loading-screen.tsx +++ b/src/components/application-loader/loading-screen/loading-screen.tsx @@ -1,14 +1,14 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ import React from 'react' import { Alert } from 'react-bootstrap' -import { HedgeDocLogo, HedgeDocLogoSize } from '../common/hedge-doc-logo/hedge-doc-logo' -import { ShowIf } from '../common/show-if/show-if' -import styles from './application-loader.module.scss' +import { AnimatedHedgeDocLogo, AnimationType } from './animated-hedge-doc-logo/animated-hedge-doc-logo' +import { ShowIf } from '../../common/show-if/show-if' +import styles from '../application-loader.module.scss' export interface LoadingScreenProps { failedTaskName?: string @@ -23,8 +23,8 @@ export const LoadingScreen: React.FC = ({ failedTaskName }) return (
- - + +
diff --git a/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx b/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx index 277e8d898..0daa1626a 100644 --- a/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx +++ b/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx @@ -4,10 +4,11 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import React from 'react' +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 { useTranslation } from 'react-i18next' export enum HedgeDocLogoSize { SMALL = 32, @@ -27,13 +28,17 @@ export enum HedgeDocLogoType { } export const HedgeDocLogoWithText: React.FC = ({ size = HedgeDocLogoSize.MEDIUM, logoType }) => { + const { t } = useTranslation() + const altText = useMemo(() => t('app.icon'), [t]) + const style = useMemo(() => ({ height: size }), [size]) + switch (logoType) { case HedgeDocLogoType.COLOR_VERTICAL: - return + return case HedgeDocLogoType.BW_HORIZONTAL: - return + return case HedgeDocLogoType.WB_HORIZONTAL: - return + return default: return null } diff --git a/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx b/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx deleted file mode 100644 index d2f20b6cd..000000000 --- a/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx +++ /dev/null @@ -1,22 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import React from 'react' -import LogoColor from './logo_color.svg' - -export enum HedgeDocLogoSize { - SMALL = 32, - MEDIUM = 64, - BIG = 256 -} - -export interface HedgeDocLogoProps { - size?: HedgeDocLogoSize | number -} - -export const HedgeDocLogo: React.FC = ({ size = HedgeDocLogoSize.MEDIUM }) => { - return -} diff --git a/src/pages/n/[id].tsx b/src/pages/n/[id].tsx index c1de2e545..ef08cc87d 100644 --- a/src/pages/n/[id].tsx +++ b/src/pages/n/[id].tsx @@ -30,7 +30,7 @@ import { Logger } from '../../utils/logger' import { NoteType } from '../../redux/note-details/types/note-details' import type { NextPage } from 'next' import { isClientSideRendering } from '../../utils/is-client-side-rendering' -import { LoadingScreen } from '../../components/application-loader/loading-screen' +import { LoadingScreen } from '../../components/application-loader/loading-screen/loading-screen' import { NoteAndAppTitleHead } from '../../components/layout/note-and-app-title-head' const EditorPane = React.lazy(() => import('../../components/editor-page/editor-pane/editor-pane'))