diff --git a/public/icons/arrow-right-2.svg b/public/icons/arrow-right-2.svg new file mode 100644 index 00000000..2b4a95b3 --- /dev/null +++ b/public/icons/arrow-right-2.svg @@ -0,0 +1,5 @@ + + + + diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index dea79bdb..f8b6760e 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -46,6 +46,7 @@ "Back": "Back", "Be the first to rate": "Be the first to rate", "Become an author": "Become an author", + "Block rules": "За что можно получить бан", "Bold": "Bold", "Bookmarked": "Saved", "Bookmarks": "Bookmarks", @@ -86,6 +87,7 @@ "Commenting": "Commenting", "Comments": "Comments", "CommentsWithCount": "{count, plural, =0 {{count} comments} one {{count} comment} few {{count} comments} other {{count} comments}}", + "Common feed": "All", "Communities": "Communities", "Community Discussion Rules": "Community Discussion Rules", "Community Principles": "Community Principles", @@ -106,9 +108,11 @@ "Create an account to subscribe": "Create an account to subscribe", "Create an account to vote": "Create an account to vote", "Create gallery": "Create gallery", + "Create own feed": "Создать свою ленту", "Create post": "Create post", "Create video": "Create video", "Crop image": "Crop image", + "Current discussions": "Актуальные дискуссии", "Culture": "Culture", "Date of Birth": "Date of Birth", "Decline": "Decline", @@ -154,6 +158,8 @@ "Feed": "Feed", "Feedback": "Feedback", "Fill email": "Fill email", + "Find co-authors": "Найти соавторов", + "Find collaborators": "Найдите соавторов и экспертов", "Fixed": "Fixed", "Follow the topic": "Follow the topic", "Follow": "Follow", @@ -165,6 +171,7 @@ "Gallery": "Gallery", "Get to know the most intelligent people of our time, edit and discuss the articles, share your expertise, rate and decide what to publish in the magazine": "Get to know the most intelligent people of our time, edit and discuss the articles, share your expertise, rate and decide what to publish in the magazine", "Go to main page": "Go to main page", + "Go to discussions": "Перейти к обсуждениям", "Group Chat": "Group Chat", "Groups": "Groups", "Header 1": "Header 1", @@ -212,9 +219,13 @@ "It does not look like url": "It doesn't look like a link", "Italic": "Italic", "Join our maillist": "To receive the best postings, just enter your email", + "Join our team of authors": "Join our team of authors", + "Join our team of authors text": "Каждый месяц на Дискурсе публикуются десятки новых авторов. Станьте одним из них — предложите свой материал в журнал и присоединитесь к горизонтальной редакции", "Join the community": "Join the community", "Join the global community of authors!": "Join the global community of authors from all over the world!", "Join": "Join", + "Join discussions": "Присоединяйтесь к дискуссиям", + "Join discussions text": "Дискурс — свободная платформа для осмысленного общения.
Здесь появятся ваши реплики, чтобы в любой момент вернуться к диалогу.", "Just start typing...": "Just start typing...", "Knowledge base": "Knowledge base", "Language": "Language", @@ -260,6 +271,7 @@ "Our regular contributor": "Our regular contributor", "Paragraphs": "Абзацев", "Participate in the Discours: share information, join the editorial team": "Участвуйте в Дискурсе: делитесь информацией, присоединяйтесь к редакции", + "Participate in discussions": "Участвуйте в дискуссиях", "Participating": "Participating", "Participation": "Participation", "Partners": "Partners", @@ -273,6 +285,9 @@ "Paste Embed code": "Paste Embed code", "Personal": "Personal", "Pin": "Pin", + "Placeholder feed": "Подпишитесь на любимые темы, авторов и сообщества — моментально узнавайте о новых публикациях и обсуждениях", + "Placeholder feedCollaborations": "На платформе можно писать материалы вместе. Здесь появятся публикации, в которые вы внесли вклад", + "Placeholder feedDiscussions": "Дискурс — свободная платформа для осмысленного общения. Здесь появятся все ваши реплики, чтобы в любой момент вернуться к диалогу", "Platform Guide": "Platform Guide", "Please check your email address": "Please check your email address", "Please confirm your email to finish": "Confirm your email and the action will complete", diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json index f9596f64..65a38874 100644 --- a/public/locales/ru/translation.json +++ b/public/locales/ru/translation.json @@ -31,7 +31,7 @@ "All posts rating": "Рейтинг всех постов", "All posts": "Все публикации", "All topics": "Все темы", - "All": "Общая лента", + "All": "Все", "Almost done! Check your email.": "Почти готово! Осталось подтвердить вашу почту.", "Are you sure you want to delete this comment?": "Уверены, что хотите удалить этот комментарий?", "Are you sure you want to delete this draft?": "Уверены, что хотите удалить этот черновик?", @@ -49,6 +49,7 @@ "Back": "Назад", "Be the first to rate": "Оцените первым", "Become an author": "Стать автором", + "Block rules": "За что можно получить бан", "Bold": "Жирный", "Bookmarked": "Сохранено", "Bookmarks": "Закладки", @@ -90,6 +91,7 @@ "Commenting": "Комментирование", "Comments": "Комментарии", "CommentsWithCount": "{count, plural, =0 {{count} комментариев} one {{count} комментарий} few {{count} комментария} other {{count} комментариев}}", + "Common feed": "Общая лента", "Communities": "Сообщества", "Community Discussion Rules": "Правила дискуссий в сообществе", "Community Principles": "Принципы сообщества", @@ -110,10 +112,12 @@ "Create an account to subscribe": "Создайте аккаунт, чтобы подписаться", "Create an account to vote": "Создайте аккаунт, чтобы голосовать", "Create gallery": "Создать галерею", + "Create own feed": "Создать свою ленту", "Create post": "Создать публикацию", "Create video": "Создать видео", "Crop image": "Кадрировать изображение", "Culture": "Культура", + "Current discussions": "Актуальные дискуссии", "Date of Birth": "Дата рождения", "Decline": "Отмена", "Delete cover": "Удалить обложку", @@ -160,6 +164,8 @@ "Feed": "Лента", "Feedback": "Обратная связь", "Fill email": "Введите почту", + "Find co-authors": "Найти соавторов", + "Find collaborators": "Найдите соавторов и экспертов", "Fixed": "Все поправлено", "Follow the topic": "Подписаться на тему", "Follow": "Подписаться", @@ -173,6 +179,7 @@ "Get notifications": "Получать уведомления", "Get to know the most intelligent people of our time, edit and discuss the articles, share your expertise, rate and decide what to publish in the magazine": "Познакомитесь с выдающимися людьми нашего времени, участвуйте в редактировании и обсуждении статей, выступайте экспертом, оценивайте материалы других авторов со всего мира и определяйте, какие статьи будут опубликованы в журнале", "Go to main page": "Перейти на главную", + "Go to discussions": "Перейти к обсуждениям", "Group Chat": "Общий чат", "Groups": "Группы", "Header 1": "Заголовок 1", @@ -222,9 +229,13 @@ "It does not look like url": "Это не похоже на ссылку", "Italic": "Курсив", "Join our maillist": "Чтобы получать рассылку лучших публикаций, просто укажите свою почту", + "Join our team of authors": "Станьте автором", + "Join our team of authors text": "Каждый месяц на Дискурсе публикуются десятки новых авторов.
Станьте одним из них — предложите свой материал в журнал и присоединитесь к горизонтальной редакции", "Join the community": "Присоединиться к сообществу", "Join the global community of authors!": "Присоединятесь к глобальному сообществу авторов со всего мира!", "Join": "Присоединиться", + "Join discussions": "Присоединяйтесь к дискуссиям", + "Join discussions text": "Дискурс — свободная платформа для осмысленного общения.
Здесь появятся ваши реплики, чтобы в любой момент вернуться к диалогу.", "Just start typing...": "Просто начните печатать...", "Karma": "Карма", "Knowledge base": "База знаний", @@ -272,6 +283,7 @@ "Our regular contributor": "Наш постоянный автор", "Paragraphs": "Абзацев", "Participate in the Discours: share information, join the editorial team": "Participate in the Discours: share information, join the editorial team", + "Participate in discussions": "Участвуйте в дискуссиях", "Participating": "Участвовать", "Participation": "Соучастие", "Partners": "Партнёры", @@ -285,6 +297,9 @@ "Paste Embed code": "Вставьте embed код", "Personal": "Личные", "Pin": "Закрепить", + "Placeholder feed": "Подпишитесь на любимые темы, авторов и сообщества — моментально узнавайте о новых публикациях и обсуждениях", + "Placeholder feedCollaborations": "На платформе можно писать материалы вместе. Здесь появятся публикации, в которые вы внесли вклад", + "Placeholder feedDiscussions": "Дискурс — свободная платформа для осмысленного общения. Здесь появятся все ваши реплики, чтобы в любой момент вернуться к диалогу", "Platform Guide": "Гид по дискурсу", "Please check your email address": "Пожалуйста, проверьте введенный адрес почты", "Please check your inbox! We have sent a password reset link.": "Пожалуйста, проверьте свою почту, мы отправили вам письмо со ссылкой для сброса пароля", diff --git a/public/placeholder-discussions.webp b/public/placeholder-discussions.webp new file mode 100644 index 00000000..a653abed Binary files /dev/null and b/public/placeholder-discussions.webp differ diff --git a/public/placeholder-experts.webp b/public/placeholder-experts.webp new file mode 100644 index 00000000..a40021b2 Binary files /dev/null and b/public/placeholder-experts.webp differ diff --git a/public/placeholder-feed.webp b/public/placeholder-feed.webp new file mode 100644 index 00000000..9d002486 Binary files /dev/null and b/public/placeholder-feed.webp differ diff --git a/public/placeholder-join.webp b/public/placeholder-join.webp new file mode 100644 index 00000000..887c55cf Binary files /dev/null and b/public/placeholder-join.webp differ diff --git a/src/components/Feed/Placeholder/Placeholder.module.scss b/src/components/Feed/Placeholder/Placeholder.module.scss new file mode 100644 index 00000000..abd61262 --- /dev/null +++ b/src/components/Feed/Placeholder/Placeholder.module.scss @@ -0,0 +1,213 @@ +.placeholder { + border-radius: 2.2rem; + display: flex; + @include font-size(1.4rem); + font-weight: 500; + overflow: hidden; + position: relative; + + h3 { + @include font-size(2.4rem); + } + + button, + .button { + align-items: center; + border-radius: 1.2rem; + display: flex; + @include font-size(1.5rem); + gap: 0.6rem; + margin-top: 3rem; + padding: 1rem 2rem; + width: 100%; + + .icon { + height: 2.4rem; + width: 2.4rem; + } + } +} + +.placeholder--feed-mode { + aspect-ratio: 1 / 0.8; + flex-direction: column; + text-align: center; + + &:after { + bottom: 0; + content: ''; + height: 20%; + left: 0; + position: absolute; + width: 100%; + + .placeholder--feed & { + background: linear-gradient(to top, #171032, rgba(23, 16, 50, 0)); + } + + .placeholder--feedCollaborations & { + background: linear-gradient(to top, #070709, rgba(7, 7, 9, 0)); + } + } + + .placeholderCover { + flex: 0 100%; + width: 100%; + + img { + position: absolute; + } + } +} + +.placeholder--profile-mode { + min-height: 28rem; + + .placeholderCover { + flex: 0 45rem; + min-width: 45rem; + order: 2; + padding: 1.6rem; + + img { + height: auto; + width: 100%; + } + } + + .placeholderContent { + display: flex; + flex-direction: column; + justify-content: space-between; + @include font-size(2rem); + line-height: 1.2; + padding: 3rem; + } + + h3 { + @include font-size(3.8rem); + } + + .button { + background: var(--background-color-invert); + color: var(--default-color-invert); + bottom: 2rem; + position: absolute; + right: 2rem; + width: auto; + + .icon { + filter: invert(1); + } + } +} + +.placeholderCover { + position: relative; + + img { + left: 0; + height: 100%; + object-fit: cover; + width: 100%; + } +} + +.placeholderContent { + padding: 1.6rem; +} + +.placeholder--feed, +.placeholder--feedCollaborations { + color: var(--default-color-invert); + + button, + .button { + background: var(--background-color); + color: var(--default-color); + } +} + +.placeholder--feed { + background: #171032; + + .placeholderCover { + img { + object-position: top; + } + } +} + +.placeholder--feedCollaborations { + background: #070709; + + .placeholderCover { + img { + object-position: bottom; + } + } +} + +.placeholder--feedDiscussions { + background: #E9E9EE; + + .placeholderCover { + padding: 2rem; + text-align: center; + + img { + height: 90%; + mix-blend-mode: multiply; + object-fit: contain; + top: 10%; + } + } + + button, + .button { + background: var(--background-color-invert); + color: var(--default-color-invert); + } +} + + +.placeholder--author { + background: #E58B72; +} + +.placeholder--authorComments { + background: #E9E9EE; + + .placeholderCover { + img { + mix-blend-mode: multiply; + } + } +} + +.bottomLinks { + display: flex; + @include font-size(1.6rem); + gap: 4rem; + + a { + border: none !important; + padding-left: 2.6rem; + position: relative; + + &:hover { + .icon { + filter: invert(0); + } + } + } + + .icon { + filter: invert(1); + height: 1.8rem; + left: 0; + position: absolute; + transition: filter 0.2s; + width: 1.8rem; + } +} diff --git a/src/components/Feed/Placeholder/Placeholder.tsx b/src/components/Feed/Placeholder/Placeholder.tsx new file mode 100644 index 00000000..94fa247a --- /dev/null +++ b/src/components/Feed/Placeholder/Placeholder.tsx @@ -0,0 +1,120 @@ +import { clsx } from 'clsx' +import { For, Show } from 'solid-js' + +import { useLocalize } from '../../../context/localize' +import { useSession } from '../../../context/session' +import { Icon } from '../../_shared/Icon' +import styles from './Placeholder.module.scss' + +export type PlaceholderProps = { + type: string + mode: 'feed' | 'profile' +} + +export const Placeholder = (props: PlaceholderProps) => { + const { t } = useLocalize() + const { author } = useSession() + + const data = { + feed: { + image: 'placeholder-feed.webp', + header: t('Feed settings'), + text: t('Placeholder feed'), + buttonLabel: author() ? t('Popular authors') : t('Create own feed'), + href: '/authors?by=followers', + }, + feedCollaborations: { + image: 'placeholder-experts.webp', + header: t('Find collaborators'), + text: t('Placeholder feedCollaborations'), + buttonLabel: t('Find co-authors'), + href: '/authors?by=name', + }, + feedDiscussions: { + image: 'placeholder-discussions.webp', + header: t('Participate in discussions'), + text: t('Placeholder feedDiscussions'), + buttonLabel: author() ? t('Current discussions') : t('Enter'), + href: '/feed?by=last_comment', + }, + author: { + image: 'placeholder-join.webp', + header: t('Join our team of authors'), + text: t('Join our team of authors text'), + buttonLabel: t('Create post'), + href: '/create', + profileLinks: [ + { + href: '/how-to-write-a-good-article', + label: t('How to write a good article'), + }, + ], + }, + authorComments: { + image: 'placeholder-discussions.webp', + header: t('Join discussions'), + text: t('Placeholder feedDiscussions'), + buttonLabel: t('Go to discussions'), + href: '/feed?by=last_comment', + profileLinks: [ + { + href: '/about/discussion-rules', + label: t('Discussion rules'), + }, + { + href: '/about/discussion-rules#ban', + label: t('Block rules'), + }, + ], + }, + } + + return ( +
+
+ +
+
+
+

+

+

+ + +
+ + {(link) => ( + + + {link.label} + + )} + +
+
+ + + {data[props.type].buttonLabel} + + } + > + + {data[props.type].buttonLabel} + + + + + +
+
+ ) +} diff --git a/src/components/Feed/Placeholder/index.ts b/src/components/Feed/Placeholder/index.ts new file mode 100644 index 00000000..20413aa5 --- /dev/null +++ b/src/components/Feed/Placeholder/index.ts @@ -0,0 +1 @@ +export { Placeholder } from './Placeholder' diff --git a/src/components/Feed/Sidebar/Sidebar.tsx b/src/components/Feed/Sidebar/Sidebar.tsx index a116bc4b..273fec0e 100644 --- a/src/components/Feed/Sidebar/Sidebar.tsx +++ b/src/components/Feed/Sidebar/Sidebar.tsx @@ -83,32 +83,6 @@ export const Sidebar = () => { -
  • - - - - {t('Bookmarks')} - - -
  • -
  • - - - - {t('Notifications')} - - -
  • 0 || subscriptions.topics.length > 0}> diff --git a/src/components/Topic/Full.tsx b/src/components/Topic/Full.tsx index ebc4f1c0..681996d1 100644 --- a/src/components/Topic/Full.tsx +++ b/src/components/Topic/Full.tsx @@ -1,7 +1,7 @@ -import type { Topic } from '../../graphql/schema/core.gen' +import type { Author, Topic } from '../../graphql/schema/core.gen' import { clsx } from 'clsx' -import { Show, createEffect, createSignal } from 'solid-js' +import { For, Show, createEffect, createSignal } from 'solid-js' import { useFollowing } from '../../context/following' import { useLocalize } from '../../context/localize' @@ -11,10 +11,13 @@ import { Button } from '../_shared/Button' import { Icon } from '../_shared/Icon' import { Subscribers } from '../_shared/Subscribers' +import stylesCard from '../Author/AuthorCard/AuthorCard.module.scss' +import { Userpic } from '../Author/Userpic' import styles from './Full.module.scss' type Props = { topic: Topic + followers?: Author[] } export const FullTopic = (props: Props) => { @@ -69,7 +72,7 @@ export const FullTopic = (props: Props) => { - {props.topic?.title} + {props.topic?.title} ) diff --git a/src/components/Topic/TopicBadge/TopicBadge.module.scss b/src/components/Topic/TopicBadge/TopicBadge.module.scss index 52edb734..6b818c60 100644 --- a/src/components/Topic/TopicBadge/TopicBadge.module.scss +++ b/src/components/Topic/TopicBadge/TopicBadge.module.scss @@ -45,7 +45,6 @@ .info { @include font-size(1.4rem); - border: none; // display: flex; @@ -63,13 +62,11 @@ .title { @include font-size(2.2rem); - font-weight: bold; } .description { @include font-size(1.6rem); - line-height: 1.4; margin: 0.8rem 0; -webkit-line-clamp: 2; @@ -107,7 +104,6 @@ .title { @include font-size(1.4rem); - font-weight: 500; line-height: 1em; color: var(--blue-500); @@ -116,9 +112,7 @@ .description { color: var(--black-400); - @include font-size(1.2rem); - font-weight: 500; margin: 0; } diff --git a/src/components/Topic/TopicBadge/TopicBadge.tsx b/src/components/Topic/TopicBadge/TopicBadge.tsx index fa7e577b..73afe366 100644 --- a/src/components/Topic/TopicBadge/TopicBadge.tsx +++ b/src/components/Topic/TopicBadge/TopicBadge.tsx @@ -48,7 +48,7 @@ export const TopicBadge = (props: Props) => { lang() === 'en' ? capitalize(props.topic.slug.replaceAll('-', ' ')) : props.topic.title return ( -
    +
    diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 9c0423ba..c5a44e98 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -27,6 +27,7 @@ import { Loading } from '../../_shared/Loading' import { MODALS, hideModal } from '../../../stores/ui' import { byCreated } from '../../../utils/sortby' import stylesArticle from '../../Article/Article.module.scss' +import { Placeholder } from '../../Feed/Placeholder' import styles from './Author.module.scss' type Props = { @@ -259,6 +260,10 @@ export const AuthorView = (props: Props) => {
    +
    + +
    +
    @@ -279,46 +284,56 @@ export const AuthorView = (props: Props) => {
    - - + +
    + +
    - - - + 0}> + + + - - - + + + - 3}> - - - - - - + + + - - {(page) => ( - <> - - - - - - - - )} - - + 3}> + + + + + + - -

    - -

    + + {(page) => ( + <> + + + + + + + + )} + +
    + + +

    + +

    +
    diff --git a/src/components/Views/Feed/Feed.module.scss b/src/components/Views/Feed/Feed.module.scss index 3cb18604..61e1c161 100644 --- a/src/components/Views/Feed/Feed.module.scss +++ b/src/components/Views/Feed/Feed.module.scss @@ -175,6 +175,7 @@ -webkit-line-clamp: 1; a { + border: none; color: rgb(0 0 0 / 65%); &:hover { diff --git a/src/components/Views/Feed/Feed.tsx b/src/components/Views/Feed/Feed.tsx index b2fc5dfe..f050871d 100644 --- a/src/components/Views/Feed/Feed.tsx +++ b/src/components/Views/Feed/Feed.tsx @@ -20,6 +20,7 @@ import { getShareUrl } from '../../Article/SharePopup' import { AuthorBadge } from '../../Author/AuthorBadge' import { AuthorLink } from '../../Author/AuthorLink' import { ArticleCard } from '../../Feed/ArticleCard' +import { Placeholder } from '../../Feed/Placeholder' import { Sidebar } from '../../Feed/Sidebar' import { Modal } from '../../Nav/Modal' import { DropDown } from '../../_shared/DropDown' @@ -100,7 +101,7 @@ export const FeedView = (props: Props) => { const { page, searchParams, changeSearchParams } = useRouter() const [isLoading, setIsLoading] = createSignal(false) const [isRightColumnLoaded, setIsRightColumnLoaded] = createSignal(false) - const { session } = useSession() + const { author, session } = useSession() const { loadReactionsBy } = useReactions() const { sortedArticles } = useArticlesStore() const { topTopics } = useTopics() @@ -234,107 +235,112 @@ export const FeedView = (props: Props) => {
    -
    -
      -
    • - {t('Recent')} -
    • - {/*
    • */} - {/* {t('Most read')}*/} - {/*
    • */} -
    • - changeSearchParams({ by: 'likes' })}> - {t('Top rated')} - -
    • -
    • - changeSearchParams({ by: 'last_comment' })}> - {t('Most commented')} - -
    • -
    -
    - + } + > +
    +
      +
    • + {t('Recent')} +
    • + {/*
    • */} + {/* {t('Most read')}*/} + {/*
    • */} +
    • + changeSearchParams({ by: 'likes' })}> + {t('Top rated')} + +
    • +
    • + changeSearchParams({ by: 'last_comment' })}> + {t('Most commented')} + +
    • +
    +
    + + changeSearchParams({ period: period.value })} + /> + changeSearchParams({ period: period.value })} + onChange={(visibility: VisibilityItem) => + changeSearchParams({ visibility: visibility.value }) + } /> - - - changeSearchParams({ visibility: visibility.value }) - } - /> +
    -
    - }> - 0}> - - {(article) => ( - handleShare(shared)} - onInvite={() => showModal('inviteMembers')} - article={article} - settings={{ isFeedMode: true }} - desktopCoverSize="M" - /> - )} - + }> + 0}> + + {(article) => ( + handleShare(shared)} + onInvite={() => showModal('inviteMembers')} + article={article} + settings={{ isFeedMode: true }} + desktopCoverSize="M" + /> + )} + -
    -
    -

    {t('Popular authors')}

    - - {t('All authors')} - - +
    +
    +

    {t('Popular authors')}

    + + {t('All authors')} + + +
    + +
      + + {(author) => ( +
    • + +
    • + )} +
      +
    -
      - - {(author) => ( -
    • - -
    • - )} -
      -
    -
    + + {(article) => ( + + )} + + - - {(article) => ( - - )} - - - - -

    - -

    + +

    + +

    +
    diff --git a/src/components/Views/Topic.tsx b/src/components/Views/Topic.tsx index d788d1f6..3d7ae3f3 100644 --- a/src/components/Views/Topic.tsx +++ b/src/components/Views/Topic.tsx @@ -1,4 +1,4 @@ -import { LoadShoutsOptions, Shout, Topic } from '../../graphql/schema/core.gen' +import { Author, LoadShoutsOptions, Shout, Topic } from '../../graphql/schema/core.gen' import { clsx } from 'clsx' import { For, Show, createEffect, createMemo, createSignal, on, onMount } from 'solid-js' @@ -33,6 +33,7 @@ interface Props { topic: Topic shouts: Shout[] topicSlug: string + followers?: Author[] } export const PRERENDERED_ARTICLES_COUNT = 28 @@ -56,6 +57,11 @@ export const TopicView = (props: Props) => { setTopic(topics[props.topicSlug]) } }) + const [followers, setFollowers] = createSignal(props.followers || []) + const loadTopicFollowers = async () => { + const result = await apiClient.getTopicFollowers({ slug: props.topicSlug }) + setFollowers(result) + } const loadFavoriteTopArticles = async (topic: string) => { const options: LoadShoutsOptions = { @@ -89,8 +95,11 @@ export const TopicView = (props: Props) => { createEffect( on( - () => topic(), - () => loadRandom(), + () => topic()?.id, + (_) => { + loadTopicFollowers() + loadRandom() + }, { defer: true }, ), ) @@ -158,7 +167,7 @@ export const TopicView = (props: Props) => { - +
    diff --git a/src/graphql/client/core.ts b/src/graphql/client/core.ts index bbfa00f4..cb9f4719 100644 --- a/src/graphql/client/core.ts +++ b/src/graphql/client/core.ts @@ -5,6 +5,7 @@ import type { LoadShoutsOptions, MutationDelete_ShoutArgs, ProfileInput, + QueryGet_Topic_FollowersArgs, QueryLoad_Authors_ByArgs, QueryLoad_Shouts_Random_TopArgs, QueryLoad_Shouts_SearchArgs, @@ -44,6 +45,7 @@ import authorsAll from '../query/core/authors-all' import authorsLoadBy from '../query/core/authors-load-by' import reactionsLoadBy from '../query/core/reactions-load-by' import topicBySlug from '../query/core/topic-by-slug' +import topicFollowers from '../query/core/topic-followers' import topicsAll from '../query/core/topics-all' import topicsRandomQuery from '../query/core/topics-random' @@ -129,6 +131,11 @@ export const apiClient = { return response.data.get_author_followers }, + getTopicFollowers: async ({ slug }: QueryGet_Topic_FollowersArgs): Promise => { + const response = await publicGraphQLClient.query(topicFollowers, { slug }).toPromise() + return response.data.get_topic_followers + }, + getAuthorFollows: async (params: { slug?: string author_id?: number diff --git a/src/graphql/query/core/topic-followers.ts b/src/graphql/query/core/topic-followers.ts new file mode 100644 index 00000000..1ec60ead --- /dev/null +++ b/src/graphql/query/core/topic-followers.ts @@ -0,0 +1,25 @@ +import { gql } from '@urql/core' + +export default gql` + query TopicFollowersQuery($slug: String) { + get_topic_followers(slug: $slug) { + id + slug + name + bio + about + pic + # communities + links + created_at + last_seen + stat { + shouts + authors + followers + rating + comments + } + } + } +` diff --git a/src/pages/about/discussionRules.page.tsx b/src/pages/about/discussionRules.page.tsx index 917beb61..899dfd5e 100644 --- a/src/pages/about/discussionRules.page.tsx +++ b/src/pages/about/discussionRules.page.tsx @@ -40,7 +40,7 @@ export const DiscussionRulesPage = () => { людей рождается истина.

    -

    За что можно получить дырку в карме и выиграть бан в сообществе

    +

    За что можно получить дырку в карме и выиграть бан в сообществе