import { type NextPage } from "next"; import Head from "next/head"; import { api } from "~/utils/api"; import Link from "next/link"; import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; import Image from "next/image"; import VideoUploadModal from "~/components/VideoUploadModal"; import { getTime } from "~/utils/getTime"; const VideoList: NextPage = () => { const router = useRouter(); const { status } = useSession(); const { data: videos, isLoading } = api.video.getAll.useQuery(); if (status === "unauthenticated") { void router.push("/sign-in"); } return ( <> Create T3 App
Screenity
{videos && videos.map(({ title, id, createdAt }) => ( ))} {isLoading ? ( <> ) : null} {videos && videos?.length <= 0 ? (
You do not have any recordings.
) : null}
); }; interface VideoCardProps { title: string; id: string; createdAt: Date; } const VideoCardSkeleton = () => { return (
); }; const VideoCard = ({ title, id, createdAt }: VideoCardProps) => { return (
video thumbnail
{title} {getTime(createdAt)}
); }; export default VideoList;