import { capitalize } from '../../utils' import './Full.scss' import { Icon } from '../Nav/Icon' import ArticleComment from './Comment' import { AuthorCard } from '../Author/Card' import { createMemo, For, onMount, Show } from 'solid-js' import type { Author, Reaction, Shout } from '../../graphql/types.gen' import { t } from '../../utils/intl' import { showModal } from '../../stores/ui' import { incrementView } from '../../stores/zine/articles' import MD from './MD' import { SharePopup } from './SharePopup' import { useAuth } from '../../context/auth' const MAX_COMMENT_LEVEL = 6 const getCommentLevel = (comment: Reaction, level = 0) => { if (comment && comment.replyTo && level < MAX_COMMENT_LEVEL) { return 0 // FIXME: getCommentLevel(commentsById[c.replyTo], level + 1) } return level } interface ArticleProps { article: Shout reactions: Reaction[] isCommentsLoading: boolean } const formatDate = (date: Date) => { return date .toLocaleDateString('ru', { month: 'long', day: 'numeric', year: 'numeric' }) .replace(' г.', '') } export const FullArticle = (props: ArticleProps) => { const { session } = useAuth() onMount(() => { incrementView({ articleSlug: props.article.slug }) }) const formattedDate = createMemo(() => formatDate(new Date(props.article.createdAt))) 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 (
{props.article.stat?.commented || ''}
{props.article.stat?.viewed}
{/*FIXME*/} {/**/}
event.preventDefault()}> } />
{/*FIXME*/} {/**/} {/* */} {/**/}
{formattedDate}
{(topic) => ( )}
1}>

{t('Authors')}

{(a: Author) => }

{t('Comments')} {props.reactions?.length.toString() || ''}

r.body)}> {(reaction) => ( )}