@@ -315,6 +306,7 @@ const Post = ({
height={40}
width={251}
onClick={() => onSubmit("unlisted")}
+ loading={isSubmitting}
>
Create Unlisted
diff --git a/client/app/(posts)/new/from/[id]/page.tsx b/client/app/(posts)/new/from/[id]/page.tsx
index c3c7477d..485f28fd 100644
--- a/client/app/(posts)/new/from/[id]/page.tsx
+++ b/client/app/(posts)/new/from/[id]/page.tsx
@@ -25,8 +25,10 @@ const NewFromExisting = async ({
withFiles: true,
withAuthor: false
})
+
+ const serialized = JSON.stringify(post)
- return
+ return
}
export default NewFromExisting
diff --git a/client/app/(posts)/post/[id]/components/post-page/index.tsx b/client/app/(posts)/post/[id]/components/post-page/index.tsx
index 6eebe027..92945c61 100644
--- a/client/app/(posts)/post/[id]/components/post-page/index.tsx
+++ b/client/app/(posts)/post/[id]/components/post-page/index.tsx
@@ -27,6 +27,7 @@ const PostPage = ({ post: initialPost, isProtected, isAuthor }: Props) => {
const [post, setPost] = useState
(
typeof initialPost === "string" ? JSON.parse(initialPost) : initialPost
)
+
const [visibility, setVisibility] = useState(post.visibility)
const router = useRouter()
@@ -63,6 +64,10 @@ const PostPage = ({ post: initialPost, isProtected, isAuthor }: Props) => {
}
}, [isAuthor, post.expiresAt, router])
+ if (isProtected) {
+ return
+ }
+
const download = async () => {
if (!post.files) return
const downloadZip = (await import("client-zip")).downloadZip
@@ -89,12 +94,9 @@ const PostPage = ({ post: initialPost, isProtected, isAuthor }: Props) => {
const viewParentClick = () => {
router.push(`/post/${post.parentId}`)
}
-
- const isAvailable = !isProtected && post.title
-
+
return (
<>
- {!isAvailable && }
diff --git a/client/app/(posts)/post/[id]/components/post-page/view-document/index.tsx b/client/app/(posts)/post/[id]/components/post-page/view-document/index.tsx
index 9b9a54bc..78831529 100644
--- a/client/app/(posts)/post/[id]/components/post-page/view-document/index.tsx
+++ b/client/app/(posts)/post/[id]/components/post-page/view-document/index.tsx
@@ -30,14 +30,19 @@ const DownloadButton = ({ rawLink }: { rawLink?: string }) => {
target="_blank"
rel="noopener noreferrer"
>
- } aria-label="Download" />
+ }
+ aria-label="Download"
+ style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
+ />
}
+ iconLeft={}
aria-label="Open raw file in new tab"
+ style={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }}
/>
diff --git a/client/app/(posts)/post/[id]/head.tsx b/client/app/(posts)/post/[id]/head.tsx
index 1d175a2d..cff9784b 100644
--- a/client/app/(posts)/post/[id]/head.tsx
+++ b/client/app/(posts)/post/[id]/head.tsx
@@ -16,7 +16,7 @@ export default async function Head({
return (
diff --git a/client/app/(posts)/post/[id]/page.tsx b/client/app/(posts)/post/[id]/page.tsx
index 83fe1d1f..2c5156f1 100644
--- a/client/app/(posts)/post/[id]/page.tsx
+++ b/client/app/(posts)/post/[id]/page.tsx
@@ -47,7 +47,10 @@ const getPost = async (id: string) => {
if (post.visibility === "protected" && !isAuthorOrAdmin) {
return {
- // post,
+ post: {
+ visibility: "protected",
+ id: post.id
+ },
isProtected: true,
isAuthor: isAuthorOrAdmin
}
diff --git a/client/app/components/badges/created-ago-badge/index.tsx b/client/app/components/badges/created-ago-badge/index.tsx
index 799eaca8..d2675143 100644
--- a/client/app/components/badges/created-ago-badge/index.tsx
+++ b/client/app/components/badges/created-ago-badge/index.tsx
@@ -1,4 +1,5 @@
-import Tooltip from "@components/tooltip"
+'use client'
+// import Tooltip from "@components/tooltip"
import { timeAgo } from "@lib/time-ago"
import { useMemo, useState, useEffect } from "react"
import Badge from "../badge"
@@ -14,14 +15,15 @@ const CreatedAgoBadge = ({ createdAt }: { createdAt: string | Date }) => {
return () => clearInterval(interval)
}, [createdDate])
- const formattedTime = `${createdDate.toLocaleDateString()} ${createdDate.toLocaleTimeString()}`
+ // const formattedTime = `${createdDate.toLocaleDateString()} ${createdDate.toLocaleTimeString()}`
return (
-
- {" "}
-
+ // TODO: investigate tooltip
+ //
+
+ {" "}
<>{time}>
-
-
+
+ //
)
}
diff --git a/client/app/components/badges/visibility-control/index.tsx b/client/app/components/badges/visibility-control/index.tsx
index b9996ace..ae653801 100644
--- a/client/app/components/badges/visibility-control/index.tsx
+++ b/client/app/components/badges/visibility-control/index.tsx
@@ -12,7 +12,7 @@ type Props = {
}
const VisibilityControl = ({ postId, visibility, setVisibility }: Props) => {
- const [isSubmitting, setSubmitting] = useState(false)
+ const [isSubmitting, setSubmitting] = useState()
const [passwordModalVisible, setPasswordModalVisible] = useState(false)
const { setToast } = useToasts()
@@ -47,53 +47,53 @@ const VisibilityControl = ({ postId, visibility, setVisibility }: Props) => {
return
}
setPasswordModalVisible(false)
- const timeout = setTimeout(() => setSubmitting(true), 100)
+ const timeout = setTimeout(() => setSubmitting(visibility), 100)
await sendRequest(visibility, password)
clearTimeout(timeout)
- setSubmitting(false)
+ setSubmitting(null)
},
[sendRequest]
)
const onClosePasswordModal = () => {
setPasswordModalVisible(false)
- setSubmitting(false)
+ setSubmitting(null)
}
const submitPassword = (password: string) => onSubmit("protected", password)
return (
<>
- {isSubmitting ? (
-
- ) : (
-
-
-
-
-
-
- )}
+
+
+
+
+
+
button:first-of-type {
diff --git a/client/app/components/button-group/index.tsx b/client/app/components/button-group/index.tsx
index a84ce6fe..309d59be 100644
--- a/client/app/components/button-group/index.tsx
+++ b/client/app/components/button-group/index.tsx
@@ -11,9 +11,9 @@ export default function ButtonGroup({
return (
diff --git a/client/app/components/button/index.tsx b/client/app/components/button/index.tsx
index f0a50d1b..03bdff17 100644
--- a/client/app/components/button/index.tsx
+++ b/client/app/components/button/index.tsx
@@ -1,6 +1,7 @@
import styles from "./button.module.css"
import { forwardRef, Ref } from "react"
import clsx from "clsx"
+import { Spinner } from "@components/spinner"
type Props = React.HTMLProps
& {
children?: React.ReactNode
@@ -13,6 +14,7 @@ type Props = React.HTMLProps & {
width?: string | number
padding?: string | number
margin?: string | number
+ loading?: boolean
}
// eslint-disable-next-line react/display-name
@@ -31,6 +33,7 @@ const Button = forwardRef(
width,
padding,
margin,
+ loading,
...props
},
ref
@@ -39,7 +42,7 @@ const Button = forwardRef(