import { Component, JSX, Show, createSignal } from 'solid-js'; import LazyLoad from '@/components/utils/LazyLoad'; import useDetectOverflow from '@/hooks/useDetectOverflow'; import useFormatDate from '@/hooks/useFormatDate'; import { useTranslation } from '@/i18n/useTranslation'; import useProfile from '@/nostr/useProfile'; import npubEncodeFallback from '@/utils/npubEncodeFallback'; import { thumbnailUrl } from '@/utils/url'; export type PostProps = { authorPubkey: string; createdAt: Date; content: JSX.Element; actions?: JSX.Element; footer?: JSX.Element; onShowProfile?: () => void; onShowEvent?: () => void; }; const Post: Component = (props) => { const i18n = useTranslation(); const { overflow, elementRef } = useDetectOverflow(); const formatDate = useFormatDate(); const [showOverflow, setShowOverflow] = createSignal(false); const createdAt = () => formatDate(props.createdAt); const createdAtFull = () => props.createdAt.toLocaleString(); const { profile: author } = useProfile(() => ({ pubkey: props.authorPubkey, })); return (
{props.content}
{props.actions}
{props.footer}
); }; export default Post;