+
{data.thumbnailLink &&
(data.mimeType.startsWith("video") ||
data.mimeType.startsWith("image")) ? (
-

+ <>
+

+
+ {data.mimeType.startsWith("video") && (
+ <>
+
+ >
+ )}
+ >
) : (
)}
diff --git a/src/app/@password.tsx b/src/app/@password.tsx
index 9122bd8..0831685 100644
--- a/src/app/@password.tsx
+++ b/src/app/@password.tsx
@@ -1,7 +1,7 @@
"use client";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import Icon from "~/components/Icon";
import { Button } from "~/components/ui/button";
@@ -18,10 +18,11 @@ export default function Password({ path, errorMessage }: Props) {
const router = useRouter();
const [input, setInput] = useState
("");
- const [loading, setLoading] = useState(false);
+ const [submitLoading, setSubmitLoading] = useState(false);
+ const [loading, setLoading] = useState(true);
const onSubmit = async (e: React.FormEvent) => {
e.preventDefault();
- setLoading(true);
+ setSubmitLoading(true);
toast.loading("Checking password...", {
id: "password",
});
@@ -46,10 +47,31 @@ export default function Password({ path, errorMessage }: Props) {
});
} finally {
setInput("");
- setLoading(false);
+ setSubmitLoading(false);
}
};
+ useEffect(() => {
+ setLoading(false);
+ }, []);
+
+ if (loading)
+ return (
+
+
+
Checking password...
+
+ );
+
return (
- {loading ? (
+ {submitLoading ? (
<>