This commit is contained in:
Untone 2024-03-01 00:11:59 +03:00
parent 72610d10b5
commit d0be8ffb6a
5 changed files with 37 additions and 26 deletions

View File

@ -2,7 +2,7 @@
@include font-size(1.2rem);
color: var(--secondary-color);
//align-self: center;
align-self: center;
display: flex;
align-items: flex-start;
justify-content: flex-start;

View File

@ -1,15 +1,15 @@
import {clsx} from 'clsx'
import {createMemo, createSignal, For, lazy, onMount, Show} from 'solid-js'
import { clsx } from 'clsx'
import { For, Show, createMemo, createSignal, lazy, onMount } from 'solid-js'
import {useLocalize} from '../../context/localize'
import {useReactions} from '../../context/reactions'
import {useSession} from '../../context/session'
import {Author, Reaction, ReactionKind, ReactionSort} from '../../graphql/schema/core.gen'
import {byCreated, byStat} from '../../utils/sortby'
import {Button} from '../_shared/Button'
import {ShowIfAuthenticated} from '../_shared/ShowIfAuthenticated'
import { useLocalize } from '../../context/localize'
import { useReactions } from '../../context/reactions'
import { useSession } from '../../context/session'
import { Author, Reaction, ReactionKind, ReactionSort } from '../../graphql/schema/core.gen'
import { byCreated, byStat } from '../../utils/sortby'
import { Button } from '../_shared/Button'
import { ShowIfAuthenticated } from '../_shared/ShowIfAuthenticated'
import {Comment} from './Comment'
import { Comment } from './Comment'
import styles from './Article.module.scss'
@ -95,11 +95,7 @@ export const CommentsTree = (props: Props) => {
<ul class={clsx(styles.commentsViewSwitcher, 'view-switcher')}>
<Show when={newReactions().length > 0}>
<li classList={{ 'view-switcher__item--selected': onlyNew() }}>
<Button
variant="light"
value={t('New only')}
onClick={() => setOnlyNew(!onlyNew())}
/>
<Button variant="light" value={t('New only')} onClick={() => setOnlyNew(!onlyNew())} />
</li>
</Show>
<li classList={{ 'view-switcher__item--selected': commentsOrder() === ReactionSort.Newest }}>

View File

@ -23,9 +23,9 @@ import { Row2 } from '../../Feed/Row2'
import { Row3 } from '../../Feed/Row3'
import { Loading } from '../../_shared/Loading'
import { byCreated } from '../../../utils/sortby'
import stylesArticle from '../../Article/Article.module.scss'
import styles from './Author.module.scss'
import {byCreated} from "../../../utils/sortby";
type Props = {
shouts: Shout[]

View File

@ -1,13 +1,21 @@
import type { PageContext } from '../renderer/types'
import type { PageProps } from './types'
import { PAGE_SIZE } from '../components/Views/AllTopics/AllTopics'
import { apiClient } from '../graphql/client/core'
import { PAGE_SIZE } from "../components/Views/AllTopics/AllTopics";
export const onBeforeRender = async (_pageContext: PageContext) => {
const allAuthors = await apiClient.getAllAuthors()
const topWritingAuthors = await apiClient.loadAuthorsBy({ by: { order: 'shouts' }, limit: PAGE_SIZE})
const topFollowedAuthors = await apiClient.loadAuthorsBy({ by: { order: 'followers' }, limit: PAGE_SIZE})
const topWritingAuthors = await apiClient.loadAuthorsBy({
by: { order: 'shouts' },
limit: PAGE_SIZE,
offset: 0,
})
const topFollowedAuthors = await apiClient.loadAuthorsBy({
by: { order: 'followers' },
limit: PAGE_SIZE,
offset: 0,
})
const pageProps: PageProps = { allAuthors, seo: { title: '' }, topWritingAuthors, topFollowedAuthors }
return {

View File

@ -3,13 +3,15 @@ import type { PageProps } from './types'
import { createEffect, createSignal, onMount } from 'solid-js'
import { AllAuthors } from '../components/Views/AllAuthors/'
import { PAGE_SIZE } from '../components/Views/AllTopics/AllTopics'
import { PageLayout } from '../components/_shared/PageLayout'
import { useLocalize } from '../context/localize'
import {loadAllAuthors, loadAuthors} from '../stores/zine/authors'
import {PAGE_SIZE} from "../components/Views/AllTopics/AllTopics";
import { loadAllAuthors, loadAuthors } from '../stores/zine/authors'
export const AllAuthorsPage = (props: PageProps) => {
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allAuthors && props.topFollowedAuthors && props.topWritingAuthors))
const [isLoaded, setIsLoaded] = createSignal<boolean>(
Boolean(props.allAuthors && props.topFollowedAuthors && props.topWritingAuthors),
)
const { t } = useLocalize()
@ -19,14 +21,19 @@ export const AllAuthorsPage = (props: PageProps) => {
}
await loadAllAuthors()
await loadAuthors({ by: { order: 'shouts' }, limit: PAGE_SIZE })
await loadAuthors({ by: { order: 'followers' }, limit: PAGE_SIZE })
await loadAuthors({ by: { order: 'shouts' }, limit: PAGE_SIZE, offset: 0 })
await loadAuthors({ by: { order: 'followers' }, limit: PAGE_SIZE, offset: 0 })
setIsLoaded(true)
})
return (
<PageLayout title={t('Authors')}>
<AllAuthors isLoaded={isLoaded()} authors={props.allAuthors} topWritingAuthors={props.topWritingAuthors} topFollowedAuthors={props.topFollowedAuthors} />
<AllAuthors
isLoaded={isLoaded()}
authors={props.allAuthors}
topWritingAuthors={props.topWritingAuthors}
topFollowedAuthors={props.topFollowedAuthors}
/>
</PageLayout>
)
}