-
-
-
-
-
-
-
- {post.files?.length === 1 ? "1 file" : `${post.files?.length || 0} files`}
-
-
-
-
+
+
+
+ {post.files?.length === 1 ? "1 file" : `${post.files?.length || 0} files`}
+
diff --git a/client/components/post-page/index.tsx b/client/components/post-page/index.tsx
index 2709dbb6..c2e6fd17 100644
--- a/client/components/post-page/index.tsx
+++ b/client/components/post-page/index.tsx
@@ -9,12 +9,15 @@ import type { File, Post } from "@lib/types"
import { Page, Button, Text, ButtonGroup, useMediaQuery } from "@geist-ui/core"
import { useEffect, useState } from "react"
import Archive from '@geist-ui/icons/archive'
+import Edit from '@geist-ui/icons/edit'
+import Parent from '@geist-ui/icons/arrowUpCircle'
import FileDropdown from "@components/file-dropdown"
import ScrollToTop from "@components/scroll-to-top"
import { useRouter } from "next/router"
import ExpirationBadge from "@components/badges/expiration-badge"
import CreatedAgoBadge from "@components/badges/created-ago-badge"
import Cookies from "js-cookie"
+import getPostPath from "@lib/get-post-path"
type Props = {
post: Post
@@ -27,6 +30,9 @@ const PostPage = ({ post }: Props) => {
const [isExpired, setIsExpired] = useState(post.expiresAt ? new Date(post.expiresAt) < new Date() : null)
const [isLoading, setIsLoading] = useState(true)
useEffect(() => {
+ if (isExpired) {
+ router.push("/expired")
+ }
const isOwner = post.users ? post.users[0].id === Cookies.get("drift-userid") : false
const expirationDate = new Date(post.expiresAt ? post.expiresAt : "")
@@ -46,7 +52,7 @@ const PostPage = ({ post }: Props) => {
return () => {
if (interval) clearInterval(interval)
}
- }, [post.expiresAt, post.users, router])
+ }, [isExpired, post.expiresAt, post.users, router])
const download = async () => {
@@ -66,6 +72,10 @@ const PostPage = ({ post }: Props) => {
link.remove()
}
+ const editACopy = () => {
+ router.push(`/new/from/${post.id}`)
+ }
+
if (isLoading) {
return <>>
}
@@ -85,24 +95,34 @@ const PostPage = ({ post }: Props) => {
{post.title}
-
+
-
+
+
-
- }>
- Download as ZIP archive
+
+ } style={{ textTransform: 'none' }}>
+ Download as ZIP Archive
-
+ }
+ onClick={editACopy}
+ style={{ textTransform: 'none' }}>
+ Edit a Copy
+
+ {console.log(post)}
+ {post.parent && }
+ onClick={() => router.push(getPostPath(post.parent!.visibility, post.parent!.id))}
+ >
+ View Parent
+ }
+
diff --git a/client/components/post-page/post-page.module.css b/client/components/post-page/post-page.module.css
index a5137bb9..af80908b 100644
--- a/client/components/post-page/post-page.module.css
+++ b/client/components/post-page/post-page.module.css
@@ -1,51 +1,51 @@
-.header {
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
.header .title {
display: flex;
- text-align: center;
+ flex-direction: row;
justify-content: space-between;
align-items: center;
+ margin-bottom: var(--gap);
+}
+
+.header .title .badges {
+ display: flex;
+ gap: var(--gap-half);
}
.header .title h3 {
margin: 0;
padding: 0;
-}
-
-.header .title .badges > * {
- margin-left: var(--gap);
+ display: inline-block;
}
.header .buttons {
display: flex;
- justify-content: space-between;
- align-items: flex-end;
+ justify-content: flex-end;
}
@media screen and (max-width: 900px) {
.header {
flex-direction: column;
+ gap: var(--gap);
}
}
@media screen and (max-width: 700px) {
.header .title {
flex-direction: column;
- padding-bottom: var(--gap-double);
- }
-
- .header .title .badges > * {
- margin-left: 0;
+ gap: var(--gap-half);
}
.header .title .badges {
+ flex-direction: column;
+ align-items: center;
+ }
+
+ .header .title .badges > * {
+ width: min-content;
+ }
+
+ .header .buttons {
display: flex;
- flex-direction: row;
- justify-content: space-between;
- width: 100%;
+ justify-content: center;
}
}
diff --git a/client/components/view-document/index.tsx b/client/components/view-document/index.tsx
index 37edca90..925f8e1d 100644
--- a/client/components/view-document/index.tsx
+++ b/client/components/view-document/index.tsx
@@ -22,7 +22,7 @@ type Props = {
const DownloadButton = ({ rawLink }: { rawLink?: string }) => {
return (
-
+
-
+