postmerge
This commit is contained in:
parent
2a58ea15e4
commit
f325a9a2f2
|
@ -153,7 +153,7 @@ export const CommentsTree = (props: Props) => {
|
|||
</Show>
|
||||
</div>
|
||||
<ul class={styles.comments}>
|
||||
<For each={sortedComments().filter((r) => !r.replyTo)}>
|
||||
<For each={sortedComments().filter((r) => !r.reply_to)}>
|
||||
{(reaction) => (
|
||||
<Comment
|
||||
sortedComments={sortedComments()}
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
import { clsx } from 'clsx'
|
||||
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 { 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 { capitalize } from '../../../utils/capitalize'
|
||||
import { getImageUrl } from '../../../utils/getImageUrl'
|
||||
import { Button } from '../../_shared/Button'
|
||||
import { CheckButton } from '../../_shared/CheckButton'
|
||||
|
||||
import styles from './TopicBadge.module.scss'
|
||||
import { title } from 'process'
|
||||
import { capitalize } from '../../../utils/capitalize'
|
||||
|
||||
type Props = {
|
||||
topic: Topic
|
||||
|
@ -22,16 +20,16 @@ type Props = {
|
|||
}
|
||||
|
||||
export const TopicBadge = (props: Props) => {
|
||||
const { t, lang } = useLocalize()
|
||||
const { mediaMatches } = useMediaQuery()
|
||||
const [isMobileView, setIsMobileView] = createSignal(false)
|
||||
const [isSubscribing, setIsSubscribing] = createSignal(false)
|
||||
createEffect(() => {
|
||||
setIsMobileView(!mediaMatches.sm)
|
||||
})
|
||||
const { t } = useLocalize()
|
||||
const {
|
||||
subscriptions,
|
||||
actions: { loadSubscriptions, loadSession },
|
||||
isAuthenticated,
|
||||
session,
|
||||
actions: { loadSubscriptions },
|
||||
} = useSession()
|
||||
|
||||
const subscribed = createMemo(() =>
|
||||
|
@ -54,59 +52,63 @@ export const TopicBadge = (props: Props) => {
|
|||
|
||||
return (
|
||||
<div class={styles.TopicBadge}>
|
||||
<a
|
||||
href={`/topic/${props.topic.slug}`}
|
||||
class={clsx(styles.picture, { [styles.withImage]: props.topic.pic })}
|
||||
style={props.topic.pic && { 'background-image': `url('${imageProxy(props.topic.pic)}')` }}
|
||||
/>
|
||||
<a href={`/topic/${props.topic.slug}`} class={styles.info}>
|
||||
<span class={styles.title}>{title()}</span>
|
||||
<div class={styles.basicInfo}>
|
||||
<a
|
||||
href={`/topic/${props.topic.slug}`}
|
||||
class={clsx(styles.picture, {
|
||||
[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}>
|
||||
<span class={styles.title}>{title()}</span>
|
||||
<Show
|
||||
when={props.topic.body}
|
||||
fallback={
|
||||
<div class={styles.description}>
|
||||
{t('PublicationsWithCount', { count: props.topic.stat.shouts ?? 0 })}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div class={clsx('text-truncate', styles.description)}>{props.topic.body}</div>
|
||||
</Show>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class={styles.actions}>
|
||||
<Show
|
||||
when={props.topic.body}
|
||||
when={!props.minimizeSubscribeButton}
|
||||
fallback={
|
||||
<div class={styles.description}>
|
||||
{t('PublicationsWithCount', { count: props.topic.stat.shouts ?? 0 })}
|
||||
</div>
|
||||
<CheckButton text={t('Follow')} checked={subscribed()} onClick={() => subscribe(!subscribed)} />
|
||||
}
|
||||
>
|
||||
<div class={clsx('text-truncate', styles.description)}>{props.topic.body}</div>
|
||||
</Show>
|
||||
</a>
|
||||
<Show when={isAuthenticated()}>
|
||||
<div class={styles.actions}>
|
||||
<Show
|
||||
when={!props.minimizeSubscribeButton}
|
||||
when={subscribed()}
|
||||
fallback={
|
||||
<CheckButton
|
||||
text={t('Follow')}
|
||||
checked={subscribed()}
|
||||
onClick={() => subscribe(!subscribed)}
|
||||
<Button
|
||||
variant="primary"
|
||||
size="S"
|
||||
value={isSubscribing() ? t('subscribing...') : t('Subscribe')}
|
||||
onClick={() => subscribe(true)}
|
||||
class={styles.subscribeButton}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Show
|
||||
when={subscribed()}
|
||||
fallback={
|
||||
<Button
|
||||
variant="primary"
|
||||
size="S"
|
||||
value={isSubscribing() ? t('...subscribing') : t('Subscribe')}
|
||||
onClick={() => subscribe(true)}
|
||||
class={styles.subscribeButton}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
onClick={() => subscribe(false)}
|
||||
variant="bordered"
|
||||
size="S"
|
||||
value={t('Following')}
|
||||
class={styles.subscribeButton}
|
||||
/>
|
||||
</Show>
|
||||
<Button
|
||||
onClick={() => subscribe(false)}
|
||||
variant="bordered"
|
||||
size="S"
|
||||
value={t('Following')}
|
||||
class={styles.subscribeButton}
|
||||
/>
|
||||
</Show>
|
||||
</div>
|
||||
</Show>
|
||||
</Show>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user