show profile component on individual video page
This commit is contained in:
parent
31f3c4fef7
commit
38e56e07e0
3 changed files with 11 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { Menu, Transition } from "@headlessui/react";
|
import { Menu, Transition } from "@headlessui/react";
|
||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
import { signOut } from "next-auth/react";
|
import { signOut, useSession } from "next-auth/react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { api } from "~/utils/api";
|
import { api } from "~/utils/api";
|
||||||
|
|
||||||
|
|
@ -8,6 +8,7 @@ export default function ProfileMenu() {
|
||||||
const { mutateAsync: createBillingPortalSession } =
|
const { mutateAsync: createBillingPortalSession } =
|
||||||
api.stripe.createBillingPortalSession.useMutation();
|
api.stripe.createBillingPortalSession.useMutation();
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
|
const { data: session } = useSession();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu as="div" className="relative inline-block text-left">
|
<Menu as="div" className="relative inline-block text-left">
|
||||||
|
|
@ -15,7 +16,7 @@ export default function ProfileMenu() {
|
||||||
<span className="sr-only">Open user menu</span>
|
<span className="sr-only">Open user menu</span>
|
||||||
<img
|
<img
|
||||||
className="h-8 w-8 rounded-full"
|
className="h-8 w-8 rounded-full"
|
||||||
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
src={session?.user?.image ?? "https://i.stack.imgur.com/dr5qp.jpg"}
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
</Menu.Button>
|
</Menu.Button>
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@ import { getTime } from "~/utils/getTime";
|
||||||
import { ShareModal } from "~/components/ShareModal";
|
import { ShareModal } from "~/components/ShareModal";
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import VideoMoreMenu from "~/components/VideoMoreMenu";
|
import VideoMoreMenu from "~/components/VideoMoreMenu";
|
||||||
|
import ProfileMenu from "~/components/ProfileMenu";
|
||||||
|
|
||||||
const VideoList: NextPage = () => {
|
const VideoList: NextPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { data: session } = useSession();
|
const { status, data: session } = useSession();
|
||||||
const { videoId } = router.query as { videoId: string };
|
const { videoId } = router.query as { videoId: string };
|
||||||
|
|
||||||
const { data: video, isLoading } = api.video.get.useQuery(
|
const { data: video, isLoading } = api.video.get.useQuery(
|
||||||
|
|
@ -59,6 +60,11 @@ const VideoList: NextPage = () => {
|
||||||
{video && video.userId === session?.user.id ? (
|
{video && video.userId === session?.user.id ? (
|
||||||
<ShareModal video={video} />
|
<ShareModal video={video} />
|
||||||
) : null}
|
) : null}
|
||||||
|
{status === "authenticated" && (
|
||||||
|
<div className="ml-4 flex items-center justify-center">
|
||||||
|
<ProfileMenu />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex h-full w-full grow flex-col items-center justify-start overflow-auto bg-[#fbfbfb]">
|
<div className="flex h-full w-full grow flex-col items-center justify-start overflow-auto bg-[#fbfbfb]">
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ const VideoList: NextPage = () => {
|
||||||
<div className="flex flex-row items-center justify-center">
|
<div className="flex flex-row items-center justify-center">
|
||||||
<VideoUploadModal />
|
<VideoUploadModal />
|
||||||
{status === "authenticated" && (
|
{status === "authenticated" && (
|
||||||
<div className="ml-3 flex items-center justify-center">
|
<div className="ml-4 flex items-center justify-center">
|
||||||
<ProfileMenu />
|
<ProfileMenu />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue