mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-07 09:55:43 -04:00
fix(frontend): improve performance by caching translated texts
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
ced4cd953c
commit
76242330fd
81 changed files with 341 additions and 292 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { useApplicationState } from '../../hooks/common/use-application-state'
|
||||
import { useTranslatedText } from '../../hooks/common/use-translated-text'
|
||||
import { InternalLink } from '../common/links/internal-link'
|
||||
import { ShowIf } from '../common/show-if/show-if'
|
||||
import { NoteInfoLineCreatedAt } from '../editor-page/sidebar/specific-sidebar-entries/note-info-sidebar-menu/note-info-line/note-info-line-created-at'
|
||||
|
@ -11,16 +12,16 @@ import { NoteInfoLineUpdatedBy } from '../editor-page/sidebar/specific-sidebar-e
|
|||
import styles from './document-infobar.module.scss'
|
||||
import React from 'react'
|
||||
import { Pencil as IconPencil } from 'react-bootstrap-icons'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders an info bar with metadata about the current note.
|
||||
*/
|
||||
export const DocumentInfobar: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const noteDetails = useApplicationState((state) => state.noteDetails)
|
||||
|
||||
// TODO Check permissions ("writability") of note and show edit link depending on that.
|
||||
const linkTitle = useTranslatedText('views.readOnly.editNote')
|
||||
return (
|
||||
<div className={`d-flex flex-row my-3 ${styles['document-infobar']}`}>
|
||||
<div className={'col-md'}> </div>
|
||||
|
@ -38,7 +39,7 @@ export const DocumentInfobar: React.FC = () => {
|
|||
href={`/n/${noteDetails.primaryAddress}`}
|
||||
icon={IconPencil}
|
||||
className={'text-primary text-decoration-none mx-1'}
|
||||
title={t('views.readOnly.editNote') ?? undefined}
|
||||
title={linkTitle}
|
||||
/>
|
||||
</ShowIf>
|
||||
</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue