Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
various tweaks and adjustments
ameer246870db37c6ed31
diff --git a/apps/desktop/src/routes/editor/ExportDialog.tsx b/apps/desktop/src/routes/editor/ExportDialog.tsxindex aa7abac84..b23fa2c02 100644--- a/apps/desktop/src/routes/editor/ExportDialog.tsx+++ b/apps/desktop/src/routes/editor/ExportDialog.tsx@@ -132,6 +132,8 @@ const ExportDialog = () => {link: <IconCapLink class="text-gray-500 size-4" />,};+ // States+const [exportState, setExportState] = createStore<ExportState>({type: "idle",});@@ -140,6 +142,14 @@ const ExportDialog = () => {type: "idle",});+ const [uploadState, setUploadState] = createStore<+ | { type: "idle" }+ | { type: "starting" }+ | { type: "rendering"; renderedFrames: number; totalFrames: number }+ | { type: "uploading"; progress: number }+ | { type: "link-copied" }+ >({ type: "idle" });+const copy = createMutation(() => ({mutationFn: async () => {setCopyState({@@ -169,7 +179,7 @@ const ExportDialog = () => {const outputPath = await commands.exportVideo(videoId,progress,- false,+ true,selectedFps(),{x: selectedResolution().width,@@ -195,8 +205,8 @@ const ExportDialog = () => {type: "copied",});setTimeout(() => {- setCopyState({ type: "idle" });- }, 2000);+ setDialog((d) => ({ ...d, open: false }));+ }, 1000);},}));@@ -257,6 +267,9 @@ const ExportDialog = () => {await commands.copyFileToPath(videoPath, path);setExportState({ type: "saving", done: false });+ setTimeout(() => {+ setDialog((d) => ({ ...d, open: false }));+ }, 1000);} catch (error) {throw error;}@@ -264,27 +277,10 @@ const ExportDialog = () => {onSettled() {setTimeout(() => {exportWithSettings.reset();- setDialog((d) => ({ ...d, open: false }));}, 1000);},}));- createProgressBar(() => {- if (exportWithSettings.isIdle || exportState.type === "idle") return;- if (exportState.type === "starting") return 0;- if (exportState.type === "rendering")- return (exportState.renderedFrames / exportState.totalFrames) * 100;- return 100;- });-- const [uploadState, setUploadState] = createStore<- | { type: "idle" }- | { type: "starting" }- | { type: "rendering"; renderedFrames: number; totalFrames: number }- | { type: "uploading"; progress: number }- | { type: "link-copied" }- >({ type: "idle" });-const uploadVideo = createMutation(() => ({mutationFn: async () => {setUploadState({ type: "idle" });@@ -413,6 +409,14 @@ const ExportDialog = () => {},}));+ createProgressBar(() => {+ if (exportWithSettings.isIdle || exportState.type === "idle") return;+ if (exportState.type === "starting") return 0;+ if (exportState.type === "rendering")+ return (exportState.renderedFrames / exportState.totalFrames) * 100;+ return 100;+ });+createProgressBar(() => {if (uploadVideo.isIdle || uploadState.type === "idle") return;if (uploadState.type === "starting") return 0;@@ -533,6 +537,7 @@ const ExportDialog = () => {variant="secondary"onClick={() => setFormat(option.value)}disabled={option.disabled}+ autofocus={false}class={cx(format() === option.value && selectedStyle)}@@ -755,7 +760,12 @@ const ExportDialog = () => {<CopyingContent copyState={copyState} /></Show>{/** Exporting to shareable link */}- <Show when={uploadState.type !== "idle" && uploadVideo.isPending}>+ <Show+ when={+ uploadState.type !== "idle" &&+ (uploadVideo.isPending || uploadState.type === "starting")+ }+ ><UploadingCapContent /></Show>{/** Exporting to file */}@@ -775,11 +785,13 @@ const CopyingContent = ({ copyState }: { copyState: CopyState }) => {<h1 class="text-lg font-medium text-gray-500">{copyState.type === "rendering"? "Rendering video..."- : copyState.type === "starting"- ? "Copying to clipboard..."- : "Copied to clipboard"}+ : copyState.type === "copied"+ ? "Copied to clipboard"+ : "Copying to clipboard..."}</h1>- <Show when={copyState.type === "rendering"}>+ <Show+ when={copyState.type === "rendering" || copyState.type === "starting"}+ ><div class="w-full bg-gray-200 rounded-full h-2.5"><divclass="bg-blue-300 h-2.5 rounded-full"@@ -796,12 +808,14 @@ const CopyingContent = ({ copyState }: { copyState: CopyState }) => {/></div></Show>- <Show when={copyState.type === "rendering"}>- <p class="text-xs text-gray-500">+ <Show+ when={copyState.type === "rendering" || copyState.type === "starting"}+ >+ <p class="text-xs">{copyState.type === "rendering"- ? `${Math.floor(- (copyState.renderedFrames / copyState.totalFrames) * 100- )}%`+ ? `${copyState.renderedFrames}/${copyState.totalFrames} frames`+ : copyState.type === "starting"+ ? "Preparing to render...": ""}</p></Show>@@ -815,33 +829,52 @@ const ExportingFileContent = ({exportState: ExportState;}) => {return (- <>- <div class="w-full bg-gray-200 rounded-full h-2.5 mb-2">- <div- class="bg-blue-300 h-2.5 rounded-full"- style={{- width: `${- exportState.type === "saving"- ? 100- : exportState.type === "rendering"- ? Math.min(- (exportState.renderedFrames / exportState.totalFrames) *- 100,- 100- )- : 0- }%`,- }}- />- </div>- <p class="relative z-10 mt-3 text-xs">- {exportState.type == "idle" || exportState.type === "starting"- ? "Preparing to render..."- : exportState.type === "rendering"- ? `Rendering video (${exportState.renderedFrames}/${exportState.totalFrames} frames)`- : "Exported successfully!"}- </p>- </>+ <div class="flex flex-col gap-4 justify-center items-center h-full">+ <h1 class="text-lg font-medium text-gray-500">+ {exportState.type === "rendering"+ ? "Rendering video..."+ : exportState.type === "saving"+ ? "Exported successfully"+ : "Exporting to file..."}+ </h1>+ <Show+ when={+ exportState.type === "starting" || exportState.type === "rendering"+ }+ >+ <div class="w-full bg-gray-200 rounded-full h-2.5">+ <div+ class="bg-blue-300 h-2.5 rounded-full"+ style={{+ width: `${+ exportState.type === "saving"+ ? 100+ : exportState.type === "rendering"+ ? Math.min(+ (exportState.renderedFrames / exportState.totalFrames) *+ 100,+ 100+ )+ : 0+ }%`,+ }}+ />+ </div>+ </Show>+ <Show+ when={+ exportState.type === "starting" || exportState.type === "rendering"+ }+ >+ <p class="text-xs">+ {exportState.type === "starting"+ ? "Preparing to render..."+ : exportState.type === "rendering"+ ? `${exportState.renderedFrames}/${exportState.totalFrames} frames`+ : ""}+ </p>+ </Show>+ </div>);};diff --git a/apps/desktop/src/routes/editor/Timeline.tsx b/apps/desktop/src/routes/editor/Timeline.tsxindex 9b216a835..af2203636 100644--- a/apps/desktop/src/routes/editor/Timeline.tsx+++ b/apps/desktop/src/routes/editor/Timeline.tsx@@ -403,7 +403,7 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {return (<divstyle={{- translate: `transformX(${+ transform: `translateX(${(markingTime - segmentStartTime) / secsPerPixel()}px)`,}}@@ -421,7 +421,7 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {<SegmentHandleposition="start"class={cx(- "absolute opacity-0 inset-y-0 z-10",+ "absolute inset-y-0 z-10 opacity-0","group-hover:opacity-100")}onMouseDown={(downEvent) => {@@ -494,7 +494,7 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {return (<Show when={ctx.width() > 100}><div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-500 whitespace-nowrap">- <span class="text-solid-white opacity-60">Clip</span>+ <span class="opacity-60 text-solid-white">Clip</span><div class="flex gap-1 items-center text-gray-50 dark:text-gray-500 text-md"><IconLucideClock class="size-3.5" />{" "}{(segment.end - segment.start).toFixed(1)}s@@ -513,7 +513,7 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {<SegmentHandleposition="end"class={cx(- "absolute opacity-0 inset-y-0 z-10",+ "absolute inset-y-0 z-10 opacity-0","group-hover:opacity-100")}onMouseDown={(downEvent) => {@@ -691,7 +691,7 @@ function ZoomTrack(props: {}}><SegmentContent class="bg-gradient-to-r zoom-gradient-border hover:border duration-300 hover:border-gray-500 from-[#292929] via-[#434343] to-[#292929] transition-colors group shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]">- <p class="w-full text-center dark:text-gray-500 text-md text-primary text-gray-50">+ <p class="w-full text-center text-gray-50 dark:text-gray-500 text-md text-primary">+</p></SegmentContent>@@ -786,7 +786,7 @@ function ZoomTrack(props: {><SegmentHandleposition="start"- class="absolute group-hover:opacity-100 opacity-0"+ class="absolute opacity-0 group-hover:opacity-100"onMouseDown={createMouseDownDrag(() => {const start = segment.start;@@ -867,7 +867,7 @@ function ZoomTrack(props: {return (<Show when={ctx.width() > 100}>- <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 dark:text-gray-500 whitespace-nowrap">+ <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 whitespace-nowrap dark:text-gray-500"><span class="opacity-70">Zoom</span><div class="flex gap-1 items-center text-md"><IconLucideSearch class="size-3.5" />{" "}@@ -880,7 +880,7 @@ function ZoomTrack(props: {</SegmentContent><SegmentHandleposition="end"- class="absolute group-hover:opacity-100 opacity-0"+ class="absolute opacity-0 group-hover:opacity-100"onMouseDown={createMouseDownDrag(() => {const end = segment.end;diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.tsindex 1d66134fe..bec835a0d 100644--- a/apps/desktop/src/routes/editor/context.ts+++ b/apps/desktop/src/routes/editor/context.ts@@ -332,7 +332,7 @@ export const [SegmentContextProvider, useSegmentContext] =- //This is used in ShareButton.tsx to notify the component that the metadata has changed, from ExportDialog.tsx+//This is used in ShareButton.tsx to notify the component that the metadata has changed, from ExportDialog.tsx//When a video is uploaded, the metadata is updatedconst [lastMetaUpdate, setLastMetaUpdate] = createSignal<{ videoId: string; timestamp: number } | null>(null);diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsxindex 2646e248d..f27a48559 100644--- a/apps/desktop/src/routes/editor/ui.tsx+++ b/apps/desktop/src/routes/editor/ui.tsx@@ -193,7 +193,7 @@ export const Dialog = {<KDialog.Contentclass={cx(props.contentClass,- "z-50 divide-y text-sm rounded-[1.25rem] overflow-hidden border border-gray-200 bg-gray-50 min-w-[22rem] ui-expanded:animate-in ui-expanded:fade-in ui-expanded:zoom-in-95 origin-top ui-closed:animate-out ui-closed:fade-out ui-closed:zoom-out-95",+ "z-50 text-sm rounded-[1.25rem] overflow-hidden border border-gray-200 bg-gray-50 min-w-[22rem] ui-expanded:animate-in ui-expanded:fade-in ui-expanded:zoom-in-95 origin-top ui-closed:animate-out ui-closed:fade-out ui-closed:zoom-out-95",(props.size ?? "sm") === "sm" ? "max-w-96" : "max-w-3xl")}>@@ -247,7 +247,15 @@ export const Dialog = {);},Content(props: ComponentProps<"div">) {- return <div {...props} class={cx("p-[1rem] flex flex-col", props.class)} />;+ return (+ <div+ {...props}+ class={cx(+ "p-[1rem] flex flex-col border-y border-gray-200",+ props.class+ )}+ />+ );},};