Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
wip: Screen recording web app
Richie McIlroy64b0d888d20d
diff --git a/apps/web/app/api/desktop/video/create/route.ts b/apps/web/app/api/desktop/video/create/route.tsindex 323c43ed1..c7bd9ac46 100644--- a/apps/web/app/api/desktop/video/create/route.ts+++ b/apps/web/app/api/desktop/video/create/route.ts@@ -82,7 +82,7 @@ export async function GET(req: NextRequest) {await db.insert(videos).values({id: id,name: `My Cap Recording - ${formattedDate}`,- ownerId: user.userId,+ ownerId: user.id,awsRegion: awsRegion,awsBucket: awsBucket,});@@ -113,7 +113,7 @@ export async function GET(req: NextRequest) {return new Response(JSON.stringify({id: id,- user_id: user.userId,+ user_id: user.id,aws_region: awsRegion,aws_bucket: awsBucket,}),diff --git a/apps/web/app/api/settings/onboarding/route.ts b/apps/web/app/api/settings/onboarding/route.tsnew file mode 100644index 000000000..f88ef43f4--- /dev/null+++ b/apps/web/app/api/settings/onboarding/route.ts@@ -0,0 +1,74 @@+import { type NextRequest } from "next/server";+import { getCurrentUser } from "@cap/database/auth/session";+import { spaceMembers, spaces, users } from "@cap/database/schema";+import { db } from "@cap/database";+import { eq, or } from "drizzle-orm";+import { nanoId } from "@cap/database/helpers";++export async function POST(request: NextRequest) {+ const user = await getCurrentUser();+ const { firstName, lastName } = await request.json();++ if (!user) {+ console.error("User not found");++ return new Response(JSON.stringify({ error: true }), {+ status: 401,+ headers: {+ "Content-Type": "application/json",+ },+ });+ }++ await db+ .update(users)+ .set({+ name: firstName,+ lastName: lastName,+ })+ .where(eq(users.id, user.id));++ let fullName = firstName;+ if (lastName) {+ fullName += ` ${lastName}`;+ }++ const spaceData = await db+ .select()+ .from(spaces)+ .where(or(eq(spaces.ownerId, user.id), eq(spaceMembers.userId, user.id)))+ .leftJoin(spaceMembers, eq(spaces.id, spaceMembers.spaceId));++ if (spaceData.length === 0) {+ const spaceId = nanoId();++ await db.insert(spaces).values({+ id: spaceId,+ ownerId: user.id,+ name: `${fullName}'s Space`,+ });++ await db.insert(spaceMembers).values({+ id: nanoId(),+ userId: user.id,+ role: "owner",+ spaceId: spaceId,+ });++ await db+ .update(users)+ .set({+ activeSpaceId: spaceId,+ })+ .where(eq(users.id, user.id));+ }++ return new Response(+ JSON.stringify({+ status: 200,+ headers: {+ "Content-Type": "application/json",+ },+ })+ );+}diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsxindex 26b78f7a9..511a752b2 100644--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx@@ -1,24 +1,26 @@"use client";import { usePathname, useRouter } from "next/navigation";import {- // Plus,+ Plus,Settings,LogOut,- // ChevronDown,+ ChevronDown,Clapperboard,Bell,History,+ Video,} from "lucide-react";import Link from "next/link";import { classNames } from "@cap/utils";-// import {-// Command,-// CommandEmpty,-// CommandGroup,-// CommandInput,-// CommandItem,-// } from "@cap/ui";-// import { Popover, PopoverContent, PopoverTrigger } from "@cap/ui";+import {+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ DialogTrigger,+} from "@cap/ui";+import { Popover, PopoverContent, PopoverTrigger } from "@cap/ui";import { useState } from "react";import {Dialog,@@ -26,21 +28,17 @@ import {DialogDescription,DialogHeader,DialogTitle,- // DialogTrigger,} from "@cap/ui";import { NewSpace } from "@/components/forms/NewSpace";import { signOut } from "next-auth/react";-// import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";-// import { handleActiveSpace } from "@/utils/database/supabase/helpers";-// import { supabase } from "@/utils/database/supabase/client";--//TODO: Auth+import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";+import { Button } from "@cap/ui";export const AdminNavItems = () => {const pathname = usePathname();const router = useRouter();- // const [open, setOpen] = useState(false);- // const { spaceData, activeSpace } = useSharedContext();+ const [open, setOpen] = useState(false);+ const { spaceData, activeSpace } = useSharedContext();const manageNavigation = [{@@ -67,7 +65,7 @@ export const AdminNavItems = () => {return (<Dialog>- {/* <div className="embossed mt-8 mb-4 w-full max-w-full">+ <div className="embossed mt-8 mb-4 w-full max-w-full"><Popover open={open} onOpenChange={setOpen}><PopoverTrigger asChild><div@@ -93,14 +91,15 @@ export const AdminNavItems = () => {<CommandInput placeholder="Search spaces..." /><CommandEmpty>No spaces found.</CommandEmpty><CommandGroup>- {spaceData?.map((space) => (+ {spaceData !== null &&+ spaceData?.map((space) => (<CommandItemkey={space.name}- onSelect={async () => {- await handleActiveSpace(space.id);- router.refresh();- setOpen(false);- }}+ // onSelect={async () => {+ // await handleActiveSpace(space.id);+ // router.refresh();+ // setOpen(false);+ // }}>{space.name}</CommandItem>@@ -115,11 +114,15 @@ export const AdminNavItems = () => {</Command></PopoverContent></Popover>- </div> */}+ </div><nav- className="w-full mt-8 flex flex-col justify-between h-full"+ className="w-full flex flex-col justify-between h-full"aria-label="Sidebar">+ <Button href="/dashboard/caps/new" className="w-full mb-4">+ <Video className="flex-shrink-0 w-6 h-6" aria-hidden="true" />+ <span className="ml-2.5 text-white">Record a Cap</span>+ </Button><div className="space-y-1">{manageNavigation.map((item) => (<div>diff --git a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsxindex e2df1caf9..e89033efe 100644--- a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx+++ b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx@@ -2,11 +2,11 @@import { createContext, useContext } from "react";import AdminDesktopNav from "@/app/dashboard/_components/AdminNavbar/AdminDesktopNav";import AdminMobileNav from "@/app/dashboard/_components/AdminNavbar/AdminMobileNav";-import { users } from "@cap/database/schema";+import { users, spaces } from "@cap/database/schema";type SharedContext = {- spaceData: null;- activeSpace: null;+ spaceData: (typeof spaces.$inferSelect)[] | null;+ activeSpace: typeof spaces.$inferSelect | null;user: typeof users.$inferSelect | null;};diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsxindex 86b65d896..dda276680 100644--- a/apps/web/app/dashboard/caps/Caps.tsx+++ b/apps/web/app/dashboard/caps/Caps.tsx@@ -4,7 +4,13 @@ import moment from "moment";import { VideoThumbnail } from "@/components/VideoThumbnail";import { useRouter } from "next/navigation";import toast from "react-hot-toast";-import { EyeIcon, LinkIcon, MessageSquareIcon, SmileIcon } from "lucide-react";+import {+ EyeIcon,+ LinkIcon,+ MessageSquareIcon,+ SmileIcon,+ Video,+} from "lucide-react";import { useEffect, useState } from "react";import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";@@ -64,12 +70,13 @@ export const Caps = ({ data }: { data: videoData }) => {Craft your narrative with a Cap—get projects done quicker.</p><Button- href="/download"+ href="/dashboard/record"size="default"className="mt-8 relative"variant="default">- Download Cap+ <Video className="flex-shrink-0 w-6 h-6" aria-hidden="true" />+ <span className="ml-2.5 text-white">Record a Cap</span></Button></div></div>diff --git a/apps/web/app/dashboard/caps/page.tsx b/apps/web/app/dashboard/caps/page.tsxindex e559d3c36..3bc4d3c8d 100644--- a/apps/web/app/dashboard/caps/page.tsx+++ b/apps/web/app/dashboard/caps/page.tsx@@ -11,7 +11,13 @@ export default async function CapsPage() {const user = await getCurrentUser();const userId = user?.id as string;- if (user !== null && (user.name === null || user.name.length === 0)) {+ if (+ user !== null &&+ (user.name === null ||+ user.name.length === 0 ||+ user.activeSpaceId === null ||+ user.activeSpaceId.length === 0)+ ) {return redirect("/onboarding");}diff --git a/apps/web/app/dashboard/layout.tsx b/apps/web/app/dashboard/layout.tsxindex c88a29e21..a181ac620 100644--- a/apps/web/app/dashboard/layout.tsx+++ b/apps/web/app/dashboard/layout.tsx@@ -3,6 +3,9 @@ import DynamicSharedLayout from "@/app/dashboard/_components/DynamicSharedLayoutimport { getCurrentUser } from "@cap/database/auth/session";import { redirect } from "next/navigation";import { DashboardTemplate } from "@/components/templates/DashboardTemplate";+import { db } from "@cap/database";+import { spaceMembers, spaces } from "@cap/database/schema";+import { eq, or } from "drizzle-orm";export default async function DashboardLayout({children,@@ -14,8 +17,30 @@ export default async function DashboardLayout({if (!user) {redirect("/login");}++ const spaceSelect = await db+ .select({+ id: spaces.id,+ name: spaces.name,+ ownerId: spaces.ownerId,+ metadata: spaces.metadata,+ createdAt: spaces.createdAt,+ updatedAt: spaces.updatedAt,+ })+ .from(spaces)+ .where(or(eq(spaces.ownerId, user.id), eq(spaceMembers.userId, user.id)))+ .leftJoin(spaceMembers, eq(spaces.id, spaceMembers.spaceId));++ const activeSpace = spaceSelect.find(+ (space) => space.id === user.activeSpaceId+ );+return (- <DynamicSharedLayout spaceData={null} activeSpace={null} user={user}>+ <DynamicSharedLayout+ spaceData={spaceSelect}+ activeSpace={activeSpace || null}+ user={user}+ ><div className="full-layout"><DashboardTemplate>{children}</DashboardTemplate></div>diff --git a/apps/web/app/dashboard/record/Record.tsx b/apps/web/app/dashboard/record/Record.tsxnew file mode 100644index 000000000..972a523ac--- /dev/null+++ b/apps/web/app/dashboard/record/Record.tsx@@ -0,0 +1,428 @@+"use client";++import { useState, useEffect } from "react";+import { users } from "@cap/database/schema";+import {+ Mic,+ MicOff,+ Video,+ VideoOff,+ Monitor,+ CircleEllipsis,+ ChevronUp,+} from "lucide-react";+import { Rnd } from "react-rnd";++export const Record = ({+ user,+}: {+ user: typeof users.$inferSelect | null;+}) => {+ const [isRecording, setIsRecording] = useState(false);+ const [audioDevices, setAudioDevices] = useState<MediaDeviceInfo[]>([]);+ const [videoDevices, setVideoDevices] = useState<MediaDeviceInfo[]>([]);+ const [selectedAudioDevice, setSelectedAudioDevice] = useState<string>();+ const [selectedVideoDevice, setSelectedVideoDevice] = useState<string>();+ const [showAudioOptions, setShowAudioOptions] = useState(false);+ const [showVideoOptions, setShowVideoOptions] = useState(false);+ const [screenStream, setScreenStream] = useState<MediaStream | null>(null);+ const [videoStream, setVideoStream] = useState<MediaStream | null>(null);+ const [combinedStream, setCombinedStream] = useState<MediaStream | null>(+ null+ );+ const [mediaRecorder, setMediaRecorder] = useState<MediaRecorder | null>(+ null+ );+ const [recordedBlobs, setRecordedBlobs] = useState<Blob[]>([]);++ const buttonStyles =+ "w-full h-full flex flex-col items-center justify-center text-center space-y-1 py-2 pl-5 pr-7 group-hover:bg-[#2e2d32] rounded-xl";++ const getDevices = async () => {+ try {+ await navigator.mediaDevices.getUserMedia({ audio: true, video: true });+ const devices = await navigator.mediaDevices.enumerateDevices();+ console.log("Devices:", devices);+ const audioDevices = devices.filter(+ (device) => device.kind === "audioinput"+ );+ const videoDevices = devices.filter(+ (device) => device.kind === "videoinput"+ );+ setAudioDevices(audioDevices);+ setVideoDevices(videoDevices);+ } catch (error) {+ console.error("Error accessing media devices:", error);+ }+ };++ const startScreenCapture = async () => {+ try {+ const stream = await navigator.mediaDevices.getDisplayMedia({+ video: true,+ });+ setScreenStream(stream);+ } catch (error) {+ console.error("Error capturing screen:", error);+ }+ };++ const startVideoCapture = async (deviceId?: string) => {+ try {+ const constraints: MediaStreamConstraints = {+ video: deviceId ? { deviceId } : true,+ audio: selectedAudioDevice ? { deviceId: selectedAudioDevice } : false,+ };++ const stream = await navigator.mediaDevices.getUserMedia(constraints);+ setVideoStream(stream);+ } catch (error) {+ console.error("Error capturing video:", error);+ }+ };++ const stopScreenCapture = () => {+ if (screenStream) {+ screenStream.getTracks().forEach((track) => track.stop());+ setScreenStream(null);+ }+ };++ const stopVideoCapture = () => {+ if (videoStream) {+ videoStream.getTracks().forEach((track) => track.stop());+ setVideoStream(null);+ }+ };++ const startRecording = async () => {+ if (screenStream && videoStream) {+ const combinedStream = new MediaStream();+ const canvas = document.createElement("canvas");+ const ctx = canvas.getContext("2d");++ const screenSize = screenStream.getVideoTracks()[0].getSettings();+ canvas.width = screenSize.width ?? 1280;+ canvas.height = screenSize.height ?? 720;++ let animationFrameId: number;++ const drawCanvas = () => {+ if (ctx) {+ ctx.drawImage(+ document.getElementById("screenPreview") as HTMLVideoElement,+ 0,+ 0,+ canvas.width,+ canvas.height+ );++ // Get the current position and size of the webcam preview+ const webcamPreview = document.getElementById(+ "webcamPreview"+ ) as HTMLVideoElement;+ const webcamRect = webcamPreview.getBoundingClientRect();+ const camWidth = webcamRect.width;+ const camHeight = webcamRect.height;+ const camX = webcamRect.left;+ const camY = webcamRect.top;++ // Calculate the aspect ratio of the video+ const videoWidth = webcamPreview.videoWidth;+ const videoHeight = webcamPreview.videoHeight;+ const aspectRatio = videoWidth / videoHeight;++ // Calculate the new dimensions based on the aspect ratio+ let newWidth = camWidth;+ let newHeight = camWidth / aspectRatio;+ if (newHeight > camHeight) {+ newWidth = camHeight * aspectRatio;+ newHeight = camHeight;+ }++ // Calculate the position to center the video+ const centerX = camX + (camWidth - newWidth) / 2;+ const centerY = camY + (camHeight - newHeight) / 2;++ // Set the position and size of the circular webcam preview on the canvas+ ctx.save();+ ctx.beginPath();+ ctx.arc(+ centerX + newWidth / 2,+ centerY + newHeight / 2,+ Math.min(newWidth, newHeight) / 2,+ 0,+ 2 * Math.PI+ );+ ctx.clip();+ ctx.drawImage(webcamPreview, centerX, centerY, newWidth, newHeight);+ ctx.restore();+ animationFrameId = requestAnimationFrame(drawCanvas);+ }+ };++ drawCanvas();++ const canvasStream = canvas.captureStream(30);+ canvasStream+ .getVideoTracks()+ .forEach((track) => combinedStream.addTrack(track));++ videoStream+ .getAudioTracks()+ .forEach((track) => combinedStream.addTrack(track));++ setCombinedStream(combinedStream);++ const options = { mimeType: "video/webm; codecs=vp9,opus" };+ const mediaRecorder = new MediaRecorder(combinedStream, options);+ const recordedChunks: Blob[] = [];++ mediaRecorder.ondataavailable = function (event) {+ if (event.data.size > 0) recordedChunks.push(event.data);+ };++ mediaRecorder.onstop = () => {+ cancelAnimationFrame(animationFrameId);+ const recordedBlob = new Blob(recordedChunks, { type: "video/webm" });+ console.log("Recorded Blob:", recordedBlob);+ setRecordedBlobs([recordedBlob]);+ };++ setIsRecording(true);+ mediaRecorder.start();+ setMediaRecorder(mediaRecorder);+ }+ };++ const stopRecording = () => {+ if (mediaRecorder && mediaRecorder.state === "recording") {+ setIsRecording(false);+ mediaRecorder.stop();+ }+ };++ useEffect(() => {+ getDevices();+ }, []);++ useEffect(() => {+ if (recordedBlobs.length > 0) {+ const recordedVideo = new Blob(recordedBlobs, { type: "video/webm" });+ const videoUrl = URL.createObjectURL(recordedVideo);+ const link = document.createElement("a");+ link.href = videoUrl;+ link.download = "recorded_video.webm";+ document.body.appendChild(link);+ link.click();+ document.body.removeChild(link);+ URL.revokeObjectURL(videoUrl);+ setRecordedBlobs([]);+ }+ }, [recordedBlobs]);++ useEffect(() => {+ const storedAudioDevice = localStorage.getItem("selectedAudioDevice");+ const storedVideoDevice = localStorage.getItem("selectedVideoDevice");+ const storedScreenStream = localStorage.getItem("screenStream");++ if (storedAudioDevice) {+ setSelectedAudioDevice(storedAudioDevice);+ }+ if (storedVideoDevice) {+ setSelectedVideoDevice(storedVideoDevice);+ startVideoCapture(storedVideoDevice);+ }+ if (storedScreenStream === "true") {+ startScreenCapture();+ }+ }, []);++ useEffect(() => {+ if (selectedAudioDevice) {+ localStorage.setItem("selectedAudioDevice", selectedAudioDevice);+ } else {+ localStorage.removeItem("selectedAudioDevice");+ }+ if (selectedVideoDevice) {+ localStorage.setItem("selectedVideoDevice", selectedVideoDevice);+ } else {+ localStorage.removeItem("selectedVideoDevice");+ }+ if (screenStream) {+ localStorage.setItem("screenStream", "true");+ } else {+ localStorage.removeItem("screenStream");+ }+ }, [selectedAudioDevice, selectedVideoDevice, screenStream]);++ return (+ <div className="z-[1000000] absolute top-0 left-0 w-full h-full bg-black flex items-center justify-center">+ <div className="z-[1000001] absolute bottom-4 left-1/2 transform -translate-x-1/2 w-[90%] h-16 bg-[#212024] flex items-center justify-center rounded-full">+ <div className="w-full max-w-[650px] mx-auto flex justify-center items-center space-x-2">+ <div className="group flex items-center justify-center relative">+ <button+ className={buttonStyles}+ onClick={() => setShowAudioOptions(!showAudioOptions)}+ >+ {selectedAudioDevice ? (+ <Mic className="w-4 h-4 text-white" />+ ) : (+ <MicOff className="w-4 h-4 text-white" />+ )}+ <div className="text-white text-xs">+ {selectedAudioDevice ? "Mute audio" : "Unmute audio"}+ </div>+ </button>+ {showAudioOptions && (+ <div className="z-[1000002] absolute bottom-full left-0 bg-[#212024] w-full text-white rounded-md shadow-lg">+ {audioDevices.map((device) => (+ <button+ key={device.deviceId}+ className="block w-full px-4 py-2 text-left hover:bg-[#2e2d32]"+ onClick={() => {+ setSelectedAudioDevice(device.deviceId);+ setShowAudioOptions(false);+ }}+ >+ {device.label}+ </button>+ ))}+ </div>+ )}+ <button+ className="flex items-center justify-center absolute top-0 right-0 w-5 h-full hover:bg-[#424147] flex-grow rounded-tr-xl rounded-br-xl"+ onClick={() => setShowAudioOptions(!showAudioOptions)}+ >+ <ChevronUp className="w-2.5 h-2.5 text-white" />+ </button>+ </div>+ <div className="group flex items-center justify-center relative">+ <button+ className={buttonStyles}+ onClick={() => setShowVideoOptions(!showVideoOptions)}+ >+ {selectedVideoDevice ? (+ <Video className="w-4 h-4 text-white" />+ ) : (+ <VideoOff className="w-4 h-4 text-white" />+ )}+ <div className="text-white text-xs">+ {selectedVideoDevice ? "Stop camera" : "Show camera"}+ </div>+ </button>+ {showVideoOptions && (+ <div className="z-[1000002] absolute bottom-full left-0 bg-[#212024] w-full text-white rounded-md shadow-lg">+ {videoDevices.map((device) => (+ <button+ key={device.deviceId}+ className="block w-full px-4 py-2 text-left hover:bg-[#2e2d32]"+ onClick={() => {+ setSelectedVideoDevice(device.deviceId);+ startVideoCapture(device.deviceId);+ setShowVideoOptions(false);+ }}+ >+ {device.label}+ </button>+ ))}+ </div>+ )}+ <button+ className="flex items-center justify-center absolute top-0 right-0 w-5 h-full hover:bg-[#424147] flex-grow rounded-tr-xl rounded-br-xl"+ onClick={() => setShowVideoOptions(!showVideoOptions)}+ >+ <ChevronUp className="w-2.5 h-2.5 text-white" />+ </button>+ </div>+ <div className="group flex flex-col items-center justify-center">+ <button+ onClick={() => {+ isRecording ? stopRecording() : startRecording();+ }}+ className="px-4 cursor-pointer disabled:cursor-not-allowed group"+ >+ <div className="shadow-recording-button group-enabled:hover:shadow-recording-heavy-button w-12 h-12 rounded-full flex items-center justify-center border border-red-700/50 border-4 group-enabled:hover:border-red-700 duration-300 transition">+ <div className="bg-red-700 group-disabled:!bg-red-700/50 transition duration-500 group-enabled:hover:!bg-red-700 w-8 h-8 rounded-full" />+ </div>+ </button>+ </div>+ <div className="group flex items-center justify-center">+ <button+ className={buttonStyles + " pl-5 pr-5"}+ onClick={screenStream ? stopScreenCapture : startScreenCapture}+ >+ <Monitor className="w-4 h-4 text-white" />+ <div className="text-white text-xs">+ {screenStream ? "Stop screen" : "Show screen"}+ </div>+ </button>+ </div>+ <div className="group flex items-center justify-center">+ <button className={buttonStyles + " pl-5 pr-5"}>+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ className="w-4 h-4 text-white"+ viewBox="0 0 24 24"+ >+ <circle cx="12" cy="12" r="1"></circle>+ <circle cx="19" cy="12" r="1"></circle>+ <circle cx="5" cy="12" r="1"></circle>+ </svg>+ <div className="text-white text-xs">More</div>+ </button>+ </div>+ </div>+ </div>+ {(screenStream || videoStream) && (+ <div className="aspect-video absolute top-8 left-0 w-full h-[calc(100%-8rem)] object-contain">+ <video+ id="screenPreview"+ ref={(video) => {+ if (video) {+ video.srcObject = screenStream;+ }+ }}+ autoPlay+ muted+ className="w-full h-full object-contain"+ />+ {videoStream && (+ <Rnd+ default={{+ x: 0,+ y: 0,+ width: 200,+ height: 200,+ }}+ bounds="parent"+ className="absolute bottom-8 left-8"+ lockAspectRatio={true}+ >+ <div className="w-full h-full rounded-full overflow-hidden">+ <video+ id="webcamPreview"+ ref={(video) => {+ if (video) {+ video.srcObject = videoStream;+ }+ }}+ autoPlay+ muted+ className="w-full h-full object-cover"+ />+ </div>+ </Rnd>+ )}+ </div>+ )}+ </div>+ );+};diff --git a/apps/web/app/dashboard/record/page.tsx b/apps/web/app/dashboard/record/page.tsxnew file mode 100644index 000000000..0c5c9be6e--- /dev/null+++ b/apps/web/app/dashboard/record/page.tsx@@ -0,0 +1,10 @@+import { Record } from "./Record";+import { getCurrentUser } from "@cap/database/auth/session";++export const revalidate = 0;++export default async function RecordPage() {+ const user = await getCurrentUser();++ return <Record user={user} />;+}diff --git a/apps/web/app/globals.css b/apps/web/app/globals.cssindex a9e09a240..af503b801 100644--- a/apps/web/app/globals.css+++ b/apps/web/app/globals.css@@ -326,3 +326,25 @@ slot:not(.dashboard-layout slot) {#scrolling-section slot {display: block;}++.shadow-recording-btn {+ --tw-shadow: 0px 0px 15px rgba(247, 74, 58, 0.2),+ 0px 0px 6px rgba(247, 74, 58, 0.1);+ --tw-shadow-colored: 0px 0px 15px var(--tw-shadow-color),+ 0px 0px 6px var(--tw-shadow-color);+}++.shadow-active-clip,+.shadow-recording-button {+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),+ var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);+}++.group:enabled .group-enabled\:hover\:shadow-recording-heavy-button:hover {+ --tw-shadow: 0px 0px 15px rgba(247, 74, 58, 0.4),+ 0px 0px 6px rgba(247, 74, 58, 0.2);+ --tw-shadow-colored: 0px 0px 15px var(--tw-shadow-color),+ 0px 0px 6px var(--tw-shadow-color);+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),+ var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);+}diff --git a/apps/web/app/onboarding/Onboarding.tsx b/apps/web/app/onboarding/Onboarding.tsxindex 7f4c2b009..018816b0a 100644--- a/apps/web/app/onboarding/Onboarding.tsx+++ b/apps/web/app/onboarding/Onboarding.tsx@@ -23,16 +23,19 @@ export const Onboarding = ({}) => {const router = useRouter();const [firstNameInput, setFirstNameInput] = useState("");+ const [loading, setLoading] = useState(false);const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {e.preventDefault();+ setLoading(true);+const formData = new FormData(e.currentTarget);const firstName = formData.get("firstName") as string;const lastName = formData.get("lastName") as string;try {- const response = await fetch("/api/settings/user/name", {+ const response = await fetch("/api/settings/onboarding", {method: "POST",headers: {"Content-Type": "application/json",@@ -46,9 +49,12 @@ export const Onboarding = ({} else {toast.error("Failed to update name");}++ setLoading(false);} catch (error) {console.error("Error updating name:", error);toast.error("An error occurred while updating name");+ setLoading(false);}};@@ -80,6 +86,7 @@ export const Onboarding = ({className="mx-auto"type="submit"size="lg"+ spinner={loading}>Complete</Button>diff --git a/apps/web/app/onboarding/page.tsx b/apps/web/app/onboarding/page.tsxindex 87a507b3a..c615172a2 100644--- a/apps/web/app/onboarding/page.tsx+++ b/apps/web/app/onboarding/page.tsx@@ -7,7 +7,13 @@ import { Onboarding } from "./Onboarding";export default async function OnboardingPage() {const user = await getCurrentUser();- if (user !== null && user.name !== null && user.name.length > 1) {+ if (+ user !== null &&+ user.name !== null &&+ user.name.length > 1 &&+ user.activeSpaceId !== null &&+ user.activeSpaceId.length > 1+ ) {redirect("/dashboard");}diff --git a/apps/web/package.json b/apps/web/package.jsonindex 076050318..55610fe4e 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -43,6 +43,7 @@"react-hook-form": "^7.49.2","react-hot-toast": "^2.4.1","react-player": "^2.14.1",+ "react-rnd": "^10.4.1","react-scroll-parallax": "^3.4.5","react-tooltip": "^5.26.3","resend": "1.1.0",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex d824708c3..ad8133a98 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -210,6 +210,9 @@ importers:react-player:specifier: ^2.14.1version: 2.14.1([email protected])+ react-rnd:+ specifier: ^10.4.1+ version: 10.4.1([email protected])([email protected])react-scroll-parallax:specifier: ^3.4.5version: 3.4.5([email protected])([email protected])@@ -5448,6 +5451,11 @@ packages:resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}engines: {node: '>=0.8'}+ resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==}+ engines: {node: '>=6'}+ dev: false+resolution: {integrity: sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==}engines: {node: '>=6'}@@ -6910,6 +6918,10 @@ packages:resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}dev: true+ resolution: {integrity: sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==}+ dev: false+resolution: {integrity: sha512-B9/wizE4WngqQftFPmdaMYlXoJlJOYxGQOanC77fq9k8+Z0v5dDSVh+3glErdIROP//s/jgb7ZuxKfB8nVyo0g==}hasBin: true@@ -9045,6 +9057,17 @@ packages:strip-json-comments: 2.0.1dev: true+ resolution: {integrity: sha512-0xYKS5+Z0zk+vICQlcZW+g54CcJTTmHluA7JUUgvERDxnKAnytylcyPsA+BSFi759s5hPlHmBRegFrwXs2FuBQ==}+ peerDependencies:+ react: ^16.13.1 || ^17.0.0 || ^18.0.0+ react-dom: ^16.13.1 || ^17.0.0 || ^18.0.0+ dependencies:+ fast-memoize: 2.5.2+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==}peerDependencies:@@ -9054,6 +9077,18 @@ packages:react: 18.2.0scheduler: 0.23.0+ resolution: {integrity: sha512-OMHzJdyJbYTZo4uQE393fHcqqPYsEtkjfMgvCHr6rejT+Ezn4OZbNyGH50vv+SunC1RMvwOTSWkEODQLzw1M9g==}+ peerDependencies:+ react: '>= 16.3.0'+ react-dom: '>= 16.3.0'+ dependencies:+ clsx: 1.2.1+ prop-types: 15.8.1+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+resolution: {integrity: sha512-nK92iY5TT2aD+YQNNQhnUbqy4dVd8jkRNmEAASbrkPU0/5btIP8o9YWlp1BNY1k26GU8qLiAAXm9TiWokYtbGA==}engines: {node: '>=18.0.0'}@@ -9199,6 +9234,19 @@ packages:use-sidecar: 1.1.2(@types/[email protected])([email protected])dev: false+ resolution: {integrity: sha512-0m887AjQZr6p2ADLNnipquqsDq4XJu/uqVqI3zuoGD19tRm6uB83HmZWydtkilNp5EWsOHbLGF4IjWMdd5du8Q==}+ peerDependencies:+ react: '>=16.3.0'+ react-dom: '>=16.3.0'+ dependencies:+ re-resizable: 6.9.6([email protected])([email protected])+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ react-draggable: 4.4.5([email protected])([email protected])+ tslib: 2.3.1+ dev: false+resolution: {integrity: sha512-tE13UukgUOh2/sqYr6jPzZTzmzc70aGRP4pAjG2if0IP3aUT+sBtAKUJh0qMh0zylJHGLmzS+XWVaON4UklHeg==}engines: {node: '>=14.0.0'}@@ -10148,6 +10196,10 @@ packages:resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}+ resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==}+ dev: false+resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}