topic-fix

This commit is contained in:
Untone 2024-06-06 11:36:07 +03:00
parent f1b705633c
commit 89a55f7d15
5 changed files with 26 additions and 32 deletions

View File

@ -46,7 +46,7 @@
"Author": "Author",
"authors": "authors",
"Authors": "Authors",
"authorsWithCount": "{count} {count, plural, one {author} other {authors}}",
"some authors": "{count} {count, plural, one {author} other {authors}}",
"Autotypograph": "Autotypograph",
"Back": "Back",
"Back to editor": "Back to editor",
@ -98,7 +98,7 @@
"Commentator": "Commentator",
"Commenting": "Commenting",
"Comments": "Comments",
"CommentsWithCount": "{count, plural, =0 {{count} comments} one {{count} comment} few {{count} comments} other {{count} comments}}",
"some comments": "{count, plural, =0 {{count} comments} one {{count} comment} few {{count} comments} other {{count} comments}}",
"Common feed": "All",
"Communities": "Communities",
"community": "community",
@ -404,7 +404,7 @@
"Share": "Share",
"Share publication": "Share publication",
"shout": "post",
"shoutsWithCount": "{count} {count, plural, one {post} other {posts}}",
"some shouts": "{count} {count, plural, one {post} other {posts}}",
"Show": "Show",
"Show lyrics": "Show lyrics",
"Show more": "Show more",

View File

@ -50,7 +50,7 @@
"Author": "Автор",
"authors": "авторы",
"Authors": "Авторы",
"authorsWithCount": "{count} {count, plural, one {автор} few {автора} other {авторов}}",
"some authors": "{count} {count, plural, one {автор} few {автора} other {авторов}}",
"Autotypograph": "Автотипограф",
"Back": "Назад",
"Back to editor": "Вернуться в редактор",
@ -103,7 +103,7 @@
"Commentator": "Комментатор",
"Commenting": "Комментирование",
"Comments": "Комментарии",
"CommentsWithCount": "{count, plural, =0 {{count} комментариев} one {{count} комментарий} few {{count} комментария} other {{count} комментариев}}",
"some comments": "{count, plural, =0 {{count} комментариев} one {{count} комментарий} few {{count} комментария} other {{count} комментариев}}",
"Common feed": "Общая лента",
"Communities": "Сообщества",
"community": "сообщество",
@ -426,7 +426,7 @@
"Short opening": "Расскажите вашу историю...",
"shout": "пост",
"shout not found": "публикация не найдена",
"shoutsWithCount": "{count} {count, plural, one {публикация} few {публикации} other {публикаций}}",
"some shouts": "{count} {count, plural, one {публикация} few {публикации} other {публикаций}}",
"Show": "Показать",
"Show lyrics": "Текст песни",
"Show more": "Читать дальше",

View File

@ -121,7 +121,7 @@ export const AuthorBadge = (props: Props) => {
<div>{t('PublicationsWithCount', { count: props.author.stat?.shouts ?? 0 })}</div>
</Show>
<Show when={props.author?.stat.comments > 0}>
<div>{t('CommentsWithCount', { count: props.author.stat?.comments ?? 0 })}</div>
<div>{t('some comments', { count: props.author.stat?.comments ?? 0 })}</div>
</Show>
<Show when={props.author?.stat.followers > 0}>
<div>{t('some followers', { count: props.author.stat?.followers ?? 0 })}</div>

View File

@ -99,16 +99,14 @@ export const TopicBadge = (props: Props) => {
<Show when={!props.subscriptionsMode}>
<div class={styles.stats}>
<span class={styles.statsItem}>{t('shoutsWithCount', { count: props.topic?.stat?.shouts })}</span>
<span class={styles.statsItem}>
{t('authorsWithCount', { count: props.topic?.stat?.authors })}
</span>
<span class={styles.statsItem}>{t('some shouts', { count: props.topic?.stat?.shouts })}</span>
<span class={styles.statsItem}>{t('some authors', { count: props.topic?.stat?.authors })}</span>
<span class={styles.statsItem}>
{t('some followers', { count: props.topic?.stat?.followers })}
</span>
<Show when={props.topic?.stat?.comments}>
<span class={styles.statsItem}>
{t('CommentsWithCount', { count: props.topic?.stat?.comments ?? 0 })}
{t('some comments', { count: props.topic?.stat?.comments ?? 0 })}
</span>
</Show>
</div>

View File

@ -50,13 +50,21 @@ export const TopicView = (props: Props) => {
const [reactedTopMonthArticles, setReactedTopMonthArticles] = createSignal<Shout[]>([])
const [topic, setTopic] = createSignal<Topic>()
createEffect(
on(
[topic, topicEntities],
([t, ttt]) => {
if (props.topicSlug && !t && ttt) {
setTopic(ttt[props.topicSlug])
loadTopicFollowers()
loadTopicAuthors()
loadRandom()
}
},
{ defer: true },
),
)
createEffect(() => {
const topics = topicEntities()
if (props.topicSlug && !topic() && topics) {
setTopic(topics[props.topicSlug])
}
})
const [followers, setFollowers] = createSignal<Author[]>(props.followers || [])
const loadTopicFollowers = async () => {
const result = await apiClient.getTopicFollowers({ slug: props.topicSlug })
@ -99,18 +107,6 @@ export const TopicView = (props: Props) => {
loadReactedTopMonthArticles(topic()?.slug)
}
createEffect(
on(
() => topic()?.id,
(_) => {
loadTopicFollowers()
loadTopicAuthors()
loadRandom()
},
{ defer: true },
),
)
const title = createMemo(
() =>
`#${capitalize(