ratings-fix

This commit is contained in:
Untone 2024-01-23 16:22:18 +03:00
parent 5b7d8a1658
commit d38adbfc61
12 changed files with 15 additions and 29 deletions

14
package-lock.json generated
View File

@ -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",

View File

@ -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') {

View File

@ -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) => {
<a href="?by=authors">{t('authors')}</a>
</li>
<li>
<a href="?by=reacted">{t('reactions')}</a>
<a href="?by=shouts">{t('publications')}</a>
</li>
</ul>

View File

@ -47,7 +47,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
commented
}

View File

@ -36,7 +36,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
commented
}

View File

@ -34,7 +34,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
commented
}

View File

@ -28,7 +28,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
}
}

View File

@ -31,7 +31,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
}
}

View File

@ -36,7 +36,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
commented
}

View File

@ -52,7 +52,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
commented
}

View File

@ -37,7 +37,7 @@ export default gql`
published_at
stat {
viewed
reacted
rating
commented
}

View File

@ -196,7 +196,7 @@ export const loadTopMonthArticles = async (): Promise<void> => {
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<void> => {
const options: LoadShoutsOptions = {
filters: { published: true },
order_by: 'rating_stat',
order_by: 'likes_stat',
limit: TOP_ARTICLES_COUNT,
}
const articles = await apiClient.getShouts(options)