Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Fix res selection + upload progress

ameer24687bb210978b57
diff --git a/apps/desktop/src/routes/editor/ExportDialog.tsx b/apps/desktop/src/routes/editor/ExportDialog.tsx
index 217cfc9bd..791bd817c 100644
--- a/apps/desktop/src/routes/editor/ExportDialog.tsx
+++ b/apps/desktop/src/routes/editor/ExportDialog.tsx
@@ -14,6 +14,7 @@ import {
} from "solid-js";
import { createStore, produce } from "solid-js/store";
+import { makePersisted } from "@solid-primitives/storage";
import Tooltip from "~/components/Tooltip";
import { authStore } from "~/store";
import { trackEvent } from "~/utils/analytics";
@@ -82,13 +83,16 @@ const ExportDialog = () => {
editorInstance,
} = useEditorContext();
- const [settings, setSettings] = createStore({
- format: "mp4",
- fps: 30,
- exportTo: "file" as ExportToOption,
- resolution: RESOLUTION_OPTIONS[0],
- compression: "social",
- });
+ const [settings, setSettings] = makePersisted(
+ createStore({
+ format: "mp4",
+ fps: 30,
+ exportTo: "file" as ExportToOption,
+ resolution: { label: "720p", value: "720p", width: 1280, height: 720 },
+ compression: "social",
+ }),
+ { name: "export_settings" }
+ );
const [copyPressed, setCopyPressed] = createSignal(false);
@@ -408,6 +412,8 @@ const ExportDialog = () => {
},
}));
+ console.log(settings.resolution.label);
+
return (
<>
<Show
@@ -654,8 +660,9 @@ const ExportDialog = () => {
<Button
class={cx(
"flex-1",
- settings.resolution.value === option.value &&
- selectedStyle
+ settings.resolution.value === option.value
+ ? selectedStyle
+ : ""
)}
variant="secondary"
onClick={() => setSettings("resolution", option)}
@@ -889,12 +896,41 @@ const UploadingSuccessContent = () => {
};
const UploadingCapContent = () => {
+ const { exportProgress, uploadState } = useEditorContext();
return (
- <div class="flex gap-2 justify-center items-center">
- <IconLucideLoaderCircle class="animate-spin size-7" />
+ <div class="flex flex-col gap-4 justify-center items-center">
<h1 class="text-lg font-medium text-center text-gray-500">
- Uploading Cap
+ Uploading Cap...
</h1>
+ <div class="w-full bg-gray-200 rounded-full h-2.5">
+ <div
+ class="bg-blue-300 h-2.5 rounded-full"
+ style={{
+ width: `${
+ uploadState.type === "uploading"
+ ? uploadState.progress
+ : uploadState.type === "rendering"
+ ? Math.min(
+ ((exportProgress()?.renderedFrames ?? 0) /
+ (exportProgress()?.totalFrames ?? 0)) *
+ 100,
+ 100
+ )
+ : 0
+ }%`,
+ }}
+ />
+ </div>
+ <p class="text-xs">
+ {uploadState.type == "idle" || uploadState.type === "starting"
+ ? "Preparing to render..."
+ : uploadState.type === "rendering"
+ ? `Rendering video (${exportProgress()?.renderedFrames}/${
+ exportProgress()?.totalFrames
+ } frames)`
+ : uploadState.type === "uploading" &&
+ `Uploading - ${Math.floor(uploadState.progress)}%`}
+ </p>
</div>
);
};
diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsx
index 3bc265c14..e40a10e54 100644
--- a/apps/desktop/src/routes/editor/Header.tsx
+++ b/apps/desktop/src/routes/editor/Header.tsx
@@ -36,8 +36,7 @@ export interface ExportEstimates {
}
export function Header() {
- const { editorInstance, history, setDialog, exportProgress } =
- useEditorContext();
+ const { editorInstance, history, setDialog } = useEditorContext();
let unlistenTitlebar: UnlistenFn | undefined;
onMount(async () => {
diff --git a/apps/desktop/src/routes/editor/ShareButton.tsx b/apps/desktop/src/routes/editor/ShareButton.tsx
index f52e6fd86..164851c1b 100644
--- a/apps/desktop/src/routes/editor/ShareButton.tsx
+++ b/apps/desktop/src/routes/editor/ShareButton.tsx
@@ -234,13 +234,7 @@ function ShareButton() {
</Show>
<Dialog.Root open={!uploadVideo.isIdle}>
<DialogContent
- title={
- uploadState.type === "uploading"
- ? "Creating Shareable Link"
- : uploadState.type === "link-copied"
- ? "Link Copied"
- : "Exporting Recording"
- }
+ title={"Reupload Recording"}
confirm={<></>}
close={<></>}
class="text-gray-500 bg-gray-600 dark:text-gray-500"