only show share settings button to video author

This commit is contained in:
MarconLP 2023-04-14 15:24:15 +02:00
parent 665369c43c
commit 81a9d739f9
No known key found for this signature in database
GPG key ID: A08A9C8B623F5EA5

View file

@ -8,9 +8,11 @@ import Link from "next/link";
import Image from "next/image";
import { getTime } from "~/utils/getTime";
import { ShareModal } from "~/components/ShareModal";
import { useSession } from "next-auth/react";
const VideoList: NextPage = () => {
const router = useRouter();
const { data: session } = useSession();
const { videoId } = router.query as { videoId: string };
const { data: video, isLoading } = api.video.get.useQuery(
@ -50,7 +52,9 @@ const VideoList: NextPage = () => {
Personal Library
</span>
</Link>
{video ? <ShareModal video={video} /> : null}
{video && video.userId === session?.user.id ? (
<ShareModal video={video} />
) : null}
</div>
</div>
<div className="flex h-full w-full grow flex-col items-center justify-start overflow-auto bg-[#fbfbfb]">