Skip to content

Commit 8b63fd4

Browse files
committed
more
1 parent e39fce3 commit 8b63fd4

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

app/components/video-card.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
Trash2Icon,
2323
UnlockIcon,
2424
} from "lucide-react";
25-
import { type ComponentProps, useEffect, useState } from "react";
25+
import { type ComponentProps, memo, useEffect, useState } from "react";
2626
import {
2727
Tooltip,
2828
TooltipContent,
@@ -51,9 +51,25 @@ type VideoCardProps = {
5151
onDeleteClick: () => void;
5252
};
5353

54-
export function VideoCard(props: VideoCardProps) {
54+
export const VideoCard = memo(VideoCardComponent, (prev, next) => {
5555
return (
56-
<div className="relative group/video aspect-video max-w-2xl rounded-lg overflow-hidden">
56+
prev.videoId === next.videoId &&
57+
prev.title === next.title &&
58+
prev.views === next.views &&
59+
prev.createdAt === next.createdAt &&
60+
prev.videoLengthSeconds === next.videoLengthSeconds &&
61+
prev.fileSizeBytes === next.fileSizeBytes &&
62+
prev.isPrivate === next.isPrivate &&
63+
prev.thumbnailUrl === next.thumbnailUrl &&
64+
prev.triggerAccessToken === next.triggerAccessToken &&
65+
prev.status === next.status &&
66+
prev.pendingDeletionDate === next.pendingDeletionDate
67+
);
68+
});
69+
70+
function VideoCardComponent(props: VideoCardProps) {
71+
return (
72+
<div className="relative group/video aspect-video max-w-2xl rounded-lg overflow-hidden border">
5773
<VideoThumbnail
5874
smallThumbnailUrl={props.thumbnailUrl}
5975
title={props.title}

app/routes/p.$videoId.tsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ import { Button } from "@/components/ui/button";
22
import { Card, CardContent } from "@/components/ui/card";
33
import { useUser } from "@clerk/tanstack-start";
44
import { getAuth } from "@clerk/tanstack-start/server";
5-
import { Separator } from "@radix-ui/react-dropdown-menu";
6-
import {
7-
Link,
8-
createFileRoute,
9-
notFound,
10-
redirect,
11-
} from "@tanstack/react-router";
5+
import { Link, createFileRoute, notFound } from "@tanstack/react-router";
126
import { createServerFn } from "@tanstack/start";
137
import { getWebRequest } from "@tanstack/start/server";
148
import { MediaPlayer, MediaProvider, Poster } from "@vidstack/react";
@@ -31,6 +25,7 @@ import { ViewIncrementer } from "../components/view-incrementer";
3125
import { WordyDate } from "../components/wordy-date";
3226
import { getVideoDataServerFn } from "../server-fns/video-player";
3327
import { seo } from "@/lib/seo";
28+
import { Footer } from "@/components/footer";
3429

3530
const fetchVideoData = createServerFn({ method: "POST" })
3631
.validator(z.object({ videoId: z.string() }))
@@ -95,7 +90,7 @@ function RouteComponent() {
9590
videoDuration={videoData.videoLengthSeconds}
9691
/>
9792
)}
98-
<header className="max-h-16 h-16 flex justify-between items-center px-4">
93+
<header className="max-h-16 h-16 flex justify-between items-center px-4 p-2">
9994
<Link className="flex items-center" to="/" preload="render">
10095
<button
10196
className="flex-shrink-0 flex items-center z-10"
@@ -121,7 +116,7 @@ function RouteComponent() {
121116
</header>
122117
<div className="flex gap-4 p-4 max-w-full overflow-x-hidden h-full flex-col xl:flex-row">
123118
<MediaPlayer
124-
className="w-full aspect-video rounded-lg overflow-hidden"
119+
className="w-full rounded-lg overflow-hidden"
125120
// biome-ignore lint/suspicious/noExplicitAny: types are fine
126121
src={videoSources as any}
127122
viewType="video"
@@ -131,19 +126,17 @@ function RouteComponent() {
131126
poster={video.largeThumbnailUrl ?? undefined}
132127
duration={videoData.videoLengthSeconds ?? undefined}
133128
storage="player"
129+
controlsDelay={500}
130+
posterLoad="eager"
134131
>
135-
<MediaProvider>
136-
{video.largeThumbnailUrl !== null && (
137-
<Poster className="vds-poster" src={video.largeThumbnailUrl} />
138-
)}
139-
</MediaProvider>
132+
<MediaProvider />
140133
<DefaultVideoLayout
141134
icons={defaultLayoutIcons}
142135
thumbnails={video.storyboard}
143136
/>
144137
</MediaPlayer>
145138
<div className="flex flex-col gap-4 min-w-96 w-96 grow">
146-
<Card className="border-none shadow-none">
139+
<Card className="border-none shadow-none bg-transparent">
147140
<CardContent className="p-0 space-y-4">
148141
<h1 className="text-2xl font-bold">{videoData.title}</h1>
149142
<div className="flex flex-col md:flex-row items-start md:items-center justify-between text-sm text-muted-foreground">
@@ -164,11 +157,11 @@ function RouteComponent() {
164157
<AuthorInfo authorId={videoData.authorId} />
165158
</CardContent>
166159
</Card>
167-
<Separator />
168-
<Card className="grow min-h-64 border-none shadow-none" />
160+
<Card className="grow min-h-64 border-none shadow-none bg-transparent" />
169161
</div>
170162
</div>
171163
</>
164+
<Footer />
172165
</div>
173166
);
174167
}

app/routes/pricing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function RouteComponent() {
105105
"rounded-3xl transition-all duration-300",
106106
"flex flex-col",
107107
tier.highlight
108-
? "bg-gradient-to-b from-zinc-100/80 to-transparent dark:from-zinc-400/[0.15]"
108+
? "bg-gradient-to-b from-zinc-100/80 to-transparent dark:from-zinc-500/[0.15]"
109109
: "bg-white dark:bg-zinc-800/50",
110110
"border",
111111
tier.highlight

0 commit comments

Comments
 (0)