import { createMemo, Show } from 'solid-js' import type { Topic } from '../../graphql/types.gen' import { FollowingEntity } from '../../graphql/types.gen' import styles from './Full.module.scss' import { follow, unfollow } from '../../stores/zine/common' import { clsx } from 'clsx' import { useSession } from '../../context/session' import { useLocalize } from '../../context/localize' type Props = { topic: Topic } export const FullTopic = (props: Props) => { const { subscriptions, actions: { requireAuthentication } } = useSession() const { t } = useLocalize() const subscribed = createMemo(() => subscriptions().topics.some((topic) => topic.slug === props.topic?.slug) ) const handleSubscribe = (isFollowed: boolean) => { requireAuthentication(() => { if (isFollowed) { unfollow({ what: FollowingEntity.Topic, slug: props.topic.slug }) } else { follow({ what: FollowingEntity.Topic, slug: props.topic.slug }) } }, 'follow') } return (
) }