import { capitalize, formatDate } from '../../utils' import './Full.scss' import { Icon } from '../_shared/Icon' import { AuthorCard } from '../Author/Card' import { createMemo, createSignal, For, onMount, Show } from 'solid-js' import type { Author, Reaction, Shout } from '../../graphql/types.gen' import { t } from '../../utils/intl' import MD from './MD' import { SharePopup } from './SharePopup' import stylesHeader from '../Nav/Header.module.scss' import styles from '../../styles/Article.module.scss' import RatingControl from './RatingControl' import { clsx } from 'clsx' import { CommentsTree } from './CommentsTree' interface ArticleProps { article: Shout } export const FullArticle = (props: ArticleProps) => { const formattedDate = createMemo(() => formatDate(new Date(props.article.createdAt))) const [isSharePopupVisible, setIsSharePopupVisible] = createSignal(false) const mainTopic = () => (props.article.topics?.find((topic) => topic?.slug === props.article.mainTopic)?.title || '').replace( ' ', ' ' ) onMount(() => { const windowHash = window.location.hash if (windowHash?.length > 0) { const comments = document.querySelector(windowHash) if (comments) { window.scrollTo({ top: comments.getBoundingClientRect().top, behavior: 'smooth' }) } } }) return (