From be2428f22c2912f1f10a9aaa2674d3abf8dff69a Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 13 Sep 2020 16:38:53 +0200 Subject: [PATCH] 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 --- cypress/integration/link.spec.ts | 12 ++++++------ .../editor/app-bar/help-button/links.tsx | 19 ++++++++++++------- .../editor/document-bar/menus/export-menu.tsx | 3 ++- .../error-boundary/error-boundary.tsx | 5 ++++- .../footer/powered-by-links.tsx | 3 ++- .../landing-layout/footer/social-links.tsx | 11 ++++++----- .../sequence-diagram/deprecation-warning.tsx | 3 ++- src/links.json | 9 +++++++++ 8 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 src/links.json diff --git a/cypress/integration/link.spec.ts b/cypress/integration/link.spec.ts index d7373dac5..ae42376aa 100644 --- a/cypress/integration/link.spec.ts +++ b/cypress/integration/link.spec.ts @@ -138,8 +138,8 @@ describe('Links Intro', () => { describe('Follow us Links', () => { it('Github', () => { - cy.get('a[href="https://github.com/codimd/server"]') - .checkExternalLink('https://github.com/codimd/server') + cy.get('a[href="https://github.com/codimd/"]') + .checkExternalLink('https://github.com/codimd/') }) it('Discourse', () => { @@ -148,13 +148,13 @@ describe('Links Intro', () => { }) it('Matrix', () => { - cy.get('a[href="https://riot.im/app/#/room/#hedgedoc:matrix.org"]') - .checkExternalLink('https://riot.im/app/#/room/#hedgedoc:matrix.org') + cy.get('a[href="https://app.element.io/#/room/#hedgedoc:matrix.org"]') + .checkExternalLink('https://app.element.io/#/room/#hedgedoc:matrix.org') }) it('Mastodon', () => { - cy.get('a[href="https://social.codimd.org/mastodon"]') - .checkExternalLink('https://social.codimd.org/mastodon') + cy.get('a[href="https://social.codimd.org"]') + .checkExternalLink('https://social.codimd.org') }) it('POEditor', () => { diff --git a/src/components/editor/app-bar/help-button/links.tsx b/src/components/editor/app-bar/help-button/links.tsx index 24dd12a41..378f8f354 100644 --- a/src/components/editor/app-bar/help-button/links.tsx +++ b/src/components/editor/app-bar/help-button/links.tsx @@ -1,11 +1,16 @@ import React from 'react' import { Col, Row } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' +import { useSelector } from 'react-redux' +import { ApplicationState } from '../../../../redux' import { TranslatedExternalLink } from '../../../common/links/translated-external-link' import { TranslatedInternalLink } from '../../../common/links/translated-internal-link' +import links from '../../../../links.json' export const Links: React.FC = () => { useTranslation() + + const backendIssueTracker = useSelector((state: ApplicationState) => state.config.version.issueTrackerUrl) return ( @@ -15,7 +20,7 @@ export const Links: React.FC = () => {
  • @@ -24,7 +29,7 @@ export const Links: React.FC = () => { @@ -32,7 +37,7 @@ export const Links: React.FC = () => {
  • @@ -40,7 +45,7 @@ export const Links: React.FC = () => {
  • @@ -63,15 +68,15 @@ export const Links: React.FC = () => {
  • - diff --git a/src/components/editor/document-bar/menus/export-menu.tsx b/src/components/editor/document-bar/menus/export-menu.tsx index 1323aed86..2a11f1189 100644 --- a/src/components/editor/document-bar/menus/export-menu.tsx +++ b/src/components/editor/document-bar/menus/export-menu.tsx @@ -2,6 +2,7 @@ import React from 'react' import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import links from '../../../../links.json' const ExportMenu: React.FC = () => { useTranslation() @@ -44,7 +45,7 @@ const ExportMenu: React.FC = () => { - +   diff --git a/src/components/error-boundary/error-boundary.tsx b/src/components/error-boundary/error-boundary.tsx index 25549729d..b8b5d4124 100644 --- a/src/components/error-boundary/error-boundary.tsx +++ b/src/components/error-boundary/error-boundary.tsx @@ -3,6 +3,7 @@ import { Button, Container } from 'react-bootstrap' import frontendVersion from '../../version.json' import { ForkAwesomeIcon } from '../common/fork-awesome/fork-awesome-icon' import { ExternalLink } from '../common/links/external-link' +import links from '../../links.json' export class ErrorBoundary extends Component { state: { @@ -35,7 +36,9 @@ export class ErrorBoundary extends Component {

    An unknown error occurred

    Don't worry, this happens sometimes. If this is the first time you see this page then try reloading the app.

    - If you can reproduce this error, then we would be glad if you or + If you can reproduce this error, then we would be glad if you + + or diff --git a/src/components/landing-layout/footer/powered-by-links.tsx b/src/components/landing-layout/footer/powered-by-links.tsx index 1672ebf3b..47c4ed27f 100644 --- a/src/components/landing-layout/footer/powered-by-links.tsx +++ b/src/components/landing-layout/footer/powered-by-links.tsx @@ -6,6 +6,7 @@ import { ExternalLink } from '../../common/links/external-link' import { TranslatedExternalLink } from '../../common/links/translated-external-link' import { TranslatedInternalLink } from '../../common/links/translated-internal-link' import { VersionInfo } from './version-info' +import links from '../../../links.json' export const PoweredByLinks: React.FC = () => { useTranslation() @@ -15,7 +16,7 @@ export const PoweredByLinks: React.FC = () => { return (

    - +  |  diff --git a/src/components/landing-layout/footer/social-links.tsx b/src/components/landing-layout/footer/social-links.tsx index c8bff8f8d..18c16864d 100644 --- a/src/components/landing-layout/footer/social-links.tsx +++ b/src/components/landing-layout/footer/social-links.tsx @@ -1,17 +1,18 @@ import React from 'react' import { Trans, useTranslation } from 'react-i18next' import { ExternalLink } from '../../common/links/external-link' +import links from '../../../links.json' const SocialLink: React.FC = () => { useTranslation() return (

    , - , - , - , - + , + , + , + , + ]}/>

    ) diff --git a/src/components/markdown-renderer/replace-components/sequence-diagram/deprecation-warning.tsx b/src/components/markdown-renderer/replace-components/sequence-diagram/deprecation-warning.tsx index ef801f618..5687f1a5b 100644 --- a/src/components/markdown-renderer/replace-components/sequence-diagram/deprecation-warning.tsx +++ b/src/components/markdown-renderer/replace-components/sequence-diagram/deprecation-warning.tsx @@ -2,6 +2,7 @@ import React from 'react' import { Alert } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { TranslatedExternalLink } from '../../../common/links/translated-external-link' +import links from '../../../../links.json' export const DeprecationWarning: React.FC = () => { useTranslation() @@ -10,7 +11,7 @@ export const DeprecationWarning: React.FC = () => {   - + ) } diff --git a/src/links.json b/src/links.json new file mode 100644 index 000000000..6addb7313 --- /dev/null +++ b/src/links.json @@ -0,0 +1,9 @@ +{ + "chatElement": "https://app.element.io/#/room/#hedgedoc:matrix.org", + "community": "https://community.codimd.org", + "faq": "https://community.codimd.org/t/frequently-asked-questions/190", + "githubOrg": "https://github.com/codimd/", + "mastodon": "https://social.codimd.org", + "translate": "https://translate.codimd.org", + "webpage": "https://codimd.org" +}