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", "Author": "Author",
"authors": "authors", "authors": "authors",
"Authors": "Authors", "Authors": "Authors",
"authorsWithCount": "{count} {count, plural, one {author} other {authors}}", "some authors": "{count} {count, plural, one {author} other {authors}}",
"Autotypograph": "Autotypograph", "Autotypograph": "Autotypograph",
"Back": "Back", "Back": "Back",
"Back to editor": "Back to editor", "Back to editor": "Back to editor",
@ -98,7 +98,7 @@
"Commentator": "Commentator", "Commentator": "Commentator",
"Commenting": "Commenting", "Commenting": "Commenting",
"Comments": "Comments", "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", "Common feed": "All",
"Communities": "Communities", "Communities": "Communities",
"community": "community", "community": "community",
@ -404,7 +404,7 @@
"Share": "Share", "Share": "Share",
"Share publication": "Share publication", "Share publication": "Share publication",
"shout": "post", "shout": "post",
"shoutsWithCount": "{count} {count, plural, one {post} other {posts}}", "some shouts": "{count} {count, plural, one {post} other {posts}}",
"Show": "Show", "Show": "Show",
"Show lyrics": "Show lyrics", "Show lyrics": "Show lyrics",
"Show more": "Show more", "Show more": "Show more",
@ -553,4 +553,4 @@
"You've reached a non-existed page": "You've reached a non-existed page", "You've reached a non-existed page": "You've reached a non-existed page",
"Your email": "Your email", "Your email": "Your email",
"Your name will appear on your profile page and as your signature in publications, comments and responses.": "Your name will appear on your profile page and as your signature in publications, comments and responses" "Your name will appear on your profile page and as your signature in publications, comments and responses.": "Your name will appear on your profile page and as your signature in publications, comments and responses"
} }

View File

@ -50,7 +50,7 @@
"Author": "Автор", "Author": "Автор",
"authors": "авторы", "authors": "авторы",
"Authors": "Авторы", "Authors": "Авторы",
"authorsWithCount": "{count} {count, plural, one {автор} few {автора} other {авторов}}", "some authors": "{count} {count, plural, one {автор} few {автора} other {авторов}}",
"Autotypograph": "Автотипограф", "Autotypograph": "Автотипограф",
"Back": "Назад", "Back": "Назад",
"Back to editor": "Вернуться в редактор", "Back to editor": "Вернуться в редактор",
@ -103,7 +103,7 @@
"Commentator": "Комментатор", "Commentator": "Комментатор",
"Commenting": "Комментирование", "Commenting": "Комментирование",
"Comments": "Комментарии", "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": "Общая лента", "Common feed": "Общая лента",
"Communities": "Сообщества", "Communities": "Сообщества",
"community": "сообщество", "community": "сообщество",
@ -426,7 +426,7 @@
"Short opening": "Расскажите вашу историю...", "Short opening": "Расскажите вашу историю...",
"shout": "пост", "shout": "пост",
"shout not found": "публикация не найдена", "shout not found": "публикация не найдена",
"shoutsWithCount": "{count} {count, plural, one {публикация} few {публикации} other {публикаций}}", "some shouts": "{count} {count, plural, one {публикация} few {публикации} other {публикаций}}",
"Show": "Показать", "Show": "Показать",
"Show lyrics": "Текст песни", "Show lyrics": "Текст песни",
"Show more": "Читать дальше", "Show more": "Читать дальше",
@ -579,4 +579,4 @@
"You've successfully logged out": "Вы успешно вышли из аккаунта", "You've successfully logged out": "Вы успешно вышли из аккаунта",
"Your email": "Ваш email", "Your email": "Ваш email",
"Your name will appear on your profile page and as your signature in publications, comments and responses.": "Ваше имя появится на странице вашего профиля и как ваша подпись в публикациях, комментариях и откликах" "Your name will appear on your profile page and as your signature in publications, comments and responses.": "Ваше имя появится на странице вашего профиля и как ваша подпись в публикациях, комментариях и откликах"
} }

View File

@ -121,7 +121,7 @@ export const AuthorBadge = (props: Props) => {
<div>{t('PublicationsWithCount', { count: props.author.stat?.shouts ?? 0 })}</div> <div>{t('PublicationsWithCount', { count: props.author.stat?.shouts ?? 0 })}</div>
</Show> </Show>
<Show when={props.author?.stat.comments > 0}> <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>
<Show when={props.author?.stat.followers > 0}> <Show when={props.author?.stat.followers > 0}>
<div>{t('some followers', { count: props.author.stat?.followers ?? 0 })}</div> <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}> <Show when={!props.subscriptionsMode}>
<div class={styles.stats}> <div class={styles.stats}>
<span class={styles.statsItem}>{t('shoutsWithCount', { count: props.topic?.stat?.shouts })}</span> <span class={styles.statsItem}>{t('some shouts', { count: props.topic?.stat?.shouts })}</span>
<span class={styles.statsItem}> <span class={styles.statsItem}>{t('some authors', { count: props.topic?.stat?.authors })}</span>
{t('authorsWithCount', { count: props.topic?.stat?.authors })}
</span>
<span class={styles.statsItem}> <span class={styles.statsItem}>
{t('some followers', { count: props.topic?.stat?.followers })} {t('some followers', { count: props.topic?.stat?.followers })}
</span> </span>
<Show when={props.topic?.stat?.comments}> <Show when={props.topic?.stat?.comments}>
<span class={styles.statsItem}> <span class={styles.statsItem}>
{t('CommentsWithCount', { count: props.topic?.stat?.comments ?? 0 })} {t('some comments', { count: props.topic?.stat?.comments ?? 0 })}
</span> </span>
</Show> </Show>
</div> </div>

View File

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