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' import { Button } from '../_shared/Button' type Props = { topic: Topic } export const FullTopic = (props: Props) => { const { subscriptions, actions: { requireAuthentication, loadSubscriptions } } = useSession() const { t } = useLocalize() const subscribed = createMemo(() => subscriptions().topics.some((topic) => topic.slug === props.topic?.slug) ) const handleSubscribe = (really: boolean) => { requireAuthentication(async () => { await (really ? follow({ what: FollowingEntity.Topic, slug: props.topic.slug }) : unfollow({ what: FollowingEntity.Topic, slug: props.topic.slug })) loadSubscriptions() }, 'follow') } return (
) }