This commit is contained in:
Untone 2024-07-13 14:47:31 +03:00
parent 2d7fbc42a8
commit 7c9c155f5b
10 changed files with 9 additions and 16 deletions

View File

@ -5,7 +5,7 @@ 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/sortBy'
import { byCreated, byStat } from '~/lib/sort'
import { Button } from '../_shared/Button'
import { ShowIfAuthenticated } from '../_shared/ShowIfAuthenticated'

View File

@ -7,7 +7,7 @@ import { Button } from '~/components/_shared/Button'
import { Icon } from '~/components/_shared/Icon'
import { useFeed } from '~/context/feed'
import { useLocalize } from '~/context/localize'
import { byScore } from '~/lib/sortBy'
import { byScore } from '~/lib/sort'
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
import { FEED_PAGE_SIZE } from '../../Views/Feed/Feed'

View File

@ -11,7 +11,7 @@ import { useLocalize } from '~/context/localize'
import type { Author } from '~/graphql/schema/core.gen'
import { authorLetterReduce, translateAuthor } from '~/intl/translate'
import { dummyFilter } from '~/lib/dummyFilter'
import { byFirstChar, byStat } from '~/lib/sortBy'
import { byFirstChar, byStat } from '~/lib/sort'
import { scrollHandler } from '~/utils/scroll'
import styles from './AllAuthors.module.scss'
import stylesAuthorList from './AuthorsList.module.scss'

View File

@ -13,7 +13,7 @@ import loadShoutsQuery from '~/graphql/query/core/articles-load-by'
import getAuthorFollowersQuery from '~/graphql/query/core/author-followers'
import getAuthorFollowsQuery from '~/graphql/query/core/author-follows'
import type { Author, Reaction, Shout, Topic } from '~/graphql/schema/core.gen'
import { byCreated } from '~/lib/sortBy'
import { byCreated } from '~/lib/sort'
import { paginate } from '~/utils/paginate'
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
import stylesArticle from '../../Article/Article.module.scss'

View File

@ -16,7 +16,7 @@ import { useTopics } from '~/context/topics'
import { useUI } from '~/context/ui'
import { loadUnratedShouts } from '~/graphql/api/private'
import type { Author, Reaction, Shout } from '~/graphql/schema/core.gen'
import { byCreated } from '~/lib/sortBy'
import { byCreated } from '~/lib/sort'
import { FeedSearchParams } from '~/routes/feed/(feed)'
import { CommentDate } from '../../Article/CommentDate'
import { getShareUrl } from '../../Article/SharePopup'

View File

@ -17,7 +17,7 @@ import {
Shout,
Topic
} from '~/graphql/schema/core.gen'
import { byStat } from '~/lib/sortBy'
import { byStat } from '~/lib/sort'
import { useFeed } from './feed'
const TOP_AUTHORS_COUNT = 5

View File

@ -10,7 +10,7 @@ import {
Shout,
Topic
} from '~/graphql/schema/core.gen'
import { byStat } from '../lib/sortBy'
import { byStat } from '../lib/sort'
import { useGraphQL } from './graphql'
export const PRERENDERED_ARTICLES_COUNT = 5

View File

@ -13,7 +13,7 @@ import {
import { loadTopics } from '~/graphql/api/public'
import { Topic } from '~/graphql/schema/core.gen'
import { getRandomTopicsFromArray } from '~/lib/getRandomTopicsFromArray'
import { byTopicStatDesc } from '../lib/sortBy'
import { byTopicStatDesc } from '../lib/sort'
type TopicsContextType = {
topicEntities: Accessor<{ [topicSlug: string]: Topic }>

View File

@ -57,10 +57,3 @@ export const byScore = () => {
return 0
}
}
// biome-ignore lint/suspicious/noExplicitAny: sort
export const sortBy = (data: any, metric: string | ((a: any, b: any) => number) | undefined) => {
const x = [...data]
// @ts-ignore
x.sort(typeof metric === 'function' ? metric : byStat(metric))
return x
}

View File

@ -3,7 +3,7 @@ import { Show, Suspense, createEffect, createSignal, onMount } from 'solid-js'
import { useTopics } from '~/context/topics'
import { loadShouts, loadTopics } from '~/graphql/api/public'
import { LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen'
import { byStat } from '~/lib/sortBy'
import { byStat } from '~/lib/sort'
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
import { HomeView, HomeViewProps } from '../components/Views/Home'
import { Loading } from '../components/_shared/Loading'