commit
3aafd4f5d3
|
@ -19,7 +19,6 @@ export default (props: {
|
|||
canEdit?: boolean
|
||||
compact?: boolean
|
||||
}) => {
|
||||
const [isSharePopupVisible, setIsSharePopupVisible] = createSignal(false)
|
||||
const [isReplyVisible, setIsReplyVisible] = createSignal(false)
|
||||
|
||||
const comment = createMemo(() => props.comment)
|
||||
|
@ -68,9 +67,9 @@ export default (props: {
|
|||
[styles.commentRatingNegative]: comment().stat?.rating < 0
|
||||
}}
|
||||
>
|
||||
<button class={clsx(styles.commentRatingControl, styles.commentRatingControlUp)}></button>
|
||||
<button class={clsx(styles.commentRatingControl, styles.commentRatingControlUp)} />
|
||||
<div class={styles.commentRatingValue}>{comment().stat?.rating || 0}</div>
|
||||
<button class={clsx(styles.commentRatingControl, styles.commentRatingControlDown)}></button>
|
||||
<button class={clsx(styles.commentRatingControl, styles.commentRatingControlDown)} />
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
|
@ -112,9 +111,6 @@ export default (props: {
|
|||
</Show>
|
||||
|
||||
<SharePopup
|
||||
onVisibilityChange={(isVisible) => {
|
||||
setIsSharePopupVisible(isVisible)
|
||||
}}
|
||||
containerCssClass={stylesHeader.control}
|
||||
trigger={
|
||||
<button class={clsx(styles.commentControl, styles.commentControlShare)}>
|
||||
|
@ -134,7 +130,7 @@ export default (props: {
|
|||
|
||||
<Show when={isReplyVisible()}>
|
||||
<form class={styles.replyForm}>
|
||||
<textarea name="reply" id="reply" rows="5"></textarea>
|
||||
<textarea name="reply" id="reply" rows="5" />
|
||||
<div class={styles.replyFormControls}>
|
||||
<button class="button button--light" onClick={() => setIsReplyVisible(false)}>
|
||||
{t('Cancel')}
|
||||
|
|
|
@ -55,9 +55,18 @@ export const AuthorCard = (props: AuthorCardProps) => {
|
|||
|
||||
const canFollow = createMemo(() => !props.hideFollow && session()?.user?.slug !== props.author.slug)
|
||||
|
||||
const name = () => {
|
||||
return props.author.name === 'Дискурс' && locale() !== 'ru' ? 'Discours' : translit(props.author.name)
|
||||
}
|
||||
const name = createMemo(() => {
|
||||
if (locale() !== 'ru') {
|
||||
if (props.author.name === 'Дискурс') {
|
||||
return 'Discours'
|
||||
}
|
||||
|
||||
return translit(props.author.name)
|
||||
}
|
||||
|
||||
return props.author.name
|
||||
})
|
||||
|
||||
// TODO: reimplement AuthorCard
|
||||
return (
|
||||
<div
|
||||
|
|
|
@ -134,8 +134,11 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
|||
<div class={styles.shoutAuthor}>
|
||||
<For each={authors}>
|
||||
{(author, index) => {
|
||||
const name =
|
||||
author.name === 'Дискурс' && locale() !== 'ru' ? 'Discours' : translit(author.name)
|
||||
let name = author.name
|
||||
|
||||
if (locale() !== 'ru') {
|
||||
name = name === 'Дискурс' ? 'Discours' : translit(name)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -8,7 +8,7 @@ import { loadAuthor } from '../../stores/zine/authors'
|
|||
import { Loading } from '../Loading'
|
||||
|
||||
export const AuthorPage = (props: PageProps) => {
|
||||
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.shouts) && Boolean(props.author))
|
||||
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.authorShouts) && Boolean(props.author))
|
||||
|
||||
const slug = createMemo(() => {
|
||||
const { page: getPage } = useRouter()
|
||||
|
@ -38,7 +38,7 @@ export const AuthorPage = (props: PageProps) => {
|
|||
return (
|
||||
<PageWrap>
|
||||
<Show when={isLoaded()} fallback={<Loading />}>
|
||||
<AuthorView author={props.author} shouts={props.shouts} authorSlug={slug()} />
|
||||
<AuthorView author={props.author} shouts={props.authorShouts} authorSlug={slug()} />
|
||||
</Show>
|
||||
</PageWrap>
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Loading } from '../Loading'
|
|||
import styles from './HomePage.module.scss'
|
||||
|
||||
export const HomePage = (props: PageProps) => {
|
||||
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.shouts) && Boolean(props.randomTopics))
|
||||
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.homeShouts) && Boolean(props.randomTopics))
|
||||
|
||||
onMount(async () => {
|
||||
if (isLoaded()) {
|
||||
|
@ -26,7 +26,7 @@ export const HomePage = (props: PageProps) => {
|
|||
return (
|
||||
<PageWrap class={styles.mainContent}>
|
||||
<Show when={isLoaded()} fallback={<Loading />}>
|
||||
<HomeView randomTopics={props.randomTopics} shouts={props.shouts || []} />
|
||||
<HomeView randomTopics={props.randomTopics} shouts={props.homeShouts || []} />
|
||||
</Show>
|
||||
</PageWrap>
|
||||
)
|
||||
|
|
|
@ -29,7 +29,7 @@ export const LayoutShoutsPage = (props: PageProps) => {
|
|||
return page.params.layout as LayoutType
|
||||
})
|
||||
const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false)
|
||||
const { sortedLayoutShouts, loadLayoutShoutsBy } = useLayoutsStore(layout(), props.shouts)
|
||||
const { sortedLayoutShouts, loadLayoutShoutsBy } = useLayoutsStore(layout(), props.layoutShouts)
|
||||
const sortedArticles = createMemo<Shout[]>(() => sortedLayoutShouts().get(layout()) || [])
|
||||
const loadMoreLayout = async (kind: LayoutType) => {
|
||||
saveScrollPosition()
|
||||
|
|
|
@ -8,7 +8,7 @@ import { loadTopic } from '../../stores/zine/topics'
|
|||
import { Loading } from '../Loading'
|
||||
|
||||
export const TopicPage = (props: PageProps) => {
|
||||
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.shouts) && Boolean(props.topic))
|
||||
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.topicShouts) && Boolean(props.topic))
|
||||
|
||||
const slug = createMemo(() => {
|
||||
const { page: getPage } = useRouter()
|
||||
|
@ -38,7 +38,7 @@ export const TopicPage = (props: PageProps) => {
|
|||
return (
|
||||
<PageWrap>
|
||||
<Show when={isLoaded()} fallback={<Loading />}>
|
||||
<TopicView topic={props.topic} shouts={props.shouts} topicSlug={slug()} />
|
||||
<TopicView topic={props.topic} shouts={props.topicShouts} topicSlug={slug()} />
|
||||
</Show>
|
||||
</PageWrap>
|
||||
)
|
||||
|
|
|
@ -6,7 +6,10 @@ import type { LayoutType } from '../stores/zine/layouts'
|
|||
export type PageProps = {
|
||||
randomTopics?: Topic[]
|
||||
article?: Shout
|
||||
shouts?: Shout[]
|
||||
layoutShouts?: Shout[]
|
||||
authorShouts?: Shout[]
|
||||
topicShouts?: Shout[]
|
||||
homeShouts?: Shout[]
|
||||
author?: Author
|
||||
allAuthors?: Author[]
|
||||
topic?: Topic
|
||||
|
|
|
@ -16,5 +16,5 @@ Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate'
|
|||
---
|
||||
|
||||
<Prerendered>
|
||||
<Root shouts={shouts} author={author} client:load />
|
||||
<Root authorShouts={shouts} author={author} client:load />
|
||||
</Prerendered>
|
||||
|
|
|
@ -15,6 +15,6 @@ initRouter(pathname, search)
|
|||
---
|
||||
|
||||
<Prerendered>
|
||||
<Root shouts={shouts} layout={layout} client:load />
|
||||
<Root layoutShouts={shouts} layout={layout} client:load />
|
||||
</Prerendered>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { initRouter } from '../stores/router'
|
|||
import { PRERENDERED_ARTICLES_COUNT, RANDOM_TOPICS_COUNT } from '../components/Views/Home'
|
||||
|
||||
const randomTopics = await apiClient.getRandomTopics({ amount: RANDOM_TOPICS_COUNT })
|
||||
const articles = await apiClient.getShouts(
|
||||
const shouts = await apiClient.getShouts(
|
||||
{ filters: { visibility: "public" }, limit: PRERENDERED_ARTICLES_COUNT })
|
||||
|
||||
const { pathname, search } = Astro.url
|
||||
|
@ -16,6 +16,6 @@ Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate'
|
|||
---
|
||||
|
||||
<Prerendered>
|
||||
<Root randomTopics={randomTopics} shouts={articles} client:load />
|
||||
<Root randomTopics={randomTopics} homeShouts={shouts} client:load />
|
||||
</Prerendered>
|
||||
|
||||
|
|
|
@ -17,5 +17,5 @@ Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate'
|
|||
---
|
||||
|
||||
<Prerendered>
|
||||
<Root shouts={shouts} topic={topic} client:load />
|
||||
<Root topicShouts={shouts} topic={topic} client:load />
|
||||
</Prerendered>
|
||||
|
|
Loading…
Reference in New Issue
Block a user