Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Improved share page + comments fix + better loading state

Richie McIlroy44749affd202
diff --git a/apps/embed/app/view/[videoId]/_components/Toolbar.tsx b/apps/embed/app/view/[videoId]/_components/Toolbar.tsx
index 3967bf98f..7926a4092 100644
--- a/apps/embed/app/view/[videoId]/_components/Toolbar.tsx
+++ b/apps/embed/app/view/[videoId]/_components/Toolbar.tsx
@@ -62,6 +62,8 @@ export const Toolbar = ({
console.log("videoElement", videoElement.currentTime);
const timestamp = videoElement ? videoElement.currentTime : 0;
+ console.log("timestamp", timestamp);
+
const response = await fetch(
`${process.env.NEXT_PUBLIC_URL}/api/video/comment`,
{
diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsx
index 65ef5fd61..408e31e42 100644
--- a/apps/web/app/s/[videoId]/Share.tsx
+++ b/apps/web/app/s/[videoId]/Share.tsx
@@ -7,6 +7,12 @@ import { userSelectProps } from "@cap/database/auth/session";
import { Toolbar } from "./_components/Toolbar";
import { Logo } from "@cap/ui";
+// Add this type definition at the top of the file
+type CommentWithAuthor = typeof commentsSchema.$inferSelect & {
+ authorName: string | null;
+};
+
+// million-ignore
export const Share = ({
data,
user,
@@ -15,35 +21,43 @@ export const Share = ({
}: {
data: typeof videos.$inferSelect;
user: typeof userSelectProps | null;
- comments: (typeof commentsSchema.$inferSelect)[];
+ comments: CommentWithAuthor[];
individualFiles: {
fileName: string;
url: string;
}[];
}) => {
return (
- <div className="wrapper py-8">
- <div className="space-y-6">
- <ShareHeader
- data={data}
- user={user}
- individualFiles={individualFiles}
- />
- <ShareVideo data={data} user={user} comments={comments} />
- <div className="flex justify-center mb-4">
- <Toolbar data={data} user={user} />
+ <>
+ <div className="flex flex-col h-screen max-w-6xl mx-auto px-4">
+ <div className="flex-shrink-0 py-4">
+ <ShareHeader
+ data={data}
+ user={user}
+ individualFiles={individualFiles}
+ />
</div>
- <div className="flex justify-center items-center">
- <a
- target="_blank"
- href={`${process.env.NEXT_PUBLIC_URL}?ref=video_${data.id}`}
- className="flex items-center justify-center space-x-2 py-2 px-4 bg-gray-100 border border-gray-200 rounded-full mx-0"
- >
- <span className="text-sm">Recorded with</span>
- <Logo className="w-14 h-auto" />
- </a>
+ <div className="md:flex-grow md:flex md:flex-col min-h-0">
+ <div className="flex-grow relative">
+ <div className="md:absolute inset-0">
+ <ShareVideo data={data} user={user} comments={comments} />
+ </div>
+ </div>
+ <div className="flex-shrink-0 py-4">
+ <Toolbar data={data} user={user} />
+ </div>
</div>
</div>
- </div>
+ <div className="flex-shrink-0 py-4">
+ <a
+ target="_blank"
+ href={`${process.env.NEXT_PUBLIC_URL}?ref=video_${data.id}`}
+ className="flex items-center justify-center space-x-2 py-2 px-4 bg-gray-100 border border-gray-200 rounded-full mx-auto w-fit"
+ >
+ <span className="text-sm">Recorded with</span>
+ <Logo className="w-14 h-auto" />
+ </a>
+ </div>
+ </>
);
};
diff --git a/apps/web/app/s/[videoId]/_components/MP4VideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/MP4VideoPlayer.tsx
index f078d6440..266bbf6ee 100644
--- a/apps/web/app/s/[videoId]/_components/MP4VideoPlayer.tsx
+++ b/apps/web/app/s/[videoId]/_components/MP4VideoPlayer.tsx
@@ -10,6 +10,7 @@ interface MP4VideoPlayerProps {
videoSrc: string;
}
+// million-ignore
export const MP4VideoPlayer = memo(
forwardRef<HTMLVideoElement, MP4VideoPlayerProps>(({ videoSrc }, ref) => {
const videoRef = useRef<HTMLVideoElement>(null);
@@ -45,7 +46,7 @@ export const MP4VideoPlayer = memo(
<video
id="video-player"
ref={videoRef}
- className="absolute top-0 left-0 rounded-lg w-full h-full object-contain"
+ className="w-full h-full object-contain"
preload="metadata"
playsInline
controls={false}
diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
index 09fe3fb3f..ac130c638 100644
--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
@@ -14,6 +14,7 @@ import { LogoSpinner } from "@cap/ui";
import { userSelectProps } from "@cap/database/auth/session";
import { fromVtt, Subtitle } from "subtitles-parser-vtt";
import toast from "react-hot-toast";
+import { Tooltip } from "react-tooltip"; // Make sure to import this if not already present
declare global {
interface Window {
@@ -29,6 +30,13 @@ const formatTime = (time: number) => {
.padStart(2, "0")}`;
};
+// million-ignore
+// Add this type definition at the top of the file
+type CommentWithAuthor = typeof commentsSchema.$inferSelect & {
+ authorName: string | null;
+};
+
+// Update the component props type
export const ShareVideo = ({
data,
user,
@@ -36,7 +44,7 @@ export const ShareVideo = ({
}: {
data: typeof videos.$inferSelect;
user: typeof userSelectProps | null;
- comments: (typeof commentsSchema.$inferSelect)[];
+ comments: CommentWithAuthor[];
}) => {
const videoRef = useRef<HTMLVideoElement>(null);
const [isPlaying, setIsPlaying] = useState(false);
@@ -53,38 +61,84 @@ export const ShareVideo = ({
const [videoSpeed, setVideoSpeed] = useState(1);
const overlayTimeoutRef = useRef<NodeJS.Timeout | null>(null);
+ const [isHovering, setIsHovering] = useState(false);
+ const hideControlsTimeoutRef = useRef<NodeJS.Timeout | null>(null);
+ const [forceHideControls, setForceHideControls] = useState(false);
+ const [isHoveringControls, setIsHoveringControls] = useState(false);
+ const enterControlsTimeoutRef = useRef<NodeJS.Timeout | null>(null);
+
+ const showControls = () => {
+ setOverlayVisible(true);
+ setIsHovering(true);
+ setForceHideControls(false);
+ if (hideControlsTimeoutRef.current) {
+ clearTimeout(hideControlsTimeoutRef.current);
+ }
+ };
+
+ const hideControls = () => {
+ if (!isHoveringControls) {
+ hideControlsTimeoutRef.current = setTimeout(() => {
+ setOverlayVisible(false);
+ setIsHovering(false);
+ setForceHideControls(true);
+ }, 250);
+ }
+ };
useEffect(() => {
const handleMouseMove = () => {
- setOverlayVisible(true);
- if (overlayTimeoutRef.current) {
- clearTimeout(overlayTimeoutRef.current);
+ if (forceHideControls) {
+ setForceHideControls(false);
+ }
+ showControls();
+ if (!isHoveringControls) {
+ hideControls();
}
- overlayTimeoutRef.current = setTimeout(() => {
- setOverlayVisible(false);
- }, 1000);
};
- window.addEventListener("mousemove", handleMouseMove);
+ const handleMouseLeave = () => {
+ setIsHovering(false);
+ setIsHoveringControls(false);
+ hideControls();
+ };
+
+ const videoContainer = document.getElementById("video-container");
+ if (videoContainer) {
+ videoContainer.addEventListener("mousemove", handleMouseMove);
+ videoContainer.addEventListener("mouseleave", handleMouseLeave);
+ }
return () => {
- window.removeEventListener("mousemove", handleMouseMove);
- if (overlayTimeoutRef.current) {
- clearTimeout(overlayTimeoutRef.current);
+ if (videoContainer) {
+ videoContainer.removeEventListener("mousemove", handleMouseMove);
+ videoContainer.removeEventListener("mouseleave", handleMouseLeave);
+ }
+ if (hideControlsTimeoutRef.current) {
+ clearTimeout(hideControlsTimeoutRef.current);
+ }
+ if (enterControlsTimeoutRef.current) {
+ clearTimeout(enterControlsTimeoutRef.current);
}
};
- }, []);
+ }, [forceHideControls, isHoveringControls]);
+
+ useEffect(() => {
+ if (isPlaying) {
+ hideControls();
+ } else {
+ showControls();
+ }
+ }, [isPlaying]);
useEffect(() => {
if (videoMetadataLoaded) {
- console.log("Metadata loaded");
setIsLoading(false);
}
}, [videoMetadataLoaded]);
useEffect(() => {
const onVideoLoadedMetadata = () => {
- console.log("Video metadata loaded");
setVideoMetadataLoaded(true);
if (videoRef.current) {
setLongestDuration(videoRef.current.duration);
@@ -197,13 +251,12 @@ export const ShareVideo = ({
const handleMuteClick = () => {
if (videoRef.current) {
- console.log("Mute clicked");
videoRef.current.muted = videoRef.current.muted ? false : true;
}
};
const handleFullscreenClick = () => {
- const player = document.getElementById("player");
+ const player = document.getElementById("video-player");
const video = videoRef.current;
if (!video) return;
@@ -212,18 +265,9 @@ export const ShareVideo = ({
/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
const isAndroid = /Android/.test(navigator.userAgent);
- if (!document.fullscreenElement && !isIOS && !isAndroid) {
- player
- ?.requestFullscreen()
- .catch((err) =>
- console.error(
- `Error attempting to enable full-screen mode: ${err.message} (${err.name})`
- )
- );
- } else if (isIOS || isAndroid) {
- if ("webkitEnterFullscreen" in video) {
- (video as any).webkitEnterFullscreen();
- } else if (video.requestFullscreen) {
+ if (isIOS || isAndroid) {
+ // For mobile devices, use the video element's fullscreen API
+ if (video.requestFullscreen) {
video
.requestFullscreen()
.catch((err) =>
@@ -231,12 +275,40 @@ export const ShareVideo = ({
`Error attempting to enable full-screen mode on mobile: ${err.message} (${err.name})`
)
);
+ } else if ("webkitEnterFullscreen" in video) {
+ (video as any).webkitEnterFullscreen();
+ } else if ("mozRequestFullScreen" in video) {
+ (video as any).mozRequestFullScreen();
+ } else if ("msRequestFullscreen" in video) {
+ (video as any).msRequestFullscreen();
}
} else {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if ("webkitExitFullscreen" in document) {
- (document as any).webkitExitFullscreen();
+ if (!document.fullscreenElement) {
+ if (player && player.requestFullscreen) {
+ player
+ .requestFullscreen()
+ .catch((err) =>
+ console.error(
+ `Error attempting to enable full-screen mode: ${err.message} (${err.name})`
+ )
+ );
+ } else if (player && "webkitRequestFullscreen" in player) {
+ (player as any).webkitRequestFullscreen();
+ } else if (player && "mozRequestFullScreen" in player) {
+ (player as any).mozRequestFullScreen();
+ } else if (player && "msRequestFullscreen" in player) {
+ (player as any).msRequestFullscreen();
+ }
+ } else {
+ if (document.exitFullscreen) {
+ document.exitFullscreen();
+ } else if ("webkitExitFullscreen" in document) {
+ (document as any).webkitExitFullscreen();
+ } else if ("mozCancelFullScreen" in document) {
+ (document as any).mozCancelFullScreen();
+ } else if ("msExitFullscreen" in document) {
+ (document as any).msExitFullscreen();
+ }
}
}
};
@@ -285,7 +357,7 @@ export const ShareVideo = ({
.toString()
.split(":")
.map(Number);
- return hours * 3600 + minutes * 60 + seconds;
+ return (hours ?? 0) * 3600 + (minutes ?? 0) * 60 + (seconds ?? 0);
};
useEffect(() => {
@@ -361,42 +433,50 @@ export const ShareVideo = ({
return (
<div
- className="relative flex h-full w-full overflow-hidden shadow-lg rounded-lg group"
- id="player"
+ id="video-container"
+ className="relative w-full h-full overflow-hidden shadow-lg rounded-lg group"
>
{isLoading && (
- <div className="absolute top-0 left-0 flex flex-col items-center justify-center w-full h-full z-10">
+ <div className="absolute inset-0 flex items-center justify-center z-10">
<LogoSpinner className="w-10 h-auto animate-spin" />
</div>
)}
- {isLoading === false && (
- <div
- className={`absolute top-0 left-0 w-full h-full z-10 flex items-center justify-center bg-black bg-opacity-50 transition-all opacity-0 ${
- overlayVisible && "group-hover:opacity-100"
- } z-20`}
- >
- <button
- aria-label="Play video"
- className=" w-full h-full flex items-center justify-center text-sm font-medium transition ease-in-out duration-150 text-white border border-transparent px-2 py-2 justify-center rounded-lg"
- tabIndex={0}
- type="button"
- onClick={() => handlePlayPauseClick()}
- >
- {isPlaying ? (
- <Pause className="w-auto h-14 hover:opacity-50" />
- ) : (
- <Play className="w-auto h-14 hover:opacity-50" />
- )}
- </button>
+ <div className="relative w-full md:h-full">
+ <div className="md:absolute inset-0 bg-black">
+ {data.source.type === "desktopMP4" ? (
+ <MP4VideoPlayer ref={videoRef} videoSrc={videoSrc} />
+ ) : (
+ <VideoPlayer ref={videoRef} videoSrc={videoSrc} />
+ )}
</div>
- )}
- <div
- className="relative block w-full h-full rounded-lg bg-black"
- style={{ paddingBottom: "min(806px, 56.25%)" }}
- >
+ {!isLoading && (
+ <div
+ className={`absolute inset-0 z-20 flex items-center justify-center bg-black bg-opacity-50 transition-opacity duration-300 ${
+ (overlayVisible || isHovering) && !forceHideControls
+ ? "opacity-100"
+ : "opacity-0"
+ }`}
+ >
+ <button
+ aria-label={isPlaying ? "Pause video" : "Play video"}
+ className="w-full h-full flex items-center justify-center"
+ onClick={() => {
+ handlePlayPauseClick();
+ showControls();
+ hideControls();
+ }}
+ >
+ {isPlaying ? (
+ <Pause className="w-auto h-14 text-white hover:opacity-50" />
+ ) : (
+ <Play className="w-auto h-14 text-white hover:opacity-50" />
+ )}
+ </button>
+ </div>
+ )}
{currentSubtitle && currentSubtitle.text && subtitlesVisible && (
- <div className="absolute bottom-0 w-full text-center transform transition p-1.5 lg:p-2.5 xl:p-3.5 -translate-y-16 z-10">
- <div className="inline px-2 py-1 text-sm text-white bg-black bg-opacity-75 rounded-xl leading-7 md:text-lg md:leading-9 lg:text-2xl lg:leading-11 2xl:text-3xl 2xl:leading-13 xs:text-base box-decoration-break-clone xs:leading-8 xl:text-2.5xl">
+ <div className="absolute bottom-16 w-full text-center p-2 z-10">
+ <div className="inline px-2 py-1 text-lg md:text-2xl text-white bg-black bg-opacity-75 rounded-xl">
{currentSubtitle.text
.replace("- ", "")
.replace(".", "")
@@ -404,16 +484,32 @@ export const ShareVideo = ({
</div>
</div>
)}
- {data.source.type === "desktopMP4" ? (
- <MP4VideoPlayer ref={videoRef} videoSrc={videoSrc} />
- ) : (
- <VideoPlayer ref={videoRef} videoSrc={videoSrc} />
- )}
</div>
- <div className="absolute bottom-0 z-20 w-full text-white bg-black bg-opacity-50 opacity-0 group-hover:opacity-100 transition-all">
+ <div
+ className={`absolute bottom-0 left-0 right-0 bg-black bg-opacity-50 z-20 transition-opacity duration-300 ${
+ (overlayVisible || isHovering || isHoveringControls) &&
+ !forceHideControls
+ ? "opacity-100"
+ : "opacity-0"
+ }`}
+ onMouseEnter={() => {
+ if (enterControlsTimeoutRef.current) {
+ clearTimeout(enterControlsTimeoutRef.current);
+ }
+ enterControlsTimeoutRef.current = setTimeout(() => {
+ setIsHoveringControls(true);
+ }, 100);
+ }}
+ onMouseLeave={() => {
+ if (enterControlsTimeoutRef.current) {
+ clearTimeout(enterControlsTimeoutRef.current);
+ }
+ setIsHoveringControls(false);
+ }}
+ >
<div
id="seek"
- className="drag-seek absolute left-0 right-0 block h-4 mx-4 -mt-2 group z-20 cursor-pointer"
+ className="absolute left-0 right-0 -top-2 h-4 mx-4 cursor-pointer"
onMouseDown={handleSeekMouseDown}
onMouseMove={handleSeekMouseMove}
onMouseUp={handleSeekMouseUp}
@@ -423,23 +519,33 @@ export const ShareVideo = ({
{!isLoading && comments !== null && (
<div className="w-full -mt-7 md:-mt-6">
{comments.map((comment) => {
- if (comment.timestamp === null) return null;
+ const commentPosition =
+ comment.timestamp === null
+ ? 0
+ : (comment.timestamp / longestDuration) * 100;
+
+ let tooltipContent = "";
+ if (comment.type === "text") {
+ tooltipContent =
+ comment.authorId === "anonymous"
+ ? `Anonymous: ${comment.content}`
+ : `${comment.authorName || "User"}: ${comment.content}`;
+ } else {
+ tooltipContent =
+ comment.authorId === "anonymous"
+ ? "Anonymous"
+ : comment.authorName || "User";
+ }
return (
<div
key={comment.id}
- className="absolute z-10 text-[16px] hover:scale-125 transition-all"
+ className="absolute z-10 text-sm hover:scale-125 transition-all"
style={{
- left: `${(comment.timestamp / longestDuration) * 100}%`,
+ left: `${commentPosition}%`,
}}
data-tooltip-id={comment.id}
- data-tooltip-content={`${
- comment.type === "text"
- ? "User: " + comment.content
- : comment.authorId === "anonymous"
- ? "Anonymous"
- : "User"
- }`}
+ data-tooltip-content={tooltipContent}
>
<span>
{comment.type === "text" ? (
@@ -451,6 +557,7 @@ export const ShareVideo = ({
comment.content
)}
</span>
+ <Tooltip id={comment.id} />
</div>
);
})}
diff --git a/apps/web/app/s/[videoId]/_components/Toolbar.tsx b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
index 1b800d7dc..3dfcf5380 100644
--- a/apps/web/app/s/[videoId]/_components/Toolbar.tsx
+++ b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
@@ -18,27 +18,34 @@ export const Toolbar = ({
const { refresh, push } = useRouter();
const [commentBoxOpen, setCommentBoxOpen] = useState(false);
const [comment, setComment] = useState("");
- const videoElement = useRef<HTMLVideoElement | null>(null);
- const [videoPlayerExists, setVideoPlayerExists] = useState(false);
+ const [videoElement, setVideoElement] = useState<HTMLVideoElement | null>(
+ null
+ );
useEffect(() => {
- const element = document.getElementById(
- "video-player"
- ) as HTMLVideoElement | null;
- if (element) {
- videoElement.current = element;
- setVideoPlayerExists(true);
- } else {
- console.warn("Video player element not found");
- setVideoPlayerExists(false);
- }
+ const checkForVideoElement = () => {
+ const element = document.getElementById(
+ "video-player"
+ ) as HTMLVideoElement | null;
+ if (element) {
+ setVideoElement(element);
+ } else {
+ setTimeout(checkForVideoElement, 100); // Check again after 100ms
+ }
+ };
+
+ checkForVideoElement();
+
+ return () => {
+ // Clean up any ongoing checks if component unmounts
+ };
}, []);
const [currentEmoji, setCurrentEmoji] = useState<{
emoji: string;
id: number;
} | null>(null);
- const clearEmojiTimeout = useRef<any>(null);
+ const clearEmojiTimeout = useRef<NodeJS.Timeout | null>(null);
useEffect(() => {
return () => {
@@ -49,8 +56,8 @@ export const Toolbar = ({
}, []);
const getTimestamp = (): number => {
- if (videoElement.current) {
- return videoElement.current.currentTime;
+ if (videoElement) {
+ return videoElement.currentTime;
}
console.warn("Video element not available, using default timestamp");
return 0;
@@ -156,18 +163,18 @@ export const Toolbar = ({
);
return (
- <>
+ <div
+ className={`${
+ !commentBoxOpen ? "max-w-[350px]" : "max-w-[500px]"
+ } mx-auto`}
+ >
<div
className={`bg-white border border-gray-200 rounded-full mx-auto shadow-lg transition-all ${
commentBoxOpen === true && "w-full"
}`}
>
- <div
- className={`${
- commentBoxOpen === true ? "flex w-full" : "grid"
- } items-center justify-start`}
- >
- <div className="w-full p-2">
+ <div className="flex">
+ <div className="flex-grow p-2">
{commentBoxOpen === true ? (
<div className="w-full flex items-center justify-between">
<input
@@ -193,19 +200,19 @@ export const Toolbar = ({
<Button
className="min-w-[160px]"
disabled={comment.length === 0}
- variant="default"
+ variant="primary"
size="sm"
onClick={() => {
handleCommentSubmit();
}}
>
- {videoPlayerExists
+ {videoElement
? `Comment at ${getTimestamp().toFixed(2)}`
: "Comment"}
</Button>
<Button
className="min-w-[100px]"
- variant="outline"
+ variant="white"
size="sm"
onClick={() => {
setCommentBoxOpen(false);
@@ -217,7 +224,7 @@ export const Toolbar = ({
</div>
</div>
) : (
- <div className="grid items-center justify-start grid-flow-col">
+ <div className="grid items-center justify-center grid-flow-col">
{REACTIONS.map((reaction) => (
<Emoji
key={reaction.emoji}
@@ -233,8 +240,8 @@ export const Toolbar = ({
push(`/login?next=${window.location.pathname}`);
return;
}
- if (videoElement.current) {
- videoElement.current.pause();
+ if (videoElement) {
+ videoElement.pause();
}
setCommentBoxOpen(true);
}}
@@ -249,7 +256,7 @@ export const Toolbar = ({
</div>
</div>
</div>
- </>
+ </div>
);
};
diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsx
index 0f3e9c07f..a6bc29496 100644
--- a/apps/web/app/s/[videoId]/page.tsx
+++ b/apps/web/app/s/[videoId]/page.tsx
@@ -2,15 +2,21 @@
import { Share } from "./Share";
import { db } from "@cap/database";
import { eq } from "drizzle-orm";
-import { videos, comments } from "@cap/database/schema";
+import { videos, comments, users } from "@cap/database/schema";
import { getCurrentUser, userSelectProps } from "@cap/database/auth/session";
import type { Metadata, ResolvingMetadata } from "next";
import { notFound } from "next/navigation";
import { ImageViewer } from "./_components/ImageViewer";
+
type Props = {
params: { [key: string]: string | string[] | undefined };
};
+// Add this type definition at the top of the file
+type CommentWithAuthor = typeof comments.$inferSelect & {
+ authorName: string | null;
+};
+
export async function generateMetadata(
{ params }: Props,
parent: ResolvingMetadata
@@ -100,9 +106,21 @@ export default async function ShareVideoPage(props: Props) {
return <p>This video is private</p>;
}
- const commentsQuery = await db
- .select()
+ const commentsQuery: CommentWithAuthor[] = await db
+ .select({
+ id: comments.id,
+ content: comments.content,
+ timestamp: comments.timestamp,
+ type: comments.type,
+ authorId: comments.authorId,
+ videoId: comments.videoId,
+ createdAt: comments.createdAt,
+ updatedAt: comments.updatedAt,
+ parentCommentId: comments.parentCommentId,
+ authorName: users.name,
+ })
.from(comments)
+ .leftJoin(users, eq(comments.authorId, users.id))
.where(eq(comments.videoId, videoId));
let screenshotUrl;
diff --git a/apps/web/app/s/loading.tsx b/apps/web/app/s/loading.tsx
index fe4f963c5..cc4b95565 100644
--- a/apps/web/app/s/loading.tsx
+++ b/apps/web/app/s/loading.tsx
@@ -2,57 +2,53 @@
export default function Loading() {
return (
- <div className="wrapper py-8">
- <div className="space-y-6">
- {/* Header placeholder */}
- <div className="md:flex md:items-center md:justify-between space-x-0 md:space-x-6 mb-6">
- <div className="md:flex items-center md:justify-between md:space-x-6">
- <div className="mb-3 md:mb-0">
- <div className="flex items-center space-x-3">
- <div className="w-48 h-8 bg-gray-200 rounded animate-pulse"></div>
- <div className="w-8 h-8 bg-gray-200 rounded-lg animate-pulse"></div>
- </div>
- <div className="w-24 h-4 bg-gray-200 rounded mt-2 animate-pulse"></div>
+ <div className="flex flex-col h-screen max-w-6xl mx-auto px-4">
+ <div className="flex-shrink-0 py-4">
+ {/* ShareHeader placeholder */}
+ <div className="flex items-center justify-between">
+ <div>
+ <div className="flex items-center space-x-3">
+ <div className="w-48 h-6 bg-gray-200 rounded animate-pulse"></div>
+ <div className="w-8 h-6 bg-gray-200 rounded-lg animate-pulse"></div>
</div>
- </div>
- <div className="flex items-center space-x-2">
- <div className="w-32 h-10 bg-gray-200 rounded animate-pulse"></div>
- <div className="w-32 h-10 bg-gray-200 rounded animate-pulse"></div>
+ <div className="mt-2 w-20 h-4 bg-gray-200 rounded-lg animate-pulse"></div>
</div>
</div>
-
- {/* Video placeholder */}
- <div className="relative flex h-full w-full overflow-hidden shadow-lg rounded-lg">
- <div
- className="relative block w-full h-full rounded-lg bg-gray-200 animate-pulse"
- style={{ paddingBottom: "min(806px, 56.25%)" }}
- >
- <div className="absolute inset-0 bg-gray-300 animate-pulse"></div>
- </div>
- {/* Controls bar placeholder */}
- <div className="absolute bottom-0 w-full h-16 bg-gray-300 animate-pulse">
- {/* Seek bar placeholder */}
- <div className="absolute top-0 left-0 right-0 h-2 bg-gray-400"></div>
- {/* Controls placeholder */}
- <div className="flex justify-between items-center h-full px-4">
- <div className="w-24 h-8 bg-gray-400 rounded"></div>
- <div className="flex space-x-2">
- <div className="w-8 h-8 bg-gray-400 rounded"></div>
- <div className="w-8 h-8 bg-gray-400 rounded"></div>
- <div className="w-8 h-8 bg-gray-400 rounded"></div>
+ </div>
+ <div className="md:flex-grow md:flex md:flex-col min-h-0">
+ <div className="flex-grow relative">
+ <div className="md:absolute inset-0">
+ {/* ShareVideo placeholder */}
+ <div className="relative w-full h-full overflow-hidden shadow-lg rounded-lg">
+ <div
+ className="relative block w-full h-full rounded-lg bg-gray-200 animate-pulse"
+ style={{ paddingBottom: "56.25%" }}
+ >
+ <div className="absolute inset-0 bg-gray-300 animate-pulse"></div>
+ </div>
+ {/* Video controls placeholder */}
+ <div className="absolute bottom-0 w-full bg-gray-800 bg-opacity-50">
+ <div className="flex items-center justify-between px-4 py-2">
+ <div className="flex items-center space-x-3">
+ <div className="w-8 h-8 bg-gray-400 rounded-full animate-pulse"></div>
+ <div className="w-24 h-4 bg-gray-400 rounded animate-pulse"></div>
+ </div>
+ <div className="flex space-x-2">
+ <div className="w-8 h-8 bg-gray-400 rounded-full animate-pulse"></div>
+ <div className="w-8 h-8 bg-gray-400 rounded-full animate-pulse"></div>
+ <div className="w-8 h-8 bg-gray-400 rounded-full animate-pulse"></div>
+ <div className="w-8 h-8 bg-gray-400 rounded-full animate-pulse"></div>
+ </div>
+ </div>
</div>
</div>
</div>
</div>
-
- {/* Toolbar placeholder */}
- <div className="flex justify-center mb-4">
- <div className="w-64 h-10 bg-gray-200 rounded animate-pulse"></div>
- </div>
-
- {/* Logo placeholder */}
- <div className="flex justify-center items-center">
- <div className="w-48 h-12 bg-gray-200 rounded-full animate-pulse"></div>
+ <div className="flex-shrink-0 py-4">
+ {/* Toolbar placeholder */}
+ <div className="flex justify-center">
+ <div className="w-64 h-10 bg-gray-200 rounded animate-pulse"></div>
+ </div>
</div>
</div>
</div>
diff --git a/apps/web/components/Footer.tsx b/apps/web/components/Footer.tsx
index 2af4faa9d..977861c8a 100644
--- a/apps/web/components/Footer.tsx
+++ b/apps/web/components/Footer.tsx
@@ -8,6 +8,7 @@ export const Footer = () => {
if (
pathname === "/login" ||
+ pathname === "/s" ||
pathname.includes("/dashboard") ||
pathname.includes("/invite") ||
pathname.includes("/s/") ||
diff --git a/apps/web/components/Navbar.tsx b/apps/web/components/Navbar.tsx
index a9b054f6c..b4d3f6f25 100644
--- a/apps/web/components/Navbar.tsx
+++ b/apps/web/components/Navbar.tsx
@@ -24,6 +24,7 @@ export const Navbar = ({ auth }: { auth: boolean }) => {
if (
pathname === "/login" ||
+ pathname === "/s" ||
pathname.includes("/dashboard") ||
pathname.includes("/invite") ||
pathname.includes("/s/") ||