Merge pull request #460 from Discours/hotfix/author-profile

Hotfix/author profile
This commit is contained in:
Tony 2024-05-10 17:41:19 +03:00 committed by GitHub
commit aebff60263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 18 deletions

View File

@ -76,17 +76,24 @@ export const AuthorView = (props: Props) => {
const fetchData = async (slug: string) => {
try {
const [subscriptionsResult, followersResult, authorResult] = await Promise.all([
const [followsResult, followersResult, authorResult] = await Promise.all([
apiClient.getAuthorFollows({ slug }),
apiClient.getAuthorFollowers({ slug }),
loadAuthor({ slug }),
])
const { authors, topics } = subscriptionsResult
const { authors, topics, error } = followsResult
if (error) {
console.error(error)
return
}
console.debug(authorResult)
setAuthor(authorResult)
console.debug(authors, topics)
setFollowing([...(authors || []), ...(topics || [])])
console.debug(followersResult)
setFollowers(followersResult || [])
console.debug('[components.Author] following data loaded', subscriptionsResult)
console.debug('[components.Author] author follows:', followsResult)
} catch (error) {
console.error('[components.Author] fetch error', error)
}

View File

@ -59,7 +59,7 @@ export const PublishSettings = (props: Props) => {
const composeDescription = () => {
if (!props.form.description) {
const cleanFootnotes = props.form.body.replaceAll(/<footnote data-value=".*?">.*?<\/footnote>/g, '')
const cleanFootnotes = props.form.body.replaceAll(/<footnote data-value=".*?">(.*?)<\/footnote>/g, '')
const leadText = cleanFootnotes.replaceAll(/<\/?[^>]+(>|$)/gi, ' ')
return shorten(leadText, DESCRIPTION_MAX_LENGTH).trim()
}

View File

@ -8,18 +8,6 @@
}
}
.unswiped {
width: 100%;
margin: 2rem 0;
margin-bottom: 6rem;
padding-bottom: 2rem;
display: block;
h2 {
text-align: center;
}
}
.Swiper {
display: block;
margin: 2rem 0;

View File

@ -1,6 +1,5 @@
import type {
Author,
AuthorFollowsResult,
CommonResult,
FollowingEntity,
LoadShoutsOptions,
@ -134,7 +133,7 @@ export const apiClient = {
slug?: string
author_id?: number
user?: string
}): Promise<AuthorFollowsResult> => {
}): Promise<CommonResult> => {
const response = await publicGraphQLClient.query(authorFollows, params).toPromise()
return response.data.get_author_follows
},

View File

@ -3,6 +3,7 @@ import { gql } from '@urql/core'
export default gql`
query GetAuthorFollows($slug: String, $user: String, $author_id: Int) {
get_author_follows(slug: $slug, user: $user, author_id: $author_id) {
error
authors {
id
slug