Merge branch 'prepare-comments' into prepare-inbox

This commit is contained in:
tonyrewin 2022-11-24 11:33:55 +03:00
commit 6c6b0ccfd2
4 changed files with 11 additions and 7 deletions

View File

@ -12,7 +12,7 @@ interface ArticlePageProps {
const ARTICLE_COMMENTS_PAGE_SIZE = 50
export const ArticleView = (props: ArticlePageProps) => {
const [getCommentsPage] = createSignal(1)
const [getCommentsPage] = createSignal(0)
const [getIsCommentsLoading, setIsCommentsLoading] = createSignal(false)
const { reactionsByShout, loadReactionsBy } = useReactionsStore({ reactions: props.reactions })

View File

@ -33,7 +33,7 @@ export const StatMetrics = (props: StatMetricsProps) => {
<span class={styles.statMetricsItem} classList={{ compact: props.compact }}>
{props.stat[entity] +
' ' +
t(nos(pseudonames[entity] || entity)) +
t((pseudonames[entity] || entity).slice(-1)) +
plural(props.stat[entity] || 0, locale() === 'ru' ? ['ов', '', 'а'] : ['s', '', 's'])}
</span>
)}

View File

@ -4,14 +4,18 @@ export default gql`
query LoadReactions($by: ReactionBy!, $limit: Int, $offset: Int) {
loadReactionsBy(by: $by, limit: $limit, offset: $offset) {
id
shout {
title
}
body
createdAt
range
replyTo {
id
# kind
}
createdBy {
name
slug
userpic
}
createdAt
updatedAt
}
}

View File

@ -27,7 +27,7 @@ export const byLength = (
return 0
}
export const byStat = (metric: keyof Stat) => {
export const byStat = (metric: keyof Stat | keyof TopicStat) => {
return (a, b) => {
const x = (a?.stat && a.stat[metric]) || 0
const y = (b?.stat && b.stat[metric]) || 0