diff --git a/apps/host/src/components/common/multi-select/multi-select.tsx b/apps/host/src/components/common/multi-select/multi-select.tsx index 8dbd64f20..137d532b1 100644 --- a/apps/host/src/components/common/multi-select/multi-select.tsx +++ b/apps/host/src/components/common/multi-select/multi-select.tsx @@ -1,9 +1,9 @@ import React, { useContext } from 'react'; import ReactSelect, { MultiValueProps, OptionProps } from 'react-select'; import { components } from 'react-select'; -import { OptionType } from '../../../../../../shared/data/types/common'; import PropTypes from 'prop-types'; import { ThemeContext } from '@/components/ThemeWrapper'; +import { OptionType } from '@fmc/data/types'; const Option = (props) => { return ( diff --git a/apps/host/src/components/modules/challenges/challenge-grid/challenge-filter.tsx b/apps/host/src/components/modules/challenges/challenge-grid/challenge-filter.tsx index 2cb168904..25f1a080a 100644 --- a/apps/host/src/components/modules/challenges/challenge-grid/challenge-filter.tsx +++ b/apps/host/src/components/modules/challenges/challenge-grid/challenge-filter.tsx @@ -3,10 +3,9 @@ import { Link } from 'react-router-dom'; import styles from './challenge-grid.module.scss'; import { useMemo } from 'react'; import { contributors } from '@fmc/data/content'; -import { OptionType } from '@fmc/data/types'; +import { ETag, OptionType } from '@fmc/data/types'; import { Difficulties } from '@fmc/data/constants'; import { Search } from 'lucide-react'; -import { ETag } from '../../../../../../../shared/data/types/challenge'; interface Props { searchInput: string; @@ -79,7 +78,7 @@ const ChallengeFilters = ({ className={styles.segmentBtn1} onClick={() => { setIsSegmentBtn1(true); - setSelectedChallengesByTags([ETag?.interview]); + setSelectedChallengesByTags([ETag.interview]); }} > Interview @@ -89,7 +88,7 @@ const ChallengeFilters = ({ className={styles.segmentBtn2} onClick={() => { setIsSegmentBtn1(false); - setSelectedChallengesByTags([ETag?.all]); + setSelectedChallengesByTags([ETag.all]); }} > All diff --git a/apps/host/src/components/modules/challenges/challenge-grid/challenge-grid.tsx b/apps/host/src/components/modules/challenges/challenge-grid/challenge-grid.tsx index 5060b5823..30ace3477 100644 --- a/apps/host/src/components/modules/challenges/challenge-grid/challenge-grid.tsx +++ b/apps/host/src/components/modules/challenges/challenge-grid/challenge-grid.tsx @@ -1,11 +1,10 @@ import { useEffect, useState } from 'react'; -import { IChallenge, OptionType } from '@fmc/data/types'; +import { ETag, IChallenge, OptionType } from '@fmc/data/types'; import { contributors } from '@fmc/data/content'; import Challenge from './challenge'; import styles from './challenge-grid.module.scss'; -import { getChallengesByid } from '../../../../../../../shared/data/utils/challenges.helper'; import ChallengeFilters from './challenge-filter'; -import { ETag } from '../../../../../../../shared/data/types/challenge'; +import { getChallengesByid } from '@fmc/data/utils'; interface Props { challenges: IChallenge[]; diff --git a/shared/data/types/index.ts b/shared/data/types/index.ts index 0c846dab0..db3cc371b 100644 --- a/shared/data/types/index.ts +++ b/shared/data/types/index.ts @@ -1,4 +1,4 @@ -export type { IChallenge } from './challenge'; +export { ETag, type IChallenge } from './challenge'; export { EDifficulty } from './challenge'; export type { IContributor } from './contributor'; export type { OptionType } from './common'; diff --git a/shared/data/utils/challenges.helper.ts b/shared/data/utils/challenges.helper.ts index fa7b98a95..42b44a364 100644 --- a/shared/data/utils/challenges.helper.ts +++ b/shared/data/utils/challenges.helper.ts @@ -71,6 +71,7 @@ export function getChallengesByDifficulties(challenges: IChallenge[], difficulti const difficultyValues = difficulties.map((difficulty) => difficulty.value); return challenges.filter((challenge) => difficultyValues.includes(challenge.difficulty)); } + export function getChallengesByTags(challenges: IChallenge[], tags: ETag[]) { if (!tags || tags.length === 0) return challenges; return challenges.filter((challenge) => { diff --git a/shared/data/utils/index.ts b/shared/data/utils/index.ts index 23c5762b1..b9718319a 100644 --- a/shared/data/utils/index.ts +++ b/shared/data/utils/index.ts @@ -1 +1 @@ -export { filterChallengeByKey } from './challenges.helper'; +export { filterChallengeByKey, getChallengesByid } from './challenges.helper';