less code

This commit is contained in:
tonyrewin 2022-09-14 17:44:10 +03:00
parent 9d054fcef9
commit 64443342a6

View File

@ -1,4 +1,4 @@
import { createEffect, createMemo, createSignal, Show, Suspense } from 'solid-js' import { createEffect, createSignal, Show, Suspense } from 'solid-js'
import { FullArticle } from '../Article/FullArticle' import { FullArticle } from '../Article/FullArticle'
import { t } from '../../utils/intl' import { t } from '../../utils/intl'
@ -7,7 +7,6 @@ import { useCurrentArticleStore } from '../../stores/zine/currentArticle'
import { loadArticleReactions, useReactionsStore } from '../../stores/zine/reactions' import { loadArticleReactions, useReactionsStore } from '../../stores/zine/reactions'
import '../../styles/Article.scss' import '../../styles/Article.scss'
import { useStore } from '@nanostores/solid'
interface ArticlePageProps { interface ArticlePageProps {
article: Shout article: Shout
@ -21,7 +20,6 @@ export const ArticlePage = (props: ArticlePageProps) => {
const { getCurrentArticle } = useCurrentArticleStore({ currentArticle: props.article }) const { getCurrentArticle } = useCurrentArticleStore({ currentArticle: props.article })
const [getCommentsPage] = createSignal(1) const [getCommentsPage] = createSignal(1)
const [getIsCommentsLoading, setIsCommentsLoading] = createSignal(false) const [getIsCommentsLoading, setIsCommentsLoading] = createSignal(false)
const slug = createMemo(() => props.slug)
const reactionslist = useReactionsStore(props.reactions) const reactionslist = useReactionsStore(props.reactions)
createEffect(async () => { createEffect(async () => {
@ -43,7 +41,7 @@ export const ArticlePage = (props: ArticlePageProps) => {
<Suspense> <Suspense>
<FullArticle <FullArticle
article={getCurrentArticle()} article={getCurrentArticle()}
reactions={reactionslist().filter((r) => r.shout.slug === slug())} reactions={reactionslist().filter((r) => r.shout.slug === props.slug)}
isCommentsLoading={getIsCommentsLoading()} isCommentsLoading={getIsCommentsLoading()}
/> />
</Suspense> </Suspense>