Edit date docs
This commit is contained in:
parent
3ec4ec6b67
commit
1601ac22ea
|
@ -18,6 +18,9 @@ import { Button } from 'web/components/button'
|
||||||
import { track } from '@amplitude/analytics-browser'
|
import { track } from '@amplitude/analytics-browser'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import { copyToClipboard } from 'web/lib/util/copy'
|
import { copyToClipboard } from 'web/lib/util/copy'
|
||||||
|
import { useUser } from 'web/hooks/use-user'
|
||||||
|
import { RichEditPost } from '../post/[...slugs]'
|
||||||
|
import { usePost } from 'web/hooks/use-post'
|
||||||
|
|
||||||
export async function getStaticProps(props: { params: { username: string } }) {
|
export async function getStaticProps(props: { params: { username: string } }) {
|
||||||
const { username } = props.params
|
const { username } = props.params
|
||||||
|
@ -65,6 +68,9 @@ export function DateDocPost(props: {
|
||||||
const { content, birthday, photoUrl, contractSlug } = dateDoc
|
const { content, birthday, photoUrl, contractSlug } = dateDoc
|
||||||
const { name, username } = creator
|
const { name, username } = creator
|
||||||
|
|
||||||
|
const user = useUser()
|
||||||
|
const post = usePost(dateDoc.id) ?? dateDoc
|
||||||
|
|
||||||
const age = dayjs().diff(birthday, 'year')
|
const age = dayjs().diff(birthday, 'year')
|
||||||
const shareUrl = `https://${DOMAIN}/date-docs/${username}`
|
const shareUrl = `https://${DOMAIN}/date-docs/${username}`
|
||||||
const marketUrl = `https://${DOMAIN}/${username}/${contractSlug}`
|
const marketUrl = `https://${DOMAIN}/${username}/${contractSlug}`
|
||||||
|
@ -115,7 +121,11 @@ export function DateDocPost(props: {
|
||||||
</Col>
|
</Col>
|
||||||
</SiteLink>
|
</SiteLink>
|
||||||
<Spacer h={6} />
|
<Spacer h={6} />
|
||||||
<Content content={content} />
|
{user && user.id === creator.id ? (
|
||||||
|
<RichEditPost post={post} />
|
||||||
|
) : (
|
||||||
|
<Content content={content} />
|
||||||
|
)}
|
||||||
<Spacer h={6} />
|
<Spacer h={6} />
|
||||||
<div className="mt-10 w-full max-w-lg self-center rounded-xl bg-gradient-to-r from-blue-200 via-purple-200 to-indigo-300 p-5">
|
<div className="mt-10 w-full max-w-lg self-center rounded-xl bg-gradient-to-r from-blue-200 via-purple-200 to-indigo-300 p-5">
|
||||||
<iframe
|
<iframe
|
||||||
|
|
|
@ -164,7 +164,7 @@ export function PostCommentsActivity(props: {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function RichEditPost(props: { post: Post }) {
|
export function RichEditPost(props: { post: Post }) {
|
||||||
const { post } = props
|
const { post } = props
|
||||||
const [editing, setEditing] = useState(false)
|
const [editing, setEditing] = useState(false)
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user