diff --git a/client/src/components/profile/components/time-line.tsx b/client/src/components/profile/components/time-line.tsx index 9d5349031b4..a51532fdc00 100644 --- a/client/src/components/profile/components/time-line.tsx +++ b/client/src/components/profile/components/time-line.tsx @@ -9,7 +9,7 @@ import { connect } from 'react-redux'; import envData from '../../../../../config/env.json'; import { getLangCode } from '../../../../../config/i18n'; -import { getCertIds, getPathFromID } from '../../../../../utils'; +import { getCertIds, getPathFromID } from '../../../../utils'; import { regeneratePathAndHistory } from '../../../../../utils/polyvinyl'; import CertificationIcon from '../../../assets/icons/certification'; import { CompletedChallenge } from '../../../redux/prop-types'; diff --git a/client/src/templates/Challenges/classic/desktop-layout.tsx b/client/src/templates/Challenges/classic/desktop-layout.tsx index c4fc7a2c81e..888c55aea67 100644 --- a/client/src/templates/Challenges/classic/desktop-layout.tsx +++ b/client/src/templates/Challenges/classic/desktop-layout.tsx @@ -3,7 +3,7 @@ import React, { useState, useEffect, ReactElement } from 'react'; import { ReflexContainer, ReflexSplitter, ReflexElement } from 'react-reflex'; import { createSelector } from 'reselect'; import { connect } from 'react-redux'; -import { sortChallengeFiles } from '../../../../../utils/sort-challengefiles'; +import { sortChallengeFiles } from '../../../../utils/sort-challengefiles'; import { challengeTypes } from '../../../../../config/challenge-types'; import { ChallengeFile, diff --git a/client/src/templates/Challenges/classic/editor-tabs.tsx b/client/src/templates/Challenges/classic/editor-tabs.tsx index 89a52572749..33757b55ee2 100644 --- a/client/src/templates/Challenges/classic/editor-tabs.tsx +++ b/client/src/templates/Challenges/classic/editor-tabs.tsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import i18next from 'i18next'; -import { sortChallengeFiles } from '../../../../../utils/sort-challengefiles'; +import { sortChallengeFiles } from '../../../../utils/sort-challengefiles'; import { ChallengeFile, ChallengeFiles } from '../../../redux/prop-types'; import { toggleVisibleEditor } from '../redux/actions'; import { diff --git a/client/src/templates/Challenges/utils/get-target-editor.ts b/client/src/templates/Challenges/utils/get-target-editor.ts index d37f580defc..1303de55c2b 100644 --- a/client/src/templates/Challenges/utils/get-target-editor.ts +++ b/client/src/templates/Challenges/utils/get-target-editor.ts @@ -1,5 +1,5 @@ import { isEmpty } from 'lodash-es'; -import { sortChallengeFiles } from '../../../../../utils/sort-challengefiles'; +import { sortChallengeFiles } from '../../../../utils/sort-challengefiles'; import { ChallengeFiles, FileKey } from '../../../redux/prop-types'; export function getTargetEditor( diff --git a/client/src/utils/__fixtures/completed-challenges.ts b/client/src/utils/__fixtures__/completed-challenges.ts similarity index 90% rename from client/src/utils/__fixtures/completed-challenges.ts rename to client/src/utils/__fixtures__/completed-challenges.ts index 8cb9f01ef4c..b0e8f38f122 100644 --- a/client/src/utils/__fixtures/completed-challenges.ts +++ b/client/src/utils/__fixtures__/completed-challenges.ts @@ -1,4 +1,4 @@ -import {challengeFiles} from '../../../../utils/__fixtures__/challenges'; +import { challengeFiles } from '../../../utils/__fixtures__/challenges'; const baseChallenge = { id: '1', diff --git a/client/src/utils/solution-display-type.test.ts b/client/src/utils/solution-display-type.test.ts index 69df0609f8a..d38ed525540 100644 --- a/client/src/utils/solution-display-type.test.ts +++ b/client/src/utils/solution-display-type.test.ts @@ -6,7 +6,7 @@ import { onlyGithubLink, onlySolution, withChallenges -} from './__fixtures/completed-challenges'; +} from './__fixtures__/completed-challenges'; import { getSolutionDisplayType } from './solution-display-type'; describe('getSolutionDisplayType', () => { diff --git a/utils/__fixtures__/challenges.ts b/client/utils/__fixtures__/challenges.ts similarity index 94% rename from utils/__fixtures__/challenges.ts rename to client/utils/__fixtures__/challenges.ts index 3805a5fce40..3cce8f42b7d 100644 --- a/utils/__fixtures__/challenges.ts +++ b/client/utils/__fixtures__/challenges.ts @@ -1,4 +1,4 @@ -import { ChallengeFile } from "../../client/src/redux/prop-types"; +import { ChallengeFile } from "../../src/redux/prop-types"; export const challengeFiles: ChallengeFile[] = [ { diff --git a/client/utils/gatsby/challenge-page-creator.js b/client/utils/gatsby/challenge-page-creator.js index 32614878204..19f03e964f6 100644 --- a/client/utils/gatsby/challenge-page-creator.js +++ b/client/utils/gatsby/challenge-page-creator.js @@ -1,5 +1,5 @@ const path = require('path'); -const { sortChallengeFiles } = require('../../../utils/sort-challengefiles'); +const { sortChallengeFiles } = require('../sort-challengefiles'); const { challengeTypes, viewTypes diff --git a/client/utils/index.ts b/client/utils/index.ts index 0b1aed80b76..ac45d2fbfbb 100644 --- a/client/utils/index.ts +++ b/client/utils/index.ts @@ -1,3 +1,27 @@ +const idToPath = new Map( + Object.entries({ + '561add10cb82ac38a17523bc': 'back-end-development-and-apis', + '5a553ca864b52e1d8bceea14': 'data-visualization', + '561acd10cb82ac38a17513bc': 'front-end-development-libraries', + '5e611829481575a52dc59c0e': 'quality-assurance-v7', + '5e6021435ac9d0ecd8b94b00': 'information-security-v7', + '561abd10cb81ac38a17513bc': 'javascript-algorithms-and-data-structures', + '561add10cb82ac38a17513bc': 'responsive-web-design', + '660add10cb82ac38a17513be': 'legacy-back-end', + '561add10cb82ac39a17513bc': 'legacy-data-visualization', + '561add10cb82ac38a17513be': 'legacy-front-end', + '561add10cb82ac38a17213bc': 'information-security-and-quality-assurance', + '561add10cb82ac38a17213bd': 'full-stack', + '5e44431b903586ffb414c951': 'scientific-computing-with-python-v7', + '5e46fc95ac417301a38fb934': 'data-analysis-with-python-v7', + '5e46fc95ac417301a38fb935': 'machine-learning-with-python-v7' + }) +); + +export const getCertIds = (): IterableIterator => idToPath.keys(); +export const getPathFromID = (id: string): string | undefined => + idToPath.get(id); + export function isBrowser(): boolean { return typeof window !== 'undefined'; } diff --git a/utils/sort-challengefiles.js b/client/utils/sort-challengefiles.js similarity index 100% rename from utils/sort-challengefiles.js rename to client/utils/sort-challengefiles.js diff --git a/utils/sort-challengefiles.test.js b/client/utils/sort-challengefiles.test.js similarity index 100% rename from utils/sort-challengefiles.test.js rename to client/utils/sort-challengefiles.test.js diff --git a/utils/index.ts b/utils/index.ts deleted file mode 100644 index 97831d89cd1..00000000000 --- a/utils/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -const idToPath = new Map( - Object.entries({ - '561add10cb82ac38a17523bc': 'back-end-development-and-apis', - '5a553ca864b52e1d8bceea14': 'data-visualization', - '561acd10cb82ac38a17513bc': 'front-end-development-libraries', - '5e611829481575a52dc59c0e': 'quality-assurance-v7', - '5e6021435ac9d0ecd8b94b00': 'information-security-v7', - '561abd10cb81ac38a17513bc': 'javascript-algorithms-and-data-structures', - '561add10cb82ac38a17513bc': 'responsive-web-design', - '660add10cb82ac38a17513be': 'legacy-back-end', - '561add10cb82ac39a17513bc': 'legacy-data-visualization', - '561add10cb82ac38a17513be': 'legacy-front-end', - '561add10cb82ac38a17213bc': 'information-security-and-quality-assurance', - '561add10cb82ac38a17213bd': 'full-stack', - '5e44431b903586ffb414c951': 'scientific-computing-with-python-v7', - '5e46fc95ac417301a38fb934': 'data-analysis-with-python-v7', - '5e46fc95ac417301a38fb935': 'machine-learning-with-python-v7' - }) -); - -export const getCertIds = (): IterableIterator => idToPath.keys(); -export const getPathFromID = (id: string): string | undefined => - idToPath.get(id); diff --git a/utils/preformatted-words.json b/utils/preformatted-words.json deleted file mode 100644 index e753dc3768c..00000000000 --- a/utils/preformatted-words.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "fcc": "fCC", - "freecodecamp": "freeCodeCamp", - "html": "HTML", - "css": "CSS", - "javascript": "JavaScript" -}