Add version info (#80)

Add version info overlay. Fixes #78
This commit is contained in:
mrdrogdrog 2020-05-29 13:08:59 +02:00 committed by GitHub
parent 5baef25b21
commit 0e8d2f1639
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 188 additions and 63 deletions

View file

@ -1,35 +1,36 @@
import { Trans, useTranslation } from 'react-i18next'
import { TranslatedLink } from './translated-link'
import React, { Fragment } from 'react'
import { ExternalLink } from './external-link'
import { Trans, useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { ApplicationState } from '../../../../redux'
import { ExternalLink } from '../../../links/external-link'
import { TranslatedExternalLink } from '../../../links/translated-external-link'
import { VersionInfo } from '../version-info/version-info'
export const PoweredByLinks: React.FC = () => {
useTranslation()
const defaultLinks =
{
releases: '/s/release-notes',
sourceCode: 'https://github.com/codimd/server/tree/41b13e71b6b1d499238c04b15d65e3bd76442f1d'
releases: '/n/release-notes'
}
const config = useSelector((state: ApplicationState) => state.backendConfig)
return (
<p>
<Trans i18nKey="poweredBy" components={[<ExternalLink href="https://codimd.org" text="CodiMD"/>]}/>
<Trans i18nKey="poweredBy">
<ExternalLink href="https://codimd.org" text="CodiMD"/>
</Trans>
{
Object.entries({ ...defaultLinks, ...(config.specialLinks) }).map(([i18nKey, href]) =>
<Fragment key={i18nKey}>
&nbsp;|&nbsp;
<TranslatedLink
href={href}
i18nKey={i18nKey}
/>
<TranslatedExternalLink href={href} i18nKey={i18nKey}/>
</Fragment>
)
}
&nbsp;|&nbsp;
<VersionInfo/>
</p>
)
}