Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit be2428f

Browse files
Extract URLs in extra file and change riot link to element-link (#551)
* Update matrix chat link to new element URL * Correct other usages of the element link * Extracted static external links into separate file
1 parent ca2bd1d commit be2428f

File tree

8 files changed

+43
-22
lines changed

8 files changed

+43
-22
lines changed

cypress/integration/link.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ describe('Links Intro', () => {
138138

139139
describe('Follow us Links', () => {
140140
it('Github', () => {
141-
cy.get('a[href="https://github.com/codimd/server"]')
142-
.checkExternalLink('https://github.com/codimd/server')
141+
cy.get('a[href="https://github.com/codimd/"]')
142+
.checkExternalLink('https://github.com/codimd/')
143143
})
144144

145145
it('Discourse', () => {
@@ -148,13 +148,13 @@ describe('Links Intro', () => {
148148
})
149149

150150
it('Matrix', () => {
151-
cy.get('a[href="https://riot.im/app/#/room/#hedgedoc:matrix.org"]')
152-
.checkExternalLink('https://riot.im/app/#/room/#hedgedoc:matrix.org')
151+
cy.get('a[href="https://app.element.io/#/room/#hedgedoc:matrix.org"]')
152+
.checkExternalLink('https://app.element.io/#/room/#hedgedoc:matrix.org')
153153
})
154154

155155
it('Mastodon', () => {
156-
cy.get('a[href="https://social.codimd.org/mastodon"]')
157-
.checkExternalLink('https://social.codimd.org/mastodon')
156+
cy.get('a[href="https://social.codimd.org"]')
157+
.checkExternalLink('https://social.codimd.org')
158158
})
159159

160160
it('POEditor', () => {

src/components/editor/app-bar/help-button/links.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import React from 'react'
22
import { Col, Row } from 'react-bootstrap'
33
import { Trans, useTranslation } from 'react-i18next'
4+
import { useSelector } from 'react-redux'
5+
import { ApplicationState } from '../../../../redux'
46
import { TranslatedExternalLink } from '../../../common/links/translated-external-link'
57
import { TranslatedInternalLink } from '../../../common/links/translated-internal-link'
8+
import links from '../../../../links.json'
69

710
export const Links: React.FC = () => {
811
useTranslation()
12+
13+
const backendIssueTracker = useSelector((state: ApplicationState) => state.config.version.issueTrackerUrl)
914
return (
1015
<Row className={'justify-content-center pt-4'}>
1116
<Col lg={4}>
@@ -15,7 +20,7 @@ export const Links: React.FC = () => {
1520
<li>
1621
<TranslatedExternalLink
1722
i18nKey='editor.help.contacts.community'
18-
href='https://community.codimd.org/'
23+
href={links.community}
1924
icon='users'
2025
className='text-primary'
2126
/>
@@ -24,23 +29,23 @@ export const Links: React.FC = () => {
2429
<TranslatedExternalLink
2530
i18nKey='editor.help.contacts.meetUsOn'
2631
i18nOption={{ service: 'Matrix' }}
27-
href='https://riot.im/app/#/room/#hedgedoc:matrix.org'
32+
href={links.chatElement}
2833
icon='hashtag'
2934
className='text-primary'
3035
/>
3136
</li>
3237
<li>
3338
<TranslatedExternalLink
3439
i18nKey='editor.help.contacts.reportIssue'
35-
href='https://github.com/codimd/server/issues'
40+
href={backendIssueTracker}
3641
icon='tag'
3742
className='text-primary'
3843
/>
3944
</li>
4045
<li>
4146
<TranslatedExternalLink
4247
i18nKey='editor.help.contacts.helpTranslating'
43-
href='https://translate.codimd.org/'
48+
href={links.translate}
4449
icon='language'
4550
className='text-primary'
4651
/>
@@ -63,15 +68,15 @@ export const Links: React.FC = () => {
6368
<li>
6469
<TranslatedInternalLink
6570
i18nKey='editor.help.documents.yamlMetadata'
66-
href='/n/yaml-data'
71+
href='/n/yaml-metadata'
6772
icon='dot-circle-o'
6873
className='text-primary'
6974
/>
7075
</li>
7176
<li>
72-
<TranslatedExternalLink
77+
<TranslatedInternalLink
7378
i18nKey='editor.help.documents.slideExample'
74-
href='https://github.com/codimd/server/issues'
79+
href='/n/slide-example'
7580
icon='dot-circle-o'
7681
className='text-primary'
7782
/>

src/components/editor/document-bar/menus/export-menu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import { Dropdown } from 'react-bootstrap'
33
import { Trans, useTranslation } from 'react-i18next'
44
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
5+
import links from '../../../../links.json'
56

67
const ExportMenu: React.FC = () => {
78
useTranslation()
@@ -44,7 +45,7 @@ const ExportMenu: React.FC = () => {
4445

4546
<Dropdown.Divider/>
4647

47-
<Dropdown.Item className='small text-muted' dir={'auto'} href={'https://community.codimd.org/t/frequently-asked-questions/190'} target={'_blank'} rel='noopener noreferrer'>
48+
<Dropdown.Item className='small text-muted' dir={'auto'} href={links.faq} target={'_blank'} rel='noopener noreferrer'>
4849
<ForkAwesomeIcon icon='file-pdf-o' className={'mx-2'}/>
4950
<Trans i18nKey={'editor.export.pdf'}/>
5051
&nbsp;

src/components/error-boundary/error-boundary.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Button, Container } from 'react-bootstrap'
33
import frontendVersion from '../../version.json'
44
import { ForkAwesomeIcon } from '../common/fork-awesome/fork-awesome-icon'
55
import { ExternalLink } from '../common/links/external-link'
6+
import links from '../../links.json'
67

78
export class ErrorBoundary extends Component {
89
state: {
@@ -35,7 +36,9 @@ export class ErrorBoundary extends Component {
3536
<div className='text-white d-flex flex-column align-items-center justify-content-center my-5'>
3637
<h1>An unknown error occurred</h1>
3738
<p>Don't worry, this happens sometimes. If this is the first time you see this page then try reloading the app.</p>
38-
If you can reproduce this error, then we would be glad if you <ExternalLink text={'open an issue on github'} href={frontendVersion.issueTrackerUrl} className={'text-primary'}/> or <ExternalLink text={'contact us on matrix.'} href={'https://riot.im/app/#/room/#hedgedoc:matrix.org'} className={'text-primary'}/>
39+
If you can reproduce this error, then we would be glad if you&#32;
40+
<ExternalLink text={'open an issue on github'} href={frontendVersion.issueTrackerUrl} className={'text-primary'}/>&#32;
41+
or <ExternalLink text={'contact us on matrix.'} href={links.chatElement} className={'text-primary'}/>
3942
<Button onClick={() => this.refreshPage()} title={'Reload App'} className={'mt-4'}>
4043
<ForkAwesomeIcon icon={'refresh'}/>&nbsp;Reload App
4144
</Button>

src/components/landing-layout/footer/powered-by-links.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ExternalLink } from '../../common/links/external-link'
66
import { TranslatedExternalLink } from '../../common/links/translated-external-link'
77
import { TranslatedInternalLink } from '../../common/links/translated-internal-link'
88
import { VersionInfo } from './version-info'
9+
import links from '../../../links.json'
910

1011
export const PoweredByLinks: React.FC = () => {
1112
useTranslation()
@@ -15,7 +16,7 @@ export const PoweredByLinks: React.FC = () => {
1516
return (
1617
<p>
1718
<Trans i18nKey="landing.footer.poweredBy">
18-
<ExternalLink href="https://codimd.org" text="HedgeDoc"/>
19+
<ExternalLink href={links.webpage} text="HedgeDoc"/>
1920
</Trans>
2021
&nbsp;|&nbsp;
2122
<TranslatedInternalLink href='/n/release-notes' i18nKey='landing.footer.releases'/>

src/components/landing-layout/footer/social-links.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import React from 'react'
22
import { Trans, useTranslation } from 'react-i18next'
33
import { ExternalLink } from '../../common/links/external-link'
4+
import links from '../../../links.json'
45

56
const SocialLink: React.FC = () => {
67
useTranslation()
78
return (
89
<p>
910
<Trans i18nKey="landing.footer.followUs" components={[
10-
<ExternalLink href="https://github.com/codimd/server" icon='github' text="GitHub"/>,
11-
<ExternalLink href="https://community.codimd.org" icon='users' text="Discourse"/>,
12-
<ExternalLink href="https://riot.im/app/#/room/#hedgedoc:matrix.org" icon="comment" text="Riot"/>,
13-
<ExternalLink href="https://social.codimd.org/mastodon" icon='mastodon' text="Mastodon"/>,
14-
<ExternalLink href="https://translate.codimd.org" icon="globe" text="POEditor"/>
11+
<ExternalLink href={links.githubOrg} icon='github' text="GitHub"/>,
12+
<ExternalLink href={links.community} icon='users' text="Discourse"/>,
13+
<ExternalLink href={links.chatElement} icon="comment" text="Element"/>,
14+
<ExternalLink href={links.mastodon} icon='mastodon' text="Mastodon"/>,
15+
<ExternalLink href={links.translate} icon="globe" text="POEditor"/>
1516
]}/>
1617
</p>
1718
)

src/components/markdown-renderer/replace-components/sequence-diagram/deprecation-warning.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import { Alert } from 'react-bootstrap'
33
import { Trans, useTranslation } from 'react-i18next'
44
import { TranslatedExternalLink } from '../../../common/links/translated-external-link'
5+
import links from '../../../../links.json'
56

67
export const DeprecationWarning: React.FC = () => {
78
useTranslation()
@@ -10,7 +11,7 @@ export const DeprecationWarning: React.FC = () => {
1011
<Alert className={'mt-2'} variant={'warning'}>
1112
<Trans i18nKey={'renderer.sequence.deprecationWarning'}/>
1213
&nbsp;
13-
<TranslatedExternalLink i18nKey={'common.why'} className={'text-dark'} href={'https://community.codimd.org/t/frequently-asked-questions/190'}/>
14+
<TranslatedExternalLink i18nKey={'common.why'} className={'text-dark'} href={links.faq}/>
1415
</Alert>
1516
)
1617
}

src/links.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"chatElement": "https://app.element.io/#/room/#hedgedoc:matrix.org",
3+
"community": "https://community.codimd.org",
4+
"faq": "https://community.codimd.org/t/frequently-asked-questions/190",
5+
"githubOrg": "https://github.com/codimd/",
6+
"mastodon": "https://social.codimd.org",
7+
"translate": "https://translate.codimd.org",
8+
"webpage": "https://codimd.org"
9+
}

0 commit comments

Comments
 (0)