From d38adbfc61d4d5ea3ae52b4b1d108a66652c226b Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 23 Jan 2024 16:22:18 +0300 Subject: [PATCH] ratings-fix --- package-lock.json | 14 -------------- src/components/Views/Feed/Feed.tsx | 6 +++--- src/components/Views/FeedSettings.tsx | 4 ++-- src/graphql/query/core/article-load.ts | 2 +- src/graphql/query/core/articles-load-by.ts | 2 +- src/graphql/query/core/articles-load-drafts.ts | 2 +- src/graphql/query/core/articles-load-feed.ts | 2 +- src/graphql/query/core/articles-load-followed.ts | 2 +- src/graphql/query/core/articles-load-random-top.ts | 2 +- .../query/core/articles-load-random-topic.ts | 2 +- src/graphql/query/core/articles-load-unrated.ts | 2 +- src/stores/zine/articles.ts | 4 ++-- 12 files changed, 15 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index 424ab0fe..c6b0edb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "license": "MIT", "dependencies": { "@authorizerdev/authorizer-js": "1.2.11", - "ackee-tracker": "5.1.0", "form-data": "4.0.0", "i18next": "22.4.15", "i18next-icu": "2.3.0", @@ -6379,14 +6378,6 @@ "tslib": "^2.3.1" } }, - "node_modules/ackee-tracker": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ackee-tracker/-/ackee-tracker-5.1.0.tgz", - "integrity": "sha512-A7iKkGyUnEXuOzxultQB7hnm4bStYCo1c38MYRRihBfqUP8AImhtZOODb00t9xrXs/BTsg06bz1MKpXeMs9sYw==", - "dependencies": { - "platform": "^1.3.6" - } - }, "node_modules/acorn": { "version": "8.11.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", @@ -15953,11 +15944,6 @@ "node": ">=8" } }, - "node_modules/platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" - }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", diff --git a/src/components/Views/Feed/Feed.tsx b/src/components/Views/Feed/Feed.tsx index 63d6945f..b3df32b7 100644 --- a/src/components/Views/Feed/Feed.tsx +++ b/src/components/Views/Feed/Feed.tsx @@ -48,14 +48,14 @@ type VisibilityItem = { } type FeedSearchParams = { - by: 'publish_date' | 'rating' | 'last_comment' + by: 'publish_date' | 'likes_stat' | 'rating' | 'last_comment' period: FeedPeriod visibility: VisibilityMode } const getOrderBy = (by: FeedSearchParams['by']) => { - if (by === 'rating') { - return 'rating_stat' + if (by === 'likes_stat' || by === 'rating') { + return 'likes_stat' } if (by === 'last_comment') { diff --git a/src/components/Views/FeedSettings.tsx b/src/components/Views/FeedSettings.tsx index 681f6020..3adbef52 100644 --- a/src/components/Views/FeedSettings.tsx +++ b/src/components/Views/FeedSettings.tsx @@ -3,7 +3,7 @@ import { useLocalize } from '../../context/localize' import styles from '../../styles/FeedSettings.module.scss' // type FeedSettingsSearchParams = { -// by: '' | 'topics' | 'authors' | 'reacted' +// by: '' | 'topics' | 'authors' | 'shouts' // } export const FeedSettingsView = (_props) => { @@ -25,7 +25,7 @@ export const FeedSettingsView = (_props) => { {t('authors')}
  • - {t('reactions')} + {t('publications')}
  • diff --git a/src/graphql/query/core/article-load.ts b/src/graphql/query/core/article-load.ts index f99e5e7e..066b7fb5 100644 --- a/src/graphql/query/core/article-load.ts +++ b/src/graphql/query/core/article-load.ts @@ -47,7 +47,7 @@ export default gql` published_at stat { viewed - reacted + rating commented } diff --git a/src/graphql/query/core/articles-load-by.ts b/src/graphql/query/core/articles-load-by.ts index 2f8129b6..a6a117ee 100644 --- a/src/graphql/query/core/articles-load-by.ts +++ b/src/graphql/query/core/articles-load-by.ts @@ -36,7 +36,7 @@ export default gql` published_at stat { viewed - reacted + rating commented } diff --git a/src/graphql/query/core/articles-load-drafts.ts b/src/graphql/query/core/articles-load-drafts.ts index 944739d7..7b2e4c01 100644 --- a/src/graphql/query/core/articles-load-drafts.ts +++ b/src/graphql/query/core/articles-load-drafts.ts @@ -34,7 +34,7 @@ export default gql` published_at stat { viewed - reacted + rating commented } diff --git a/src/graphql/query/core/articles-load-feed.ts b/src/graphql/query/core/articles-load-feed.ts index 01789b08..bc48b7cd 100644 --- a/src/graphql/query/core/articles-load-feed.ts +++ b/src/graphql/query/core/articles-load-feed.ts @@ -28,7 +28,7 @@ export default gql` published_at stat { viewed - reacted + rating } } diff --git a/src/graphql/query/core/articles-load-followed.ts b/src/graphql/query/core/articles-load-followed.ts index 122f290b..2eb0f193 100644 --- a/src/graphql/query/core/articles-load-followed.ts +++ b/src/graphql/query/core/articles-load-followed.ts @@ -31,7 +31,7 @@ export default gql` published_at stat { viewed - reacted + rating } } diff --git a/src/graphql/query/core/articles-load-random-top.ts b/src/graphql/query/core/articles-load-random-top.ts index e103ea28..f7f9b8cc 100644 --- a/src/graphql/query/core/articles-load-random-top.ts +++ b/src/graphql/query/core/articles-load-random-top.ts @@ -36,7 +36,7 @@ export default gql` published_at stat { viewed - reacted + rating commented } diff --git a/src/graphql/query/core/articles-load-random-topic.ts b/src/graphql/query/core/articles-load-random-topic.ts index 5ae25c19..e0b820c3 100644 --- a/src/graphql/query/core/articles-load-random-topic.ts +++ b/src/graphql/query/core/articles-load-random-topic.ts @@ -52,7 +52,7 @@ export default gql` published_at stat { viewed - reacted + rating commented } diff --git a/src/graphql/query/core/articles-load-unrated.ts b/src/graphql/query/core/articles-load-unrated.ts index 29b647de..fd0a2823 100644 --- a/src/graphql/query/core/articles-load-unrated.ts +++ b/src/graphql/query/core/articles-load-unrated.ts @@ -37,7 +37,7 @@ export default gql` published_at stat { viewed - reacted + rating commented } diff --git a/src/stores/zine/articles.ts b/src/stores/zine/articles.ts index 1fb5c731..c2293a27 100644 --- a/src/stores/zine/articles.ts +++ b/src/stores/zine/articles.ts @@ -196,7 +196,7 @@ export const loadTopMonthArticles = async (): Promise => { published: true, after, }, - order_by: 'rating_stat', + order_by: 'likes_stat', limit: TOP_MONTH_ARTICLES_COUNT, } const articles = await apiClient.getShouts(options) @@ -209,7 +209,7 @@ const TOP_ARTICLES_COUNT = 10 export const loadTopArticles = async (): Promise => { const options: LoadShoutsOptions = { filters: { published: true }, - order_by: 'rating_stat', + order_by: 'likes_stat', limit: TOP_ARTICLES_COUNT, } const articles = await apiClient.getShouts(options)