Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
wip: Cap embed feature styling
Richie McIlroy226a5d48cefd
diff --git a/apps/embed/app/layout.tsx b/apps/embed/app/layout.tsxindex 59f248938..7628e7cf7 100644--- a/apps/embed/app/layout.tsx+++ b/apps/embed/app/layout.tsx@@ -48,9 +48,9 @@ export default async function RootLayout({<meta name="msapplication-TileColor" content="#da532c" /><meta name="theme-color" content="#ffffff" /></head>- <body>+ <body className="w-screen h-screen"><Toaster />- <main className="w-full overflow-hidden">{children}</main>+ <main className="w-full h-full overflow-hidden">{children}</main></body></html>);diff --git a/apps/embed/app/view/[videoId]/Share.tsx b/apps/embed/app/view/[videoId]/Share.tsxindex 49c58434b..5a10e2df4 100644--- a/apps/embed/app/view/[videoId]/Share.tsx+++ b/apps/embed/app/view/[videoId]/Share.tsx@@ -14,10 +14,8 @@ export const Share = ({comments: (typeof commentsSchema.$inferSelect)[];}) => {return (- <div>- <div className="space-y-6">- <ShareVideo data={data} user={user} comments={comments} />- </div>+ <div className="w-full h-full space-y-6">+ <ShareVideo data={data} user={user} comments={comments} /></div>);};diff --git a/apps/embed/app/view/[videoId]/_components/ShareHeader.tsx b/apps/embed/app/view/[videoId]/_components/ShareHeader.tsxdeleted file mode 100644index 7e89913d6..000000000--- a/apps/embed/app/view/[videoId]/_components/ShareHeader.tsx+++ /dev/null@@ -1,128 +0,0 @@-import { Button, LogoBadge } from "@cap/ui";-import { videos } from "@cap/database/schema";-import moment from "moment";-import { userSelectProps } from "@cap/database/auth/session";-import { useRouter } from "next/navigation";-import { useState } from "react";-import { toast } from "react-hot-toast";-import { LinkIcon } from "lucide-react";-import { Tooltip } from "react-tooltip";--export const ShareHeader = ({- data,- user,-}: {- data: typeof videos.$inferSelect;- user: typeof userSelectProps | null;-}) => {- const { push, refresh } = useRouter();- const [isEditing, setIsEditing] = useState(false);- const [title, setTitle] = useState(data.name);-- const handleBlur = async () => {- setIsEditing(false);- const response = await fetch(- `${process.env.NEXT_PUBLIC_URL}/api/video/title`,- {- method: "PUT",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ title, videoId: data.id }),- }- );- if (!response.ok) {- toast.error("Failed to update title - please try again.");- return;- }-- toast.success("Video title updated");-- refresh();- };-- const handleKeyDown = async (event: { key: string }) => {- if (event.key === "Enter") {- handleBlur();- }- };-- return (- <>- <Tooltip data-tooltip-id="clipboard" />- <div>- <div className="md:flex md:items-center md:justify-between space-x-0 md:space-x-6">- <div className="flex items-center md:justify-between space-x-6">- <div>- <a- href={- user- ? "/dashboard"- : `${process.env.NEXT_PUBLIC_URL}?referrer=${data.id}`- }- >- <LogoBadge className="w-8 h-auto" />- </a>- </div>- <div>- {isEditing ? (- <input- value={title}- onChange={(e) => setTitle(e.target.value)}- onBlur={handleBlur}- onKeyDown={handleKeyDown}- autoFocus- className="text-2xl font-semibold"- />- ) : (- <h1- className="text-2xl"- onClick={() => {- if (user !== null && user.id.toString() === data.ownerId) {- setIsEditing(true);- }- }}- >- {title}- </h1>- )}- <p className="text-gray-400 text-sm">- {moment(data.createdAt).fromNow()}- </p>- </div>- <div>- <button- data-tooltip-id="clipboard"- data-tooltip-content="Copy link to clipboard"- className="bg-white p-2 w-8 h-8 rounded-lg flex items-center justify-center border hover:border-primary-3 transition-all"- onClick={() => {- if (process.env.NEXT_PUBLIC_IS_CAP) {- navigator.clipboard.writeText(- `https://cap.link/${data.id}`- );- } else {- navigator.clipboard.writeText(- `${process.env.NEXT_PUBLIC_URL}/s/${data.id}`- );- }- toast.success("Link copied to clipboard!");- }}- >- <LinkIcon className="w-5 h-5" />- </button>- </div>- </div>- {user !== null && (- <div className="hidden md:flex">- <Button- onClick={() => {- push(`${process.env.NEXT_PUBLIC_URL}/dashboard`);- }}- >- Go to Dashboard- </Button>- </div>- )}- </div>- </div>- </>- );-};diff --git a/apps/embed/app/view/[videoId]/_components/ShareVideo.tsx b/apps/embed/app/view/[videoId]/_components/ShareVideo.tsxindex dfa973087..98204c36a 100644--- a/apps/embed/app/view/[videoId]/_components/ShareVideo.tsx+++ b/apps/embed/app/view/[videoId]/_components/ShareVideo.tsx@@ -316,10 +316,10 @@ export const ShareVideo = ({if (data.jobStatus === "ERROR") {return (- <div className="flex items-center justify-center w-full h-full rounded-lg overflow-hidden">+ <div className="flex items-center justify-center w-full h-full overflow-hidden"><divstyle={{ paddingBottom: "min(806px, 56.25%)" }}- className="relative w-full h-full rounded-lg bg-black flex items-center justify-center p-8"+ className="relative w-full h-full bg-black flex items-center justify-center p-8"><p className="text-white text-xl">There was an error when processing the video. Please contact@@ -332,7 +332,7 @@ export const ShareVideo = ({return (<div- className="relative flex h-full w-full overflow-hidden shadow-lg rounded-lg group"+ className="relative flex h-full w-full overflow-hidden shadow-lg group"id="player">{isLoading && (@@ -390,7 +390,7 @@ export const ShareVideo = ({</div>)}<div- className="relative block w-full h-full rounded-lg bg-black"+ className="relative block w-full h-full bg-black"style={{ paddingBottom: "min(806px, 56.25%)" }}>{currentSubtitle && currentSubtitle.text && subtitlesVisible && (diff --git a/apps/embed/app/view/[videoId]/_components/Toolbar.tsx b/apps/embed/app/view/[videoId]/_components/Toolbar.tsxindex 6710a54f2..6e5e5b3d1 100644--- a/apps/embed/app/view/[videoId]/_components/Toolbar.tsx+++ b/apps/embed/app/view/[videoId]/_components/Toolbar.tsx@@ -5,6 +5,7 @@ import { videos } from "@cap/database/schema";import { userSelectProps } from "@cap/database/auth/session";import { useRouter } from "next/navigation";import { Button } from "@cap/ui";+import toast from "react-hot-toast";// million-ignoreexport const Toolbar = ({@@ -78,6 +79,11 @@ export const Toolbar = ({});+ if (response.status === 429) {+ toast.error("Too many requests - please try again later.");+ return;+ }+if (!response.ok) {console.error("Failed to record emoji reaction");}