postmerge
Some checks failed
deploy / test (push) Failing after 42s
deploy / Update templates on Mailgun (push) Failing after 4s

This commit is contained in:
Untone 2024-01-11 20:40:06 +03:00
parent 2a58ea15e4
commit f325a9a2f2
2 changed files with 57 additions and 55 deletions

View File

@ -153,7 +153,7 @@ export const CommentsTree = (props: Props) => {
</Show> </Show>
</div> </div>
<ul class={styles.comments}> <ul class={styles.comments}>
<For each={sortedComments().filter((r) => !r.replyTo)}> <For each={sortedComments().filter((r) => !r.reply_to)}>
{(reaction) => ( {(reaction) => (
<Comment <Comment
sortedComments={sortedComments()} sortedComments={sortedComments()}

View File

@ -1,20 +1,18 @@
import { clsx } from 'clsx' import { clsx } from 'clsx'
import { createEffect, createMemo, createSignal, Show } from 'solid-js' import { createEffect, createMemo, createSignal, Show } from 'solid-js'
import styles from './TopicBadge.module.scss'
import { FollowingEntity, Topic } from '../../../graphql/schema/core.gen'
import { createMemo, createSignal, Show } from 'solid-js'
import { imageProxy } from '../../../utils/imageProxy'
import { Button } from '../../_shared/Button'
import { useSession } from '../../../context/session'
import { useLocalize } from '../../../context/localize' import { useLocalize } from '../../../context/localize'
import { useMediaQuery } from '../../../context/mediaQuery'
import { useSession } from '../../../context/session'
import { FollowingEntity, Topic } from '../../../graphql/schema/core.gen'
import { follow, unfollow } from '../../../stores/zine/common' import { follow, unfollow } from '../../../stores/zine/common'
import { capitalize } from '../../../utils/capitalize'
import { getImageUrl } from '../../../utils/getImageUrl' import { getImageUrl } from '../../../utils/getImageUrl'
import { Button } from '../../_shared/Button' import { Button } from '../../_shared/Button'
import { CheckButton } from '../../_shared/CheckButton' import { CheckButton } from '../../_shared/CheckButton'
import styles from './TopicBadge.module.scss' import styles from './TopicBadge.module.scss'
import { title } from 'process'
import { capitalize } from '../../../utils/capitalize'
type Props = { type Props = {
topic: Topic topic: Topic
@ -22,16 +20,16 @@ type Props = {
} }
export const TopicBadge = (props: Props) => { export const TopicBadge = (props: Props) => {
const { t, lang } = useLocalize()
const { mediaMatches } = useMediaQuery()
const [isMobileView, setIsMobileView] = createSignal(false)
const [isSubscribing, setIsSubscribing] = createSignal(false) const [isSubscribing, setIsSubscribing] = createSignal(false)
createEffect(() => { createEffect(() => {
setIsMobileView(!mediaMatches.sm) setIsMobileView(!mediaMatches.sm)
}) })
const { t } = useLocalize()
const { const {
subscriptions, subscriptions,
actions: { loadSubscriptions, loadSession }, actions: { loadSubscriptions },
isAuthenticated,
session,
} = useSession() } = useSession()
const subscribed = createMemo(() => const subscribed = createMemo(() =>
@ -54,10 +52,18 @@ export const TopicBadge = (props: Props) => {
return ( return (
<div class={styles.TopicBadge}> <div class={styles.TopicBadge}>
<div class={styles.basicInfo}>
<a <a
href={`/topic/${props.topic.slug}`} href={`/topic/${props.topic.slug}`}
class={clsx(styles.picture, { [styles.withImage]: props.topic.pic })} class={clsx(styles.picture, {
style={props.topic.pic && { 'background-image': `url('${imageProxy(props.topic.pic)}')` }} [styles.withImage]: props.topic.pic,
[styles.smallSize]: isMobileView(),
})}
style={
props.topic.pic && {
'background-image': `url('${getImageUrl(props.topic.pic, { width: 40, height: 40 })}')`,
}
}
/> />
<a href={`/topic/${props.topic.slug}`} class={styles.info}> <a href={`/topic/${props.topic.slug}`} class={styles.info}>
<span class={styles.title}>{title()}</span> <span class={styles.title}>{title()}</span>
@ -72,16 +78,13 @@ export const TopicBadge = (props: Props) => {
<div class={clsx('text-truncate', styles.description)}>{props.topic.body}</div> <div class={clsx('text-truncate', styles.description)}>{props.topic.body}</div>
</Show> </Show>
</a> </a>
<Show when={isAuthenticated()}> </div>
<div class={styles.actions}> <div class={styles.actions}>
<Show <Show
when={!props.minimizeSubscribeButton} when={!props.minimizeSubscribeButton}
fallback={ fallback={
<CheckButton <CheckButton text={t('Follow')} checked={subscribed()} onClick={() => subscribe(!subscribed)} />
text={t('Follow')}
checked={subscribed()}
onClick={() => subscribe(!subscribed)}
/>
} }
> >
<Show <Show
@ -90,7 +93,7 @@ export const TopicBadge = (props: Props) => {
<Button <Button
variant="primary" variant="primary"
size="S" size="S"
value={isSubscribing() ? t('...subscribing') : t('Subscribe')} value={isSubscribing() ? t('subscribing...') : t('Subscribe')}
onClick={() => subscribe(true)} onClick={() => subscribe(true)}
class={styles.subscribeButton} class={styles.subscribeButton}
/> />
@ -106,7 +109,6 @@ export const TopicBadge = (props: Props) => {
</Show> </Show>
</Show> </Show>
</div> </div>
</Show>
</div> </div>
) )
} }