diff --git a/src/api/auth.ts b/src/api/auth/index.ts similarity index 87% rename from src/api/auth.ts rename to src/api/auth/index.ts index f57547533..6b0c050c4 100644 --- a/src/api/auth.ts +++ b/src/api/auth/index.ts @@ -1,6 +1,5 @@ -import { RegisterError } from '../components/landing/pages/register/register' -import { expectResponseCode, getApiUrl } from '../utils/apiUtils' -import { defaultFetchConfig } from './default' +import { RegisterError } from '../../components/register-page/register-page' +import { expectResponseCode, getApiUrl, defaultFetchConfig } from '../utils' export const doInternalLogin = async (username: string, password: string): Promise => { const response = await fetch(getApiUrl() + '/auth/internal', { diff --git a/src/api/config/index.ts b/src/api/config/index.ts index c4878dcfc..1cab3fb38 100644 --- a/src/api/config/index.ts +++ b/src/api/config/index.ts @@ -1,5 +1,4 @@ -import { expectResponseCode, getApiUrl } from '../../utils/apiUtils' -import { defaultFetchConfig } from '../default' +import { expectResponseCode, getApiUrl, defaultFetchConfig } from '../utils' import { Config } from './types' export const getConfig = async (): Promise => { diff --git a/src/api/config/types.ts b/src/api/config/types.d.ts similarity index 100% rename from src/api/config/types.ts rename to src/api/config/types.d.ts diff --git a/src/api/default.ts b/src/api/default.ts deleted file mode 100644 index 971ca0044..000000000 --- a/src/api/default.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const defaultFetchConfig: Partial = { - mode: 'cors', - cache: 'no-cache', - credentials: 'same-origin', - headers: { - 'Content-Type': 'application/json' - }, - redirect: 'follow', - referrerPolicy: 'no-referrer' -} diff --git a/src/api/history.ts b/src/api/history/index.ts similarity index 87% rename from src/api/history.ts rename to src/api/history/index.ts index 6acaa3874..a00e34050 100644 --- a/src/api/history.ts +++ b/src/api/history/index.ts @@ -1,6 +1,6 @@ -import { HistoryEntry } from '../components/landing/pages/history/history' -import { expectResponseCode, getApiUrl } from '../utils/apiUtils' -import { defaultFetchConfig } from './default' + +import { expectResponseCode, getApiUrl, defaultFetchConfig } from '../utils' +import { HistoryEntry } from '../../components/history-page/history-page' export const getHistory = async (): Promise => { const response = await fetch(getApiUrl() + '/history') diff --git a/src/api/me.ts b/src/api/me/index.ts similarity index 87% rename from src/api/me.ts rename to src/api/me/index.ts index 0e00a3dbe..4b2706678 100644 --- a/src/api/me.ts +++ b/src/api/me/index.ts @@ -1,6 +1,5 @@ -import { LoginProvider } from '../redux/user/types' -import { expectResponseCode, getApiUrl } from '../utils/apiUtils' -import { defaultFetchConfig } from './default' +import { LoginProvider } from '../../redux/user/types' +import { expectResponseCode, getApiUrl, defaultFetchConfig } from '../utils' export const getMe = async (): Promise => { const response = await fetch(getApiUrl() + '/me', { diff --git a/src/api/imageProxy.ts b/src/api/media/index.ts similarity index 61% rename from src/api/imageProxy.ts rename to src/api/media/index.ts index 042235093..2f7fb2c4e 100644 --- a/src/api/imageProxy.ts +++ b/src/api/media/index.ts @@ -1,6 +1,5 @@ -import { ImageProxyResponse } from '../components/editor/markdown-renderer/replace-components/image/types' -import { expectResponseCode, getApiUrl } from '../utils/apiUtils' -import { defaultFetchConfig } from './default' +import { ImageProxyResponse } from '../../components/markdown-renderer/replace-components/image/types' +import { expectResponseCode, getApiUrl, defaultFetchConfig } from '../utils' export const getProxiedUrl = async (imageUrl: string): Promise => { const response = await fetch(getApiUrl() + '/media/proxy', { diff --git a/src/api/note.ts b/src/api/notes/index.ts similarity index 86% rename from src/api/note.ts rename to src/api/notes/index.ts index 761789a99..d96e1f8e8 100644 --- a/src/api/note.ts +++ b/src/api/notes/index.ts @@ -1,5 +1,4 @@ -import { expectResponseCode, getApiUrl } from '../utils/apiUtils' -import { defaultFetchConfig } from './default' +import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils' interface LastChange { userId: string diff --git a/src/api/utils.ts b/src/api/utils.ts new file mode 100644 index 000000000..0377f8482 --- /dev/null +++ b/src/api/utils.ts @@ -0,0 +1,22 @@ +import { store } from '../redux' + +export const defaultFetchConfig: Partial = { + mode: 'cors', + cache: 'no-cache', + credentials: 'same-origin', + headers: { + 'Content-Type': 'application/json' + }, + redirect: 'follow', + referrerPolicy: 'no-referrer' +} + +export const getApiUrl = (): string => { + return store.getState().apiUrl.apiUrl +} + +export const expectResponseCode = (response: Response, code = 200): void => { + if (response.status !== code) { + throw new Error(`response code is not ${code}`) + } +} diff --git a/src/components/application-loader/initializers/configLoader.ts b/src/components/application-loader/initializers/configLoader.ts index b7fcc3923..3b31c35f8 100644 --- a/src/components/application-loader/initializers/configLoader.ts +++ b/src/components/application-loader/initializers/configLoader.ts @@ -2,7 +2,7 @@ import { getConfig } from '../../../api/config' import { setApiUrl } from '../../../redux/api-url/methods' import { setBanner } from '../../../redux/banner/methods' import { setConfig } from '../../../redux/config/methods' -import { getAndSetUser } from '../../../utils/apiUtils' +import { getAndSetUser } from '../../login-page/auth/utils' export const loadAllConfig: (baseUrl: string) => Promise = async (baseUrl) => { setApiUrl({ diff --git a/src/components/common/element-separator/element-separator.tsx b/src/components/common/element-separator/element-separator.tsx deleted file mode 100644 index f8888c3f9..000000000 --- a/src/components/common/element-separator/element-separator.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React, { Fragment } from 'react' -import { ShowIf } from '../show-if/show-if' - -export interface ElementSeparatorProps { - separator: React.ReactElement -} - -export const ElementSeparator: React.FC = ({ children, separator }) => { - return ( - - { - React.Children - .toArray(children) - .filter(child => child !== null) - .map((child, index) => { - return ( - - 0}> - {separator} - - {child} - - ) - }) - } - - ) -} diff --git a/src/components/common/icon-button/icon-button.scss b/src/components/common/icon-button/icon-button.scss index 342fcf307..c4e1385c2 100644 --- a/src/components/common/icon-button/icon-button.scss +++ b/src/components/common/icon-button/icon-button.scss @@ -1,11 +1,17 @@ .btn-icon { - padding: 0.375rem 0.375rem; - border-right: 1px solid rgba(0, 0, 0, 0.2); - display: flex; + + &.with-border { + .icon-part { + border-right: 1px solid rgba(0, 0, 0, 0.2); + } + + .text-part { + padding: 0.375rem 0.75rem; + } + } .icon-part { padding: 0.375rem 0.375rem; - border-right: 1px solid rgba(0, 0, 0, 0.2); display: flex; .social-icon { @@ -14,7 +20,7 @@ } .text-part { - padding: 0.375rem 0.75rem; + padding: 0.375rem 0.75rem 0.375rem 0; } } diff --git a/src/components/common/icon-button/icon-button.tsx b/src/components/common/icon-button/icon-button.tsx index 795308af8..da43d7bf0 100644 --- a/src/components/common/icon-button/icon-button.tsx +++ b/src/components/common/icon-button/icon-button.tsx @@ -3,15 +3,15 @@ import { Button, ButtonProps } from 'react-bootstrap' import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' import './icon-button.scss' -export interface SocialButtonProps extends ButtonProps { +export interface IconButtonProps extends ButtonProps { icon: IconName onClick?: () => void + border?: boolean } -export const IconButton: React.FC = ({ icon, children, variant, onClick }) => { +export const IconButton: React.FC = ({ icon, children, border = false, ...props }) => { return ( - + setShowReadOnly(true)} i18nKey={'editor.documentBar.permissions'}/> setShowReadOnly(false)} diff --git a/src/components/editor/document-bar/buttons/pin-to-history-button.tsx b/src/components/editor/document-bar/buttons/pin-to-history-button.tsx new file mode 100644 index 000000000..4b945a69e --- /dev/null +++ b/src/components/editor/document-bar/buttons/pin-to-history-button.tsx @@ -0,0 +1,12 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +import { TranslatedIconButton } from '../../../common/icon-button/translated-icon-button' + +export const PinToHistoryButton: React.FC = () => { + useTranslation() + + const isPinned = true + const i18nKey = isPinned ? 'editor.documentBar.pinNoteToHistory' : 'editor.documentBar.pinnedToHistory' + + return +} diff --git a/src/components/editor/document-bar/buttons/revision-button.tsx b/src/components/editor/document-bar/buttons/revision-button.tsx new file mode 100644 index 000000000..823dd2bf7 --- /dev/null +++ b/src/components/editor/document-bar/buttons/revision-button.tsx @@ -0,0 +1,6 @@ +import React from 'react' +import { TranslatedIconButton } from '../../../common/icon-button/translated-icon-button' + +export const RevisionButton: React.FC = () => { + return +} diff --git a/src/components/editor/document-bar/share-link-button.tsx b/src/components/editor/document-bar/buttons/share-link-button.tsx similarity index 56% rename from src/components/editor/document-bar/share-link-button.tsx rename to src/components/editor/document-bar/buttons/share-link-button.tsx index 7c0ba3f41..006bc57d4 100644 --- a/src/components/editor/document-bar/share-link-button.tsx +++ b/src/components/editor/document-bar/buttons/share-link-button.tsx @@ -1,19 +1,16 @@ import React, { Fragment, useState } from 'react' -import { Button, Modal } from 'react-bootstrap' +import { Modal } from 'react-bootstrap' import { Trans } from 'react-i18next' -import { CopyableField } from '../../common/copyable-field/copyable-field' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { CommonModal } from '../../common/modals/common-modal' +import { CopyableField } from '../../../common/copyable-field/copyable-field' +import { CommonModal } from '../../../common/modals/common-modal' +import { TranslatedIconButton } from '../../../common/icon-button/translated-icon-button' export const ShareLinkButton: React.FC = () => { const [showReadOnly, setShowReadOnly] = useState(false) return ( - + setShowReadOnly(true)} i18nKey={'editor.documentBar.shareLink'}/> setShowReadOnly(false)} diff --git a/src/components/editor/document-bar/connection-indicator/user-line.tsx b/src/components/editor/document-bar/connection-indicator/user-line.tsx index 42d9c9050..5c2d1e80d 100644 --- a/src/components/editor/document-bar/connection-indicator/user-line.tsx +++ b/src/components/editor/document-bar/connection-indicator/user-line.tsx @@ -1,5 +1,5 @@ import React, { Fragment } from 'react' -import { UserAvatar } from '../../../landing/layout/user-avatar/user-avatar' +import { UserAvatar } from '../../../common/user-avatar/user-avatar' import { ActiveIndicator, ActiveIndicatorStatus } from './active-indicator' import './user-line.scss' diff --git a/src/components/editor/document-bar/document-bar.tsx b/src/components/editor/document-bar/document-bar.tsx index d6f3b988f..ef85b40d0 100644 --- a/src/components/editor/document-bar/document-bar.tsx +++ b/src/components/editor/document-bar/document-bar.tsx @@ -1,14 +1,14 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { ConnectionIndicator } from './connection-indicator/connection-indicator' -import { DocumentInfoButton } from './document-info-button' -import { EditorMenu } from './editor-menu' -import { ExportMenu } from './export-menu' -import { ImportMenu } from './import-menu' -import { PermissionButton } from './permission-button' -import { PinToHistoryButton } from './pin-to-history-button' -import { ShareLinkButton } from './share-link-button' -import { RevisionButton } from './revision-button' +import { DocumentInfoButton } from './document-info/document-info-button' +import { EditorMenu } from './menus/editor-menu' +import { ExportMenu } from './menus/export-menu' +import { ImportMenu } from './menus/import-menu' +import { PermissionButton } from './buttons/permission-button' +import { PinToHistoryButton } from './buttons/pin-to-history-button' +import { ShareLinkButton } from './buttons/share-link-button' +import { RevisionButton } from './buttons/revision-button' export interface DocumentBarProps { title: string diff --git a/src/components/editor/document-bar/document-info-time-line-helper/unitalic-bold-text.scss b/src/components/editor/document-bar/document-info-time-line-helper/unitalic-bold-text.scss deleted file mode 100644 index e4b91dcfe..000000000 --- a/src/components/editor/document-bar/document-info-time-line-helper/unitalic-bold-text.scss +++ /dev/null @@ -1,3 +0,0 @@ -.font-style-normal { - font-style: normal; -} diff --git a/src/components/editor/document-bar/document-info-time-line-helper/unitalic-bold-text.tsx b/src/components/editor/document-bar/document-info-time-line-helper/unitalic-bold-text.tsx deleted file mode 100644 index ec37be6ea..000000000 --- a/src/components/editor/document-bar/document-info-time-line-helper/unitalic-bold-text.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' -import './unitalic-bold-text.scss' - -export interface BoldTextProps { - text: string ; -} - -export const UnitalicBoldText: React.FC = ({ text }) => { - return {text} -} diff --git a/src/components/editor/document-bar/document-info-button.tsx b/src/components/editor/document-bar/document-info/document-info-button.tsx similarity index 79% rename from src/components/editor/document-bar/document-info-button.tsx rename to src/components/editor/document-bar/document-info/document-info-button.tsx index 0952f4459..19a5b3614 100644 --- a/src/components/editor/document-bar/document-info-button.tsx +++ b/src/components/editor/document-bar/document-info/document-info-button.tsx @@ -1,12 +1,12 @@ import moment from 'moment' import React, { Fragment, useState } from 'react' -import { Button, ListGroup, Modal } from 'react-bootstrap' +import { ListGroup, Modal } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' -import { CommonModal } from '../../common/modals/common-modal' +import { CommonModal } from '../../../common/modals/common-modal' import { DocumentInfoLine } from './document-info-line' import { DocumentInfoLineWithTimeMode, DocumentInfoTimeLine } from './document-info-time-line' -import { UnitalicBoldText } from './document-info-time-line-helper/unitalic-bold-text' +import { UnitalicBoldText } from './unitalic-bold-text' +import { TranslatedIconButton } from '../../../common/icon-button/translated-icon-button' export const DocumentInfoButton: React.FC = () => { const [showModal, setShowModal] = useState(false) @@ -14,10 +14,7 @@ export const DocumentInfoButton: React.FC = () => { return ( - + setShowModal(true)} i18nKey={'editor.documentBar.documentInfo'}/> setShowModal(false)} diff --git a/src/components/editor/document-bar/document-info-line.tsx b/src/components/editor/document-bar/document-info/document-info-line.tsx similarity index 82% rename from src/components/editor/document-bar/document-info-line.tsx rename to src/components/editor/document-bar/document-info/document-info-line.tsx index 9a4b9e539..cd19d6cfb 100644 --- a/src/components/editor/document-bar/document-info-line.tsx +++ b/src/components/editor/document-bar/document-info/document-info-line.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { ForkAwesomeIcon, IconName } from '../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon, IconName } from '../../../common/fork-awesome/fork-awesome-icon' export interface DocumentInfoLineProps { icon: IconName diff --git a/src/components/editor/document-bar/document-info-time-line.scss b/src/components/editor/document-bar/document-info/document-info-time-line.scss similarity index 100% rename from src/components/editor/document-bar/document-info-time-line.scss rename to src/components/editor/document-bar/document-info/document-info-time-line.scss diff --git a/src/components/editor/document-bar/document-info-time-line.tsx b/src/components/editor/document-bar/document-info/document-info-time-line.tsx similarity index 83% rename from src/components/editor/document-bar/document-info-time-line.tsx rename to src/components/editor/document-bar/document-info/document-info-time-line.tsx index 119549e9e..d22d12d36 100644 --- a/src/components/editor/document-bar/document-info-time-line.tsx +++ b/src/components/editor/document-bar/document-info/document-info-time-line.tsx @@ -1,11 +1,11 @@ import { Moment } from 'moment' import React from 'react' import { Trans, useTranslation } from 'react-i18next' -import { IconName } from '../../common/fork-awesome/fork-awesome-icon' +import { IconName } from '../../../common/fork-awesome/fork-awesome-icon' import { DocumentInfoLine } from './document-info-line' import './document-info-time-line.scss' -import { TimeFromNow } from './document-info-time-line-helper/time-from-now' -import { UserAvatar } from '../../landing/layout/user-avatar/user-avatar' +import { TimeFromNow } from './time-from-now' +import { UserAvatar } from '../../../common/user-avatar/user-avatar' export interface DocumentInfoLineWithTimeProps { time: Moment, diff --git a/src/components/editor/document-bar/document-info-time-line-helper/time-from-now.tsx b/src/components/editor/document-bar/document-info/time-from-now.tsx similarity index 65% rename from src/components/editor/document-bar/document-info-time-line-helper/time-from-now.tsx rename to src/components/editor/document-bar/document-info/time-from-now.tsx index d2814c6e0..fef7e334e 100644 --- a/src/components/editor/document-bar/document-info-time-line-helper/time-from-now.tsx +++ b/src/components/editor/document-bar/document-info/time-from-now.tsx @@ -1,11 +1,11 @@ import { Moment } from 'moment' import React from 'react' -export interface ItalicTime { +export interface TimeFromNowProps { time: Moment } -export const TimeFromNow: React.FC = ({ time }) => { +export const TimeFromNow: React.FC = ({ time }) => { return ( ) diff --git a/src/components/editor/document-bar/document-info/unitalic-bold-text.tsx b/src/components/editor/document-bar/document-info/unitalic-bold-text.tsx new file mode 100644 index 000000000..645e25df4 --- /dev/null +++ b/src/components/editor/document-bar/document-info/unitalic-bold-text.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +export interface UnitalicBoldTextProps { + text: string ; +} + +export const UnitalicBoldText: React.FC = ({ text }) => { + return {text} +} diff --git a/src/components/editor/document-bar/editor-menu.tsx b/src/components/editor/document-bar/menus/editor-menu.tsx similarity index 89% rename from src/components/editor/document-bar/editor-menu.tsx rename to src/components/editor/document-bar/menus/editor-menu.tsx index 132671798..6f02065da 100644 --- a/src/components/editor/document-bar/editor-menu.tsx +++ b/src/components/editor/document-bar/menus/editor-menu.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { DropdownItemWithDeletionModal } from '../../landing/pages/history/common/entry-menu/dropdown-item-with-deletion-modal' +import { DropdownItemWithDeletionModal } from '../../../history-page/entry-menu/dropdown-item-with-deletion-modal' export interface EditorMenuProps { noteTitle: string diff --git a/src/components/editor/document-bar/export-menu.tsx b/src/components/editor/document-bar/menus/export-menu.tsx similarity index 91% rename from src/components/editor/document-bar/export-menu.tsx rename to src/components/editor/document-bar/menus/export-menu.tsx index a80715c82..729e85f8f 100644 --- a/src/components/editor/document-bar/export-menu.tsx +++ b/src/components/editor/document-bar/menus/export-menu.tsx @@ -1,8 +1,8 @@ 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 { TranslatedExternalLink } from '../../common/links/translated-external-link' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { TranslatedExternalLink } from '../../../common/links/translated-external-link' const ExportMenu: React.FC = () => { useTranslation() diff --git a/src/components/editor/document-bar/import-menu.tsx b/src/components/editor/document-bar/menus/import-menu.tsx similarity index 91% rename from src/components/editor/document-bar/import-menu.tsx rename to src/components/editor/document-bar/menus/import-menu.tsx index bb5534d82..19173d619 100644 --- a/src/components/editor/document-bar/import-menu.tsx +++ b/src/components/editor/document-bar/menus/import-menu.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Dropdown } from 'react-bootstrap' import { Trans } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' export const ImportMenu: React.FC = () => { return ( diff --git a/src/components/editor/document-bar/pin-to-history-button.tsx b/src/components/editor/document-bar/pin-to-history-button.tsx deleted file mode 100644 index 36d4ca403..000000000 --- a/src/components/editor/document-bar/pin-to-history-button.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import { Button } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' - -export const PinToHistoryButton: React.FC = () => { - useTranslation() - - const isPinned = true - const i18nKey = isPinned ? 'editor.documentBar.pinNoteToHistory' : 'editor.documentBar.pinnedToHistory' - - return ( - - ) -} diff --git a/src/components/editor/document-bar/revision-button.tsx b/src/components/editor/document-bar/revision-button.tsx deleted file mode 100644 index 6899c6a4f..000000000 --- a/src/components/editor/document-bar/revision-button.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react' -import { Button } from 'react-bootstrap' -import { Trans } from 'react-i18next' -import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' - -export const RevisionButton: React.FC = () => { - return ( - - ) -} diff --git a/src/components/editor/renderer-window/markdown-render-window.tsx b/src/components/editor/document-renderer-pane/document-render-pane.tsx similarity index 80% rename from src/components/editor/renderer-window/markdown-render-window.tsx rename to src/components/editor/document-renderer-pane/document-render-pane.tsx index 104cc1b30..64571dff1 100644 --- a/src/components/editor/renderer-window/markdown-render-window.tsx +++ b/src/components/editor/document-renderer-pane/document-render-pane.tsx @@ -4,18 +4,18 @@ import useResizeObserver from 'use-resize-observer' import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { ShowIf } from '../../common/show-if/show-if' -import { MarkdownRenderer } from '../markdown-renderer/markdown-renderer' -import { MarkdownToc } from '../markdown-toc/markdown-toc' +import { MarkdownRenderer } from '../../markdown-renderer/markdown-renderer' import { YAMLMetaData } from '../yaml-metadata/yaml-metadata' +import { TableOfContents } from '../table-of-contents/table-of-contents' -interface RenderWindowProps { +interface DocumentRenderPaneProps { content: string onMetadataChange: (metaData: YAMLMetaData | undefined) => void onFirstHeadingChange: (firstHeading: string | undefined) => void wide?: boolean } -export const MarkdownRenderWindow: React.FC = ({ content, onMetadataChange, onFirstHeadingChange, wide }) => { +export const DocumentRenderPane: React.FC = ({ content, onMetadataChange, onFirstHeadingChange, wide }) => { const [tocAst, setTocAst] = useState() const renderer = useRef(null) const { width } = useResizeObserver({ ref: renderer }) @@ -36,7 +36,7 @@ export const MarkdownRenderWindow: React.FC = ({ content, onM
= 1280 && !!tocAst}> - +
@@ -46,7 +46,7 @@ export const MarkdownRenderWindow: React.FC = ({ content, onM
- +
diff --git a/src/components/editor/editor-window/editor-window.scss b/src/components/editor/editor-pane/editor-pane.scss similarity index 100% rename from src/components/editor/editor-window/editor-window.scss rename to src/components/editor/editor-pane/editor-pane.scss diff --git a/src/components/editor/editor-window/editor-window.tsx b/src/components/editor/editor-pane/editor-pane.tsx similarity index 93% rename from src/components/editor/editor-window/editor-window.tsx rename to src/components/editor/editor-pane/editor-pane.tsx index 133956b5d..53a87b83f 100644 --- a/src/components/editor/editor-window/editor-window.tsx +++ b/src/components/editor/editor-pane/editor-pane.tsx @@ -23,19 +23,19 @@ import 'codemirror/mode/gfm/gfm' import React, { useCallback, useMemo, useState } from 'react' import { Controlled as ControlledCodeMirror } from 'react-codemirror2' import { useTranslation } from 'react-i18next' -import './editor-window.scss' -import { emojiHints, emojiWordRegex, findWordAtCursor } from './hints/emoji' +import './editor-pane.scss' +import { generateEmojiHints, emojiWordRegex, findWordAtCursor } from './hints/emoji' import { defaultKeyMap } from './key-map' import { createStatusInfo, defaultState, StatusBar, StatusBarInfo } from './status-bar/status-bar' import { ToolBar } from './tool-bar/tool-bar' -export interface EditorWindowProps { +export interface EditorPaneProps { onContentChange: (content: string) => void content: string } const hintOptions = { - hint: emojiHints, + hint: generateEmojiHints, completeSingle: false, completeOnSingleClick: false, alignWithWord: true @@ -48,7 +48,7 @@ const onChange = (editor: Editor) => { } } -export const EditorWindow: React.FC = ({ onContentChange, content }) => { +export const EditorPane: React.FC = ({ onContentChange, content }) => { const { t } = useTranslation() const [editor, setEditor] = useState() const [statusBarInfo, setStatusBarInfo] = useState(defaultState) diff --git a/src/components/editor/editor-window/hints.scss b/src/components/editor/editor-pane/hints.scss similarity index 100% rename from src/components/editor/editor-window/hints.scss rename to src/components/editor/editor-pane/hints.scss diff --git a/src/components/editor/editor-window/hints/emoji.ts b/src/components/editor/editor-pane/hints/emoji.ts similarity index 92% rename from src/components/editor/editor-window/hints/emoji.ts rename to src/components/editor/editor-pane/hints/emoji.ts index 2fa0eb101..6ed290e47 100644 --- a/src/components/editor/editor-window/hints/emoji.ts +++ b/src/components/editor/editor-pane/hints/emoji.ts @@ -1,7 +1,7 @@ import { Editor, Hint, Hints, Pos } from 'codemirror' import { Data, EmojiData, NimbleEmojiIndex } from 'emoji-mart' import data from 'emoji-mart/data/twitter.json' -import { getEmojiIcon, getEmojiShortCode } from '../../../../utils/emoji' +import { getEmojiIcon, getEmojiShortCode } from '../tool-bar/utils/emojiUtils' import { customEmojis } from '../tool-bar/emoji-picker/emoji-picker' interface findWordAtCursorResponse { @@ -12,7 +12,6 @@ interface findWordAtCursorResponse { const allowedCharsInEmojiCodeRegex = /(:|\w|-|_|\+)/ const emojiIndex = new NimbleEmojiIndex(data as unknown as Data) - export const emojiWordRegex = /^:((\w|-|_|\+)+)$/ export const findWordAtCursor = (editor: Editor): findWordAtCursorResponse => { @@ -34,7 +33,7 @@ export const findWordAtCursor = (editor: Editor): findWordAtCursorResponse => { } } -export const emojiHints = (editor: Editor): Promise< Hints| null > => { +export const generateEmojiHints = (editor: Editor): Promise< Hints| null > => { return new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) const searchResult = emojiWordRegex.exec(searchTerm.text) diff --git a/src/components/editor/editor-window/key-map.ts b/src/components/editor/editor-pane/key-map.ts similarity index 98% rename from src/components/editor/editor-window/key-map.ts rename to src/components/editor/editor-pane/key-map.ts index 6806921f4..326a817f7 100644 --- a/src/components/editor/editor-window/key-map.ts +++ b/src/components/editor/editor-pane/key-map.ts @@ -5,7 +5,7 @@ import { markSelection, strikeThroughSelection, underlineSelection -} from './tool-bar/utils' +} from './tool-bar/utils/toolbarButtonUtils' const isMac = navigator.platform.toLowerCase().includes('mac') diff --git a/src/components/editor/editor-window/one-dark.css b/src/components/editor/editor-pane/one-dark.css similarity index 100% rename from src/components/editor/editor-window/one-dark.css rename to src/components/editor/editor-pane/one-dark.css diff --git a/src/components/editor/editor-window/status-bar/status-bar.scss b/src/components/editor/editor-pane/status-bar/status-bar.scss similarity index 100% rename from src/components/editor/editor-window/status-bar/status-bar.scss rename to src/components/editor/editor-pane/status-bar/status-bar.scss diff --git a/src/components/editor/editor-window/status-bar/status-bar.tsx b/src/components/editor/editor-pane/status-bar/status-bar.tsx similarity index 100% rename from src/components/editor/editor-window/status-bar/status-bar.tsx rename to src/components/editor/editor-pane/status-bar/status-bar.tsx diff --git a/src/components/editor/editor-window/tool-bar/editor-preferences/editor-preference-select.tsx b/src/components/editor/editor-pane/tool-bar/editor-preferences/editor-preference-select.tsx similarity index 100% rename from src/components/editor/editor-window/tool-bar/editor-preferences/editor-preference-select.tsx rename to src/components/editor/editor-pane/tool-bar/editor-preferences/editor-preference-select.tsx diff --git a/src/components/editor/editor-window/tool-bar/editor-preferences/editor-preferences.tsx b/src/components/editor/editor-pane/tool-bar/editor-preferences/editor-preferences.tsx similarity index 100% rename from src/components/editor/editor-window/tool-bar/editor-preferences/editor-preferences.tsx rename to src/components/editor/editor-pane/tool-bar/editor-preferences/editor-preferences.tsx diff --git a/src/components/editor/editor-window/tool-bar/emoji-picker-button.tsx b/src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx similarity index 82% rename from src/components/editor/editor-window/tool-bar/emoji-picker-button.tsx rename to src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx index 7ac317b17..0949b7d5e 100644 --- a/src/components/editor/editor-window/tool-bar/emoji-picker-button.tsx +++ b/src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker-button.tsx @@ -2,9 +2,9 @@ import CodeMirror from 'codemirror' import React, { Fragment, useState } from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' -import { EmojiPicker } from './emoji-picker/emoji-picker' -import { addEmoji } from './utils' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { EmojiPicker } from './emoji-picker' +import { addEmoji } from '../utils/toolbarButtonUtils' export interface EmojiPickerButtonProps { editor: CodeMirror.Editor diff --git a/src/components/editor/editor-window/tool-bar/emoji-picker/emoji-picker.scss b/src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker.scss similarity index 100% rename from src/components/editor/editor-window/tool-bar/emoji-picker/emoji-picker.scss rename to src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker.scss diff --git a/src/components/editor/editor-window/tool-bar/emoji-picker/emoji-picker.tsx b/src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker.tsx similarity index 94% rename from src/components/editor/editor-window/tool-bar/emoji-picker/emoji-picker.tsx rename to src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker.tsx index 94266f0da..6e39a8b6a 100644 --- a/src/components/editor/editor-window/tool-bar/emoji-picker/emoji-picker.tsx +++ b/src/components/editor/editor-pane/tool-bar/emoji-picker/emoji-picker.tsx @@ -6,6 +6,7 @@ import { useClickAway } from 'react-use' import { ShowIf } from '../../../../common/show-if/show-if' import './emoji-picker.scss' import { ForkAwesomeIcons } from './icon-names' +import forkawesomeIcon from './forkawesome.png' export interface EmojiPickerProps { show: boolean @@ -19,7 +20,7 @@ export const customEmojis: CustomEmoji[] = Object.keys(ForkAwesomeIcons).map((na text: '', emoticons: [], keywords: ['fork awesome'], - imageUrl: '/img/forkawesome.png', + imageUrl: forkawesomeIcon, customCategory: 'ForkAwesome' })) diff --git a/public/img/forkawesome.png b/src/components/editor/editor-pane/tool-bar/emoji-picker/forkawesome.png similarity index 100% rename from public/img/forkawesome.png rename to src/components/editor/editor-pane/tool-bar/emoji-picker/forkawesome.png diff --git a/src/components/editor/editor-window/tool-bar/emoji-picker/icon-names.ts b/src/components/editor/editor-pane/tool-bar/emoji-picker/icon-names.ts similarity index 100% rename from src/components/editor/editor-window/tool-bar/emoji-picker/icon-names.ts rename to src/components/editor/editor-pane/tool-bar/emoji-picker/icon-names.ts diff --git a/src/components/editor/editor-window/tool-bar/tool-bar.scss b/src/components/editor/editor-pane/tool-bar/tool-bar.scss similarity index 100% rename from src/components/editor/editor-window/tool-bar/tool-bar.scss rename to src/components/editor/editor-pane/tool-bar/tool-bar.scss diff --git a/src/components/editor/editor-window/tool-bar/tool-bar.tsx b/src/components/editor/editor-pane/tool-bar/tool-bar.tsx similarity index 97% rename from src/components/editor/editor-window/tool-bar/tool-bar.tsx rename to src/components/editor/editor-pane/tool-bar/tool-bar.tsx index 33fbfb73e..f2819fc72 100644 --- a/src/components/editor/editor-window/tool-bar/tool-bar.tsx +++ b/src/components/editor/editor-pane/tool-bar/tool-bar.tsx @@ -4,7 +4,7 @@ import { Button, ButtonGroup, ButtonToolbar } from 'react-bootstrap' import { useTranslation } from 'react-i18next' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' import { EditorPreferences } from './editor-preferences/editor-preferences' -import { EmojiPickerButton } from './emoji-picker-button' +import { EmojiPickerButton } from './emoji-picker/emoji-picker-button' import './tool-bar.scss' import { addCodeFences, @@ -24,7 +24,7 @@ import { subscriptSelection, superscriptSelection, underlineSelection -} from './utils' +} from './utils/toolbarButtonUtils' export interface ToolBarProps { editor: Editor | undefined diff --git a/src/utils/emoji.ts b/src/components/editor/editor-pane/tool-bar/utils/emojiUtils.ts similarity index 100% rename from src/utils/emoji.ts rename to src/components/editor/editor-pane/tool-bar/utils/emojiUtils.ts diff --git a/src/components/editor/editor-window/tool-bar/utils.test.ts b/src/components/editor/editor-pane/tool-bar/utils/toolbarButtonUtils.test.ts similarity index 99% rename from src/components/editor/editor-window/tool-bar/utils.test.ts rename to src/components/editor/editor-pane/tool-bar/utils/toolbarButtonUtils.test.ts index 3f8f4eeca..40290aba1 100644 --- a/src/components/editor/editor-window/tool-bar/utils.test.ts +++ b/src/components/editor/editor-pane/tool-bar/utils/toolbarButtonUtils.test.ts @@ -21,7 +21,7 @@ import { subscriptSelection, superscriptSelection, underlineSelection -} from './utils' +} from './toolbarButtonUtils' Mock.configure('jest') diff --git a/src/components/editor/editor-window/tool-bar/utils.ts b/src/components/editor/editor-pane/tool-bar/utils/toolbarButtonUtils.ts similarity index 98% rename from src/components/editor/editor-window/tool-bar/utils.ts rename to src/components/editor/editor-pane/tool-bar/utils/toolbarButtonUtils.ts index 8b0c8017e..27c323926 100644 --- a/src/components/editor/editor-window/tool-bar/utils.ts +++ b/src/components/editor/editor-pane/tool-bar/utils/toolbarButtonUtils.ts @@ -1,6 +1,6 @@ import { Editor } from 'codemirror' import { EmojiData } from 'emoji-mart' -import { getEmojiShortCode } from '../../../../utils/emoji' +import { getEmojiShortCode } from './emojiUtils' export const makeSelectionBold = (editor: Editor): void => wrapTextWith(editor, '**') export const makeSelectionItalic = (editor: Editor): void => wrapTextWith(editor, '*') diff --git a/src/components/editor/editor.tsx b/src/components/editor/editor.tsx index 7eb32cc3f..df6e13f9f 100644 --- a/src/components/editor/editor.tsx +++ b/src/components/editor/editor.tsx @@ -5,15 +5,15 @@ import useMedia from 'use-media' import { ApplicationState } from '../../redux' import { setEditorModeConfig } from '../../redux/editor/methods' import { DocumentTitle } from '../common/document-title/document-title' -import { Splitter } from '../common/splitter/splitter' -import { InfoBanner } from '../landing/layout/info-banner' +import { DocumentRenderPane } from './document-renderer-pane/document-render-pane' +import { EditorPane } from './editor-pane/editor-pane' +import { Splitter } from './splitter/splitter' +import { MotdBanner } from '../common/motd-banner/motd-banner' import { DocumentBar } from './document-bar/document-bar' -import { EditorWindow } from './editor-window/editor-window' import { editorTestContent } from './editorTestContent' -import { MarkdownRenderWindow } from './renderer-window/markdown-render-window' -import { EditorMode } from './task-bar/editor-view-mode' -import { TaskBar } from './task-bar/task-bar' import { YAMLMetaData } from './yaml-metadata/yaml-metadata' +import { AppBar } from './app-bar/app-bar' +import { EditorMode } from './app-bar/editor-view-mode' export interface EditorPathParams { id: string @@ -62,21 +62,21 @@ export const Editor: React.FC = () => { return ( - +
- + setMarkdownContent(content)} content={markdownContent}/> } showRight={editorMode === EditorMode.PREVIEW || (editorMode === EditorMode.BOTH)} right={ - { + return encodeURIComponent(String(content).trim().toLowerCase().replace(/\s+/g, '-')) +} + const convertLevel = (toc: TocAst, levelsToShowUnderThis: number, headerCounts: Map, wrapInListItem: boolean): ReactElement | null => { if (levelsToShowUnderThis < 0) { return null @@ -48,7 +51,7 @@ const convertLevel = (toc: TocAst, levelsToShowUnderThis: number, headerCounts: } } -export const MarkdownToc: React.FC = ({ ast, maxDepth = 3, sticky }) => { +export const TableOfContents: React.FC = ({ ast, maxDepth = 3, sticky }) => { const tocTree = useMemo(() => convertLevel(ast, maxDepth, new Map(), false), [ast, maxDepth]) return ( diff --git a/src/components/landing/pages/history/common/entry-menu/delete-note-item.tsx b/src/components/history-page/entry-menu/delete-note-item.tsx similarity index 100% rename from src/components/landing/pages/history/common/entry-menu/delete-note-item.tsx rename to src/components/history-page/entry-menu/delete-note-item.tsx diff --git a/src/components/landing/pages/history/common/entry-menu/dropdown-item-with-deletion-modal.tsx b/src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx similarity index 89% rename from src/components/landing/pages/history/common/entry-menu/dropdown-item-with-deletion-modal.tsx rename to src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx index 783d697e4..0a340038c 100644 --- a/src/components/landing/pages/history/common/entry-menu/dropdown-item-with-deletion-modal.tsx +++ b/src/components/history-page/entry-menu/dropdown-item-with-deletion-modal.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useState } from 'react' import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon, IconName } from '../../../../../common/fork-awesome/fork-awesome-icon' -import { DeletionModal } from '../../../../../common/modals/deletion-modal' +import { ForkAwesomeIcon, IconName } from '../../common/fork-awesome/fork-awesome-icon' +import { DeletionModal } from '../../common/modals/deletion-modal' export interface DropdownItemWithDeletionModalProps { onConfirm: () => void diff --git a/src/components/landing/pages/history/common/entry-menu/entry-menu.scss b/src/components/history-page/entry-menu/entry-menu.scss similarity index 100% rename from src/components/landing/pages/history/common/entry-menu/entry-menu.scss rename to src/components/history-page/entry-menu/entry-menu.scss diff --git a/src/components/landing/pages/history/common/entry-menu/entry-menu.tsx b/src/components/history-page/entry-menu/entry-menu.tsx similarity index 90% rename from src/components/landing/pages/history/common/entry-menu/entry-menu.tsx rename to src/components/history-page/entry-menu/entry-menu.tsx index d0cfa6ef7..c0d7b916c 100644 --- a/src/components/landing/pages/history/common/entry-menu/entry-menu.tsx +++ b/src/components/history-page/entry-menu/entry-menu.tsx @@ -1,9 +1,9 @@ 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 { ShowIf } from '../../../../../common/show-if/show-if' -import { HistoryEntryOrigin } from '../../history' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../common/show-if/show-if' +import { HistoryEntryOrigin } from '../history-page' import './entry-menu.scss' import { DeleteNoteItem } from './delete-note-item' import { RemoveNoteEntryItem } from './remove-note-entry-item' diff --git a/src/components/landing/pages/history/common/entry-menu/remove-note-entry-item.tsx b/src/components/history-page/entry-menu/remove-note-entry-item.tsx similarity index 100% rename from src/components/landing/pages/history/common/entry-menu/remove-note-entry-item.tsx rename to src/components/history-page/entry-menu/remove-note-entry-item.tsx diff --git a/src/components/landing/pages/history/history-card/history-card-list.tsx b/src/components/history-page/history-card/history-card-list.tsx similarity index 93% rename from src/components/landing/pages/history/history-card/history-card-list.tsx rename to src/components/history-page/history-card/history-card-list.tsx index e3ee02bc4..786b5ca81 100644 --- a/src/components/landing/pages/history/history-card/history-card-list.tsx +++ b/src/components/history-page/history-card/history-card-list.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Row } from 'react-bootstrap' -import { Pager } from '../../../../common/pagination/pager' +import { Pager } from '../../common/pagination/pager' import { HistoryEntriesProps } from '../history-content/history-content' import { HistoryCard } from './history-card' diff --git a/src/components/landing/pages/history/history-card/history-card.scss b/src/components/history-page/history-card/history-card.scss similarity index 100% rename from src/components/landing/pages/history/history-card/history-card.scss rename to src/components/history-page/history-card/history-card.scss diff --git a/src/components/landing/pages/history/history-card/history-card.tsx b/src/components/history-page/history-card/history-card.tsx similarity index 88% rename from src/components/landing/pages/history/history-card/history-card.tsx rename to src/components/history-page/history-card/history-card.tsx index 2bf61484d..38c3376f7 100644 --- a/src/components/landing/pages/history/history-card/history-card.tsx +++ b/src/components/history-page/history-card/history-card.tsx @@ -2,10 +2,10 @@ import moment from 'moment' import React from 'react' import { Badge, Card } from 'react-bootstrap' import { Link } from 'react-router-dom' -import { formatHistoryDate } from '../../../../../utils/historyUtils' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { EntryMenu } from '../common/entry-menu/entry-menu' -import { PinButton } from '../common/pin-button' +import { formatHistoryDate } from '../utils' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { EntryMenu } from '../entry-menu/entry-menu' +import { PinButton } from '../pin-button/pin-button' import { HistoryEntryProps } from '../history-content/history-content' import './history-card.scss' diff --git a/src/components/landing/pages/history/history-content/history-content.tsx b/src/components/history-page/history-content/history-content.tsx similarity index 96% rename from src/components/landing/pages/history/history-content/history-content.tsx rename to src/components/history-page/history-content/history-content.tsx index d4367ca5a..7726624ba 100644 --- a/src/components/landing/pages/history/history-content/history-content.tsx +++ b/src/components/history-page/history-content/history-content.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useState } from 'react' import { Alert, Row } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { PagerPagination } from '../../../../common/pagination/pager-pagination' -import { HistoryEntryOrigin, LocatedHistoryEntry } from '../history' +import { PagerPagination } from '../../common/pagination/pager-pagination' +import { HistoryEntryOrigin, LocatedHistoryEntry } from '../history-page' import { HistoryCardList } from '../history-card/history-card-list' import { HistoryTable } from '../history-table/history-table' import { ViewStateEnum } from '../history-toolbar/history-toolbar' diff --git a/src/components/landing/pages/history/history.tsx b/src/components/history-page/history-page.tsx similarity index 95% rename from src/components/landing/pages/history/history.tsx rename to src/components/history-page/history-page.tsx index e0270fd46..066751081 100644 --- a/src/components/landing/pages/history/history.tsx +++ b/src/components/history-page/history-page.tsx @@ -2,9 +2,9 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac import { Row } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { deleteHistory, deleteHistoryEntry, getHistory, setHistory, updateHistoryEntry } from '../../../../api/history' -import { deleteNote } from '../../../../api/note' -import { ApplicationState } from '../../../../redux' +import { deleteHistory, deleteHistoryEntry, getHistory, setHistory, updateHistoryEntry } from '../../api/history' +import { deleteNote } from '../../api/notes' +import { ApplicationState } from '../../redux' import { collectEntries, downloadHistory, @@ -12,8 +12,8 @@ import { mergeEntryArrays, setHistoryToLocalStore, sortAndFilterEntries -} from '../../../../utils/historyUtils' -import { ErrorModal } from '../../../common/modals/error-modal' +} from './utils' +import { ErrorModal } from '../common/modals/error-modal' import { HistoryContent } from './history-content/history-content' import { HistoryToolbar, HistoryToolbarState, initState as toolbarInitState } from './history-toolbar/history-toolbar' @@ -41,7 +41,7 @@ export enum HistoryEntryOrigin { REMOTE = 'remote' } -export const History: React.FC = () => { +export const HistoryPage: React.FC = () => { useTranslation() const [localHistoryEntries, setLocalHistoryEntries] = useState(loadHistoryFromLocalStore) const [remoteHistoryEntries, setRemoteHistoryEntries] = useState([]) diff --git a/src/components/landing/pages/history/history-table/history-table-row.tsx b/src/components/history-page/history-table/history-table-row.tsx similarity index 86% rename from src/components/landing/pages/history/history-table/history-table-row.tsx rename to src/components/history-page/history-table/history-table-row.tsx index f25bbe742..8b448f164 100644 --- a/src/components/landing/pages/history/history-table/history-table-row.tsx +++ b/src/components/history-page/history-table/history-table-row.tsx @@ -1,9 +1,9 @@ import React from 'react' import { Badge } from 'react-bootstrap' import { Link } from 'react-router-dom' -import { formatHistoryDate } from '../../../../../utils/historyUtils' -import { EntryMenu } from '../common/entry-menu/entry-menu' -import { PinButton } from '../common/pin-button' +import { formatHistoryDate } from '../utils' +import { EntryMenu } from '../entry-menu/entry-menu' +import { PinButton } from '../pin-button/pin-button' import { HistoryEntryProps } from '../history-content/history-content' export const HistoryTableRow: React.FC = ({ entry, onPinClick, onRemoveClick, onDeleteClick }) => { diff --git a/src/components/landing/pages/history/history-table/history-table.scss b/src/components/history-page/history-table/history-table.scss similarity index 100% rename from src/components/landing/pages/history/history-table/history-table.scss rename to src/components/history-page/history-table/history-table.scss diff --git a/src/components/landing/pages/history/history-table/history-table.tsx b/src/components/history-page/history-table/history-table.tsx similarity index 95% rename from src/components/landing/pages/history/history-table/history-table.tsx rename to src/components/history-page/history-table/history-table.tsx index 134650bd4..3756bdcc2 100644 --- a/src/components/landing/pages/history/history-table/history-table.tsx +++ b/src/components/history-page/history-table/history-table.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Table } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { Pager } from '../../../../common/pagination/pager' +import { Pager } from '../../common/pagination/pager' import { HistoryEntriesProps } from '../history-content/history-content' import { HistoryTableRow } from './history-table-row' import './history-table.scss' diff --git a/src/components/landing/pages/history/history-toolbar/clear-history-button.tsx b/src/components/history-page/history-toolbar/clear-history-button.tsx similarity index 88% rename from src/components/landing/pages/history/history-toolbar/clear-history-button.tsx rename to src/components/history-page/history-toolbar/clear-history-button.tsx index f5752576f..17a9b6963 100644 --- a/src/components/landing/pages/history/history-toolbar/clear-history-button.tsx +++ b/src/components/history-page/history-toolbar/clear-history-button.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useState } from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { DeletionModal } from '../../../../common/modals/deletion-modal' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { DeletionModal } from '../../common/modals/deletion-modal' export interface ClearHistoryButtonProps { onClearHistory: () => void diff --git a/src/components/landing/pages/history/history-toolbar/export-history-button.tsx b/src/components/history-page/history-toolbar/export-history-button.tsx similarity index 85% rename from src/components/landing/pages/history/history-toolbar/export-history-button.tsx rename to src/components/history-page/history-toolbar/export-history-button.tsx index b8f7e6a76..709b5639e 100644 --- a/src/components/landing/pages/history/history-toolbar/export-history-button.tsx +++ b/src/components/history-page/history-toolbar/export-history-button.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Button } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' export interface ExportHistoryButtonProps { onExportHistory: () => void diff --git a/src/components/landing/pages/history/history-toolbar/history-toolbar.tsx b/src/components/history-page/history-toolbar/history-toolbar.tsx similarity index 94% rename from src/components/landing/pages/history/history-toolbar/history-toolbar.tsx rename to src/components/history-page/history-toolbar/history-toolbar.tsx index d1c0de14e..de8b6fdb1 100644 --- a/src/components/landing/pages/history/history-toolbar/history-toolbar.tsx +++ b/src/components/history-page/history-toolbar/history-toolbar.tsx @@ -3,11 +3,11 @@ import { Button, Form, FormControl, InputGroup, ToggleButton, ToggleButtonGroup import { Typeahead } from 'react-bootstrap-typeahead' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { ApplicationState } from '../../../../../redux' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { ShowIf } from '../../../../common/show-if/show-if' -import { SortButton, SortModeEnum } from '../../../../common/sort-button/sort-button' -import { HistoryEntry } from '../history' +import { ApplicationState } from '../../../redux' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../common/show-if/show-if' +import { SortButton, SortModeEnum } from '../sort-button/sort-button' +import { HistoryEntry } from '../history-page' import { ClearHistoryButton } from './clear-history-button' import { ExportHistoryButton } from './export-history-button' import { ImportHistoryButton } from './import-history-button' diff --git a/src/components/landing/pages/history/history-toolbar/import-history-button.tsx b/src/components/history-page/history-toolbar/import-history-button.tsx similarity index 90% rename from src/components/landing/pages/history/history-toolbar/import-history-button.tsx rename to src/components/history-page/history-toolbar/import-history-button.tsx index e71686e21..1e582672a 100644 --- a/src/components/landing/pages/history/history-toolbar/import-history-button.tsx +++ b/src/components/history-page/history-toolbar/import-history-button.tsx @@ -1,10 +1,10 @@ import React, { useRef, useState } from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { convertV1History, V1HistoryEntry } from '../../../../../utils/historyUtils' -import { ErrorModal } from '../../../../common/modals/error-modal' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { HistoryEntry, HistoryJson } from '../history' +import { convertV1History, V1HistoryEntry } from '../utils' +import { ErrorModal } from '../../common/modals/error-modal' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { HistoryEntry, HistoryJson } from '../history-page' export interface ImportHistoryButtonProps { onImportHistory: (entries: HistoryEntry[]) => void diff --git a/src/components/landing/pages/history/history-toolbar/typeahead-hacks.scss b/src/components/history-page/history-toolbar/typeahead-hacks.scss similarity index 100% rename from src/components/landing/pages/history/history-toolbar/typeahead-hacks.scss rename to src/components/history-page/history-toolbar/typeahead-hacks.scss diff --git a/src/components/landing/pages/history/common/pin-button.scss b/src/components/history-page/pin-button/pin-button.scss similarity index 99% rename from src/components/landing/pages/history/common/pin-button.scss rename to src/components/history-page/pin-button/pin-button.scss index 17c93de9f..c2e645310 100644 --- a/src/components/landing/pages/history/common/pin-button.scss +++ b/src/components/history-page/pin-button/pin-button.scss @@ -1,5 +1,4 @@ .history-pin { - .fa { opacity: 0.2; transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out; diff --git a/src/components/landing/pages/history/common/pin-button.tsx b/src/components/history-page/pin-button/pin-button.tsx similarity index 86% rename from src/components/landing/pages/history/common/pin-button.tsx rename to src/components/history-page/pin-button/pin-button.tsx index 9ecd8f069..3de8b116f 100644 --- a/src/components/landing/pages/history/common/pin-button.tsx +++ b/src/components/history-page/pin-button/pin-button.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import './pin-button.scss' export interface PinButtonProps { diff --git a/src/components/common/sort-button/sort-button.tsx b/src/components/history-page/sort-button/sort-button.tsx similarity index 84% rename from src/components/common/sort-button/sort-button.tsx rename to src/components/history-page/sort-button/sort-button.tsx index 3278a32d0..f73431079 100644 --- a/src/components/common/sort-button/sort-button.tsx +++ b/src/components/history-page/sort-button/sort-button.tsx @@ -1,7 +1,7 @@ import React from 'react' import { ButtonProps } from 'react-bootstrap' -import { IconName } from '../fork-awesome/fork-awesome-icon' -import { IconButton } from '../icon-button/icon-button' +import { IconName } from '../../common/fork-awesome/fork-awesome-icon' +import { IconButton } from '../../common/icon-button/icon-button' export enum SortModeEnum { up = 1, @@ -43,5 +43,5 @@ export const SortButton: React.FC = ({ children, variant, onDir onDirectionChange(toggleDirection(direction)) } - return {children} + return {children} } diff --git a/src/utils/historyUtils.ts b/src/components/history-page/utils.ts similarity index 95% rename from src/utils/historyUtils.ts rename to src/components/history-page/utils.ts index d0fa588a6..b7f64369a 100644 --- a/src/utils/historyUtils.ts +++ b/src/components/history-page/utils.ts @@ -1,12 +1,12 @@ import moment from 'moment' -import { SortModeEnum } from '../components/common/sort-button/sort-button' +import { SortModeEnum } from './sort-button/sort-button' import { HistoryEntry, HistoryEntryOrigin, HistoryJson, LocatedHistoryEntry -} from '../components/landing/pages/history/history' -import { HistoryToolbarState } from '../components/landing/pages/history/history-toolbar/history-toolbar' +} from './history-page' +import { HistoryToolbarState } from './history-toolbar/history-toolbar' export function collectEntries (localEntries: HistoryEntry[], remoteEntries: HistoryEntry[]): LocatedHistoryEntry[] { const locatedLocalEntries = locateEntries(localEntries, HistoryEntryOrigin.LOCAL) diff --git a/src/components/landing/pages/intro/cover-buttons/cover-buttons.scss b/src/components/intro-page/cover-buttons/cover-buttons.scss similarity index 100% rename from src/components/landing/pages/intro/cover-buttons/cover-buttons.scss rename to src/components/intro-page/cover-buttons/cover-buttons.scss diff --git a/src/components/landing/pages/intro/cover-buttons/cover-buttons.tsx b/src/components/intro-page/cover-buttons/cover-buttons.tsx similarity index 84% rename from src/components/landing/pages/intro/cover-buttons/cover-buttons.tsx rename to src/components/intro-page/cover-buttons/cover-buttons.tsx index e3c640cd9..6c934537f 100644 --- a/src/components/landing/pages/intro/cover-buttons/cover-buttons.tsx +++ b/src/components/intro-page/cover-buttons/cover-buttons.tsx @@ -3,10 +3,10 @@ import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { Link } from 'react-router-dom' -import { ApplicationState } from '../../../../../redux' -import { ShowIf } from '../../../../common/show-if/show-if' -import { SignInButton } from '../../../layout/navigation/sign-in-button' +import { ApplicationState } from '../../../redux' +import { ShowIf } from '../../common/show-if/show-if' import './cover-buttons.scss' +import { SignInButton } from '../../landing-layout/navigation/sign-in-button' export const CoverButtons: React.FC = () => { useTranslation() diff --git a/src/components/landing/pages/intro/feature-links.tsx b/src/components/intro-page/feature-links.tsx similarity index 93% rename from src/components/landing/pages/intro/feature-links.tsx rename to src/components/intro-page/feature-links.tsx index 69b7c1dbb..79f5ce819 100644 --- a/src/components/landing/pages/intro/feature-links.tsx +++ b/src/components/intro-page/feature-links.tsx @@ -2,7 +2,7 @@ import React from 'react' import { Col, Row } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../common/fork-awesome/fork-awesome-icon' export const FeatureLinks: React.FC = () => { useTranslation() diff --git a/src/components/landing/pages/intro/img/screenshot.png b/src/components/intro-page/img/screenshot.png similarity index 100% rename from src/components/landing/pages/intro/img/screenshot.png rename to src/components/intro-page/img/screenshot.png diff --git a/src/components/landing/pages/intro/intro.tsx b/src/components/intro-page/intro-page.tsx similarity index 80% rename from src/components/landing/pages/intro/intro.tsx rename to src/components/intro-page/intro-page.tsx index 64fd7658c..52b521389 100644 --- a/src/components/landing/pages/intro/intro.tsx +++ b/src/components/intro-page/intro-page.tsx @@ -1,12 +1,12 @@ import React, { Fragment } from 'react' import { Trans, useTranslation } from 'react-i18next' -import { Branding } from '../../../common/branding/branding' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { Branding } from '../common/branding/branding' +import { ForkAwesomeIcon } from '../common/fork-awesome/fork-awesome-icon' import { CoverButtons } from './cover-buttons/cover-buttons' import { FeatureLinks } from './feature-links' import screenshot from './img/screenshot.png' -const Intro: React.FC = () => { +const IntroPage: React.FC = () => { const { t } = useTranslation() return ( @@ -28,4 +28,4 @@ const Intro: React.FC = () => { ) } -export { Intro } +export { IntroPage } diff --git a/src/components/landing/layout/footer/footer.tsx b/src/components/landing-layout/footer/footer.tsx similarity index 100% rename from src/components/landing/layout/footer/footer.tsx rename to src/components/landing-layout/footer/footer.tsx diff --git a/src/components/landing/layout/footer/language-picker.tsx b/src/components/landing-layout/footer/language-picker.tsx similarity index 100% rename from src/components/landing/layout/footer/language-picker.tsx rename to src/components/landing-layout/footer/language-picker.tsx diff --git a/src/components/landing/layout/footer/powered-by-links.tsx b/src/components/landing-layout/footer/powered-by-links.tsx similarity index 70% rename from src/components/landing/layout/footer/powered-by-links.tsx rename to src/components/landing-layout/footer/powered-by-links.tsx index b6038dfb7..80a696603 100644 --- a/src/components/landing/layout/footer/powered-by-links.tsx +++ b/src/components/landing-layout/footer/powered-by-links.tsx @@ -1,11 +1,11 @@ import React, { Fragment } from 'react' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { ApplicationState } from '../../../../redux' -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/version-info' +import { ApplicationState } from '../../../redux' +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' export const PoweredByLinks: React.FC = () => { useTranslation() diff --git a/src/components/landing/layout/footer/social-links.tsx b/src/components/landing-layout/footer/social-links.tsx similarity index 91% rename from src/components/landing/layout/footer/social-links.tsx rename to src/components/landing-layout/footer/social-links.tsx index d4942430a..6d2351b8e 100644 --- a/src/components/landing/layout/footer/social-links.tsx +++ b/src/components/landing-layout/footer/social-links.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Trans, useTranslation } from 'react-i18next' -import { ExternalLink } from '../../../common/links/external-link' +import { ExternalLink } from '../../common/links/external-link' const SocialLink: React.FC = () => { useTranslation() diff --git a/src/components/landing/layout/version-info/version-info.tsx b/src/components/landing-layout/footer/version-info.tsx similarity index 86% rename from src/components/landing/layout/version-info/version-info.tsx rename to src/components/landing-layout/footer/version-info.tsx index 2e665e4b0..9f367c615 100644 --- a/src/components/landing/layout/version-info/version-info.tsx +++ b/src/components/landing-layout/footer/version-info.tsx @@ -3,11 +3,11 @@ import { Button, Col, Modal, Row } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { Link } from 'react-router-dom' -import { ApplicationState } from '../../../../redux' -import frontendVersion from '../../../../version.json' -import { TranslatedExternalLink } from '../../../common/links/translated-external-link' -import { ShowIf } from '../../../common/show-if/show-if' -import { CopyableField } from '../../../common/copyable-field/copyable-field' +import { ApplicationState } from '../../../redux' +import frontendVersion from '../../../version.json' +import { TranslatedExternalLink } from '../../common/links/translated-external-link' +import { ShowIf } from '../../common/show-if/show-if' +import { CopyableField } from '../../common/copyable-field/copyable-field' export const VersionInfo: React.FC = () => { const [show, setShow] = useState(false) diff --git a/src/components/landing/landing-layout.tsx b/src/components/landing-layout/landing-layout.tsx similarity index 73% rename from src/components/landing/landing-layout.tsx rename to src/components/landing-layout/landing-layout.tsx index 5712d14d9..147616aac 100644 --- a/src/components/landing/landing-layout.tsx +++ b/src/components/landing-layout/landing-layout.tsx @@ -1,15 +1,15 @@ import React from 'react' import { Container } from 'react-bootstrap' import { DocumentTitle } from '../common/document-title/document-title' -import { Footer } from './layout/footer/footer' -import { InfoBanner } from './layout/info-banner' -import { HeaderBar } from './layout/navigation/header-bar/header-bar' +import { Footer } from './footer/footer' +import { MotdBanner } from '../common/motd-banner/motd-banner' +import { HeaderBar } from './navigation/header-bar/header-bar' export const LandingLayout: React.FC = ({ children }) => { return ( - +
diff --git a/src/components/landing/layout/navigation/header-bar/header-bar.scss b/src/components/landing-layout/navigation/header-bar/header-bar.scss similarity index 100% rename from src/components/landing/layout/navigation/header-bar/header-bar.scss rename to src/components/landing-layout/navigation/header-bar/header-bar.scss diff --git a/src/components/landing/layout/navigation/header-bar/header-bar.tsx b/src/components/landing-layout/navigation/header-bar/header-bar.tsx similarity index 92% rename from src/components/landing/layout/navigation/header-bar/header-bar.tsx rename to src/components/landing-layout/navigation/header-bar/header-bar.tsx index 4d73fc036..3c22b09d1 100644 --- a/src/components/landing/layout/navigation/header-bar/header-bar.tsx +++ b/src/components/landing-layout/navigation/header-bar/header-bar.tsx @@ -2,12 +2,12 @@ import React, { Fragment } from 'react' import { Navbar } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { ApplicationState } from '../../../../../redux' +import { ApplicationState } from '../../../../redux' import { HeaderNavLink } from '../header-nav-link' import { NewGuestNoteButton } from '../new-guest-note-button' import { NewUserNoteButton } from '../new-user-note-button' import { SignInButton } from '../sign-in-button' -import { UserDropdown } from '../user-dropdown/user-dropdown' +import { UserDropdown } from '../user-dropdown' import './header-bar.scss' const HeaderBar: React.FC = () => { diff --git a/src/components/landing/layout/navigation/header-nav-link.tsx b/src/components/landing-layout/navigation/header-nav-link.tsx similarity index 100% rename from src/components/landing/layout/navigation/header-nav-link.tsx rename to src/components/landing-layout/navigation/header-nav-link.tsx diff --git a/src/components/landing/layout/navigation/new-guest-note-button.tsx b/src/components/landing-layout/navigation/new-guest-note-button.tsx similarity index 88% rename from src/components/landing/layout/navigation/new-guest-note-button.tsx rename to src/components/landing-layout/navigation/new-guest-note-button.tsx index 71e6463e1..16900344d 100644 --- a/src/components/landing/layout/navigation/new-guest-note-button.tsx +++ b/src/components/landing-layout/navigation/new-guest-note-button.tsx @@ -2,7 +2,7 @@ import React from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { LinkContainer } from 'react-router-bootstrap' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' export const NewGuestNoteButton: React.FC = () => { const { t } = useTranslation() diff --git a/src/components/landing/layout/navigation/new-user-note-button.tsx b/src/components/landing-layout/navigation/new-user-note-button.tsx similarity index 88% rename from src/components/landing/layout/navigation/new-user-note-button.tsx rename to src/components/landing-layout/navigation/new-user-note-button.tsx index 3087232cd..aa6e6d29f 100644 --- a/src/components/landing/layout/navigation/new-user-note-button.tsx +++ b/src/components/landing-layout/navigation/new-user-note-button.tsx @@ -2,7 +2,7 @@ import React from 'react' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { LinkContainer } from 'react-router-bootstrap' -import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' export const NewUserNoteButton: React.FC = () => { const { t } = useTranslation() diff --git a/src/components/landing/layout/navigation/sign-in-button.tsx b/src/components/landing-layout/navigation/sign-in-button.tsx similarity index 89% rename from src/components/landing/layout/navigation/sign-in-button.tsx rename to src/components/landing-layout/navigation/sign-in-button.tsx index 53ec2778f..b22259f0e 100644 --- a/src/components/landing/layout/navigation/sign-in-button.tsx +++ b/src/components/landing-layout/navigation/sign-in-button.tsx @@ -4,8 +4,8 @@ import { ButtonProps } from 'react-bootstrap/Button' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { LinkContainer } from 'react-router-bootstrap' -import { ApplicationState } from '../../../../redux' -import { ShowIf } from '../../../common/show-if/show-if' +import { ApplicationState } from '../../../redux' +import { ShowIf } from '../../common/show-if/show-if' type SignInButtonProps = { className?: string diff --git a/src/components/landing/layout/navigation/user-dropdown/user-dropdown.tsx b/src/components/landing-layout/navigation/user-dropdown.tsx similarity index 85% rename from src/components/landing/layout/navigation/user-dropdown/user-dropdown.tsx rename to src/components/landing-layout/navigation/user-dropdown.tsx index a4e78beb9..eadc36760 100644 --- a/src/components/landing/layout/navigation/user-dropdown/user-dropdown.tsx +++ b/src/components/landing-layout/navigation/user-dropdown.tsx @@ -3,10 +3,10 @@ import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { LinkContainer } from 'react-router-bootstrap' -import { ApplicationState } from '../../../../../redux' -import { clearUser } from '../../../../../redux/user/methods' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' -import { UserAvatar } from '../../user-avatar/user-avatar' +import { ApplicationState } from '../../../redux' +import { clearUser } from '../../../redux/user/methods' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { UserAvatar } from '../../common/user-avatar/user-avatar' export const UserDropdown: React.FC = () => { useTranslation() diff --git a/src/components/landing/pages/login/auth/social-link-button/social-link-button.scss b/src/components/login-page/auth/social-link-button/social-link-button.scss similarity index 100% rename from src/components/landing/pages/login/auth/social-link-button/social-link-button.scss rename to src/components/login-page/auth/social-link-button/social-link-button.scss diff --git a/src/components/landing/pages/login/auth/social-link-button/social-link-button.tsx b/src/components/login-page/auth/social-link-button/social-link-button.tsx similarity index 88% rename from src/components/landing/pages/login/auth/social-link-button/social-link-button.tsx rename to src/components/login-page/auth/social-link-button/social-link-button.tsx index 88c49d718..2f18c807d 100644 --- a/src/components/landing/pages/login/auth/social-link-button/social-link-button.tsx +++ b/src/components/login-page/auth/social-link-button/social-link-button.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { ForkAwesomeIcon, IconName } from '../../../../../common/fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon, IconName } from '../../../common/fork-awesome/fork-awesome-icon' import './social-link-button.scss' export interface SocialButtonProps { diff --git a/src/components/login-page/auth/utils.ts b/src/components/login-page/auth/utils.ts new file mode 100644 index 000000000..35c834c8b --- /dev/null +++ b/src/components/login-page/auth/utils.ts @@ -0,0 +1,12 @@ +import { getMe } from '../../../api/me' +import { setUser } from '../../../redux/user/methods' + +export const getAndSetUser: () => (Promise) = async () => { + const me = await getMe() + setUser({ + id: me.id, + name: me.name, + photo: me.photo, + provider: me.provider + }) +} diff --git a/src/components/landing/pages/login/auth/via-internal.tsx b/src/components/login-page/auth/via-internal.tsx similarity index 91% rename from src/components/landing/pages/login/auth/via-internal.tsx rename to src/components/login-page/auth/via-internal.tsx index 04b6b82c5..00e0dee18 100644 --- a/src/components/landing/pages/login/auth/via-internal.tsx +++ b/src/components/login-page/auth/via-internal.tsx @@ -3,10 +3,10 @@ import { Alert, Button, Card, Form } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { Link } from 'react-router-dom' -import { doInternalLogin } from '../../../../../api/auth' -import { ApplicationState } from '../../../../../redux' -import { getAndSetUser } from '../../../../../utils/apiUtils' -import { ShowIf } from '../../../../common/show-if/show-if' +import { doInternalLogin } from '../../../api/auth' +import { ApplicationState } from '../../../redux' +import { ShowIf } from '../../common/show-if/show-if' +import { getAndSetUser } from './utils' export const ViaInternal: React.FC = () => { const { t } = useTranslation() diff --git a/src/components/landing/pages/login/auth/via-ldap.tsx b/src/components/login-page/auth/via-ldap.tsx similarity index 92% rename from src/components/landing/pages/login/auth/via-ldap.tsx rename to src/components/login-page/auth/via-ldap.tsx index f69677933..0a5d34ff1 100644 --- a/src/components/landing/pages/login/auth/via-ldap.tsx +++ b/src/components/login-page/auth/via-ldap.tsx @@ -3,9 +3,9 @@ import { Alert, Button, Card, Form } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { doLdapLogin } from '../../../../../api/auth' -import { ApplicationState } from '../../../../../redux' -import { getAndSetUser } from '../../../../../utils/apiUtils' +import { doLdapLogin } from '../../../api/auth' +import { ApplicationState } from '../../../redux' +import { getAndSetUser } from './utils' export const ViaLdap: React.FC = () => { const { t } = useTranslation() diff --git a/src/components/landing/pages/login/auth/via-one-click.tsx b/src/components/login-page/auth/via-one-click.tsx similarity index 95% rename from src/components/landing/pages/login/auth/via-one-click.tsx rename to src/components/login-page/auth/via-one-click.tsx index e2bb4f399..83c4bc6bc 100644 --- a/src/components/landing/pages/login/auth/via-one-click.tsx +++ b/src/components/login-page/auth/via-one-click.tsx @@ -1,7 +1,7 @@ import React from 'react' import { useSelector } from 'react-redux' -import { ApplicationState } from '../../../../../redux' -import { IconName } from '../../../../common/fork-awesome/fork-awesome-icon' +import { ApplicationState } from '../../../redux' +import { IconName } from '../../common/fork-awesome/fork-awesome-icon' import { SocialLinkButton } from './social-link-button/social-link-button' export enum OneClickType { diff --git a/src/components/landing/pages/login/auth/via-openid.tsx b/src/components/login-page/auth/via-openid.tsx similarity index 92% rename from src/components/landing/pages/login/auth/via-openid.tsx rename to src/components/login-page/auth/via-openid.tsx index 4f9c33326..8b0733e6e 100644 --- a/src/components/landing/pages/login/auth/via-openid.tsx +++ b/src/components/login-page/auth/via-openid.tsx @@ -1,8 +1,8 @@ import React, { FormEvent, useState } from 'react' import { Alert, Button, Card, Form } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { doOpenIdLogin } from '../../../../../api/auth' -import { getAndSetUser } from '../../../../../utils/apiUtils' +import { doOpenIdLogin } from '../../../api/auth' +import { getAndSetUser } from './utils' export const ViaOpenId: React.FC = () => { useTranslation() diff --git a/src/components/landing/pages/login/login.tsx b/src/components/login-page/login-page.tsx similarity index 94% rename from src/components/landing/pages/login/login.tsx rename to src/components/login-page/login-page.tsx index 529590011..e255832cf 100644 --- a/src/components/landing/pages/login/login.tsx +++ b/src/components/login-page/login-page.tsx @@ -3,14 +3,14 @@ import { Card, Col, Row } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { Redirect } from 'react-router' -import { ApplicationState } from '../../../../redux' -import { ShowIf } from '../../../common/show-if/show-if' +import { ApplicationState } from '../../redux' +import { ShowIf } from '../common/show-if/show-if' import { ViaInternal } from './auth/via-internal' import { ViaLdap } from './auth/via-ldap' import { OneClickType, ViaOneClick } from './auth/via-one-click' import { ViaOpenId } from './auth/via-openid' -export const Login: React.FC = () => { +export const LoginPage: React.FC = () => { useTranslation() const authProviders = useSelector((state: ApplicationState) => state.config.authProviders) const customAuthNames = useSelector((state: ApplicationState) => state.config.customAuthNames) diff --git a/src/components/editor/markdown-renderer/container-plugins/alert.ts b/src/components/markdown-renderer/container-plugins/alert.ts similarity index 100% rename from src/components/editor/markdown-renderer/container-plugins/alert.ts rename to src/components/markdown-renderer/container-plugins/alert.ts diff --git a/src/components/editor/markdown-renderer/markdown-it-plugins/highlighted-code.ts b/src/components/markdown-renderer/markdown-it-plugins/highlighted-code.ts similarity index 100% rename from src/components/editor/markdown-renderer/markdown-it-plugins/highlighted-code.ts rename to src/components/markdown-renderer/markdown-it-plugins/highlighted-code.ts diff --git a/src/components/editor/markdown-renderer/markdown-it-plugins/linkify-extra.ts b/src/components/markdown-renderer/markdown-it-plugins/linkify-extra.ts similarity index 100% rename from src/components/editor/markdown-renderer/markdown-it-plugins/linkify-extra.ts rename to src/components/markdown-renderer/markdown-it-plugins/linkify-extra.ts diff --git a/src/components/editor/markdown-renderer/markdown-it-plugins/parser-debugger.ts b/src/components/markdown-renderer/markdown-it-plugins/parser-debugger.ts similarity index 100% rename from src/components/editor/markdown-renderer/markdown-it-plugins/parser-debugger.ts rename to src/components/markdown-renderer/markdown-it-plugins/parser-debugger.ts diff --git a/src/components/editor/markdown-renderer/markdown-it-plugins/plantuml-error.ts b/src/components/markdown-renderer/markdown-it-plugins/plantuml-error.ts similarity index 100% rename from src/components/editor/markdown-renderer/markdown-it-plugins/plantuml-error.ts rename to src/components/markdown-renderer/markdown-it-plugins/plantuml-error.ts diff --git a/src/components/editor/markdown-renderer/markdown-renderer.scss b/src/components/markdown-renderer/markdown-renderer.scss similarity index 86% rename from src/components/editor/markdown-renderer/markdown-renderer.scss rename to src/components/markdown-renderer/markdown-renderer.scss index cbc7ebc2f..00ba88c47 100644 --- a/src/components/editor/markdown-renderer/markdown-renderer.scss +++ b/src/components/markdown-renderer/markdown-renderer.scss @@ -1,4 +1,4 @@ -@import '../../../../node_modules/github-markdown-css/github-markdown.css'; +@import '../../../node_modules/github-markdown-css/github-markdown.css'; .markdown-body { position: relative; @@ -52,6 +52,11 @@ pre { overflow: visible; + + code { + white-space: pre-wrap; + word-break: break-word; + } } } diff --git a/src/components/editor/markdown-renderer/markdown-renderer.tsx b/src/components/markdown-renderer/markdown-renderer.tsx similarity index 94% rename from src/components/editor/markdown-renderer/markdown-renderer.tsx rename to src/components/markdown-renderer/markdown-renderer.tsx index ca6845175..701905dd5 100644 --- a/src/components/editor/markdown-renderer/markdown-renderer.tsx +++ b/src/components/markdown-renderer/markdown-renderer.tsx @@ -27,13 +27,13 @@ import ReactHtmlParser, { convertNodeToElement, Transform } from 'react-html-par import { Trans } from 'react-i18next' import MathJaxReact from 'react-mathjax' import { useSelector } from 'react-redux' -import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' -import { ApplicationState } from '../../../redux' -import { slugify } from '../../../utils/slugify' -import { InternalLink } from '../../common/links/internal-link' -import { ShowIf } from '../../common/show-if/show-if' -import { ForkAwesomeIcons } from '../editor-window/tool-bar/emoji-picker/icon-names' -import { RawYAMLMetadata, YAMLMetaData } from '../yaml-metadata/yaml-metadata' +import { TocAst } from '../../external-types/markdown-it-toc-done-right/interface' +import { ApplicationState } from '../../redux' +import { InternalLink } from '../common/links/internal-link' +import { ShowIf } from '../common/show-if/show-if' +import { ForkAwesomeIcons } from '../editor/editor-pane/tool-bar/emoji-picker/icon-names' +import { slugify } from '../editor/table-of-contents/table-of-contents' +import { RawYAMLMetadata, YAMLMetaData } from '../editor/yaml-metadata/yaml-metadata' import { createRenderContainer, validAlertLevels } from './container-plugins/alert' import { highlightedCode } from './markdown-it-plugins/highlighted-code' import { linkifyExtra } from './markdown-it-plugins/linkify-extra' @@ -78,8 +78,9 @@ export interface MarkdownRendererProps { const markdownItTwitterEmojis = Object.keys((emojiData as unknown as Data).emojis) .reduce((reduceObject, emojiIdentifier) => { const emoji = (emojiData as unknown as Data).emojis[emojiIdentifier] - if (emoji.unified) { - reduceObject[emojiIdentifier] = emoji.unified.split('-').map(char => `&#x${char};`).join('') + const emojiCodes = emoji.unified ?? emoji.b + if (emojiCodes) { + reduceObject[emojiIdentifier] = emojiCodes.split('-').map(char => `&#x${char};`).join('') } return reduceObject }, {} as { [key: string]: string }) diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-asciinema-link.ts b/src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts similarity index 88% rename from src/components/editor/markdown-renderer/regex-plugins/replace-asciinema-link.ts rename to src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts index e597ee46a..c334e949f 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-asciinema-link.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const protocolRegex = /(?:http(?:s)?:\/\/)?/ const domainRegex = /(?:asciinema\.org\/a\/)/ diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-gist-link.ts b/src/components/markdown-renderer/regex-plugins/replace-gist-link.ts similarity index 88% rename from src/components/editor/markdown-renderer/regex-plugins/replace-gist-link.ts rename to src/components/markdown-renderer/regex-plugins/replace-gist-link.ts index 5c49f51f7..9dba99ed9 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-gist-link.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-gist-link.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const protocolRegex = /(?:http(?:s)?:\/\/)?/ const domainRegex = /(?:gist\.github\.com\/)/ diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts similarity index 81% rename from src/components/editor/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts rename to src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts index f908dbfbc..06471d677 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const finalRegex = /^{%gist (\w+\/\w+) ?%}$/ diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-slideshare-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-slideshare-short-code.ts similarity index 80% rename from src/components/editor/markdown-renderer/regex-plugins/replace-legacy-slideshare-short-code.ts rename to src/components/markdown-renderer/regex-plugins/replace-legacy-slideshare-short-code.ts index f3574b5fd..ec7282b47 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-slideshare-short-code.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-slideshare-short-code.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const finalRegex = /^{%slideshare (\w+\/[\w-]+) ?%}$/ diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-speakerdeck-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-speakerdeck-short-code.ts similarity index 80% rename from src/components/editor/markdown-renderer/regex-plugins/replace-legacy-speakerdeck-short-code.ts rename to src/components/markdown-renderer/regex-plugins/replace-legacy-speakerdeck-short-code.ts index badaf9eb4..f5267aa43 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-speakerdeck-short-code.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-speakerdeck-short-code.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const finalRegex = /^{%speakerdeck (\w+\/[\w-]+) ?%}$/ diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts similarity index 80% rename from src/components/editor/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts rename to src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts index 4a6a076d1..ed77b411b 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' export const replaceLegacyVimeoShortCode: RegexOptions = { name: 'legacy-vimeo-short-code', diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts similarity index 80% rename from src/components/editor/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts rename to src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts index fc0d34809..2cbc50417 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' export const replaceLegacyYoutubeShortCode: RegexOptions = { name: 'legacy-youtube-short-code', diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-pdf-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts similarity index 78% rename from src/components/editor/markdown-renderer/regex-plugins/replace-pdf-short-code.ts rename to src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts index 68cc41688..be8f3289e 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-pdf-short-code.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' export const replacePdfShortCode: RegexOptions = { name: 'pdf-short-code', diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-author.ts b/src/components/markdown-renderer/regex-plugins/replace-quote-extra-author.ts similarity index 80% rename from src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-author.ts rename to src/components/markdown-renderer/regex-plugins/replace-quote-extra-author.ts index 785cb6e88..ae97acd89 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-author.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-quote-extra-author.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' export const replaceQuoteExtraAuthor: RegexOptions = { name: 'quote-extra-name', diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-color.ts b/src/components/markdown-renderer/regex-plugins/replace-quote-extra-color.ts similarity index 95% rename from src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-color.ts rename to src/components/markdown-renderer/regex-plugins/replace-quote-extra-color.ts index d8d806088..41c868f01 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-color.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-quote-extra-color.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const cssColorRegex = /\[color=(#(?:[0-9a-f]{2}){2,4}|(?:#[0-9a-f]{3})|black|silver|gray|whitesmoke|maroon|red|purple|fuchsia|green|lime|olivedrab|yellow|navy|blue|teal|aquamarine|orange|aliceblue|antiquewhite|aqua|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|currentcolor|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|gainsboro|ghostwhite|goldenrod|gold|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavenderblush|lavender|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|limegreen|linen|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|oldlace|olive|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|rebeccapurple|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|thistle|tomato|transparent|turquoise|violet|wheat|white|yellowgreen)]/i diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-time.ts b/src/components/markdown-renderer/regex-plugins/replace-quote-extra-time.ts similarity index 80% rename from src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-time.ts rename to src/components/markdown-renderer/regex-plugins/replace-quote-extra-time.ts index 7556a3880..c8c0ae3ed 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-quote-extra-time.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-quote-extra-time.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' export const replaceQuoteExtraTime: RegexOptions = { name: 'quote-extra-time', diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-vimeo-link.ts b/src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts similarity index 89% rename from src/components/editor/markdown-renderer/regex-plugins/replace-vimeo-link.ts rename to src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts index 032efc494..bf126dc76 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-vimeo-link.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const protocolRegex = /(?:http(?:s)?:\/\/)?/ const domainRegex = /(?:player\.)?(?:vimeo\.com\/)(?:(?:channels|album|ondemand|groups)\/\w+\/)?(?:video\/)?/ diff --git a/src/components/editor/markdown-renderer/regex-plugins/replace-youtube-link.ts b/src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts similarity index 90% rename from src/components/editor/markdown-renderer/regex-plugins/replace-youtube-link.ts rename to src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts index 0fef18405..6f51fe360 100644 --- a/src/components/editor/markdown-renderer/regex-plugins/replace-youtube-link.ts +++ b/src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts @@ -1,4 +1,4 @@ -import { RegexOptions } from '../../../../external-types/markdown-it-regex/interface' +import { RegexOptions } from '../../../external-types/markdown-it-regex/interface' const protocolRegex = /(?:http(?:s)?:\/\/)?/ const subdomainRegex = /(?:www.)?/ diff --git a/src/components/editor/markdown-renderer/replace-components/ComponentReplacer.ts b/src/components/markdown-renderer/replace-components/ComponentReplacer.ts similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/ComponentReplacer.ts rename to src/components/markdown-renderer/replace-components/ComponentReplacer.ts diff --git a/src/components/editor/markdown-renderer/replace-components/asciinema/asciinema-frame.tsx b/src/components/markdown-renderer/replace-components/asciinema/asciinema-frame.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/asciinema/asciinema-frame.tsx rename to src/components/markdown-renderer/replace-components/asciinema/asciinema-frame.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx b/src/components/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx rename to src/components/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/codi-md-tag-utils.ts b/src/components/markdown-renderer/replace-components/codi-md-tag-utils.ts similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/codi-md-tag-utils.ts rename to src/components/markdown-renderer/replace-components/codi-md-tag-utils.ts diff --git a/src/components/editor/markdown-renderer/replace-components/gist/gist-frame.scss b/src/components/markdown-renderer/replace-components/gist/gist-frame.scss similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/gist/gist-frame.scss rename to src/components/markdown-renderer/replace-components/gist/gist-frame.scss diff --git a/src/components/editor/markdown-renderer/replace-components/gist/gist-frame.tsx b/src/components/markdown-renderer/replace-components/gist/gist-frame.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/gist/gist-frame.tsx rename to src/components/markdown-renderer/replace-components/gist/gist-frame.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/gist/gist-preview.png b/src/components/markdown-renderer/replace-components/gist/gist-preview.png similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/gist/gist-preview.png rename to src/components/markdown-renderer/replace-components/gist/gist-preview.png diff --git a/src/components/editor/markdown-renderer/replace-components/gist/gist-replacer.tsx b/src/components/markdown-renderer/replace-components/gist/gist-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/gist/gist-replacer.tsx rename to src/components/markdown-renderer/replace-components/gist/gist-replacer.tsx diff --git a/src/components/common/highlighted-code/highlighted-code.scss b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.scss similarity index 89% rename from src/components/common/highlighted-code/highlighted-code.scss rename to src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.scss index 82f4d1c5a..f1cb9acb8 100644 --- a/src/components/common/highlighted-code/highlighted-code.scss +++ b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.scss @@ -1,5 +1,5 @@ .markdown-body { - @import '../../../../node_modules/highlight.js/styles/github-gist'; + @import '../../../../../../node_modules/highlight.js/styles/github-gist.css'; } .markdown-body pre code.hljs { diff --git a/src/components/common/highlighted-code/highlighted-code.tsx b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.tsx similarity index 100% rename from src/components/common/highlighted-code/highlighted-code.tsx rename to src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/highlighted-fence/highlighted-fence-replacer.tsx b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-fence-replacer.tsx similarity index 93% rename from src/components/editor/markdown-renderer/replace-components/highlighted-fence/highlighted-fence-replacer.tsx rename to src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-fence-replacer.tsx index 5048c6265..45a325d94 100644 --- a/src/components/editor/markdown-renderer/replace-components/highlighted-fence/highlighted-fence-replacer.tsx +++ b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-fence-replacer.tsx @@ -1,6 +1,6 @@ import { DomElement } from 'domhandler' import React from 'react' -import { HighlightedCode } from '../../../../common/highlighted-code/highlighted-code' +import { HighlightedCode } from './highlighted-code/highlighted-code' import { ComponentReplacer } from '../ComponentReplacer' export class HighlightedCodeReplacer implements ComponentReplacer { diff --git a/src/components/editor/markdown-renderer/replace-components/image/image-frame.tsx b/src/components/markdown-renderer/replace-components/image/image-frame.tsx similarity index 86% rename from src/components/editor/markdown-renderer/replace-components/image/image-frame.tsx rename to src/components/markdown-renderer/replace-components/image/image-frame.tsx index 4421ae9ea..4cc026142 100644 --- a/src/components/editor/markdown-renderer/replace-components/image/image-frame.tsx +++ b/src/components/markdown-renderer/replace-components/image/image-frame.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react' import { useSelector } from 'react-redux' -import { getProxiedUrl } from '../../../../../api/imageProxy' -import { ApplicationState } from '../../../../../redux' +import { getProxiedUrl } from '../../../../api/media' +import { ApplicationState } from '../../../../redux' export const ImageFrame: React.FC> = ({ alt, src, ...props }) => { const [imageUrl, setImageUrl] = useState('') diff --git a/src/components/editor/markdown-renderer/replace-components/image/image-replacer.tsx b/src/components/markdown-renderer/replace-components/image/image-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/image/image-replacer.tsx rename to src/components/markdown-renderer/replace-components/image/image-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/image/types.ts b/src/components/markdown-renderer/replace-components/image/types.ts similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/image/types.ts rename to src/components/markdown-renderer/replace-components/image/types.ts diff --git a/src/components/editor/markdown-renderer/replace-components/mathjax/mathjax-replacer.tsx b/src/components/markdown-renderer/replace-components/mathjax/mathjax-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/mathjax/mathjax-replacer.tsx rename to src/components/markdown-renderer/replace-components/mathjax/mathjax-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/one-click-frame/one-click-embedding.scss b/src/components/markdown-renderer/replace-components/one-click-frame/one-click-embedding.scss similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/one-click-frame/one-click-embedding.scss rename to src/components/markdown-renderer/replace-components/one-click-frame/one-click-embedding.scss diff --git a/src/components/editor/markdown-renderer/replace-components/one-click-frame/one-click-embedding.tsx b/src/components/markdown-renderer/replace-components/one-click-frame/one-click-embedding.tsx similarity index 93% rename from src/components/editor/markdown-renderer/replace-components/one-click-frame/one-click-embedding.tsx rename to src/components/markdown-renderer/replace-components/one-click-frame/one-click-embedding.tsx index a65d58cef..3c9bb8c36 100644 --- a/src/components/editor/markdown-renderer/replace-components/one-click-frame/one-click-embedding.tsx +++ b/src/components/markdown-renderer/replace-components/one-click-frame/one-click-embedding.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react' import { Trans } from 'react-i18next' -import { IconName } from '../../../../common/fork-awesome/fork-awesome-icon' -import { ShowIf } from '../../../../common/show-if/show-if' +import { IconName } from '../../../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../../../common/show-if/show-if' import './one-click-embedding.scss' interface OneClickFrameProps { diff --git a/src/components/editor/markdown-renderer/replace-components/pdf/pdf-frame.scss b/src/components/markdown-renderer/replace-components/pdf/pdf-frame.scss similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/pdf/pdf-frame.scss rename to src/components/markdown-renderer/replace-components/pdf/pdf-frame.scss diff --git a/src/components/editor/markdown-renderer/replace-components/pdf/pdf-frame.tsx b/src/components/markdown-renderer/replace-components/pdf/pdf-frame.tsx similarity index 91% rename from src/components/editor/markdown-renderer/replace-components/pdf/pdf-frame.tsx rename to src/components/markdown-renderer/replace-components/pdf/pdf-frame.tsx index 82a3960c0..92919bfe9 100644 --- a/src/components/editor/markdown-renderer/replace-components/pdf/pdf-frame.tsx +++ b/src/components/markdown-renderer/replace-components/pdf/pdf-frame.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import { ExternalLink } from '../../../../common/links/external-link' +import { ExternalLink } from '../../../common/links/external-link' import { OneClickEmbedding } from '../one-click-frame/one-click-embedding' import './pdf-frame.scss' diff --git a/src/components/editor/markdown-renderer/replace-components/pdf/pdf-replacer.tsx b/src/components/markdown-renderer/replace-components/pdf/pdf-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/pdf/pdf-replacer.tsx rename to src/components/markdown-renderer/replace-components/pdf/pdf-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx b/src/components/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx rename to src/components/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/quote-options/quote-options-replacer.tsx b/src/components/markdown-renderer/replace-components/quote-options/quote-options-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/quote-options/quote-options-replacer.tsx rename to src/components/markdown-renderer/replace-components/quote-options/quote-options-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/toc/toc-replacer.tsx b/src/components/markdown-renderer/replace-components/toc/toc-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/toc/toc-replacer.tsx rename to src/components/markdown-renderer/replace-components/toc/toc-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/vimeo/vimeo-frame.tsx b/src/components/markdown-renderer/replace-components/vimeo/vimeo-frame.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/vimeo/vimeo-frame.tsx rename to src/components/markdown-renderer/replace-components/vimeo/vimeo-frame.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx b/src/components/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx rename to src/components/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/youtube/youtube-frame.tsx b/src/components/markdown-renderer/replace-components/youtube/youtube-frame.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/youtube/youtube-frame.tsx rename to src/components/markdown-renderer/replace-components/youtube/youtube-frame.tsx diff --git a/src/components/editor/markdown-renderer/replace-components/youtube/youtube-replacer.tsx b/src/components/markdown-renderer/replace-components/youtube/youtube-replacer.tsx similarity index 100% rename from src/components/editor/markdown-renderer/replace-components/youtube/youtube-replacer.tsx rename to src/components/markdown-renderer/replace-components/youtube/youtube-replacer.tsx diff --git a/src/components/landing/pages/profile/profile.tsx b/src/components/profile-page/profile-page.tsx similarity index 80% rename from src/components/landing/pages/profile/profile.tsx rename to src/components/profile-page/profile-page.tsx index 32e07587c..5f21b4a0c 100644 --- a/src/components/landing/pages/profile/profile.tsx +++ b/src/components/profile-page/profile-page.tsx @@ -2,14 +2,14 @@ import React from 'react' import { Col, Row } from 'react-bootstrap' import { useSelector } from 'react-redux' import { Redirect } from 'react-router' -import { ApplicationState } from '../../../../redux' -import { LoginProvider } from '../../../../redux/user/types' -import { ShowIf } from '../../../common/show-if/show-if' +import { ApplicationState } from '../../redux' +import { LoginProvider } from '../../redux/user/types' +import { ShowIf } from '../common/show-if/show-if' import { ProfileAccountManagement } from './settings/profile-account-management' import { ProfileChangePassword } from './settings/profile-change-password' import { ProfileDisplayName } from './settings/profile-display-name' -export const Profile: React.FC = () => { +export const ProfilePage: React.FC = () => { const user = useSelector((state: ApplicationState) => state.user) if (!user) { diff --git a/src/components/landing/pages/profile/settings/profile-account-management.tsx b/src/components/profile-page/settings/profile-account-management.tsx similarity index 91% rename from src/components/landing/pages/profile/settings/profile-account-management.tsx rename to src/components/profile-page/settings/profile-account-management.tsx index a0dd1c37c..27c3bead3 100644 --- a/src/components/landing/pages/profile/settings/profile-account-management.tsx +++ b/src/components/profile-page/settings/profile-account-management.tsx @@ -1,10 +1,10 @@ import React, { Fragment, useEffect, useRef, useState } from 'react' import { Button, Card, Modal } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { deleteUser } from '../../../../../api/me' -import { clearUser } from '../../../../../redux/user/methods' -import { getApiUrl } from '../../../../../utils/apiUtils' -import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { deleteUser } from '../../../api/me' +import { clearUser } from '../../../redux/user/methods' +import { getApiUrl } from '../../../api/utils' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' export const ProfileAccountManagement: React.FC = () => { useTranslation() diff --git a/src/components/landing/pages/profile/settings/profile-change-password.tsx b/src/components/profile-page/settings/profile-change-password.tsx similarity index 98% rename from src/components/landing/pages/profile/settings/profile-change-password.tsx rename to src/components/profile-page/settings/profile-change-password.tsx index 616420cf9..064942174 100644 --- a/src/components/landing/pages/profile/settings/profile-change-password.tsx +++ b/src/components/profile-page/settings/profile-change-password.tsx @@ -1,7 +1,7 @@ import React, { ChangeEvent, FormEvent, useState } from 'react' import { Button, Card, Form } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { changePassword } from '../../../../../api/me' +import { changePassword } from '../../../api/me' export const ProfileChangePassword: React.FC = () => { useTranslation() diff --git a/src/components/landing/pages/profile/settings/profile-display-name.tsx b/src/components/profile-page/settings/profile-display-name.tsx similarity index 92% rename from src/components/landing/pages/profile/settings/profile-display-name.tsx rename to src/components/profile-page/settings/profile-display-name.tsx index 1e85c03e3..f83db8bdb 100644 --- a/src/components/landing/pages/profile/settings/profile-display-name.tsx +++ b/src/components/profile-page/settings/profile-display-name.tsx @@ -2,9 +2,9 @@ import React, { ChangeEvent, FormEvent, useEffect, useState } from 'react' import { Alert, Button, Card, Form } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { updateDisplayName } from '../../../../../api/me' -import { ApplicationState } from '../../../../../redux' -import { getAndSetUser } from '../../../../../utils/apiUtils' +import { updateDisplayName } from '../../../api/me' +import { ApplicationState } from '../../../redux' +import { getAndSetUser } from '../../login-page/auth/utils' export const ProfileDisplayName: React.FC = () => { const regexInvalidDisplayName = /^\s*$/ diff --git a/src/components/landing/pages/register/register.tsx b/src/components/register-page/register-page.tsx similarity index 93% rename from src/components/landing/pages/register/register.tsx rename to src/components/register-page/register-page.tsx index 419edc64b..baf4a996c 100644 --- a/src/components/landing/pages/register/register.tsx +++ b/src/components/register-page/register-page.tsx @@ -1,13 +1,13 @@ import React, { FormEvent, useCallback, useEffect, useState } from 'react' import { useSelector } from 'react-redux' import { Redirect } from 'react-router' -import { doInternalRegister } from '../../../../api/auth' -import { ApplicationState } from '../../../../redux' -import { getAndSetUser } from '../../../../utils/apiUtils' +import { doInternalRegister } from '../../api/auth' +import { ApplicationState } from '../../redux' import { Row, Col, Card, Form, Button, Alert } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { TranslatedExternalLink } from '../../../common/links/translated-external-link' -import { ShowIf } from '../../../common/show-if/show-if' +import { TranslatedExternalLink } from '../common/links/translated-external-link' +import { ShowIf } from '../common/show-if/show-if' +import { getAndSetUser } from '../login-page/auth/utils' export enum RegisterError { NONE = 'none', @@ -15,7 +15,7 @@ export enum RegisterError { OTHER = 'other' } -export const Register: React.FC = () => { +export const RegisterPage: React.FC = () => { const { t } = useTranslation() const config = useSelector((state: ApplicationState) => state.config) const user = useSelector((state: ApplicationState) => state.user) diff --git a/src/index.tsx b/src/index.tsx index 557257100..2ddca1ea9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,17 +4,17 @@ import { Provider } from 'react-redux' import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom' import { ApplicationLoader } from './components/application-loader/application-loader' import { Editor } from './components/editor/editor' -import { NotFound } from './components/error/not-found' -import { LandingLayout } from './components/landing/landing-layout' -import { History } from './components/landing/pages/history/history' -import { Intro } from './components/landing/pages/intro/intro' -import { Login } from './components/landing/pages/login/login' -import { Profile } from './components/landing/pages/profile/profile' -import { Register } from './components/landing/pages/register/register' -import { Redirector } from './components/redirector/redirector' -import './global-style/index.scss' +import { NotFoundErrorScreen } from './components/common/routing/not-found-error-screen' +import { LandingLayout } from './components/landing-layout/landing-layout' +import { HistoryPage } from './components/history-page/history-page' +import { IntroPage } from './components/intro-page/intro-page' +import { LoginPage } from './components/login-page/login-page' +import { ProfilePage } from './components/profile-page/profile-page' +import { RegisterPage } from './components/register-page/register-page' +import { Redirector } from './components/common/routing/redirector' +import './style/index.scss' import * as serviceWorker from './service-worker' -import { store } from './utils/store' +import { store } from './redux' ReactDOM.render( @@ -23,27 +23,27 @@ ReactDOM.render( - + - + - + - + - + @@ -56,7 +56,7 @@ ReactDOM.render( - + diff --git a/src/redux/api-url/methods.ts b/src/redux/api-url/methods.ts index 47fbf6ccd..668c6d844 100644 --- a/src/redux/api-url/methods.ts +++ b/src/redux/api-url/methods.ts @@ -1,4 +1,4 @@ -import { store } from '../../utils/store' +import { store } from '..' import { ApiUrlActionType, ApiUrlObject, SetApiUrlAction } from './types' export const setApiUrl = (state: ApiUrlObject): void => { diff --git a/src/redux/banner/methods.ts b/src/redux/banner/methods.ts index 0ebf7bd1b..4b8b3a51e 100644 --- a/src/redux/banner/methods.ts +++ b/src/redux/banner/methods.ts @@ -1,4 +1,4 @@ -import { store } from '../../utils/store' +import { store } from '..' import { BannerActionType, BannerState, SetBannerAction } from './types' export const setBanner = (state: BannerState): void => { diff --git a/src/redux/config/methods.ts b/src/redux/config/methods.ts index 29298280c..2d527cc5d 100644 --- a/src/redux/config/methods.ts +++ b/src/redux/config/methods.ts @@ -1,5 +1,5 @@ import { Config } from '../../api/config/types' -import { store } from '../../utils/store' +import { store } from '..' import { ConfigActionType, SetConfigAction } from './types' export const setConfig = (state: Config): void => { diff --git a/src/redux/editor/methods.ts b/src/redux/editor/methods.ts index 21fdc67d1..5f83e1783 100644 --- a/src/redux/editor/methods.ts +++ b/src/redux/editor/methods.ts @@ -1,5 +1,5 @@ -import { EditorMode } from '../../components/editor/task-bar/editor-view-mode' -import { store } from '../../utils/store' +import { store } from '..' +import { EditorMode } from '../../components/editor/app-bar/editor-view-mode' import { EditorConfigActionType, SetEditorConfigAction } from './types' export const setEditorModeConfig = (editorMode: EditorMode): void => { diff --git a/src/redux/editor/reducers.ts b/src/redux/editor/reducers.ts index bd6d79c44..ea4013714 100644 --- a/src/redux/editor/reducers.ts +++ b/src/redux/editor/reducers.ts @@ -1,6 +1,6 @@ import { Reducer } from 'redux' -import { EditorMode } from '../../components/editor/task-bar/editor-view-mode' import { EditorConfig, EditorConfigActions, EditorConfigActionType, SetEditorConfigAction } from './types' +import { EditorMode } from '../../components/editor/app-bar/editor-view-mode' export const initialState: EditorConfig = { editorMode: EditorMode.BOTH diff --git a/src/redux/editor/types.ts b/src/redux/editor/types.ts index cc8120127..cc60b5061 100644 --- a/src/redux/editor/types.ts +++ b/src/redux/editor/types.ts @@ -1,5 +1,5 @@ import { Action } from 'redux' -import { EditorMode } from '../../components/editor/task-bar/editor-view-mode' +import { EditorMode } from '../../components/editor/app-bar/editor-view-mode'; export enum EditorConfigActionType { SET_EDITOR_VIEW_MODE = 'editor/mode/set' diff --git a/src/redux/index.ts b/src/redux/index.ts index 6344b98b2..2fc28c6f9 100644 --- a/src/redux/index.ts +++ b/src/redux/index.ts @@ -1,4 +1,4 @@ -import { combineReducers, Reducer } from 'redux' +import { combineReducers, createStore, Reducer } from 'redux' import { Config } from '../api/config/types' import { ApiUrlReducer } from './api-url/reducers' import { ApiUrlObject } from './api-url/types' @@ -25,3 +25,5 @@ export const allReducers: Reducer = combineReducers void = (state: UserState) => { diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Black.eot b/src/style/fonts/source-code-pro/SourceCodePro-Black.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Black.eot rename to src/style/fonts/source-code-pro/SourceCodePro-Black.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Black.ttf b/src/style/fonts/source-code-pro/SourceCodePro-Black.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Black.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-Black.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Black.woff b/src/style/fonts/source-code-pro/SourceCodePro-Black.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Black.woff rename to src/style/fonts/source-code-pro/SourceCodePro-Black.woff diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Bold.eot b/src/style/fonts/source-code-pro/SourceCodePro-Bold.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Bold.eot rename to src/style/fonts/source-code-pro/SourceCodePro-Bold.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Bold.ttf b/src/style/fonts/source-code-pro/SourceCodePro-Bold.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Bold.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-Bold.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Bold.woff b/src/style/fonts/source-code-pro/SourceCodePro-Bold.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Bold.woff rename to src/style/fonts/source-code-pro/SourceCodePro-Bold.woff diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-ExtraLight.eot b/src/style/fonts/source-code-pro/SourceCodePro-ExtraLight.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-ExtraLight.eot rename to src/style/fonts/source-code-pro/SourceCodePro-ExtraLight.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-ExtraLight.ttf b/src/style/fonts/source-code-pro/SourceCodePro-ExtraLight.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-ExtraLight.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-ExtraLight.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-ExtraLight.woff b/src/style/fonts/source-code-pro/SourceCodePro-ExtraLight.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-ExtraLight.woff rename to src/style/fonts/source-code-pro/SourceCodePro-ExtraLight.woff diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Light.eot b/src/style/fonts/source-code-pro/SourceCodePro-Light.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Light.eot rename to src/style/fonts/source-code-pro/SourceCodePro-Light.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Light.ttf b/src/style/fonts/source-code-pro/SourceCodePro-Light.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Light.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-Light.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Light.woff b/src/style/fonts/source-code-pro/SourceCodePro-Light.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Light.woff rename to src/style/fonts/source-code-pro/SourceCodePro-Light.woff diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Medium.eot b/src/style/fonts/source-code-pro/SourceCodePro-Medium.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Medium.eot rename to src/style/fonts/source-code-pro/SourceCodePro-Medium.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Medium.ttf b/src/style/fonts/source-code-pro/SourceCodePro-Medium.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Medium.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-Medium.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Medium.woff b/src/style/fonts/source-code-pro/SourceCodePro-Medium.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Medium.woff rename to src/style/fonts/source-code-pro/SourceCodePro-Medium.woff diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Regular.eot b/src/style/fonts/source-code-pro/SourceCodePro-Regular.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Regular.eot rename to src/style/fonts/source-code-pro/SourceCodePro-Regular.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Regular.ttf b/src/style/fonts/source-code-pro/SourceCodePro-Regular.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Regular.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-Regular.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Regular.woff b/src/style/fonts/source-code-pro/SourceCodePro-Regular.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Regular.woff rename to src/style/fonts/source-code-pro/SourceCodePro-Regular.woff diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Semibold.eot b/src/style/fonts/source-code-pro/SourceCodePro-Semibold.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Semibold.eot rename to src/style/fonts/source-code-pro/SourceCodePro-Semibold.eot diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Semibold.ttf b/src/style/fonts/source-code-pro/SourceCodePro-Semibold.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Semibold.ttf rename to src/style/fonts/source-code-pro/SourceCodePro-Semibold.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceCodePro-Semibold.woff b/src/style/fonts/source-code-pro/SourceCodePro-Semibold.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceCodePro-Semibold.woff rename to src/style/fonts/source-code-pro/SourceCodePro-Semibold.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Black.eot b/src/style/fonts/source-code-pro/SourceSansPro-Black.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Black.eot rename to src/style/fonts/source-code-pro/SourceSansPro-Black.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Black.ttf b/src/style/fonts/source-code-pro/SourceSansPro-Black.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Black.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-Black.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Black.woff b/src/style/fonts/source-code-pro/SourceSansPro-Black.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Black.woff rename to src/style/fonts/source-code-pro/SourceSansPro-Black.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-BlackItalic.eot b/src/style/fonts/source-code-pro/SourceSansPro-BlackItalic.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-BlackItalic.eot rename to src/style/fonts/source-code-pro/SourceSansPro-BlackItalic.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-BlackItalic.ttf b/src/style/fonts/source-code-pro/SourceSansPro-BlackItalic.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-BlackItalic.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-BlackItalic.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-BlackItalic.woff b/src/style/fonts/source-code-pro/SourceSansPro-BlackItalic.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-BlackItalic.woff rename to src/style/fonts/source-code-pro/SourceSansPro-BlackItalic.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Bold.eot b/src/style/fonts/source-code-pro/SourceSansPro-Bold.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Bold.eot rename to src/style/fonts/source-code-pro/SourceSansPro-Bold.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Bold.ttf b/src/style/fonts/source-code-pro/SourceSansPro-Bold.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Bold.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-Bold.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Bold.woff b/src/style/fonts/source-code-pro/SourceSansPro-Bold.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Bold.woff rename to src/style/fonts/source-code-pro/SourceSansPro-Bold.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-BoldItalic.eot b/src/style/fonts/source-code-pro/SourceSansPro-BoldItalic.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-BoldItalic.eot rename to src/style/fonts/source-code-pro/SourceSansPro-BoldItalic.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-BoldItalic.ttf b/src/style/fonts/source-code-pro/SourceSansPro-BoldItalic.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-BoldItalic.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-BoldItalic.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-BoldItalic.woff b/src/style/fonts/source-code-pro/SourceSansPro-BoldItalic.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-BoldItalic.woff rename to src/style/fonts/source-code-pro/SourceSansPro-BoldItalic.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLight.eot b/src/style/fonts/source-code-pro/SourceSansPro-ExtraLight.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLight.eot rename to src/style/fonts/source-code-pro/SourceSansPro-ExtraLight.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLight.ttf b/src/style/fonts/source-code-pro/SourceSansPro-ExtraLight.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLight.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-ExtraLight.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLight.woff b/src/style/fonts/source-code-pro/SourceSansPro-ExtraLight.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLight.woff rename to src/style/fonts/source-code-pro/SourceSansPro-ExtraLight.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.eot b/src/style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.eot rename to src/style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.ttf b/src/style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.woff b/src/style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.woff rename to src/style/fonts/source-code-pro/SourceSansPro-ExtraLightItalic.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Italic.eot b/src/style/fonts/source-code-pro/SourceSansPro-Italic.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Italic.eot rename to src/style/fonts/source-code-pro/SourceSansPro-Italic.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Italic.ttf b/src/style/fonts/source-code-pro/SourceSansPro-Italic.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Italic.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-Italic.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Italic.woff b/src/style/fonts/source-code-pro/SourceSansPro-Italic.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Italic.woff rename to src/style/fonts/source-code-pro/SourceSansPro-Italic.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Light.eot b/src/style/fonts/source-code-pro/SourceSansPro-Light.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Light.eot rename to src/style/fonts/source-code-pro/SourceSansPro-Light.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Light.ttf b/src/style/fonts/source-code-pro/SourceSansPro-Light.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Light.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-Light.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Light.woff b/src/style/fonts/source-code-pro/SourceSansPro-Light.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Light.woff rename to src/style/fonts/source-code-pro/SourceSansPro-Light.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-LightItalic.eot b/src/style/fonts/source-code-pro/SourceSansPro-LightItalic.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-LightItalic.eot rename to src/style/fonts/source-code-pro/SourceSansPro-LightItalic.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-LightItalic.ttf b/src/style/fonts/source-code-pro/SourceSansPro-LightItalic.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-LightItalic.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-LightItalic.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-LightItalic.woff b/src/style/fonts/source-code-pro/SourceSansPro-LightItalic.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-LightItalic.woff rename to src/style/fonts/source-code-pro/SourceSansPro-LightItalic.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Regular.eot b/src/style/fonts/source-code-pro/SourceSansPro-Regular.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Regular.eot rename to src/style/fonts/source-code-pro/SourceSansPro-Regular.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Regular.ttf b/src/style/fonts/source-code-pro/SourceSansPro-Regular.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Regular.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-Regular.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Regular.woff b/src/style/fonts/source-code-pro/SourceSansPro-Regular.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Regular.woff rename to src/style/fonts/source-code-pro/SourceSansPro-Regular.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Semibold.eot b/src/style/fonts/source-code-pro/SourceSansPro-Semibold.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Semibold.eot rename to src/style/fonts/source-code-pro/SourceSansPro-Semibold.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Semibold.ttf b/src/style/fonts/source-code-pro/SourceSansPro-Semibold.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Semibold.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-Semibold.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-Semibold.woff b/src/style/fonts/source-code-pro/SourceSansPro-Semibold.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-Semibold.woff rename to src/style/fonts/source-code-pro/SourceSansPro-Semibold.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.eot b/src/style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.eot rename to src/style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.ttf b/src/style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.ttf rename to src/style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.woff b/src/style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.woff rename to src/style/fonts/source-code-pro/SourceSansPro-SemiboldItalic.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Bold.eot b/src/style/fonts/source-code-pro/SourceSerifPro-Bold.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Bold.eot rename to src/style/fonts/source-code-pro/SourceSerifPro-Bold.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Bold.ttf b/src/style/fonts/source-code-pro/SourceSerifPro-Bold.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Bold.ttf rename to src/style/fonts/source-code-pro/SourceSerifPro-Bold.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Bold.woff b/src/style/fonts/source-code-pro/SourceSerifPro-Bold.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Bold.woff rename to src/style/fonts/source-code-pro/SourceSerifPro-Bold.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Regular.eot b/src/style/fonts/source-code-pro/SourceSerifPro-Regular.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Regular.eot rename to src/style/fonts/source-code-pro/SourceSerifPro-Regular.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Regular.ttf b/src/style/fonts/source-code-pro/SourceSerifPro-Regular.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Regular.ttf rename to src/style/fonts/source-code-pro/SourceSerifPro-Regular.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Regular.woff b/src/style/fonts/source-code-pro/SourceSerifPro-Regular.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Regular.woff rename to src/style/fonts/source-code-pro/SourceSerifPro-Regular.woff diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Semibold.eot b/src/style/fonts/source-code-pro/SourceSerifPro-Semibold.eot similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Semibold.eot rename to src/style/fonts/source-code-pro/SourceSerifPro-Semibold.eot diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Semibold.ttf b/src/style/fonts/source-code-pro/SourceSerifPro-Semibold.ttf similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Semibold.ttf rename to src/style/fonts/source-code-pro/SourceSerifPro-Semibold.ttf diff --git a/src/global-style/fonts/source-code-pro/SourceSerifPro-Semibold.woff b/src/style/fonts/source-code-pro/SourceSerifPro-Semibold.woff similarity index 100% rename from src/global-style/fonts/source-code-pro/SourceSerifPro-Semibold.woff rename to src/style/fonts/source-code-pro/SourceSerifPro-Semibold.woff diff --git a/src/global-style/fonts/source-code-pro/source-code-pro.scss b/src/style/fonts/source-code-pro/source-code-pro.scss similarity index 100% rename from src/global-style/fonts/source-code-pro/source-code-pro.scss rename to src/style/fonts/source-code-pro/source-code-pro.scss diff --git a/src/global-style/fonts/twemoji/TwemojiMozilla.ttf b/src/style/fonts/twemoji/TwemojiMozilla.ttf similarity index 100% rename from src/global-style/fonts/twemoji/TwemojiMozilla.ttf rename to src/style/fonts/twemoji/TwemojiMozilla.ttf diff --git a/src/global-style/fonts/twemoji/twemoji.scss b/src/style/fonts/twemoji/twemoji.scss similarity index 100% rename from src/global-style/fonts/twemoji/twemoji.scss rename to src/style/fonts/twemoji/twemoji.scss diff --git a/src/global-style/index.scss b/src/style/index.scss similarity index 93% rename from src/global-style/index.scss rename to src/style/index.scss index 5af86b539..2eaae40d0 100644 --- a/src/global-style/index.scss +++ b/src/style/index.scss @@ -36,3 +36,7 @@ body { .overflow-y-scroll { overflow-y: scroll; } + +.font-style-normal { + font-style: normal; +} diff --git a/src/utils/apiUtils.ts b/src/utils/apiUtils.ts deleted file mode 100644 index a41fc022e..000000000 --- a/src/utils/apiUtils.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { getMe } from '../api/me' -import { setUser } from '../redux/user/methods' -import { store } from './store' - -export const getAndSetUser: () => (Promise) = async () => { - const me = await getMe() - setUser({ - id: me.id, - name: me.name, - photo: me.photo, - provider: me.provider - }) -} - -export const getApiUrl = (): string => { - return store.getState().apiUrl.apiUrl -} - -export const expectResponseCode = (response: Response, code = 200): void => { - if (response.status !== code) { - throw new Error(`response code is not ${code}`) - } -} diff --git a/src/utils/slugify.ts b/src/utils/slugify.ts deleted file mode 100644 index b634568bf..000000000 --- a/src/utils/slugify.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const slugify = (url:string) => { - return encodeURIComponent(String(url).trim().toLowerCase().replace(/\s+/g, '-')) -} diff --git a/src/utils/store.ts b/src/utils/store.ts deleted file mode 100644 index 8b19d3391..000000000 --- a/src/utils/store.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { createStore } from 'redux' -import { allReducers } from '../redux' - -export const store = createStore(allReducers)