mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
Fix Communication between frontend and backend (#1201)
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de> Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4a18e51c83
commit
9cf7980334
38 changed files with 268 additions and 164 deletions
|
@ -18,7 +18,7 @@ import equal from 'fast-deep-equal'
|
|||
export const PoweredByLinks: React.FC = () => {
|
||||
useTranslation()
|
||||
|
||||
const specialLinks = useSelector((state: ApplicationState) => Object.entries(state.config.specialLinks) as [string, string][], equal)
|
||||
const specialUrls: [string, string][] = useSelector((state: ApplicationState) => Object.entries(state.config.specialUrls) as [string, string][], equal)
|
||||
|
||||
return (
|
||||
<p>
|
||||
|
@ -28,7 +28,7 @@ export const PoweredByLinks: React.FC = () => {
|
|||
|
|
||||
<TranslatedInternalLink href='/n/release-notes' i18nKey='landing.footer.releases'/>
|
||||
{
|
||||
specialLinks.map(([i18nKey, href]) =>
|
||||
specialUrls.map(([i18nKey, href]) =>
|
||||
<Fragment key={ i18nKey }>
|
||||
|
|
||||
<TranslatedExternalLink href={ href } i18nKey={ 'landing.footer.' + i18nKey }/>
|
||||
|
|
|
@ -4,17 +4,32 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import React, { useMemo } from 'react'
|
||||
import { CommonModal, CommonModalProps } 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 { useSelector } from 'react-redux'
|
||||
import { ApplicationState } from '../../../../redux'
|
||||
import equal from 'fast-deep-equal'
|
||||
import { BackendVersion } from '../../../../api/config/types'
|
||||
|
||||
export const VersionInfoModal: React.FC<CommonModalProps> = ({ onHide, show }) => {
|
||||
const serverVersion = useSelector((state: ApplicationState) => state.config.version, equal)
|
||||
const serverVersion: BackendVersion = useSelector((state: ApplicationState) => state.config.version, equal)
|
||||
const backendVersion = useMemo(() => {
|
||||
const version = `${serverVersion.major}.${serverVersion.minor}.${serverVersion.patch}`
|
||||
|
||||
if (serverVersion.preRelease) {
|
||||
return `${version}-${serverVersion.preRelease}`
|
||||
}
|
||||
|
||||
if (serverVersion.commit) {
|
||||
return serverVersion.commit
|
||||
}
|
||||
return version
|
||||
}, [serverVersion])
|
||||
|
||||
|
||||
return (
|
||||
<CommonModal data-cy={ 'version-modal' } show={ show } onHide={ onHide } closeButton={ true }
|
||||
|
@ -23,9 +38,9 @@ export const VersionInfoModal: React.FC<CommonModalProps> = ({ onHide, show }) =
|
|||
<Row>
|
||||
<VersionInfoModalColumn
|
||||
titleI18nKey={ 'landing.versionInfo.serverVersion' }
|
||||
version={ serverVersion.version }
|
||||
issueTrackerLink={ serverVersion.issueTrackerUrl }
|
||||
sourceCodeLink={ serverVersion.sourceCodeUrl }/>
|
||||
version={ backendVersion }
|
||||
issueTrackerLink={ links.backendIssues }
|
||||
sourceCodeLink={ links.backendSourceCode }/>
|
||||
<VersionInfoModalColumn
|
||||
titleI18nKey={ 'landing.versionInfo.clientVersion' }
|
||||
version={ frontendVersion.version }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue