import { getDateDoc } from 'web/lib/firebase/posts'
import { ArrowLeftIcon, LinkIcon } from '@heroicons/react/outline'
import { Page } from 'web/components/page'
import dayjs from 'dayjs'
import toast from 'react-hot-toast'
import clsx from 'clsx'
import { DateDoc } from 'common/post'
import { Content } from 'web/components/editor'
import { Col } from 'web/components/layout/col'
import { Row } from 'web/components/layout/row'
import { SiteLink } from 'web/components/site-link'
import { User } from 'web/lib/firebase/users'
import { DOMAIN } from 'common/envs/constants'
import Custom404 from '../404'
import { ShareIcon } from '@heroicons/react/solid'
import { Button } from 'web/components/button'
import { track } from '@amplitude/analytics-browser'
import { copyToClipboard } from 'web/lib/util/copy'
import { useUser } from 'web/hooks/use-user'
import { PostCommentsActivity, RichEditPost } from '../post/[...slugs]'
import { usePost } from 'web/hooks/use-post'
import { useTipTxns } from 'web/hooks/use-tip-txns'
import { useCommentsOnPost } from 'web/hooks/use-comments'
import { NoSEO } from 'web/components/NoSEO'
export async function getStaticProps(props: { params: { username: string } }) {
const { username } = props.params
const { user: creator, post } = (await getDateDoc(username)) ?? {
creator: null,
post: null,
}
return {
props: {
creator,
post,
},
revalidate: 5, // regenerate after five seconds
}
}
export async function getStaticPaths() {
return { paths: [], fallback: 'blocking' }
}
export default function DateDocPageHelper(props: {
creator: User | null
post: DateDoc | null
}) {
const { creator, post } = props
if (!creator || !post) return