Hotfix/author page title (#393)

Author page title fix
This commit is contained in:
Ilya Y 2024-02-03 12:23:44 +03:00 committed by GitHub
parent 21e9fc00da
commit ce1eb2aa43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -1,15 +1,15 @@
import type { Author, Reaction, Shout, Topic } from '../../../graphql/schema/core.gen'
import { getPagePath } from '@nanostores/router'
import { Meta } from '@solidjs/meta'
import { Meta, Title } from '@solidjs/meta'
import { clsx } from 'clsx'
import { Show, createMemo, createSignal, Switch, onMount, For, Match, createEffect, on } from 'solid-js'
import { Show, createMemo, createSignal, Switch, onMount, For, Match, createEffect } from 'solid-js'
import { useFollowing } from '../../../context/following'
import { useLocalize } from '../../../context/localize'
import { apiClient } from '../../../graphql/client/core'
import { router, useRouter } from '../../../stores/router'
import { loadShouts, useArticlesStore } from '../../../stores/zine/articles'
import { loadMyFeed, loadShouts, useArticlesStore } from '../../../stores/zine/articles'
import { loadAuthor, useAuthorsStore } from '../../../stores/zine/authors'
import { getImageUrl } from '../../../utils/getImageUrl'
import { getDescription } from '../../../utils/meta'
@ -45,6 +45,7 @@ export const AuthorView = (props: Props) => {
const [followers, setFollowers] = createSignal<Author[]>([])
const [following, setFollowing] = createSignal<Array<Author | Topic>>([])
const [showExpandBioControl, setShowExpandBioControl] = createSignal(false)
const [commented, setCommented] = createSignal<Reaction[]>()
// current author
const [author, setAuthor] = createSignal<Author>()
@ -125,13 +126,12 @@ export const AuthorView = (props: Props) => {
const fetchComments = async (commenter: Author) => {
const data = await apiClient.getReactionsBy({
by: { comment: true, created_by: commenter.id },
by: { comment: false, created_by: commenter.id },
})
console.debug(`[components.Author] fetched ${data.length} comments`)
setCommented(data)
}
const [commented, setCommented] = createSignal<Reaction[]>([])
createEffect(() => {
const a = author()
if (a) {
@ -149,6 +149,7 @@ export const AuthorView = (props: Props) => {
return (
<div class={styles.authorPage}>
<Show when={author()}>
<Title>{author().name}</Title>
<Meta name="descprition" content={description()} />
<Meta name="og:type" content="profile" />
<Meta name="og:title" content={author().name} />

View File

@ -5,12 +5,14 @@ import { createEffect, createMemo, createSignal, on, onCleanup, onMount, Show }
import { Loading } from '../components/_shared/Loading'
import { PageLayout } from '../components/_shared/PageLayout'
import { AuthorView, PRERENDERED_ARTICLES_COUNT } from '../components/Views/Author'
import { useLocalize } from '../context/localize'
import { ReactionsProvider } from '../context/reactions'
import { useRouter } from '../stores/router'
import { loadShouts, resetSortedArticles } from '../stores/zine/articles'
import { loadAuthor } from '../stores/zine/authors'
export const AuthorPage = (props: PageProps) => {
const { t } = useLocalize()
const { page } = useRouter()
const slug = createMemo(() => page().params['slug'] as string)
@ -57,7 +59,7 @@ export const AuthorPage = (props: PageProps) => {
const usePrerenderedData = props.author?.slug === slug()
return (
<PageLayout title={props.seo?.title}>
<PageLayout title={props.seo?.title || t('Discours')}>
<ReactionsProvider>
<Show when={isLoaded()} fallback={<Loading />}>
<AuthorView