diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index 13fffae5..299c62a1 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -6,8 +6,8 @@ import { useLocalize } from '~/context/localize' import { useReactions } from '~/context/reactions' import { useSession } from '~/context/session' import { Author, Reaction, ReactionKind, ReactionSort } from '~/graphql/schema/core.gen' -import { byCreated, byStat } from '~/lib/sort' import { SortFunction } from '~/types/common' +import { byCreated, byStat } from '~/utils/sort' import { Button } from '../_shared/Button' import { ShowIfAuthenticated } from '../_shared/ShowIfAuthenticated' import styles from './Article.module.scss' diff --git a/src/components/SearchModal/SearchModal.tsx b/src/components/SearchModal/SearchModal.tsx index 5545f1c2..b0ef9644 100644 --- a/src/components/SearchModal/SearchModal.tsx +++ b/src/components/SearchModal/SearchModal.tsx @@ -5,8 +5,8 @@ import { Icon } from '~/components/_shared/Icon' import { useFeed } from '~/context/feed' import { useLocalize } from '~/context/localize' import type { Shout } from '~/graphql/schema/core.gen' -import { byScore } from '~/lib/sort' import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll' +import { byScore } from '~/utils/sort' import { FEED_PAGE_SIZE } from '../Views/Feed/Feed' import styles from './SearchModal.module.scss' import { SearchResultItem } from './SearchResultItem' @@ -23,7 +23,7 @@ const getSearchCoincidences = ({ str, intersection }: { str: string; intersectio )}` const prepareSearchResults = (list: Shout[], searchValue: string) => - list.sort(byScore() as (a: Shout, b: Shout) => number).map((article, index) => ({ + list.sort(byScore as (a: Shout, b: Shout) => number).map((article, index) => ({ ...article, id: index, title: article.title diff --git a/src/components/TopicsNav/TopicsNav.tsx b/src/components/TopicsNav/TopicsNav.tsx index 2a4f5395..c6f1801a 100644 --- a/src/components/TopicsNav/TopicsNav.tsx +++ b/src/components/TopicsNav/TopicsNav.tsx @@ -5,7 +5,7 @@ import { Icon } from '~/components/_shared/Icon' import { useLocalize } from '~/context/localize' import { useTopics } from '~/context/topics' import type { Topic } from '~/graphql/schema/core.gen' -import { getRandomTopicsFromArray } from '~/lib/getRandomTopicsFromArray' +import { getRandomItemsFromArray } from '~/utils/random' import styles from './TopicsNav.module.scss' export const RandomTopics = () => { @@ -17,11 +17,11 @@ export const RandomTopics = () => { createEffect( on(sortedTopics, (ttt: Topic[]) => { if (ttt?.length) { - setRandomTopics(getRandomTopicsFromArray(ttt)) + setRandomTopics(getRandomItemsFromArray(ttt)) } }) ) - onMount(() => sortedTopics() && getRandomTopicsFromArray(sortedTopics())) + onMount(() => sortedTopics() && getRandomItemsFromArray(sortedTopics())) return (