import './Comment.scss' import { Icon } from '../Nav/Icon' import { AuthorCard } from '../Author/Card' import { Show } from 'solid-js/web' import { clsx } from 'clsx' import type { Author, Reaction as Point } from '../../graphql/types.gen' import { createMemo, createSignal, onMount } from 'solid-js' import { t } from '../../utils/intl' // import { createReaction, updateReaction, deleteReaction } from '../../stores/zine/reactions' import { renderMarkdown } from '@astrojs/markdown-remark' import { markdownOptions } from '../../../mdx.config' import { deleteReaction } from '../../stores/zine/reactions' export default (props: { level?: number comment: Partial canEdit?: boolean compact?: boolean }) => { const comment = createMemo(() => props.comment) const [body, setBody] = createSignal('') onMount(() => { const b: string = props.comment?.body if (b?.toString().startsWith('<')) { setBody(b) } else { renderMarkdown(b, markdownOptions).then(({ code }) => setBody(code)) } }) const remove = () => { if (comment()?.id) { console.log('[comment] removing', comment().id) deleteReaction(comment().id) } } return (
} >
{comment()?.createdAt}
{comment().stat.rating}
{/*FIXME implement edit comment modal*/} {/* showModal('editComment')}*/} {/*>*/} {/* */} {/* {t('Edit')}*/} {/**/} {/*FIXME implement modals */} {/*
) }