import type { Component } from 'solid-js'; import type { ReactiveComment } from '../controllers/commentListState'; import { createDateNow } from '@solid-primitives/date'; import { createMemo, Index, Show } from 'solid-js'; import commentBoxState from '../controllers/commentBoxState'; import configProvider from '../controllers/configProvider'; import { getTimeAgo } from '../waline/utils/date'; import { isLinkHttp } from '../waline/utils/path'; import CommentBox from './CommentBox'; import CommentCardActions from './CommentCardActions'; import CommentMeta from './CommentMeta'; import { VerifiedIcon } from './Icons'; const CommentCard: Component<{ content: ReactiveComment; rootId: number }> = (props) => { const link = createMemo(() => { const { link: link2 } = props.content; if (!link2) return ''; return isLinkHttp(link2) ? link2 : `https://${link2}`; }); const { replyId, edit } = commentBoxState; const showCommentBox = createMemo( () => replyId() === props.content.objectId || edit()?.objectId === props.content.objectId, ); const [now] = createDateNow(); const { locale, commentClassName } = configProvider; const time = createMemo(() => getTimeAgo(new Date(props.content.time), now(), locale())); return (