Fix reload page after foute from profile to another profile (#430)
This commit is contained in:
parent
e3c00cc6cd
commit
b84e7f43f7
|
@ -29,8 +29,6 @@ import stylesArticle from '../../Article/Article.module.scss'
|
||||||
import styles from './Author.module.scss'
|
import styles from './Author.module.scss'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
shouts: Shout[]
|
|
||||||
author: Author
|
|
||||||
authorSlug: string
|
authorSlug: string
|
||||||
}
|
}
|
||||||
export const PRERENDERED_ARTICLES_COUNT = 12
|
export const PRERENDERED_ARTICLES_COUNT = 12
|
||||||
|
@ -39,8 +37,8 @@ const LOAD_MORE_PAGE_SIZE = 9
|
||||||
export const AuthorView = (props: Props) => {
|
export const AuthorView = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const { loadSubscriptions } = useFollowing()
|
const { loadSubscriptions } = useFollowing()
|
||||||
const { sortedArticles } = useArticlesStore({ shouts: props.shouts })
|
const { sortedArticles } = useArticlesStore()
|
||||||
const { authorEntities } = useAuthorsStore({ authors: [props.author] })
|
const { authorEntities } = useAuthorsStore()
|
||||||
const { page: getPage, searchParams } = useRouter()
|
const { page: getPage, searchParams } = useRouter()
|
||||||
const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false)
|
const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false)
|
||||||
const [isBioExpanded, setIsBioExpanded] = createSignal(false)
|
const [isBioExpanded, setIsBioExpanded] = createSignal(false)
|
||||||
|
@ -200,10 +198,10 @@ export const AuthorView = (props: Props) => {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class={clsx('col-md-8', styles.additionalControls)}>
|
<div class={clsx('col-md-8', styles.additionalControls)}>
|
||||||
<Show when={props.author?.stat?.rating || props.author?.stat?.rating === 0}>
|
<Show when={author()?.stat?.rating || author()?.stat?.rating === 0}>
|
||||||
<div class={styles.ratingContainer}>
|
<div class={styles.ratingContainer}>
|
||||||
{t('All posts rating')}
|
{t('All posts rating')}
|
||||||
<AuthorShoutsRating author={props.author} class={styles.ratingControl} />
|
<AuthorShoutsRating author={author()} class={styles.ratingControl} />
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,17 +56,11 @@ export const AuthorPage = (props: PageProps) => {
|
||||||
|
|
||||||
onCleanup(() => resetSortedArticles())
|
onCleanup(() => resetSortedArticles())
|
||||||
|
|
||||||
const usePrerenderedData = props.author?.slug === slug()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageLayout title={props.seo?.title || t('Discours')}>
|
<PageLayout title={props.seo?.title || t('Discours')}>
|
||||||
<ReactionsProvider>
|
<ReactionsProvider>
|
||||||
<Show when={isLoaded()} fallback={<Loading />}>
|
<Show when={isLoaded()} fallback={<Loading />}>
|
||||||
<AuthorView
|
<AuthorView authorSlug={slug()} />
|
||||||
author={usePrerenderedData ? props.author : null}
|
|
||||||
shouts={usePrerenderedData ? props.authorShouts : null}
|
|
||||||
authorSlug={slug()}
|
|
||||||
/>
|
|
||||||
</Show>
|
</Show>
|
||||||
</ReactionsProvider>
|
</ReactionsProvider>
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
|
|
|
@ -15,17 +15,17 @@ export const getImageUrl = (
|
||||||
src: string,
|
src: string,
|
||||||
options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {},
|
options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {},
|
||||||
) => {
|
) => {
|
||||||
if (!src.includes('discours.io') && src.includes('http')) {
|
if (!src.includes('discours.io') && src.includes('http')) {
|
||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
const filename = src.toLowerCase().split('/').pop()
|
const filename = src.toLowerCase().split('/').pop()
|
||||||
const ext = filename.split('.').pop()
|
const ext = filename.split('.').pop()
|
||||||
const isAudio = ext in ['wav', 'mp3', 'ogg', 'aif', 'flac']
|
const isAudio = ext in ['wav', 'mp3', 'ogg', 'aif', 'flac']
|
||||||
const base = isAudio ? cdnUrl : `${thumborUrl}/unsafe/`
|
const base = isAudio ? cdnUrl : `${thumborUrl}/unsafe/`
|
||||||
const suffix = isAudio || options.noSizeUrlPart ? '' : getSizeUrlPart(options)
|
const suffix = isAudio || options.noSizeUrlPart ? '' : getSizeUrlPart(options)
|
||||||
const subfolder = isAudio ? 'audio' : 'image'
|
const subfolder = isAudio ? 'audio' : 'image'
|
||||||
|
|
||||||
return `${base}${suffix}production/${subfolder}/${filename}`
|
return `${base}${suffix}production/${subfolder}/${filename}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getOpenGraphImageUrl = (
|
export const getOpenGraphImageUrl = (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user