mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-31 07:08:40 -04:00
fix: Move content into to frontend directory
Doing this BEFORE the merge prevents a lot of merge conflicts. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4e18ce38f3
commit
762a0a850e
1051 changed files with 0 additions and 35 deletions
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react'
|
||||
import type { CommonModalProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } 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 type { BackendVersion } from '../../../../api/config/types'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
|
||||
/**
|
||||
* Renders a modal with the version information.
|
||||
*
|
||||
* @param onHide The callback to call if the modal should be closed
|
||||
* @param show If the modal should be shown.
|
||||
*/
|
||||
export const VersionInfoModal: React.FC<CommonModalProps> = ({ onHide, show }) => {
|
||||
const serverVersion: BackendVersion = useApplicationState((state) => state.config.version)
|
||||
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
|
||||
{...cypressId('version-modal')}
|
||||
show={show}
|
||||
onHide={onHide}
|
||||
showCloseButton={true}
|
||||
title={'landing.versionInfo.title'}>
|
||||
<Modal.Body>
|
||||
<Row>
|
||||
<VersionInfoModalColumn
|
||||
titleI18nKey={'landing.versionInfo.serverVersion'}
|
||||
version={backendVersion}
|
||||
issueTrackerLink={links.backendIssues}
|
||||
sourceCodeLink={links.backendSourceCode}
|
||||
/>
|
||||
<VersionInfoModalColumn
|
||||
titleI18nKey={'landing.versionInfo.clientVersion'}
|
||||
version={frontendVersion.version}
|
||||
issueTrackerLink={frontendVersion.issueTrackerUrl}
|
||||
sourceCodeLink={frontendVersion.sourceCodeUrl}
|
||||
/>
|
||||
</Row>
|
||||
</Modal.Body>
|
||||
</CommonModal>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue