diff --git a/src/components/Author/Card.tsx b/src/components/Author/Card.tsx index f8fde5a0..60f2275e 100644 --- a/src/components/Author/Card.tsx +++ b/src/components/Author/Card.tsx @@ -22,11 +22,8 @@ interface AuthorCardProps { export const AuthorCard = (props: AuthorCardProps) => { const { session } = useAuthStore() - const subscribed = createMemo( - () => - !!session() - ?.news?.authors?.filter((u) => u === props.author.slug) - .pop() + const subscribed = createMemo( + () => session()?.news?.authors?.some((u) => u === props.author.slug) || false ) const canFollow = createMemo(() => !props.hideFollow && session()?.user?.slug !== props.author.slug) const bio = () => props.author.bio || t('Our regular contributor') @@ -37,57 +34,53 @@ export const AuthorCard = (props: AuthorCardProps) => { } // TODO: reimplement AuthorCard return ( - <> - -
- +
+ -
-
- - - {name()} - - - -
{name()}
-
+
+
+ + + {name()} + + + +
{name()}
+
- -
{bio()}
-
-
+ +
{bio()}
+
+
- - -
- - + +
+
) } diff --git a/src/components/Author/Full.tsx b/src/components/Author/Full.tsx index b32eacac..cb1d2822 100644 --- a/src/components/Author/Full.tsx +++ b/src/components/Author/Full.tsx @@ -4,14 +4,12 @@ import './Full.scss' export default (props: { author: Author }) => { return ( - <> -
-
-
- -
+
+
+
+
- +
) } diff --git a/src/graphql/query/articles-for-authors.ts b/src/graphql/query/articles-for-authors.ts index 6434090b..1c178999 100644 --- a/src/graphql/query/articles-for-authors.ts +++ b/src/graphql/query/articles-for-authors.ts @@ -26,6 +26,8 @@ export default gql` _id: slug name slug + bio + links userpic } createdAt diff --git a/src/layouts/zine.astro b/src/layouts/zine.astro index 41be19e4..e4ce1d99 100644 --- a/src/layouts/zine.astro +++ b/src/layouts/zine.astro @@ -4,7 +4,7 @@ import '../styles/app.scss' import { t } from '../utils/intl' const lang = Astro.url.searchParams.get('lang') || 'ru' -console.log('[layout] server locale is', lang) +// console.log('[layout] server locale is', lang) setLocale(lang) --- diff --git a/src/stores/zine/topics.ts b/src/stores/zine/topics.ts index 8994375e..9fc75672 100644 --- a/src/stores/zine/topics.ts +++ b/src/stores/zine/topics.ts @@ -19,25 +19,26 @@ const [topicsByAuthor, setTopicByAuthor] = createSignal<{ [authorSlug: string]: const sortedTopics = createLazyMemo(() => { const topics = Object.values(topicEntities()) - const sortAllByValue = sortAllBy() - switch (sortAllByValue) { - case 'created': { + switch (sortAllBy()) { + case 'created': // log.debug('sorted by created') topics.sort(byCreated) break - } case 'shouts': + // log.debug(`sorted by shouts`) + topics.sort(byTopicStatDesc('shouts')) + break case 'authors': - // log.debug(`sorted by ${sortBy}`) - topics.sort(byTopicStatDesc(sortAllByValue)) + // log.debug(`sorted by authors`) + topics.sort(byTopicStatDesc('authors')) break case 'title': // log.debug('sorted by title') topics.sort((a, b) => a.title.localeCompare(b.title)) break default: - log.error(`Unknown sort: ${sortAllByValue}`) + log.error(`Unknown sort: ${sortAllBy()}`) } return topics diff --git a/src/utils/apiClient.ts b/src/utils/apiClient.ts index c18538b3..4cf7ef76 100644 --- a/src/utils/apiClient.ts +++ b/src/utils/apiClient.ts @@ -221,13 +221,22 @@ export const apiClient = { }, getAllTopics: async () => { const response = await publicGraphQLClient.query(topicsAll, {}).toPromise() + if (response.error) { + log.debug('getAllTopics', response.error) + } return response.data.topicsAll }, - getAllAuthors: async () => { const response = await publicGraphQLClient.query(authorsAll, {}).toPromise() + if (response.error) { + log.debug('getAllAuthors', response.error) + } return response.data.authorsAll }, + getAuthor: async ({ slug }: { slug: string }) => { + const response = await publicGraphQLClient.query(authorsBySlugs, { slugs: [slug] }).toPromise() + return response.data.getUsersBySlugs + }, getArticle: async ({ slug }: { slug: string }): Promise => { const response = await publicGraphQLClient.query(articleBySlug, { slug }).toPromise() return response.data?.getShoutBySlug