import type { Author, Topic } from '../../graphql/schema/core.gen' import { clsx } from 'clsx' import { For, Show, createEffect, createSignal } from 'solid-js' import { useFollowing } from '../../context/following' import { useLocalize } from '../../context/localize' import { useSession } from '../../context/session' import { FollowingEntity } from '../../graphql/schema/core.gen' import { Button } from '../_shared/Button' import { Icon } from '../_shared/Icon' import { Subscribers } from '../_shared/Subscribers' import stylesCard from '../Author/AuthorCard/AuthorCard.module.scss' import { Userpic } from '../Author/Userpic' import styles from './Full.module.scss' type Props = { topic: Topic followers?: Author[] } export const FullTopic = (props: Props) => { const { t } = useLocalize() const { subscriptions, setFollowing } = useFollowing() const { requireAuthentication } = useSession() const [followed, setFollowed] = createSignal() createEffect(() => { const subs = subscriptions if (subs?.topics.length !== 0) { const items = subs.topics || [] setFollowed(items.some((x: Topic) => x?.slug === props.topic?.slug)) } }) const handleFollowClick = (_ev) => { const really = !followed() setFollowed(really) requireAuthentication(() => { setFollowing(FollowingEntity.Topic, props.topic.slug, really) }, 'follow') } return (

#{props.topic?.title}

{t('PublicationsWithCount', { count: props.topic?.stat.shouts ?? 0, })}
{props.topic?.title}
) }