Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Basic comments/transcript implementation on share page

Richie McIlroy27b77b56ecdd
diff --git a/apps/web/app/api/video/comment/delete/route.ts b/apps/web/app/api/video/comment/delete/route.ts
new file mode 100644
index 000000000..a72f45ebe
--- /dev/null
+++ b/apps/web/app/api/video/comment/delete/route.ts
@@ -0,0 +1,71 @@
+import { type NextRequest } from "next/server";
+import { getCurrentUser } from "@cap/database/auth/session";
+import { comments } from "@cap/database/schema";
+import { db } from "@cap/database";
+import { and, eq, or } from "drizzle-orm";
+import { getHeaders } from "@/utils/helpers";
+
+export async function DELETE(request: NextRequest) {
+ const user = await getCurrentUser();
+ const { searchParams } = request.nextUrl;
+ const commentId = searchParams.get("commentId");
+ const origin = request.headers.get("origin") as string;
+
+ if (!commentId || !user?.id) {
+ return new Response(
+ JSON.stringify({ error: "Missing required data" }),
+ {
+ status: 400,
+ headers: getHeaders(origin),
+ }
+ );
+ }
+
+ try {
+ // First, verify that the comment belongs to the user
+ const query = await db
+ .select()
+ .from(comments)
+ .where(
+ and(
+ eq(comments.id, commentId),
+ eq(comments.authorId, user.id)
+ )
+ );
+
+ if (query.length === 0) {
+ return new Response(
+ JSON.stringify({ error: "Comment not found or unauthorized" }),
+ {
+ status: 404,
+ headers: getHeaders(origin),
+ }
+ );
+ }
+
+ // Delete the comment and all its replies
+ await db.delete(comments).where(
+ or(
+ eq(comments.id, commentId),
+ eq(comments.parentCommentId, commentId)
+ )
+ );
+
+ return new Response(
+ JSON.stringify({ success: true }),
+ {
+ status: 200,
+ headers: getHeaders(origin),
+ }
+ );
+ } catch (error) {
+ console.error("Error deleting comment:", error);
+ return new Response(
+ JSON.stringify({ error: "Failed to delete comment" }),
+ {
+ status: 500,
+ headers: getHeaders(origin),
+ }
+ );
+ }
+}
\ No newline at end of file
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index 5fb3ace1b..33112bcff 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -404,4 +404,26 @@ footer a {
.prose p, .prose li {
@apply text-gray-500/80 !important;
-}
\ No newline at end of file
+}
+
+.new-card-style {
+ background: #FFFFFF;
+ border: 1px solid #E7EAF0;
+ box-shadow: 0px 8px 16px rgba(18, 22, 31, 0.04);
+ border-radius: 20px;
+}
+
+@keyframes slideUp {
+ from {
+ opacity: 0;
+ transform: translateY(20px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+.animate-slideUp {
+ animation: slideUp 0.3s ease-out forwards;
+}
diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsx
index 408e31e42..cfc11e867 100644
--- a/apps/web/app/s/[videoId]/Share.tsx
+++ b/apps/web/app/s/[videoId]/Share.tsx
@@ -6,13 +6,19 @@ import { comments as commentsSchema, videos } from "@cap/database/schema";
import { userSelectProps } from "@cap/database/auth/session";
import { Toolbar } from "./_components/Toolbar";
import { Logo } from "@cap/ui";
+import { Sidebar } from "./_components/Sidebar";
+import { useEffect, useState, useRef } from "react";
-// Add this type definition at the top of the file
type CommentWithAuthor = typeof commentsSchema.$inferSelect & {
authorName: string | null;
};
-// million-ignore
+interface Analytics {
+ views: number;
+ comments: number;
+ reactions: number;
+}
+
export const Share = ({
data,
user,
@@ -27,28 +33,86 @@ export const Share = ({
url: string;
}[];
}) => {
+ const [analytics, setAnalytics] = useState<Analytics>({
+ views: 0,
+ comments: 0,
+ reactions: 0,
+ });
+
+ const videoRef = useRef<HTMLVideoElement>(null);
+
+ const handleSeek = (time: number) => {
+ if (videoRef.current) {
+ videoRef.current.currentTime = time;
+ }
+ };
+
+ useEffect(() => {
+ const fetchAnalytics = async () => {
+ try {
+ const response = await fetch(`/api/video/analytics?videoId=${data.id}`);
+ if (!response.ok) {
+ throw new Error("Failed to fetch analytics");
+ }
+ const analyticsData = await response.json();
+ const metadata = (data.metadata as { reactions?: number }) || {};
+
+ setAnalytics({
+ views: analyticsData.count || 0,
+ comments: comments.length,
+ reactions: metadata.reactions || 0,
+ });
+ } catch (error) {
+ console.error("Error fetching analytics:", error);
+ }
+ };
+
+ fetchAnalytics();
+ }, [data.id, comments.length, data.metadata]);
+
return (
- <>
- <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="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 className="min-h-screen flex flex-col bg-[#F7F8FA]">
+ <div className="flex-1 container mx-auto px-4 py-4">
+ <ShareHeader
+ data={data}
+ user={user}
+ individualFiles={individualFiles}
+ />
+
+ <div className="mt-4">
+ <div className="flex flex-col lg:flex-row gap-4">
+ <div className="flex-1">
+ <div className="relative aspect-video new-card-style p-3">
+ <ShareVideo
+ data={data}
+ user={user}
+ comments={comments}
+ ref={videoRef}
+ />
+ </div>
+ <div className="mt-4 lg:hidden">
+ <Toolbar data={data} user={user} />
+ </div>
+ </div>
+
+ <div className="lg:w-80 flex flex-col">
+ <Sidebar
+ data={data}
+ user={user}
+ comments={comments}
+ analytics={analytics}
+ onSeek={handleSeek}
+ />
</div>
</div>
- <div className="flex-shrink-0 py-4">
+
+ <div className="hidden lg:block mt-4">
<Toolbar data={data} user={user} />
</div>
</div>
</div>
- <div className="flex-shrink-0 py-4">
+
+ <div className="mt-auto py-4">
<a
target="_blank"
href={`${process.env.NEXT_PUBLIC_URL}?ref=video_${data.id}`}
@@ -58,6 +122,6 @@ export const Share = ({
<Logo className="w-14 h-auto" />
</a>
</div>
- </>
+ </div>
);
};
diff --git a/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx b/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx
new file mode 100644
index 000000000..2d13c4b02
--- /dev/null
+++ b/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx
@@ -0,0 +1,210 @@
+import { Dialog, DialogContent, LogoBadge, Button } from "@cap/ui";
+import { motion } from "framer-motion";
+import { signIn } from "next-auth/react";
+import { useState, useEffect } from "react";
+import { toast } from "react-hot-toast";
+
+interface AuthOverlayProps {
+ isOpen: boolean;
+ onClose: () => void;
+}
+
+const MotionDialogContent = motion(DialogContent);
+
+export const AuthOverlay: React.FC<AuthOverlayProps> = ({
+ isOpen,
+ onClose,
+}) => {
+ const [email, setEmail] = useState("");
+ const [loading, setLoading] = useState(false);
+ const [emailSent, setEmailSent] = useState(false);
+
+ const handleGoogleSignIn = () => {
+ signIn("google");
+ };
+
+ return (
+ <Dialog open={isOpen} onOpenChange={onClose}>
+ <MotionDialogContent
+ initial={{ opacity: 0, scale: 0.95 }}
+ animate={{ opacity: 1, scale: 1 }}
+ exit={{ opacity: 0, scale: 0.95 }}
+ transition={{ duration: 0.2 }}
+ className="w-[90vw] sm:max-w-md p-6 rounded-xl"
+ >
+ <div className="space-y-6">
+ <LogoBadge className="h-12 w-auto" />
+
+ <div className="text-left space-y-3">
+ <motion.h1
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: 0.1 }}
+ className="text-3xl font-semibold"
+ >
+ Sign in to comment
+ </motion.h1>
+ <motion.p
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: 0.2 }}
+ className="text-2xl text-gray-500"
+ >
+ Join the conversation.
+ </motion.p>
+ </div>
+
+ <div className="flex flex-col space-y-3 fade-in-down animate-delay-2">
+ {process.env.NODE_ENV !== "development" && (
+ <>
+ <Button
+ variant="dark"
+ size="lg"
+ className="h-12 text-lg flex items-center justify-center space-x-2"
+ onClick={handleGoogleSignIn}
+ disabled={loading}
+ >
+ <svg
+ className="w-4 h-4"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 12 12"
+ >
+ <g fill="#E1E1E6" clipPath="url(#clip0)">
+ <path d="M11.762 6.138c0-.408-.033-.818-.104-1.22h-5.66V7.23H9.24a2.78 2.78 0 0 1-1.2 1.823v1.5h1.934c1.135-1.046 1.788-2.589 1.788-4.414"></path>
+ <path d="M5.999 12c1.618 0 2.983-.531 3.977-1.448l-1.933-1.5c-.538.367-1.233.574-2.042.574-1.565 0-2.892-1.056-3.369-2.476H.637v1.545A6 6 0 0 0 6 12"></path>
+ <path d="M2.63 7.15a3.6 3.6 0 0 1 0-2.297V3.307H.637a6 6 0 0 0 0 5.388z"></path>
+ <path d="M5.999 2.374a3.26 3.26 0 0 1 2.302.9l1.713-1.713A5.77 5.77 0 0 0 5.999 0 6 6 0 0 0 .637 3.307L2.63 4.852C3.104 3.43 4.434 2.374 6 2.374"></path>
+ </g>
+ <defs>
+ <clipPath id="clip0">
+ <path fill="#fff" d="M0 0h11.762v12H0z"></path>
+ </clipPath>
+ </defs>
+ </svg>
+ <span className="text-gray-50">Continue with Google</span>
+ </Button>
+
+ <div className="relative">
+ <div className="absolute inset-0 flex items-center">
+ <div className="w-full border-t border-blue-100" />
+ </div>
+ <div className="relative flex justify-center">
+ <span className="bg-white px-2 text-gray-500 rounded-xl text-xs">
+ Or
+ </span>
+ </div>
+ </div>
+ </>
+ )}
+
+ <form
+ onSubmit={async (e) => {
+ e.preventDefault();
+ if (!email) return;
+
+ setLoading(true);
+ signIn("email", {
+ email,
+ redirect: false,
+ })
+ .then((res) => {
+ setLoading(false);
+ if (res?.ok && !res?.error) {
+ setEmail("");
+ setEmailSent(true);
+ toast.success("Email sent - check your inbox!");
+ } else {
+ toast.error("Error sending email - try again?");
+ }
+ })
+ .catch((err) => {
+ setEmailSent(false);
+ setLoading(false);
+ toast.error("Error sending email - try again?");
+ });
+ }}
+ className="flex flex-col space-y-3"
+ >
+ <div>
+ <input
+ id="email"
+ name="email"
+ autoFocus
+ type="email"
+ placeholder={emailSent ? "" : "[email protected]"}
+ autoComplete="email"
+ required
+ value={email}
+ disabled={emailSent}
+ onChange={(e) => {
+ setEmail(e.target.value);
+ }}
+ className="block w-full appearance-none rounded-full border border-gray-300 px-3 h-12 placeholder-gray-400 shadow-sm focus:border-black focus:outline-none focus:ring-black text-lg"
+ />
+ {process.env.NODE_ENV === "development" && (
+ <div className="py-3 px-6 flex items-center justify-center bg-red-600 rounded-xl mt-3">
+ <p className="text-white text-lg">
+ <span className="font-bold text-white">
+ Development mode:
+ </span>{" "}
+ Auth URL will be logged to your dev console.
+ </p>
+ </div>
+ )}
+ </div>
+ <Button
+ variant="primary"
+ size="lg"
+ className="h-12 text-lg"
+ type="submit"
+ disabled={loading || emailSent}
+ >
+ {emailSent
+ ? process.env.NODE_ENV === "development"
+ ? "Email sent to your terminal"
+ : "Email sent to your inbox"
+ : "Continue with Email"}
+ </Button>
+ <p className="text-xs text-gray-500 pt-2">
+ By typing your email and clicking continue, you acknowledge that
+ you have both read and agree to Cap's{" "}
+ <a
+ href="/terms"
+ target="_blank"
+ className="text-gray-600 font-semibold text-xs"
+ >
+ Terms of Service
+ </a>{" "}
+ and{" "}
+ <a
+ href="/privacy"
+ target="_blank"
+ className="text-gray-600 font-semibold text-xs"
+ >
+ Privacy Policy
+ </a>
+ .
+ </p>
+ </form>
+ </div>
+
+ {emailSent && (
+ <div>
+ <button
+ className="mt-5 text-sm text-gray-500 underline hover:text-black"
+ onClick={() => {
+ setEmailSent(false);
+ setEmail("");
+ setLoading(false);
+ }}
+ >
+ Click to restart sign in process.
+ </button>
+ </div>
+ )}
+ </div>
+ </MotionDialogContent>
+ </Dialog>
+ );
+};
diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
index b61e6532c..f5a22b50d 100644
--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
@@ -1,7 +1,7 @@
import { comments as commentsSchema, videos } from "@cap/database/schema";
import { VideoPlayer } from "./VideoPlayer";
import { MP4VideoPlayer } from "./MP4VideoPlayer";
-import { useState, useEffect, useRef } from "react";
+import { useState, useEffect, useRef, forwardRef } from "react";
import {
Play,
Pause,
@@ -37,15 +37,14 @@ type CommentWithAuthor = typeof commentsSchema.$inferSelect & {
};
// Update the component props type
-export const ShareVideo = ({
- data,
- user,
- comments,
-}: {
- data: typeof videos.$inferSelect;
- user: typeof userSelectProps | null;
- comments: CommentWithAuthor[];
-}) => {
+export const ShareVideo = forwardRef<
+ HTMLVideoElement,
+ {
+ data: typeof videos.$inferSelect;
+ user: typeof userSelectProps | null;
+ comments: CommentWithAuthor[];
+ }
+>(({ data, user, comments }, ref) => {
const videoRef = useRef<HTMLVideoElement>(null);
const [isPlaying, setIsPlaying] = useState(false);
const [currentTime, setCurrentTime] = useState(0);
@@ -67,6 +66,16 @@ export const ShareVideo = ({
const [isHoveringControls, setIsHoveringControls] = useState(false);
const enterControlsTimeoutRef = useRef<NodeJS.Timeout | null>(null);
+ useEffect(() => {
+ if (videoRef.current) {
+ if (typeof ref === "function") {
+ ref(videoRef.current);
+ } else if (ref) {
+ ref.current = videoRef.current;
+ }
+ }
+ }, [ref]);
+
const showControls = () => {
setOverlayVisible(true);
setIsHovering(true);
@@ -763,4 +772,4 @@ export const ShareVideo = ({
</div>
</div>
);
-};
+});
diff --git a/apps/web/app/s/[videoId]/_components/Sidebar.tsx b/apps/web/app/s/[videoId]/_components/Sidebar.tsx
index 0519ecba6..96d51b144 100644
--- a/apps/web/app/s/[videoId]/_components/Sidebar.tsx
+++ b/apps/web/app/s/[videoId]/_components/Sidebar.tsx
@@ -1 +1,83 @@
-
\ No newline at end of file
+"use client";
+
+import { useState } from "react";
+import { Activity } from "./tabs/Activity";
+import { Transcript } from "./tabs/Transcript";
+import { Settings } from "./tabs/Settings";
+import { comments as commentsSchema, videos } from "@cap/database/schema";
+import { userSelectProps } from "@cap/database/auth/session";
+import { classNames } from "@cap/utils";
+
+type TabType = "activity" | "transcript" | "settings";
+
+interface SidebarProps {
+ data: typeof videos.$inferSelect;
+ user: typeof userSelectProps | null;
+ comments: (typeof commentsSchema.$inferSelect)[];
+ analytics: {
+ views: number;
+ comments: number;
+ reactions: number;
+ };
+ onSeek?: (time: number) => void;
+}
+
+export const Sidebar: React.FC<SidebarProps> = ({
+ data,
+ user,
+ comments,
+ analytics,
+ onSeek,
+}) => {
+ const [activeTab, setActiveTab] = useState<TabType>("activity");
+
+ const tabs = [
+ { id: "activity", label: "Comments" },
+ { id: "transcript", label: "Transcript" },
+ ];
+
+ const renderTabContent = () => {
+ switch (activeTab) {
+ case "activity":
+ return (
+ <Activity
+ analytics={analytics}
+ comments={comments}
+ user={user}
+ onSeek={onSeek}
+ />
+ );
+ case "transcript":
+ return <Transcript data={data} onSeek={onSeek} />;
+ case "settings":
+ return <Settings />;
+ default:
+ return null;
+ }
+ };
+
+ return (
+ <div className="new-card-style overflow-hidden h-full flex flex-col lg:aspect-video">
+ <div className="flex-none">
+ <div className="flex border-b border-gray-200">
+ {tabs.map((tab) => (
+ <button
+ key={tab.id}
+ onClick={() => setActiveTab(tab.id as TabType)}
+ className={classNames(
+ "flex-1 px-6 py-3 text-sm font-medium text-gray-600 hover:text-gray-900 relative",
+ activeTab === tab.id && "text-gray-900"
+ )}
+ >
+ {tab.label}
+ {activeTab === tab.id && (
+ <div className="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-500" />
+ )}
+ </button>
+ ))}
+ </div>
+ </div>
+ <div className="flex-1 min-h-0">{renderTabContent()}</div>
+ </div>
+ );
+};
diff --git a/apps/web/app/s/[videoId]/_components/Toolbar.tsx b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
index 81d11cac1..540748333 100644
--- a/apps/web/app/s/[videoId]/_components/Toolbar.tsx
+++ b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
@@ -6,6 +6,7 @@ import { userSelectProps } from "@cap/database/auth/session";
import { useRouter } from "next/navigation";
import { Button } from "@cap/ui";
import toast from "react-hot-toast";
+import { AuthOverlay } from "./AuthOverlay";
// million-ignore
export const Toolbar = ({
@@ -15,9 +16,10 @@ export const Toolbar = ({
data: typeof videos.$inferSelect;
user: typeof userSelectProps | null;
}) => {
- const { refresh, push } = useRouter();
+ const { refresh } = useRouter();
const [commentBoxOpen, setCommentBoxOpen] = useState(false);
const [comment, setComment] = useState("");
+ const [showAuthOverlay, setShowAuthOverlay] = useState(false);
const [videoElement, setVideoElement] = useState<HTMLVideoElement | null>(
null
);
@@ -164,19 +166,21 @@ export const Toolbar = ({
useEffect(() => {
const handleKeyPress = (e: KeyboardEvent) => {
- // Only trigger if 'c' is pressed and comment box isn't already open
- // Also check if user isn't typing in an input field
if (
e.key.toLowerCase() === "c" &&
!commentBoxOpen &&
+ !e.metaKey &&
+ !e.ctrlKey &&
+ !e.altKey &&
+ !e.shiftKey &&
!(
e.target instanceof HTMLInputElement ||
e.target instanceof HTMLTextAreaElement
)
) {
- e.preventDefault(); // Prevent the 'c' from being added to the input
+ e.preventDefault();
if (!user) {
- push(`/login?next=${window.location.pathname}`);
+ setShowAuthOverlay(true);
return;
}
if (videoElement) {
@@ -190,104 +194,113 @@ export const Toolbar = ({
return () => {
window.removeEventListener("keydown", handleKeyPress);
};
- }, [commentBoxOpen, user, push, videoElement]);
+ }, [commentBoxOpen, user, videoElement]);
+
+ const handleCommentClick = () => {
+ if (!user) {
+ setShowAuthOverlay(true);
+ return;
+ }
+ if (videoElement) {
+ videoElement.pause();
+ }
+ setCommentBoxOpen(true);
+ };
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"
- }`}
+ className={`${
+ !commentBoxOpen ? "max-w-[350px]" : "max-w-[500px]"
+ } mx-auto`}
>
- <div className="flex">
- <div className="flex-grow p-1">
- {commentBoxOpen === true ? (
- <div className="w-full flex items-center justify-between">
- <input
- autoFocus
- type="text"
- value={comment}
- onChange={(e) => setComment(e.target.value)}
- placeholder="Add a comment"
- className="flex-grow h-full outline-none px-3"
- maxLength={255}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- e.preventDefault();
- handleCommentSubmit();
- }
- if (e.key === "Escape") {
- setCommentBoxOpen(false);
- setComment("");
- }
- }}
- />
- <div className="flex items-center space-x-2">
- <Button
- className="min-w-[160px]"
- disabled={comment.length === 0}
- variant="primary"
- size="sm"
- onClick={() => {
- handleCommentSubmit();
- }}
- >
- {videoElement && getTimestamp() > 0
- ? `Comment at ${getTimestamp().toFixed(2)}`
- : "Comment"}
- </Button>
- <Button
- className="min-w-[100px]"
- variant="white"
- size="sm"
- onClick={() => {
- setCommentBoxOpen(false);
- setComment("");
- }}
- >
- Cancel
- </Button>
- </div>
- </div>
- ) : (
- <div className="grid items-center justify-center grid-flow-col">
- {REACTIONS.map((reaction) => (
- <Emoji
- key={reaction.emoji}
- emoji={reaction.emoji}
- label={reaction.label}
- />
- ))}
- <div className="w-[1px] bg-gray-200 h-[16px] mx-4"></div>
- <div className="flex items-center">
- <button
- onClick={() => {
- if (!user) {
- push(`/login?next=${window.location.pathname}`);
- return;
+ <div
+ className={`new-card-style mx-auto transition-all ${
+ commentBoxOpen === true && "w-full"
+ }`}
+ >
+ <div className="flex">
+ <div className="flex-grow p-1">
+ {commentBoxOpen === true ? (
+ <div className="w-full flex items-center justify-between">
+ <input
+ autoFocus
+ type="text"
+ value={comment}
+ onChange={(e) => setComment(e.target.value)}
+ placeholder="Add a comment"
+ className="flex-grow h-full outline-none px-3"
+ maxLength={255}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ handleCommentSubmit();
}
- if (videoElement) {
- videoElement.pause();
+ if (e.key === "Escape") {
+ setCommentBoxOpen(false);
+ setComment("");
}
- setCommentBoxOpen(true);
}}
- className="font-medium bg-gray-200 py-1 px-3 relative transition-bg-color duration-600 flex justify-center items-center rounded-full ease-in-out hover:bg-gray-200 active:bg-gray-400 active:duration-0"
- >
- <span className="text-sm text-gray-500 font-medium">
- Comment (c)
- </span>
- </button>
+ />
+ <div className="flex items-center space-x-2">
+ <Button
+ className="min-w-[160px]"
+ disabled={comment.length === 0}
+ variant="primary"
+ size="sm"
+ onClick={() => {
+ handleCommentSubmit();
+ }}
+ >
+ {videoElement && getTimestamp() > 0
+ ? `Comment at ${getTimestamp().toFixed(2)}`
+ : "Comment"}
+ </Button>
+ <Button
+ className="min-w-[100px]"
+ variant="white"
+ size="sm"
+ onClick={() => {
+ setCommentBoxOpen(false);
+ setComment("");
+ }}
+ >
+ Cancel
+ </Button>
+ </div>
</div>
- </div>
- )}
+ ) : (
+ <div className="grid items-center justify-center grid-flow-col">
+ {REACTIONS.map((reaction) => (
+ <Emoji
+ key={reaction.emoji}
+ emoji={reaction.emoji}
+ label={reaction.label}
+ />
+ ))}
+ <div className="w-[1px] bg-gray-200 h-[16px] mx-4"></div>
+ <div className="flex items-center">
+ <button
+ onClick={handleCommentClick}
+ className="font-medium bg-gray-200 py-1 px-3 relative transition-bg-color duration-600 flex justify-center items-center rounded-full ease-in-out hover:bg-gray-200 active:bg-gray-400 active:duration-0"
+ >
+ <span className="text-sm text-gray-500 font-medium">
+ Comment (c)
+ </span>
+ </button>
+ </div>
+ </div>
+ )}
+ </div>
</div>
</div>
</div>
- </div>
+
+ <AuthOverlay
+ isOpen={showAuthOverlay}
+ onClose={() => setShowAuthOverlay(false)}
+ />
+ </>
);
};
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx
index 0519ecba6..1a269a9b9 100644
--- a/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx
+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx
@@ -1 +1,581 @@
-
\ No newline at end of file
+"use client";
+
+import { useState, useRef, useEffect } from "react";
+import { comments as commentsSchema } from "@cap/database/schema";
+import { userSelectProps } from "@cap/database/auth/session";
+import { EyeIcon, MessageSquare, SmileIcon } from "lucide-react";
+import { formatDistanceToNow } from "date-fns";
+import { Tooltip } from "react-tooltip";
+import { AnimatePresence, motion } from "framer-motion";
+import { AuthOverlay } from "../AuthOverlay";
+
+type CommentType = typeof commentsSchema.$inferSelect & {
+ authorName?: string | null;
+};
+
+interface ActivityProps {
+ analytics: {
+ views: number;
+ comments: number;
+ reactions: number;
+ };
+ comments: CommentType[];
+ user: typeof userSelectProps | null;
+ onSeek?: (time: number) => void;
+}
+
+const Avatar: React.FC<{
+ name: string | null | undefined;
+ className?: string;
+}> = ({ name, className = "" }) => {
+ const initial = name?.[0]?.toUpperCase() || "A";
+ const bgColor = name ? "bg-blue-400" : "bg-gray-200";
+ const textColor = name ? "text-white" : "text-gray-500";
+
+ return (
+ <div
+ className={`w-[20px] h-[20px] rounded-full flex items-center justify-center ${bgColor} ${className}`}
+ >
+ <span className={`text-xs font-medium ${textColor}`}>{initial}</span>
+ </div>
+ );
+};
+
+interface CommentInputProps {
+ onSubmit: (content: string) => void;
+ onCancel?: () => void;
+ placeholder?: string;
+ showCancelButton?: boolean;
+ buttonLabel?: string;
+ user?: typeof userSelectProps | null;
+ autoFocus?: boolean;
+}
+
+const CommentInput: React.FC<CommentInputProps> = ({
+ onSubmit,
+ onCancel,
+ placeholder,
+ showCancelButton = false,
+ buttonLabel = "Reply",
+ user,
+ autoFocus = false,
+}) => {
+ const [content, setContent] = useState("");
+ const inputRef = useRef<HTMLInputElement>(null);
+
+ useEffect(() => {
+ if (autoFocus && inputRef.current) {
+ inputRef.current.focus();
+ }
+ }, [autoFocus]);
+
+ const handleSubmit = (e?: React.FormEvent) => {
+ e?.preventDefault();
+ if (content.trim()) {
+ onSubmit(content);
+ setContent("");
+ }
+ };
+
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ handleSubmit();
+ }
+ };
+
+ return (
+ <div className="flex items-start space-x-3">
+ <div className="flex-1">
+ <div className="bg-gray-100 rounded-lg p-4">
+ <input
+ ref={inputRef}
+ type="text"
+ value={content}
+ onChange={(e) => setContent(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder={placeholder || "Leave a comment"}
+ className="w-full text-[15px] leading-[22px] text-gray-500 bg-transparent focus:outline-none"
+ />
+ <div className="flex space-x-2 mt-2">
+ <button
+ onClick={() => handleSubmit()}
+ className="px-2 py-1.5 bg-blue-500 text-white text-xs font-medium rounded-full hover:bg-blue-600 focus:outline-none"
+ >
+ {buttonLabel}
+ </button>
+ {showCancelButton && onCancel && (
+ <button
+ onClick={onCancel}
+ className="px-2 py-1.5 bg-gray-100 text-gray-700 text-xs font-medium rounded-full hover:bg-gray-200 focus:outline-none"
+ >
+ Cancel
+ </button>
+ )}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+};
+
+const formatTimestamp = (date: Date) => {
+ return new Intl.DateTimeFormat("en-US", {
+ hour: "numeric",
+ minute: "numeric",
+ hour12: true,
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ }).format(date);
+};
+
+const formatTimeAgo = (date: Date) => {
+ const now = new Date();
+ const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
+
+ if (diffInSeconds < 60) return "now";
+
+ const diffInMinutes = Math.floor(diffInSeconds / 60);
+ if (diffInMinutes < 60) return `${diffInMinutes}m ago`;
+
+ const diffInHours = Math.floor(diffInMinutes / 60);
+ if (diffInHours < 24) return `${diffInHours}h ago`;
+
+ const diffInDays = Math.floor(diffInHours / 24);
+ if (diffInDays < 30) return `${diffInDays}d ago`;
+
+ const diffInMonths = Math.floor(diffInDays / 30);
+ if (diffInMonths < 12) return `${diffInMonths}mo ago`;
+
+ const diffInYears = Math.floor(diffInDays / 365);
+ return `${diffInYears}y ago`;
+};
+
+const Comment: React.FC<{
+ comment: CommentType;
+ replies: CommentType[];
+ onReply: (commentId: string) => void;
+ replyingToId: string | null;
+ handleReply: (content: string) => void;
+ onCancelReply: () => void;
+ onDelete: (commentId: string) => void;
+ user: typeof userSelectProps | null;
+ level?: number;
+ onSeek?: (time: number) => void;
+}> = ({
+ comment,
+ replies,
+ onReply,
+ replyingToId,
+ handleReply,
+ onCancelReply,
+ onDelete,
+ user,
+ level = 0,
+ onSeek,
+}) => {
+ const isReplying = replyingToId === comment.id;
+ const isOwnComment = user?.id === comment.authorId;
+ const nestedReplies =
+ level === 0
+ ? replies.filter((reply) => {
+ if (reply.parentCommentId === comment.id) return true;
+ const parentComment = replies.find(
+ (r) => r.id === reply.parentCommentId
+ );
+ return parentComment && parentComment.parentCommentId === comment.id;
+ })
+ : [];
+
+ const handleDelete = () => {
+ if (window.confirm("Are you sure you want to delete this comment?")) {
+ onDelete(comment.id);
+ }
+ };
+
+ const canReply = true;
+ const commentDate = new Date(comment.createdAt);
+
+ return (
+ <motion.div
+ id={`comment-${comment.id}`}
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: -20 }}
+ transition={{ duration: 0.2 }}
+ className={`space-y-3 ${
+ level > 0 ? "ml-8 border-l-2 border-gray-100 pl-4" : ""
+ }`}
+ >
+ <div className="flex items-start space-x-3">
+ <Avatar name={comment.authorName} />
+ <div className="flex-1">
+ <div className="flex items-center space-x-2">
+ <span className="font-medium text-gray-900">
+ {comment.authorName || "Anonymous"}
+ </span>
+ <span
+ className="text-sm text-gray-500"
+ data-tooltip-id={`comment-${comment.id}-timestamp`}
+ data-tooltip-content={formatTimestamp(commentDate)}
+ >
+ {formatTimeAgo(commentDate)}
+ </span>
+ <Tooltip id={`comment-${comment.id}-timestamp`} />
+ {comment.timestamp && (
+ <button
+ onClick={() => onSeek?.(comment.timestamp!)}
+ className="text-sm text-blue-500 hover:text-blue-700 cursor-pointer"
+ >
+ {new Date(comment.timestamp * 1000).toISOString().substr(11, 8)}
+ </button>
+ )}
+ </div>
+ <p className="text-gray-700 mt-1">{comment.content}</p>
+ <div className="flex items-center space-x-4 mt-2">
+ {user && !isReplying && canReply && (
+ <button
+ onClick={() => onReply(comment.id)}
+ className="text-sm text-gray-500 hover:text-gray-700"
+ >
+ Reply
+ </button>
+ )}
+ {isOwnComment && (
+ <button
+ onClick={handleDelete}
+ className="text-sm text-red-500 hover:text-red-700"
+ >
+ Delete
+ </button>
+ )}
+ </div>
+ </div>
+ </div>
+
+ {isReplying && canReply && (
+ <div className="ml-5">
+ <CommentInput
+ onSubmit={handleReply}
+ onCancel={onCancelReply}
+ placeholder="Write a reply..."
+ showCancelButton={true}
+ user={user}
+ autoFocus={true}
+ />
+ </div>
+ )}
+
+ {nestedReplies.length > 0 && (
+ <div className="space-y-3 mt-3">
+ {nestedReplies.map((reply) => (
+ <Comment
+ key={reply.id}
+ comment={reply}
+ replies={replies}
+ onReply={onReply}
+ replyingToId={replyingToId}
+ handleReply={handleReply}
+ onCancelReply={onCancelReply}
+ onDelete={onDelete}
+ user={user}
+ level={1}
+ onSeek={onSeek}
+ />
+ ))}
+ </div>
+ )}
+ </motion.div>
+ );
+};
+
+export const Activity: React.FC<ActivityProps> = ({
+ analytics,
+ comments: initialComments,
+ user,
+ onSeek,
+}) => {
+ const [replyingTo, setReplyingTo] = useState<string | null>(null);
+ const [comments, setComments] = useState(initialComments);
+ const [optimisticComments, setOptimisticComments] = useState<CommentType[]>(
+ []
+ );
+ const [showAuthOverlay, setShowAuthOverlay] = useState(false);
+ const commentsContainerRef = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ if (commentsContainerRef.current) {
+ commentsContainerRef.current.scrollTop =
+ commentsContainerRef.current.scrollHeight;
+ }
+ }, []);
+
+ const scrollToBottom = () => {
+ if (commentsContainerRef.current) {
+ commentsContainerRef.current.scrollTo({
+ top: commentsContainerRef.current.scrollHeight,
+ behavior: "smooth",
+ });
+ }
+ };
+
+ const addOptimisticComment = (newComment: CommentType) => {
+ setOptimisticComments((prev) => [...prev, newComment]);
+ setTimeout(scrollToBottom, 100);
+ };
+
+ const handleNewComment = async (content: string) => {
+ const optimisticComment: CommentType = {
+ id: `temp-${Date.now()}`,
+ authorId: user?.id || "anonymous",
+ authorName: user?.name || "Anonymous",
+ content,
+ createdAt: new Date(),
+ videoId: comments[0]?.videoId || "",
+ parentCommentId: "",
+ type: "text",
+ timestamp: null,
+ updatedAt: new Date(),
+ };
+
+ addOptimisticComment(optimisticComment);
+
+ try {
+ const response = await fetch("/api/video/comment", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ type: "text",
+ content,
+ videoId: comments[0]?.videoId,
+ parentCommentId: "",
+ }),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to post comment");
+ }
+
+ const newComment = await response.json();
+
+ setOptimisticComments((prev) =>
+ prev.filter((c) => c.id !== optimisticComment.id)
+ );
+
+ setTimeout(() => {
+ setComments((prev) => [
+ ...prev,
+ { ...optimisticComment, ...newComment },
+ ]);
+ }, 100);
+ } catch (error) {
+ console.error("Error posting comment:", error);
+ setOptimisticComments((prev) =>
+ prev.filter((c) => c.id !== optimisticComment.id)
+ );
+ }
+ };
+
+ const handleReply = async (content: string) => {
+ if (!replyingTo) return;
+
+ const parentComment = comments.find((c) => c.id === replyingTo);
+ const actualParentId = parentComment?.parentCommentId
+ ? parentComment.parentCommentId
+ : replyingTo;
+
+ const optimisticReply: CommentType = {
+ id: `temp-${Date.now()}`,
+ authorId: user?.id || "anonymous",
+ authorName: user?.name || "Anonymous",
+ content,
+ createdAt: new Date(),
+ videoId: comments[0]?.videoId || "",
+ parentCommentId: actualParentId,
+ type: "text",
+ timestamp: null,
+ updatedAt: new Date(),
+ };
+
+ addOptimisticComment(optimisticReply);
+
+ try {
+ const response = await fetch("/api/video/comment", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ type: "text",
+ content,
+ videoId: comments[0]?.videoId,
+ parentCommentId: actualParentId,
+ }),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to post reply");
+ }
+
+ const newReply = await response.json();
+
+ // Remove optimistic reply first
+ setOptimisticComments((prev) =>
+ prev.filter((c) => c.id !== optimisticReply.id)
+ );
+
+ // Add the real reply with a delay and scroll to it
+ setTimeout(() => {
+ const newReplyWithId = { ...optimisticReply, ...newReply };
+ setComments((prev) => [...prev, newReplyWithId]);
+
+ // Wait a bit for the DOM to update, then scroll to the new reply
+ setTimeout(() => {
+ const newReplyElement = document.getElementById(
+ `comment-${newReplyWithId.id}`
+ );
+ if (newReplyElement) {
+ newReplyElement.scrollIntoView({
+ behavior: "smooth",
+ block: "center",
+ });
+ }
+ }, 100);
+ }, 100);
+
+ setReplyingTo(null);
+ } catch (error) {
+ console.error("Error posting reply:", error);
+ setOptimisticComments((prev) =>
+ prev.filter((c) => c.id !== optimisticReply.id)
+ );
+ }
+ };
+
+ const handleCancelReply = () => {
+ setReplyingTo(null);
+ };
+
+ const handleDeleteComment = async (commentId: string) => {
+ try {
+ const response = await fetch(
+ `/api/video/comment/delete?commentId=${commentId}`,
+ {
+ method: "DELETE",
+ }
+ );
+
+ if (!response.ok) {
+ const data = await response.json();
+ throw new Error(data.error || "Failed to delete comment");
+ }
+
+ // Remove the comment and its replies from the state
+ setComments((prev) =>
+ prev.filter(
+ (comment) =>
+ comment.id !== commentId && comment.parentCommentId !== commentId
+ )
+ );
+ } catch (error) {
+ console.error("Error deleting comment:", error);
+ // You might want to show an error toast here
+ }
+ };
+
+ const allComments = [...comments, ...optimisticComments];
+ const rootComments = allComments.filter(
+ (comment) => !comment.parentCommentId || comment.parentCommentId === ""
+ );
+
+ return (
+ <div className="flex flex-col h-full">
+ <div className="flex-none border-b border-gray-200">
+ <div className="flex justify-between p-4">
+ <div className="flex items-center space-x-6">
+ <div className="flex items-center space-x-2">
+ <EyeIcon className="w-4 h-4 text-gray-400" />
+ <span className="text-sm text-gray-600">{analytics.views}</span>
+ </div>
+ <div className="flex items-center space-x-2">
+ <MessageSquare className="w-4 h-4 text-gray-400" />
+ <span className="text-sm text-gray-600">
+ {analytics.comments}
+ </span>
+ </div>
+ <div className="flex items-center space-x-2">
+ <SmileIcon className="w-4 h-4 text-gray-400" />
+ <span className="text-sm text-gray-600">
+ {analytics.reactions}
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div
+ ref={commentsContainerRef}
+ className="flex-1 overflow-y-auto min-h-0"
+ >
+ <div className="space-y-6 p-4">
+ <AnimatePresence mode="sync">
+ {rootComments
+ .sort(
+ (a, b) =>
+ new Date(a.createdAt).getTime() -
+ new Date(b.createdAt).getTime()
+ )
+ .map((comment) => (
+ <Comment
+ key={comment.id}
+ comment={comment}
+ replies={allComments}
+ onReply={(id) => {
+ if (!user) {
+ setShowAuthOverlay(true);
+ } else {
+ setReplyingTo(id);
+ }
+ }}
+ replyingToId={replyingTo}
+ handleReply={handleReply}
+ onCancelReply={handleCancelReply}
+ onDelete={handleDeleteComment}
+ user={user}
+ onSeek={onSeek}
+ />
+ ))}
+ </AnimatePresence>
+ </div>
+ </div>
+
+ <div className="flex-none border-t border-gray-200 bg-white p-4">
+ {user ? (
+ <CommentInput
+ onSubmit={handleNewComment}
+ placeholder="Leave a comment"
+ buttonLabel="Comment"
+ user={user}
+ />
+ ) : (
+ <div
+ onClick={() => setShowAuthOverlay(true)}
+ className="bg-gray-100 rounded-lg p-4 cursor-pointer hover:bg-gray-200 transition-colors"
+ >
+ <span className="text-[15px] leading-[22px] text-gray-500">
+ Sign in to leave a comment
+ </span>
+ </div>
+ )}
+ </div>
+
+ <AuthOverlay
+ isOpen={showAuthOverlay}
+ onClose={() => setShowAuthOverlay(false)}
+ />
+ </div>
+ );
+};
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Settings.tsx b/apps/web/app/s/[videoId]/_components/tabs/Settings.tsx
index 0519ecba6..a775f092c 100644
--- a/apps/web/app/s/[videoId]/_components/tabs/Settings.tsx
+++ b/apps/web/app/s/[videoId]/_components/tabs/Settings.tsx
@@ -1 +1,79 @@
-
\ No newline at end of file
+"use client";
+
+import { useState } from "react";
+import { Switch } from "@cap/ui";
+
+interface SettingOption {
+ id: string;
+ label: string;
+ description?: string;
+ enabled: boolean;
+}
+
+export const Settings = () => {
+ const [settings, setSettings] = useState<SettingOption[]>([
+ {
+ id: "allow_comments",
+ label: "Allow Comments",
+ description: "Define what viewers can see and do.",
+ enabled: true,
+ },
+ {
+ id: "allow_anonymous_comments",
+ label: "Allow Anonymous Comments",
+ enabled: false,
+ },
+ {
+ id: "enable_transcript",
+ label: "Enable Transcript",
+ enabled: true,
+ },
+ {
+ id: "enable_download",
+ label: "Enable Download",
+ enabled: true,
+ },
+ ]);
+
+ const toggleSetting = (id: string) => {
+ setSettings((prev) =>
+ prev.map((setting) =>
+ setting.id === id ? { ...setting, enabled: !setting.enabled } : setting
+ )
+ );
+ };
+
+ return (
+ <div className="flex flex-col h-full">
+ <div className="p-4 border-b border-gray-200">
+ <h3 className="text-sm font-medium">Settings</h3>
+ </div>
+ <div className="flex-1 overflow-y-auto">
+ <div className="space-y-6 p-4">
+ {settings.map((setting) => (
+ <div key={setting.id} className="flex items-center justify-between">
+ <div className="flex-1">
+ <div className="flex items-center justify-between">
+ <div>
+ <h4 className="text-sm font-medium text-gray-900">
+ {setting.label}
+ </h4>
+ {setting.description && (
+ <p className="text-sm text-gray-500">
+ {setting.description}
+ </p>
+ )}
+ </div>
+ <Switch
+ checked={setting.enabled}
+ onCheckedChange={() => toggleSetting(setting.id)}
+ />
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx b/apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx
index 0519ecba6..5c2e69410 100644
--- a/apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx
+++ b/apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx
@@ -1 +1,268 @@
-
\ No newline at end of file
+"use client";
+
+import { videos } from "@cap/database/schema";
+import { useState, useEffect } from "react";
+import { MessageSquare } from "lucide-react";
+
+interface TranscriptProps {
+ data: typeof videos.$inferSelect;
+ onSeek?: (time: number) => void;
+}
+
+interface TranscriptEntry {
+ id: number;
+ timestamp: string;
+ text: string;
+ startTime: number; // in seconds
+}
+
+const parseVTT = (vttContent: string): TranscriptEntry[] => {
+ const lines = vttContent.split("\n");
+ const entries: TranscriptEntry[] = [];
+ let currentEntry: Partial<TranscriptEntry & { startTime: number }> = {};
+ let currentId = 0;
+
+ const timeToSeconds = (timeStr: string): number | null => {
+ const parts = timeStr.split(":");
+ if (parts.length !== 3) return null;
+
+ const [hoursStr, minutesStr, secondsStr] = parts;
+ if (!hoursStr || !minutesStr || !secondsStr) return null;
+
+ const hours = parseInt(hoursStr, 10);
+ const minutes = parseInt(minutesStr, 10);
+ const seconds = parseInt(secondsStr, 10);
+
+ if (isNaN(hours) || isNaN(minutes) || isNaN(seconds)) return null;
+
+ return hours * 3600 + minutes * 60 + seconds;
+ };
+
+ const parseTimestamp = (
+ timestamp: string
+ ): { mm_ss: string; totalSeconds: number } | null => {
+ const parts = timestamp.split(":");
+ if (parts.length !== 3) return null;
+
+ const [hoursStr, minutesStr, secondsWithMs] = parts;
+ if (!hoursStr || !minutesStr || !secondsWithMs) return null;
+
+ const secondsPart = secondsWithMs.split(".")[0];
+ if (!secondsPart) return null;
+
+ const totalSeconds = timeToSeconds(
+ `${hoursStr}:${minutesStr}:${secondsPart}`
+ );
+ if (totalSeconds === null) return null;
+
+ return {
+ mm_ss: `${minutesStr}:${secondsPart}`,
+ totalSeconds,
+ };
+ };
+
+ for (let i = 0; i < lines.length; i++) {
+ const line = lines[i];
+ if (!line?.trim()) continue;
+
+ const trimmedLine = line.trim();
+
+ // Skip WEBVTT header
+ if (trimmedLine === "WEBVTT") continue;
+
+ // Parse cue ID (number)
+ if (/^\d+$/.test(trimmedLine)) {
+ currentId = parseInt(trimmedLine, 10);
+ continue;
+ }
+
+ // Parse timestamp line
+ if (trimmedLine.includes("-->")) {
+ const [startTimeStr, endTimeStr] = trimmedLine.split(" --> ");
+ if (!startTimeStr || !endTimeStr) continue;
+
+ const startTimestamp = parseTimestamp(startTimeStr);
+ if (startTimestamp) {
+ currentEntry = {
+ id: currentId,
+ timestamp: startTimestamp.mm_ss,
+ startTime: startTimestamp.totalSeconds,
+ };
+ }
+ continue;
+ }
+
+ // Parse text content
+ if (currentEntry.timestamp && !currentEntry.text) {
+ currentEntry.text = trimmedLine;
+ if (
+ currentEntry.id !== undefined &&
+ currentEntry.timestamp &&
+ currentEntry.text &&
+ currentEntry.startTime !== undefined
+ ) {
+ entries.push(currentEntry as TranscriptEntry);
+ }
+ currentEntry = {};
+ }
+ }
+
+ return entries.sort((a, b) => a.startTime - b.startTime);
+};
+
+export const Transcript: React.FC<TranscriptProps> = ({ data, onSeek }) => {
+ const [transcriptData, setTranscriptData] = useState<TranscriptEntry[]>([]);
+ const [isLoading, setIsLoading] = useState(true);
+ const [selectedEntry, setSelectedEntry] = useState<number | null>(null);
+ const [isTranscriptionProcessing, setIsTranscriptionProcessing] =
+ useState(false);
+
+ useEffect(() => {
+ const fetchTranscript = async () => {
+ let transcriptionUrl;
+
+ if (
+ data.bucket &&
+ data.awsBucket !== process.env.NEXT_PUBLIC_CAP_AWS_BUCKET
+ ) {
+ // For custom S3 buckets, fetch through the API
+ transcriptionUrl = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&fileType=transcription`;
+ } else {
+ // For default Cap storage
+ transcriptionUrl = `https://v.cap.so/${data.ownerId}/${data.id}/transcription.vtt`;
+ }
+
+ try {
+ const response = await fetch(transcriptionUrl);
+ const vttContent = await response.text();
+ const parsed = parseVTT(vttContent);
+ setTranscriptData(parsed);
+ } catch (error) {
+ console.error("Error loading transcript:", error);
+ }
+ setIsLoading(false);
+ };
+
+ if (data.transcriptionStatus === "COMPLETE") {
+ fetchTranscript();
+ } else {
+ const startTime = Date.now();
+ const maxDuration = 2 * 60 * 1000; // 2 minutes
+
+ const intervalId = setInterval(() => {
+ if (Date.now() - startTime > maxDuration) {
+ clearInterval(intervalId);
+ setIsLoading(false);
+ return;
+ }
+
+ fetch(`/api/video/transcribe/status?videoId=${data.id}`)
+ .then((response) => response.json())
+ .then(({ transcriptionStatus }) => {
+ if (transcriptionStatus === "PROCESSING") {
+ setIsTranscriptionProcessing(true);
+ } else if (transcriptionStatus === "COMPLETE") {
+ fetchTranscript();
+ clearInterval(intervalId);
+ } else if (transcriptionStatus === "FAILED") {
+ clearInterval(intervalId);
+ setIsLoading(false);
+ }
+ });
+ }, 1000);
+
+ return () => clearInterval(intervalId);
+ }
+ }, [
+ data.id,
+ data.ownerId,
+ data.bucket,
+ data.awsBucket,
+ data.transcriptionStatus,
+ ]);
+
+ const handleReset = () => {
+ setIsLoading(true);
+ // Re-fetch the transcript
+ const fetchTranscript = async () => {
+ const transcriptionUrl =
+ data.bucket && data.awsBucket !== process.env.NEXT_PUBLIC_CAP_AWS_BUCKET
+ ? `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&fileType=transcription`
+ : `https://v.cap.so/${data.ownerId}/${data.id}/transcription.vtt`;
+
+ try {
+ const response = await fetch(transcriptionUrl);
+ const vttContent = await response.text();
+ const parsed = parseVTT(vttContent);
+ setTranscriptData(parsed);
+ } catch (error) {
+ console.error("Error resetting transcript:", error);
+ }
+ setIsLoading(false);
+ };
+
+ fetchTranscript();
+ };
+
+ const handleTranscriptClick = (entry: TranscriptEntry) => {
+ setSelectedEntry(entry.id);
+
+ // Use the onSeek callback to handle video seeking
+ if (onSeek) {
+ onSeek(entry.startTime);
+ }
+ };
+
+ if (isLoading) {
+ return (
+ <div className="flex items-center justify-center h-full">
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" />
+ </div>
+ );
+ }
+
+ if (isTranscriptionProcessing) {
+ return (
+ <div className="flex items-center justify-center h-full text-gray-500">
+ <div className="text-center">
+ <MessageSquare className="w-8 h-8 mx-auto mb-2 text-gray-400 animate-pulse" />
+ <p>Transcription in progress...</p>
+ </div>
+ </div>
+ );
+ }
+
+ if (!transcriptData.length) {
+ return (
+ <div className="flex items-center justify-center h-full text-gray-500">
+ <div className="text-center">
+ <MessageSquare className="w-8 h-8 mx-auto mb-2 text-gray-400" />
+ <p>No transcript available</p>
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div className="flex flex-col h-full">
+ <div className="flex-1 overflow-y-auto">
+ <div className="space-y-3 p-4">
+ {transcriptData.map((entry) => (
+ <div
+ key={entry.id}
+ className={`group rounded-lg p-2 transition-colors cursor-pointer ${
+ selectedEntry === entry.id ? "bg-blue-50" : "hover:bg-gray-100"
+ }`}
+ onClick={() => handleTranscriptClick(entry)}
+ >
+ <div className="text-sm text-gray-500 mb-1">
+ {entry.timestamp}
+ </div>
+ <div className="text-sm text-gray-900">{entry.text}</div>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/apps/web/package.json b/apps/web/package.json
index 4a10d1f11..331204d39 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -39,6 +39,7 @@
"drizzle-orm": "0.30.9",
"dub": "^0.33.1",
"file-saver": "^2.0.5",
+ "framer-motion": "^11.13.1",
"hls.js": "^1.5.3",
"jszip": "^3.10.1",
"lodash": "^4.17.21",
diff --git a/packages/ui/src/components/Dialog.tsx b/packages/ui/src/components/Dialog.tsx
index 1a9921e0e..5b631dd65 100644
--- a/packages/ui/src/components/Dialog.tsx
+++ b/packages/ui/src/components/Dialog.tsx
@@ -3,17 +3,11 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";
-
import { classNames } from "@cap/utils";
const Dialog = DialogPrimitive.Root;
-
const DialogTrigger = DialogPrimitive.Trigger;
-
-const DialogPortal = ({ ...props }: DialogPrimitive.DialogPortalProps) => (
- <DialogPrimitive.Portal {...props} />
-);
-DialogPortal.displayName = DialogPrimitive.Portal.displayName;
+const DialogPortal = DialogPrimitive.Portal;
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -22,7 +16,7 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={classNames(
- "fixed inset-0 z-50 bg-black opacity-80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 overflow-y-scroll",
+ "fixed inset-0 z-50 bg-black/80 backdrop-blur-sm",
className
)}
{...props}
@@ -36,20 +30,22 @@ const DialogContent = React.forwardRef<
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
- <DialogPrimitive.Content
- ref={ref}
- className={classNames(
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full overflow-y-scroll max-h-screen",
- className
- )}
- {...props}
- >
- {children}
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
- <X className="h-5 w-5" />
- <span className="sr-only">Close</span>
- </DialogPrimitive.Close>
- </DialogPrimitive.Content>
+ <div className="fixed inset-0 z-50 flex items-center justify-center">
+ <DialogPrimitive.Content
+ ref={ref}
+ className={classNames(
+ "relative bg-white shadow-lg sm:rounded-lg",
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
+ <X className="h-5 w-5" />
+ <span className="sr-only">Close</span>
+ </DialogPrimitive.Close>
+ </DialogPrimitive.Content>
+ </div>
</DialogPortal>
));
DialogContent.displayName = DialogPrimitive.Content.displayName;
@@ -60,7 +56,7 @@ const DialogHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={classNames(
- "flex flex-col space-y-1.5 text-center sm:text-left pb-4 border-b border-subtle",
+ "flex flex-col space-y-1.5 text-center sm:text-left pb-4 border-b border-subtle",
className
)}
{...props}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1c4bb63a6..cdf4c3fb3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -241,7 +241,7 @@ importers:
next-auth:
specifier: ^4.24.5
react:
specifier: ^18.2.0
version: 18.3.1
@@ -524,6 +524,9 @@ importers:
file-saver:
specifier: ^2.0.5
version: 2.0.5
+ framer-motion:
+ specifier: ^11.13.1
hls.js:
specifier: ^1.5.3
version: 1.5.15
@@ -717,7 +720,7 @@ importers:
next-auth:
specifier: ^4.24.5
react-email:
specifier: ^1.10.1
version: 1.10.1
@@ -4268,11 +4271,11 @@ packages:
react-dom:
optional: true
- '@storybook/[email protected]':
- resolution: {integrity: sha512-QnAaY/DJCQRaUY0naOIbNTi+q3bYiQOhh6tV+P6W8vCXCSTKaQWSnmKbTrL+1AEDl03H0z1rKg5TVZViblCbgQ==}
+ '@storybook/[email protected]':
+ resolution: {integrity: sha512-w0pwGHXz5q+AoLwxlPVxWjsiqNs3oTYrwS4f+iVWJGCaAHDa5re6qMdVpOnS7s/W0PdJsutfi1DcAq5POyD5Zw==}
peerDependencies:
- storybook: ^8.5.0-alpha.10
- vite: ^4.0.0 || ^5.0.0
+ storybook: ^8.5.0-alpha.16
+ vite: ^4.0.0 || ^5.0.0 || ^6.0.0
'@storybook/[email protected]':
resolution: {integrity: sha512-pmf2bP3fzh45e56gqOuBT8sDX05hGdUKIZ/hcI84d5xmd6MeHiPW8th2v946wCHcxHzxib2/UU9vQUh+mB4VNw==}
@@ -4282,10 +4285,10 @@ packages:
peerDependencies:
storybook: ^8.3.3
- '@storybook/[email protected]':
- resolution: {integrity: sha512-He8y7nA9r7zNHHEU1LcxdF4S1Y3/Xi7MxlwbvPuDg3gbwkoRA5XXRxwcXQYfLfynlWmJdfcbI53qPI4HrsZxWA==}
+ '@storybook/[email protected]':
+ resolution: {integrity: sha512-VD06zT7yrneVWzJwB+Jv+pNXtS1TSfxh9ONaY4OPLncbGJeXQaYkyv7HSoIU+PWBcdd132+0FzO+7j3UeIgKXw==}
peerDependencies:
- storybook: ^8.5.0-alpha.10
+ storybook: ^8.5.0-alpha.16
'@storybook/[email protected]':
resolution: {integrity: sha512-dHYFQH3mA+EtnCkHXzicbLgsvzYjcDJ1JWsogbItZogkPHgSJM/Wr71uMkcvw8v9mmCyP4NpXJuu6bPoVsOnzg==}
@@ -6838,6 +6841,20 @@ packages:
resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==}
+ resolution: {integrity: sha512-F40tpGTHByhn9h3zdBQPcEro+pSLtzARcocbNqAyfBI+u9S+KZuHH/7O9+z+GEkoF3eqFxfvVw0eBDytohwqmQ==}
+ peerDependencies:
+ '@emotion/is-prop-valid': '*'
+ react: ^18.0.0
+ react-dom: ^18.0.0
+ peerDependenciesMeta:
+ '@emotion/is-prop-valid':
+ optional: true
+ react:
+ optional: true
+ react-dom:
+ optional: true
+
resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==}
engines: {node: '>= 0.6'}
@@ -8526,6 +8543,12 @@ packages:
resolution: {integrity: sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-Oc1MLGJQ6nrvXccXA89lXtOqFyBmvHtaDcTRGT66o8Czl7nuA8BeHAd9MQV1pQKX0d2RHFBFaw5g3k23hQJt0w==}
+
+ resolution: {integrity: sha512-lq6TzXkH5c/ysJQBxgLXgM01qwBH1b4goTPh57VvZWJbVJZF/0SB31UWEn4EIqbVPf3au88n2rvK17SpDTja1A==}
+
resolution: {integrity: sha512-zRmGlvxy+YdW3Dmt+TR4xPHynbxwXtAQDTN/Fo9N3LMxaUlB2C5KmZpzYyGKy4c7k4Jf3RCR0A2pm9SZELOLXw==}
@@ -11145,13 +11168,13 @@ snapshots:
dependencies:
'@aws-crypto/util': 5.2.0
'@aws-sdk/types': 3.654.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-crypto/[email protected]':
dependencies:
'@aws-crypto/util': 5.2.0
'@aws-sdk/types': 3.654.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-crypto/[email protected]':
dependencies:
@@ -11160,7 +11183,7 @@ snapshots:
'@aws-sdk/types': 3.654.0
'@aws-sdk/util-locate-window': 3.568.0
'@smithy/util-utf8': 2.3.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-crypto/[email protected]':
dependencies:
@@ -11180,13 +11203,13 @@ snapshots:
'@aws-crypto/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-crypto/[email protected]':
dependencies:
'@aws-sdk/types': 3.654.0
'@smithy/util-utf8': 2.3.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11431,7 +11454,7 @@ snapshots:
'@smithy/util-middleware': 3.0.6
'@smithy/util-retry': 3.0.6
'@smithy/util-utf8': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
transitivePeerDependencies:
- aws-crt
@@ -11498,7 +11521,7 @@ snapshots:
'@aws-sdk/types': 3.654.0
'@smithy/property-provider': 3.1.6
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11510,7 +11533,7 @@ snapshots:
'@smithy/smithy-client': 3.3.5
'@smithy/types': 3.4.2
'@smithy/util-stream': 3.1.8
- tslib: 2.7.0
+ tslib: 2.8.0
dependencies:
@@ -11525,7 +11548,7 @@ snapshots:
'@smithy/property-provider': 3.1.6
'@smithy/shared-ini-file-loader': 3.1.7
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
transitivePeerDependencies:
- '@aws-sdk/client-sso-oidc'
- aws-crt
@@ -11555,7 +11578,7 @@ snapshots:
'@smithy/property-provider': 3.1.6
'@smithy/shared-ini-file-loader': 3.1.7
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
dependencies:
@@ -11565,7 +11588,7 @@ snapshots:
'@smithy/property-provider': 3.1.6
'@smithy/shared-ini-file-loader': 3.1.7
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
transitivePeerDependencies:
- '@aws-sdk/client-sso-oidc'
- aws-crt
@@ -11576,7 +11599,7 @@ snapshots:
'@aws-sdk/types': 3.654.0
'@smithy/property-provider': 3.1.6
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11586,14 +11609,14 @@ snapshots:
'@smithy/protocol-http': 4.1.3
'@smithy/types': 3.4.2
'@smithy/util-config-provider': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
'@aws-sdk/types': 3.654.0
'@smithy/protocol-http': 4.1.3
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11606,7 +11629,7 @@ snapshots:
'@smithy/types': 3.4.2
'@smithy/util-middleware': 3.0.6
'@smithy/util-utf8': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11619,7 +11642,7 @@ snapshots:
dependencies:
'@aws-sdk/types': 3.654.0
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11649,13 +11672,13 @@ snapshots:
'@smithy/util-middleware': 3.0.6
'@smithy/util-stream': 3.1.8
'@smithy/util-utf8': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
'@aws-sdk/types': 3.654.0
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11706,7 +11729,7 @@ snapshots:
'@smithy/protocol-http': 4.1.3
'@smithy/signature-v4': 4.1.4
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
dependencies:
@@ -11715,7 +11738,7 @@ snapshots:
'@smithy/property-provider': 3.1.6
'@smithy/shared-ini-file-loader': 3.1.7
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11724,7 +11747,7 @@ snapshots:
'@aws-sdk/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -11738,11 +11761,11 @@ snapshots:
'@aws-sdk/types': 3.654.0
'@smithy/querystring-builder': 3.0.6
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@aws-sdk/[email protected]':
dependencies:
@@ -14317,16 +14340,16 @@ snapshots:
'@smithy/[email protected]':
dependencies:
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/util-base64': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14355,37 +14378,37 @@ snapshots:
'@smithy/property-provider': 3.1.6
'@smithy/types': 3.4.2
'@smithy/url-parser': 3.0.6
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@aws-crypto/crc32': 5.2.0
'@smithy/types': 3.4.2
'@smithy/util-hex-encoding': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/eventstream-serde-universal': 3.0.8
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/eventstream-serde-universal': 3.0.8
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/eventstream-codec': 3.1.5
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14400,7 +14423,7 @@ snapshots:
'@smithy/chunked-blob-reader': 3.0.0
'@smithy/chunked-blob-reader-native': 3.0.0
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14413,7 +14436,7 @@ snapshots:
dependencies:
'@smithy/types': 3.4.2
'@smithy/util-utf8': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14426,13 +14449,13 @@ snapshots:
'@smithy/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/types': 3.4.2
'@smithy/util-utf8': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14490,7 +14513,7 @@ snapshots:
'@smithy/[email protected]':
dependencies:
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14501,12 +14524,12 @@ snapshots:
dependencies:
'@smithy/types': 3.4.2
'@smithy/util-uri-escape': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14515,7 +14538,7 @@ snapshots:
'@smithy/[email protected]':
dependencies:
'@smithy/types': 3.4.2
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14526,7 +14549,7 @@ snapshots:
'@smithy/util-middleware': 3.0.6
'@smithy/util-uri-escape': 3.0.0
'@smithy/util-utf8': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14564,16 +14587,16 @@ snapshots:
'@smithy/[email protected]':
dependencies:
'@smithy/is-array-buffer': 2.2.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/is-array-buffer': 3.0.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14601,7 +14624,7 @@ snapshots:
'@smithy/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14627,12 +14650,12 @@ snapshots:
'@smithy/[email protected]':
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
'@smithy/util-buffer-from': 2.2.0
- tslib: 2.7.0
+ tslib: 2.8.0
'@smithy/[email protected]':
dependencies:
@@ -14915,9 +14938,9 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1([email protected])
dependencies:
- '@storybook/csf-plugin': 8.5.0-alpha.10([email protected])
+ '@storybook/csf-plugin': 8.5.0-alpha.16([email protected])
browser-assert: 1.2.1
storybook: 8.3.3
ts-dedent: 2.2.0
@@ -14950,7 +14973,7 @@ snapshots:
transitivePeerDependencies:
- webpack-sources
dependencies:
storybook: 8.3.3
unplugin: 1.16.0
@@ -15013,7 +15036,7 @@ snapshots:
dependencies:
'@swc/counter': 0.1.3
- tslib: 2.7.0
+ tslib: 2.8.0
dependencies:
@@ -15775,7 +15798,7 @@ snapshots:
astring: 1.9.0
magicast: 0.2.11
recast: 0.23.9
- tslib: 2.7.0
+ tslib: 2.8.0
@@ -16017,7 +16040,7 @@ snapshots:
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
dependencies:
@@ -16114,7 +16137,7 @@ snapshots:
dependencies:
- tslib: 2.7.0
+ tslib: 2.8.0
@@ -17629,7 +17652,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@@ -18198,6 +18221,15 @@ snapshots:
+ dependencies:
+ motion-dom: 11.13.0
+ motion-utils: 11.13.0
+ tslib: 2.8.0
+ optionalDependencies:
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
@@ -20685,6 +20717,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
+
+
@@ -20760,7 +20796,7 @@ snapshots:
optionalDependencies:
nodemailer: 6.9.15
dependencies:
'@babel/runtime': 7.25.6
'@panva/hkdf': 1.2.1
@@ -21673,7 +21709,7 @@ snapshots:
dependencies:
react: 18.3.1
react-style-singleton: 2.2.1(@types/[email protected])([email protected])
- tslib: 2.7.0
+ tslib: 2.8.0
optionalDependencies:
'@types/react': 18.3.9
@@ -21693,7 +21729,7 @@ snapshots:
react: 18.3.1
react-remove-scroll-bar: 2.3.6(@types/[email protected])([email protected])
react-style-singleton: 2.2.1(@types/[email protected])([email protected])
- tslib: 2.7.0
+ tslib: 2.8.0
use-callback-ref: 1.3.2(@types/[email protected])([email protected])
use-sidecar: 1.1.2(@types/[email protected])([email protected])
optionalDependencies:
@@ -21730,7 +21766,7 @@ snapshots:
get-nonce: 1.0.1
invariant: 2.2.4
react: 18.3.1
- tslib: 2.7.0
+ tslib: 2.8.0
optionalDependencies:
'@types/react': 18.3.9
@@ -21804,7 +21840,7 @@ snapshots:
esprima: 4.0.1
source-map: 0.6.1
tiny-invariant: 1.3.3
- tslib: 2.7.0
+ tslib: 2.8.0
dependencies:
@@ -22396,7 +22432,7 @@ snapshots:
dependencies:
- '@storybook/builder-vite': 8.5.0-alpha.10([email protected])([email protected](@types/[email protected])([email protected]))
+ '@storybook/builder-vite': 8.5.0-alpha.16([email protected])([email protected](@types/[email protected])([email protected]))
transitivePeerDependencies:
- storybook
- vite
@@ -23253,7 +23289,7 @@ snapshots:
dependencies:
react: 18.3.1
- tslib: 2.7.0
+ tslib: 2.8.0
optionalDependencies:
'@types/react': 18.3.9
@@ -23261,7 +23297,7 @@ snapshots:
dependencies:
detect-node-es: 1.1.0
react: 18.3.1
- tslib: 2.7.0
+ tslib: 2.8.0
optionalDependencies:
'@types/react': 18.3.9