diff --git a/src/components/application-loader/application-loader.tsx b/src/components/application-loader/application-loader.tsx index 20e9c2879..47c6ba47d 100644 --- a/src/components/application-loader/application-loader.tsx +++ b/src/components/application-loader/application-loader.tsx @@ -1,33 +1,29 @@ -import React, { Fragment, useEffect, useState } from 'react' +import React, { Fragment, useCallback, useEffect, useState } from 'react' import { useLocation } from 'react-router' -import { InitTask, setUp } from '../../initializers' import './application-loader.scss' +import { createSetUpTaskList, InitTask } from './initializers' import { LoadingScreen } from './loading-screen' export const ApplicationLoader: React.FC = ({ children }) => { + const { pathname } = useLocation() + + const setUpTasks = useCallback(() => { + const baseUrl: string = window.location.pathname.replace(pathname, '') + '/' + console.debug('Base URL is', baseUrl) + return createSetUpTaskList(baseUrl) + }, [pathname]) + const [failedTitle, setFailedTitle] = useState('') const [doneTasks, setDoneTasks] = useState(0) - const [initTasks, setInitTasks] = useState([]) - const { pathname } = useLocation() - const [tasksAlreadyTriggered, setTasksAlreadyTriggered] = useState(false) + const [initTasks] = useState(setUpTasks) - const runTask = async (task: Promise): Promise => { + const runTask = useCallback(async (task: Promise): Promise => { await task setDoneTasks(prevDoneTasks => { return prevDoneTasks + 1 }) - } - - useEffect(() => { - if (tasksAlreadyTriggered) { - return - } - setTasksAlreadyTriggered(true) - const baseUrl: string = window.location.pathname.replace(pathname, '') + '/' - console.debug('Base URL is', baseUrl) - setInitTasks(setUp(baseUrl)) - }, [tasksAlreadyTriggered, pathname]) + }, []) useEffect(() => { for (const task of initTasks) { @@ -36,7 +32,7 @@ export const ApplicationLoader: React.FC = ({ children }) => { setFailedTitle(task.name) }) } - }, [initTasks]) + }, [initTasks, runTask]) return ( doneTasks < initTasks.length || initTasks.length === 0 diff --git a/src/initializers/configLoader.ts b/src/components/application-loader/initializers/configLoader.ts similarity index 58% rename from src/initializers/configLoader.ts rename to src/components/application-loader/initializers/configLoader.ts index 25a67c94f..e96f026fc 100644 --- a/src/initializers/configLoader.ts +++ b/src/components/application-loader/initializers/configLoader.ts @@ -1,8 +1,8 @@ -import { getBackendConfig } from '../api/backend-config' -import { getFrontendConfig } from '../api/frontend-config' -import { setBackendConfig } from '../redux/backend-config/methods' -import { setFrontendConfig } from '../redux/frontend-config/methods' -import { getAndSetUser } from '../utils/apiUtils' +import { getBackendConfig } from '../../../api/backend-config' +import { getFrontendConfig } from '../../../api/frontend-config' +import { setBackendConfig } from '../../../redux/backend-config/methods' +import { setFrontendConfig } from '../../../redux/frontend-config/methods' +import { getAndSetUser } from '../../../utils/apiUtils' export const loadAllConfig: (baseUrl: string) => Promise = async (baseUrl) => { const frontendConfig = await getFrontendConfig(baseUrl) diff --git a/src/initializers/i18n.ts b/src/components/application-loader/initializers/i18n.ts similarity index 100% rename from src/initializers/i18n.ts rename to src/components/application-loader/initializers/i18n.ts index f98819e95..2e7df0dde 100644 --- a/src/initializers/i18n.ts +++ b/src/components/application-loader/initializers/i18n.ts @@ -1,7 +1,6 @@ import i18n from 'i18next' -import Backend from 'i18next-http-backend' import LanguageDetector from 'i18next-browser-languagedetector' -import { initReactI18next } from 'react-i18next' +import Backend from 'i18next-http-backend' import moment from 'moment' import 'moment/locale/ar' import 'moment/locale/ca' @@ -30,6 +29,7 @@ import 'moment/locale/uk' import 'moment/locale/vi' import 'moment/locale/zh-cn' import 'moment/locale/zh-tw' +import { initReactI18next } from 'react-i18next' export const setUpI18n = async (): Promise => { await i18n diff --git a/src/initializers/index.ts b/src/components/application-loader/initializers/index.ts similarity index 88% rename from src/initializers/index.ts rename to src/components/application-loader/initializers/index.ts index 956fdd475..09b8e811f 100644 --- a/src/initializers/index.ts +++ b/src/components/application-loader/initializers/index.ts @@ -14,7 +14,7 @@ export interface InitTask { task: Promise } -export const setUp = (baseUrl: string): InitTask[] => { +export const createSetUpTaskList = (baseUrl: string): InitTask[] => { return [{ name: 'Load Translations', task: setUpI18n() diff --git a/src/components/application-loader/loading-screen.tsx b/src/components/application-loader/loading-screen.tsx index 08697a052..f23f98b22 100644 --- a/src/components/application-loader/loading-screen.tsx +++ b/src/components/application-loader/loading-screen.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Alert } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../fork-awesome/fork-awesome-icon' -import { ShowIf } from '../common/show-if' +import { ForkAwesomeIcon } from '../common/fork-awesome/fork-awesome-icon' +import { ShowIf } from '../common/show-if/show-if' export interface LoadingScreenProps { failedTitle: string diff --git a/src/components/element-separator/element-separator.tsx b/src/components/common/element-separator/element-separator.tsx similarity index 93% rename from src/components/element-separator/element-separator.tsx rename to src/components/common/element-separator/element-separator.tsx index b850d32b4..f8888c3f9 100644 --- a/src/components/element-separator/element-separator.tsx +++ b/src/components/common/element-separator/element-separator.tsx @@ -1,5 +1,5 @@ import React, { Fragment } from 'react' -import { ShowIf } from '../common/show-if' +import { ShowIf } from '../show-if/show-if' export interface ElementSeparatorProps { separator: React.ReactElement diff --git a/src/components/error-modal/error-modal.tsx b/src/components/common/error-modal/error-modal.tsx similarity index 91% rename from src/components/error-modal/error-modal.tsx rename to src/components/common/error-modal/error-modal.tsx index 77a0633f6..1ff475793 100644 --- a/src/components/error-modal/error-modal.tsx +++ b/src/components/common/error-modal/error-modal.tsx @@ -1,7 +1,7 @@ import React, { Fragment } from 'react' import { Modal } from 'react-bootstrap' import { Trans } from 'react-i18next' -import { ForkAwesomeIcon, IconName } from '../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' export interface ErrorModalProps { show: boolean diff --git a/src/fork-awesome/fork-awesome-icon.tsx b/src/components/common/fork-awesome/fork-awesome-icon.tsx similarity index 100% rename from src/fork-awesome/fork-awesome-icon.tsx rename to src/components/common/fork-awesome/fork-awesome-icon.tsx index d2fd97b05..7901135a2 100644 --- a/src/fork-awesome/fork-awesome-icon.tsx +++ b/src/components/common/fork-awesome/fork-awesome-icon.tsx @@ -1,5 +1,5 @@ -import React from 'react' import 'fork-awesome/css/fork-awesome.min.css' +import React from 'react' export type IconName = '500px'|'activitypub'|'address-book-o'|'address-book'|'address-card-o'|'address-card'|'adjust'|'adn'|'align-center'|'align-justify'|'align-left'|'align-right'|'amazon'|'ambulance'|'american-sign-language-interpreting'|'anchor'|'android'|'angellist'|'angle-double-down'|'angle-double-left'|'angle-double-right'|'angle-double-up'|'angle-down'|'angle-left'|'angle-right'|'angle-up'|'apple'|'archive-org'|'archive'|'archlinux'|'area-chart'|'arrow-circle-down'|'arrow-circle-left'|'arrow-circle-o-down'|'arrow-circle-o-left'|'arrow-circle-o-right'|'arrow-circle-o-up'|'arrow-circle-right'|'arrow-circle-up'|'arrow-down'|'arrow-left'|'arrow-right'|'arrows-alt'|'arrows-h'|'arrows'|'arrows-v'|'arrow-up'|'artstation'|'assistive-listening-systems'|'asterisk'|'at'|'att'|'audio-description'|'backward'|'balance-scale'|'bandcamp'|'ban'|'bar-chart'|'barcode'|'bars'|'bath'|'battery-empty'|'battery-full'|'battery-half'|'battery-quarter'|'battery-three-quarters'|'bed'|'beer'|'behance-square'|'behance'|'bell-o'|'bell-rigning-o'|'bell-ringing'|'bell-slash-o'|'bell-slash'|'bell'|'bicycle'|'binoculars'|'biometric'|'birthday-cake'|'bitbucket-square'|'bitbucket'|'black-tie'|'blind'|'bluetooth-b'|'bluetooth'|'bold'|'bolt'|'bomb'|'bookmark-o'|'bookmark'|'book'|'bootstrap'|'braille'|'briefcase'|'btc'|'bug'|'building-o'|'building'|'bullhorn'|'bullseye'|'bus'|'buysellads'|'calculator'|'calendar-check-o'|'calendar-minus-o'|'calendar-o'|'calendar-plus-o'|'calendar'|'calendar-times-o'|'camera-retro'|'camera'|'caret-down'|'caret-left'|'caret-right'|'caret-square-o-down'|'caret-square-o-left'|'caret-square-o-right'|'caret-square-o-up'|'caret-up'|'car'|'cart-arrow-down'|'cart-plus'|'cc-amex'|'cc-diners-club'|'cc-discover'|'cc-jcb'|'cc-mastercard'|'cc-paypal'|'cc-stripe'|'cc'|'cc-visa'|'certificate'|'chain-broken'|'check-circle-o'|'check-circle'|'check-square-o'|'check-square'|'check'|'chevron-circle-down'|'chevron-circle-left'|'chevron-circle-right'|'chevron-circle-up'|'chevron-down'|'chevron-left'|'chevron-right'|'chevron-up'|'child'|'chrome'|'circle-o-notch'|'circle-o'|'circle'|'circle-thin'|'classicpress-circle'|'classicpress'|'clipboard'|'clock-o'|'clone'|'cloud-download'|'cloud'|'cloud-upload'|'code-fork'|'codepen'|'code'|'codiepie'|'coffee'|'cogs'|'cog'|'columns'|'commenting-o'|'commenting'|'comment-o'|'comments-o'|'comments'|'comment'|'compass'|'compress'|'connectdevelop'|'contao'|'copyright'|'creative-commons'|'credit-card-alt'|'credit-card'|'crop'|'crosshairs'|'css3'|'c'|'cubes'|'cube'|'cutlery'|'dashcube'|'database'|'deaf'|'debian'|'delicious'|'desktop'|'deviantart'|'dev-to'|'diamond'|'diaspora'|'digg'|'digitalocean'|'discord-alt'|'discord'|'dogmazic'|'dot-circle-o'|'download'|'dribbble'|'dropbox'|'drupal'|'edge'|'eercast'|'eject'|'ellipsis-h'|'ellipsis-v'|'emby'|'empire'|'envelope-open-o'|'envelope-open'|'envelope-o'|'envelope-square'|'envelope'|'envira'|'eraser'|'ethereum'|'etsy'|'eur'|'exchange'|'exclamation-circle'|'exclamation'|'exclamation-triangle'|'expand'|'expeditedssl'|'external-link-square'|'external-link'|'eyedropper'|'eye-slash'|'eye'|'facebook-messenger'|'facebook-official'|'facebook-square'|'facebook'|'fast-backward'|'fast-forward'|'fax'|'f-droid'|'female'|'ffmpeg'|'fighter-jet'|'file-archive-o'|'file-audio-o'|'file-code-o'|'file-epub'|'file-excel-o'|'file-image-o'|'file-o'|'file-pdf-o'|'file-powerpoint-o'|'files-o'|'file'|'file-text-o'|'file-text'|'file-video-o'|'file-word-o'|'film'|'filter'|'fire-extinguisher'|'firefox'|'fire'|'first-order'|'flag-checkered'|'flag-o'|'flag'|'flask'|'flickr'|'floppy-o'|'folder-open-o'|'folder-open'|'folder-o'|'folder'|'font-awesome'|'fonticons'|'font'|'fork-awesome'|'fort-awesome'|'forumbee'|'forward'|'foursquare'|'free-code-camp'|'freedombox'|'friendica'|'frown-o'|'funkwhale'|'futbol-o'|'gamepad'|'gavel'|'gbp'|'genderless'|'get-pocket'|'gg-circle'|'gg'|'gift'|'gimp'|'gitea'|'github-alt'|'github-square'|'github'|'gitlab'|'git-square'|'git'|'glass'|'glide-g'|'glide'|'globe-e'|'globe'|'globe-w'|'gnupg'|'gnu-social'|'google-plus-official'|'google-plus-square'|'google-plus'|'google'|'google-wallet'|'graduation-cap'|'gratipay'|'grav'|'hackaday'|'hacker-news'|'hackster'|'hal'|'hand-lizard-o'|'hand-o-down'|'hand-o-left'|'hand-o-right'|'hand-o-up'|'hand-paper-o'|'hand-peace-o'|'hand-pointer-o'|'hand-rock-o'|'hand-scissors-o'|'handshake-o'|'hand-spock-o'|'hashnode'|'hashtag'|'hdd-o'|'header'|'headphones'|'heartbeat'|'heart-o'|'heart'|'history'|'home'|'hospital-o'|'hourglass-end'|'hourglass-half'|'hourglass-o'|'hourglass-start'|'hourglass'|'houzz'|'h-square'|'html5'|'hubzilla'|'i-cursor'|'id-badge'|'id-card-o'|'id-card'|'ils'|'imdb'|'inbox'|'indent'|'industry'|'info-circle'|'info'|'inkscape'|'inr'|'instagram'|'internet-explorer'|'ioxhost'|'italic'|'jirafeau'|'joomla'|'joplin'|'jpy'|'jsfiddle'|'julia'|'jupyter'|'keybase'|'keyboard-o'|'key-modern'|'key'|'krw'|'language'|'laptop'|'laravel'|'lastfm-square'|'lastfm'|'leaf'|'leanpub'|'lemon-o'|'level-down'|'level-up'|'liberapay-square'|'liberapay'|'life-ring'|'lightbulb-o'|'line-chart'|'linkedin-square'|'linkedin'|'link'|'linode'|'linux'|'list-alt'|'list-ol'|'list'|'list-ul'|'location-arrow'|'lock'|'long-arrow-down'|'long-arrow-left'|'long-arrow-right'|'long-arrow-up'|'low-vision'|'magic'|'magnet'|'male'|'map-marker'|'map-o'|'map-pin'|'map-signs'|'map'|'mars-double'|'mars-stroke-h'|'mars-stroke'|'mars-stroke-v'|'mars'|'mastodon-alt'|'mastodon-square'|'mastodon'|'matrix-org'|'maxcdn'|'meanpath'|'medium-square'|'medium'|'medkit'|'meetup'|'meh-o'|'mercury'|'microchip'|'microphone-slash'|'microphone'|'minus-circle'|'minus-square-o'|'minus-square'|'minus'|'mixcloud'|'mobile'|'modx'|'money'|'moon-o'|'moon'|'motorcycle'|'mouse-pointer'|'music'|'neuter'|'newspaper-o'|'nextcloud-square'|'nextcloud'|'nodejs'|'object-group'|'object-ungroup'|'odnoklassniki-square'|'odnoklassniki'|'opencart'|'open-collective'|'openid'|'opera'|'optin-monster'|'orcid'|'outdent'|'pagelines'|'paint-brush'|'paperclip'|'paper-plane-o'|'paper-plane'|'paragraph'|'patreon'|'pause-circle-o'|'pause-circle'|'pause'|'paw'|'paypal'|'peertube'|'pencil-square-o'|'pencil-square'|'pencil'|'percent'|'phone-square'|'phone'|'php'|'picture-o'|'pie-chart'|'pinterest-p'|'pinterest-square'|'pinterest'|'pixelfed'|'plane'|'play-circle-o'|'play-circle'|'play'|'pleroma'|'plug'|'plus-circle'|'plus-square-o'|'plus-square'|'plus'|'podcast'|'power-off'|'print'|'product-hunt'|'puzzle-piece'|'python'|'qq'|'qrcode'|'question-circle-o'|'question-circle'|'question'|'quora'|'quote-left'|'quote-right'|'random'|'ravelry'|'react'|'rebel'|'recycle'|'reddit-alien'|'reddit-square'|'reddit'|'refresh'|'registered'|'renren'|'repeat'|'reply-all'|'reply'|'researchgate'|'retweet'|'road'|'rocket'|'rss-square'|'rss'|'rub'|'safari'|'scissors'|'scribd'|'scuttlebutt'|'search-minus'|'search-plus'|'search'|'sellsy'|'server'|'shaarli-o'|'shaarli'|'share-alt-square'|'share-alt'|'share-square-o'|'share-square'|'share'|'shield'|'ship'|'shirtsinbulk'|'shopping-bag'|'shopping-basket'|'shopping-cart'|'shower'|'signalapp'|'signal'|'sign-in'|'sign-language'|'sign-out'|'simplybuilt'|'sitemap'|'skyatlas'|'skype'|'slack'|'sliders'|'slideshare'|'smile-o'|'snapchat-ghost'|'snapchat-square'|'snapchat'|'snowdrift'|'snowflake-o'|'social-home'|'sort-alpha-asc'|'sort-alpha-desc'|'sort-amount-asc'|'sort-amount-desc'|'sort-asc'|'sort-desc'|'sort-numeric-asc'|'sort-numeric-desc'|'sort'|'soundcloud'|'space-shuttle'|'spell-check'|'spinner'|'spoon'|'spotify'|'square-o'|'square'|'stack-exchange'|'stack-overflow'|'star-half-o'|'star-half'|'star-o'|'star'|'steam-square'|'steam'|'step-backward'|'step-forward'|'stethoscope'|'sticky-note-o'|'sticky-note'|'stop-circle-o'|'stop-circle'|'stop'|'street-view'|'strikethrough'|'stumbleupon-circle'|'stumbleupon'|'subscript'|'subway'|'suitcase'|'sun-o'|'sun'|'superpowers'|'superscript'|'syncthing'|'table'|'tablet'|'tachometer'|'tags'|'tag'|'tasks'|'taxi'|'telegram'|'television'|'tencent-weibo'|'terminal'|'text-height'|'text-width'|'themeisle'|'thermometer-empty'|'thermometer-full'|'thermometer-half'|'thermometer-quarter'|'thermometer-three-quarters'|'th-large'|'th-list'|'th'|'thumbs-down'|'thumbs-o-down'|'thumbs-o-up'|'thumbs-up'|'thumb-tack'|'ticket'|'times-circle-o'|'times-circle'|'times'|'tint'|'tipeee'|'toggle-off'|'toggle-on'|'tor-onion'|'trademark'|'train'|'transgender-alt'|'transgender'|'trash-o'|'trash'|'tree'|'trello'|'tripadvisor'|'trophy'|'truck'|'try'|'tty'|'tumblr-square'|'tumblr'|'twitch'|'twitter-square'|'twitter'|'umbrella'|'underline'|'undo'|'universal-access'|'university'|'unlock-alt'|'unlock'|'unslpash'|'upload'|'usb'|'usd'|'user-circle-o'|'user-circle'|'user-md'|'user-o'|'user-plus'|'user-secret'|'users'|'user'|'user-times'|'venus-double'|'venus-mars'|'venus'|'viacoin'|'viadeo-square'|'viadeo'|'video-camera'|'vimeo-square'|'vimeo'|'vine'|'vk'|'volume-control-phone'|'volume-down'|'volume-mute'|'volume-off'|'volume-up'|'weibo'|'weixin'|'whatsapp'|'wheelchair-alt'|'wheelchair'|'wifi'|'wikidata'|'wikipedia-w'|'window-close-o'|'window-close'|'window-maximize'|'window-minimize'|'window-restore'|'windows'|'wire'|'wordpress'|'wpbeginner'|'wpexplorer'|'wpforms'|'wrench'|'xing-square'|'xing'|'xmpp'|'yahoo'|'y-combinator'|'yelp'|'yoast'|'youtube-play'|'youtube-square'|'youtube'|'zotero' export type IconSize = '2x'|'3x'|'4x'|'5x' diff --git a/src/components/icon-button/icon-button.scss b/src/components/common/icon-button/icon-button.scss similarity index 100% rename from src/components/icon-button/icon-button.scss rename to src/components/common/icon-button/icon-button.scss diff --git a/src/components/icon-button/icon-button.tsx b/src/components/common/icon-button/icon-button.tsx similarity index 89% rename from src/components/icon-button/icon-button.tsx rename to src/components/common/icon-button/icon-button.tsx index 6a058d3bf..795308af8 100644 --- a/src/components/icon-button/icon-button.tsx +++ b/src/components/common/icon-button/icon-button.tsx @@ -1,7 +1,7 @@ import React from 'react' -import './icon-button.scss' import { Button, ButtonProps } from 'react-bootstrap' -import { ForkAwesomeIcon, IconName } from '../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' +import './icon-button.scss' export interface SocialButtonProps extends ButtonProps { icon: IconName diff --git a/src/components/links/external-link.tsx b/src/components/common/links/external-link.tsx similarity index 78% rename from src/components/links/external-link.tsx rename to src/components/common/links/external-link.tsx index 8fae3ce66..c4924eaae 100644 --- a/src/components/links/external-link.tsx +++ b/src/components/common/links/external-link.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { ForkAwesomeIcon, IconName } from '../../fork-awesome/fork-awesome-icon' -import { ShowIf } from '../common/show-if' +import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' +import { ShowIf } from '../show-if/show-if' import { LinkWithTextProps } from './types' export const ExternalLink: React.FC = ({ href, text, icon, className = 'text-light' }) => { diff --git a/src/components/links/internal-link.tsx b/src/components/common/links/internal-link.tsx similarity index 77% rename from src/components/links/internal-link.tsx rename to src/components/common/links/internal-link.tsx index 88daf9af8..7464ac169 100644 --- a/src/components/links/internal-link.tsx +++ b/src/components/common/links/internal-link.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Link } from 'react-router-dom' -import { ForkAwesomeIcon, IconName } from '../../fork-awesome/fork-awesome-icon' -import { ShowIf } from '../common/show-if' +import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' +import { ShowIf } from '../show-if/show-if' import { LinkWithTextProps } from './types' export const InternalLink: React.FC = ({ href, text, icon, className = 'text-light' }) => { diff --git a/src/components/links/translated-external-link.tsx b/src/components/common/links/translated-external-link.tsx similarity index 100% rename from src/components/links/translated-external-link.tsx rename to src/components/common/links/translated-external-link.tsx diff --git a/src/components/links/translated-internal-link.tsx b/src/components/common/links/translated-internal-link.tsx similarity index 100% rename from src/components/links/translated-internal-link.tsx rename to src/components/common/links/translated-internal-link.tsx diff --git a/src/components/links/types.ts b/src/components/common/links/types.ts similarity index 84% rename from src/components/links/types.ts rename to src/components/common/links/types.ts index efab57f92..1fdd91699 100644 --- a/src/components/links/types.ts +++ b/src/components/common/links/types.ts @@ -1,5 +1,5 @@ import { StringMap, TOptionsBase } from 'i18next' -import { IconName } from '../../fork-awesome/fork-awesome-icon' +import { IconName } from '../fork-awesome/fork-awesome-icon' export interface GeneralLinkProp { href: string; diff --git a/src/components/pagination/pager-item.tsx b/src/components/common/pagination/pager-item.tsx similarity index 100% rename from src/components/pagination/pager-item.tsx rename to src/components/common/pagination/pager-item.tsx diff --git a/src/components/pagination/pager-pagination.tsx b/src/components/common/pagination/pager-pagination.tsx similarity index 98% rename from src/components/pagination/pager-pagination.tsx rename to src/components/common/pagination/pager-pagination.tsx index 2ba344c6c..137c7db76 100644 --- a/src/components/pagination/pager-pagination.tsx +++ b/src/components/common/pagination/pager-pagination.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react' import { Pagination } from 'react-bootstrap' -import { ShowIf } from '../common/show-if' +import { ShowIf } from '../show-if/show-if' import { PagerItem } from './pager-item' export interface PaginationProps { diff --git a/src/components/pagination/pager.tsx b/src/components/common/pagination/pager.tsx similarity index 100% rename from src/components/pagination/pager.tsx rename to src/components/common/pagination/pager.tsx diff --git a/src/components/common/show-if.tsx b/src/components/common/show-if/show-if.tsx similarity index 100% rename from src/components/common/show-if.tsx rename to src/components/common/show-if/show-if.tsx diff --git a/src/components/sort-button/sort-button.tsx b/src/components/common/sort-button/sort-button.tsx similarity index 94% rename from src/components/sort-button/sort-button.tsx rename to src/components/common/sort-button/sort-button.tsx index 10159a10c..2ed513078 100644 --- a/src/components/sort-button/sort-button.tsx +++ b/src/components/common/sort-button/sort-button.tsx @@ -1,6 +1,6 @@ import React from 'react' import { ButtonProps } from 'react-bootstrap' -import { IconName } from '../../fork-awesome/fork-awesome-icon' +import { IconName } from '../fork-awesome/fork-awesome-icon' import { IconButton } from '../icon-button/icon-button' export enum SortModeEnum { diff --git a/src/components/editor/editor.tsx b/src/components/editor/editor.tsx index f94317267..14e659664 100644 --- a/src/components/editor/editor.tsx +++ b/src/components/editor/editor.tsx @@ -2,7 +2,7 @@ import React from 'react' import { useSelector } from 'react-redux' import { useParams } from 'react-router' import { ApplicationState } from '../../redux' -import { ShowIf } from '../common/show-if' +import { ShowIf } from '../common/show-if/show-if' import { EditorWindow } from './editor-window/editor-window' import { MarkdownPreview } from './markdown-preview/markdown-preview' import { EditorMode } from './task-bar/editor-view-mode' diff --git a/src/components/editor/task-bar/connection-indicator.tsx b/src/components/editor/task-bar/connection-indicator.tsx index 4e4f9eaca..3c5723954 100644 --- a/src/components/editor/task-bar/connection-indicator.tsx +++ b/src/components/editor/task-bar/connection-indicator.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Dropdown } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { ActiveIndicatorStatus } from './active-indicator' import './connection-indicator.scss' import { UserLine } from './user-line' diff --git a/src/components/editor/task-bar/dark-mode-button.tsx b/src/components/editor/task-bar/dark-mode-button.tsx index 4faf5cc55..68200a3a0 100644 --- a/src/components/editor/task-bar/dark-mode-button.tsx +++ b/src/components/editor/task-bar/dark-mode-button.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { ToggleButton, ToggleButtonGroup } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' const DarkModeButton: React.FC = () => { const { t } = useTranslation() diff --git a/src/components/editor/task-bar/editor-menu.tsx b/src/components/editor/task-bar/editor-menu.tsx index a8a9b479d..f342ca27b 100644 --- a/src/components/editor/task-bar/editor-menu.tsx +++ b/src/components/editor/task-bar/editor-menu.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' const EditorMenu: React.FC = () => { useTranslation() diff --git a/src/components/editor/task-bar/editor-view-mode.tsx b/src/components/editor/task-bar/editor-view-mode.tsx index 90b4d1bef..1eba4ff63 100644 --- a/src/components/editor/task-bar/editor-view-mode.tsx +++ b/src/components/editor/task-bar/editor-view-mode.tsx @@ -2,9 +2,9 @@ import React from 'react' import { ToggleButton, ToggleButtonGroup } from 'react-bootstrap' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' -import { ForkAwesomeIcon } from '../../../fork-awesome/fork-awesome-icon' import { ApplicationState } from '../../../redux' import { setEditorModeConfig } from '../../../redux/editor/methods' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' export enum EditorMode { PREVIEW, diff --git a/src/components/editor/task-bar/help-button.tsx b/src/components/editor/task-bar/help-button.tsx index 9a3ee6bd5..8342a6631 100644 --- a/src/components/editor/task-bar/help-button.tsx +++ b/src/components/editor/task-bar/help-button.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useState } from 'react' import { Button, Card, Col, Modal, Row, Table } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../fork-awesome/fork-awesome-icon' -import { TranslatedExternalLink } from '../../links/translated-external-link' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' +import { TranslatedExternalLink } from '../../common/links/translated-external-link' export const HelpButton: React.FC = () => { const { t } = useTranslation() diff --git a/src/components/editor/task-bar/task-bar.tsx b/src/components/editor/task-bar/task-bar.tsx index 057749ad5..d868cf646 100644 --- a/src/components/editor/task-bar/task-bar.tsx +++ b/src/components/editor/task-bar/task-bar.tsx @@ -1,12 +1,12 @@ import React from 'react' -import { Link } from 'react-router-dom' import { Button, Nav, Navbar } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../fork-awesome/fork-awesome-icon' -import { DarkModeButton } from './dark-mode-button' -import { EditorViewMode } from './editor-view-mode' import { Trans, useTranslation } from 'react-i18next' -import { EditorMenu } from './editor-menu' +import { Link } from 'react-router-dom' +import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { ConnectionIndicator } from './connection-indicator' +import { DarkModeButton } from './dark-mode-button' +import { EditorMenu } from './editor-menu' +import { EditorViewMode } from './editor-view-mode' import { HelpButton } from './help-button' const TaskBar: React.FC = () => { diff --git a/src/components/landing/layout/footer/powered-by-links.tsx b/src/components/landing/layout/footer/powered-by-links.tsx index 865a00c45..9e2baed7f 100644 --- a/src/components/landing/layout/footer/powered-by-links.tsx +++ b/src/components/landing/layout/footer/powered-by-links.tsx @@ -2,9 +2,9 @@ import React, { Fragment } from 'react' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { ApplicationState } from '../../../../redux' -import { ExternalLink } from '../../../links/external-link' -import { TranslatedExternalLink } from '../../../links/translated-external-link' -import { TranslatedInternalLink } from '../../../links/translated-internal-link' +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' export const PoweredByLinks: React.FC = () => { diff --git a/src/components/landing/layout/footer/social-links.tsx b/src/components/landing/layout/footer/social-links.tsx index 7ff5c8e33..d4942430a 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 '../../../links/external-link' +import { ExternalLink } from '../../../common/links/external-link' const SocialLink: React.FC = () => { useTranslation() diff --git a/src/components/landing/layout/navigation/new-guest-note-button.tsx b/src/components/landing/layout/navigation/new-guest-note-button.tsx index ec396da3e..dc9fcdb60 100644 --- a/src/components/landing/layout/navigation/new-guest-note-button.tsx +++ b/src/components/landing/layout/navigation/new-guest-note-button.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { LinkContainer } from 'react-router-bootstrap' import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../fork-awesome/fork-awesome-icon' +import { LinkContainer } from 'react-router-bootstrap' +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 index 029c48284..3a182dfd8 100644 --- a/src/components/landing/layout/navigation/new-user-note-button.tsx +++ b/src/components/landing/layout/navigation/new-user-note-button.tsx @@ -1,8 +1,8 @@ -import { LinkContainer } from 'react-router-bootstrap' -import { Button } from 'react-bootstrap' import React from 'react' +import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../fork-awesome/fork-awesome-icon' +import { LinkContainer } from 'react-router-bootstrap' +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 index cdf189350..084ae6996 100644 --- a/src/components/landing/layout/navigation/sign-in-button.tsx +++ b/src/components/landing/layout/navigation/sign-in-button.tsx @@ -5,7 +5,7 @@ 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' +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/user-dropdown.tsx index 7c80665ee..549e6d7c4 100644 --- a/src/components/landing/layout/navigation/user-dropdown/user-dropdown.tsx +++ b/src/components/landing/layout/navigation/user-dropdown/user-dropdown.tsx @@ -3,9 +3,9 @@ import { Dropdown } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { LinkContainer } from 'react-router-bootstrap' -import { ForkAwesomeIcon } from '../../../../../fork-awesome/fork-awesome-icon' 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' export const UserDropdown: React.FC = () => { diff --git a/src/components/landing/layout/version-info/version-info.tsx b/src/components/landing/layout/version-info/version-info.tsx index 670ff6ed5..14026323b 100644 --- a/src/components/landing/layout/version-info/version-info.tsx +++ b/src/components/landing/layout/version-info/version-info.tsx @@ -5,8 +5,8 @@ import { useSelector } from 'react-redux' import { Link } from 'react-router-dom' import { ApplicationState } from '../../../../redux' import frontendVersion from '../../../../version.json' -import { ShowIf } from '../../../common/show-if' -import { TranslatedExternalLink } from '../../../links/translated-external-link' +import { TranslatedExternalLink } from '../../../common/links/translated-external-link' +import { ShowIf } from '../../../common/show-if/show-if' import { VersionInputField } from './version-input-field' export const VersionInfo: React.FC = () => { diff --git a/src/components/landing/layout/version-info/version-input-field.tsx b/src/components/landing/layout/version-info/version-input-field.tsx index 2c75c7e8b..c3b4c8264 100644 --- a/src/components/landing/layout/version-info/version-input-field.tsx +++ b/src/components/landing/layout/version-info/version-input-field.tsx @@ -1,7 +1,7 @@ import React, { Fragment, useRef, useState } from 'react' import { Button, FormControl, InputGroup, Overlay, Tooltip } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../../../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' export interface VersionInputFieldProps { version: string diff --git a/src/components/landing/pages/history/common/close-button.tsx b/src/components/landing/pages/history/common/close-button.tsx index a429abbd5..b32e99a61 100644 --- a/src/components/landing/pages/history/common/close-button.tsx +++ b/src/components/landing/pages/history/common/close-button.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../../../fork-awesome/fork-awesome-icon' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' import './close-button.scss' export interface CloseButtonProps { diff --git a/src/components/landing/pages/history/common/pin-button.tsx b/src/components/landing/pages/history/common/pin-button.tsx index 7582f46ec..9ecd8f069 100644 --- a/src/components/landing/pages/history/common/pin-button.tsx +++ b/src/components/landing/pages/history/common/pin-button.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../../../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/landing/pages/history/common/sync-status.tsx b/src/components/landing/pages/history/common/sync-status.tsx index 8357415b0..dff01fcaf 100644 --- a/src/components/landing/pages/history/common/sync-status.tsx +++ b/src/components/landing/pages/history/common/sync-status.tsx @@ -1,18 +1,18 @@ import React from 'react' import { Button } from 'react-bootstrap' -import { ForkAwesomeIcon } from '../../../../../fork-awesome/fork-awesome-icon' -import { Location } from '../history' +import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon' +import { HistoryEntryOrigin } from '../history' import './sync-status.scss' export interface SyncStatusProps { isDark: boolean - location: Location + location: HistoryEntryOrigin onSync: () => void className?: string } export const SyncStatus: React.FC = ({ isDark, location, onSync, className }) => { - const icon = location === Location.REMOTE ? 'cloud' : 'laptop' + const icon = location === HistoryEntryOrigin.REMOTE ? 'cloud' : 'laptop' return (