Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

design: update desktop app buttons (#804)

Ameer Al Ashhab38e09541a100
diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsx
index 91a1e041f..6d1685bab 100644
--- a/apps/desktop/src/routes/(window-chrome)/(main).tsx
+++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx
@@ -3,8 +3,7 @@ import { useNavigate } from "@solidjs/router";
import {
createMutation,
createQuery,
- useQueryClient,
- UseQueryResult,
+ useQueryClient
} from "@tanstack/solid-query";
import { getVersion } from "@tauri-apps/api/app";
import { getCurrentWindow, LogicalSize } from "@tauri-apps/api/window";
@@ -297,17 +296,16 @@ function Page() {
await commands.showWindow("Upgrade");
}
}}
- class={`text-[0.6rem] ${
- license.data?.type === "pro"
- ? "bg-[--blue-400] text-gray-1 dark:text-gray-12"
- : "bg-gray-3 cursor-pointer hover:bg-gray-5"
- } rounded-lg px-1.5 py-0.5`}
+ class={`text-[0.6rem] ${license.data?.type === "pro"
+ ? "bg-[--blue-400] text-gray-1 dark:text-gray-12"
+ : "bg-gray-3 cursor-pointer hover:bg-gray-5"
+ } rounded-lg px-1.5 py-0.5`}
>
{license.data?.type === "commercial"
? "Commercial"
: license.data?.type === "pro"
- ? "Pro"
- : "Personal"}
+ ? "Pro"
+ : "Personal"}
</span>
</Suspense>
</ErrorBoundary>
@@ -338,7 +336,7 @@ function Page() {
"flex flex-row items-center rounded-[0.5rem] relative border h-8 transition-all duration-500",
(rawOptions.captureTarget.variant === "screen" ||
rawOptions.captureTarget.variant === "area") &&
- "ml-[2.4rem]"
+ "ml-[2.4rem]"
)}
style={{
"transition-timing-function":
@@ -433,7 +431,7 @@ function Page() {
) : (
<Button
disabled={toggleRecording.isPending}
- variant={isRecording() ? "destructive" : "primary"}
+ variant={isRecording() ? "destructive" : "blue"}
size="md"
onClick={() => toggleRecording.mutate()}
class="flex flex-grow justify-center items-center"
@@ -577,8 +575,8 @@ function AreaSelectButton(props: {
props.targetVariant === "area"
? "Remove selection"
: areaSelection.pending
- ? "Selecting area..."
- : "Select area"
+ ? "Selecting area..."
+ : "Select area"
}
childClass="flex fixed flex-row items-center w-8 h-8"
>
@@ -649,7 +647,7 @@ function AreaSelectButton(props: {
class={cx(
"w-[1rem] h-[1rem]",
areaSelection.pending &&
- "animate-gentle-bounce duration-1000 text-gray-12 mt-1"
+ "animate-gentle-bounce duration-1000 text-gray-12 mt-1"
)}
/>
</button>
@@ -973,8 +971,8 @@ function TargetSelectInfoPill<T>(props: {
{!props.permissionGranted
? "Request Permission"
: props.value !== null
- ? "On"
- : "Off"}
+ ? "On"
+ : "Off"}
</InfoPill>
);
}
diff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsx
index 4e825bce1..e3ec5cbd2 100644
--- a/apps/desktop/src/routes/editor/Editor.tsx
+++ b/apps/desktop/src/routes/editor/Editor.tsx
@@ -386,20 +386,21 @@ function Dialogs() {
<div class="flex flex-row gap-3 justify-end items-center w-full">
<div class="flex flex-row items-center space-x-[0.5rem] text-gray-11">
<Tooltip content="Rule of Thirds">
- <button
- type="button"
+ <Button
+ variant="secondary"
+ size="xs"
class={cx(
- "flex items-center bg-gray-3 justify-center text-center rounded-[0.5rem] h-[2rem] w-[2rem] border text-[0.875rem] focus:border-blue-9 outline-none transition-colors duration-200",
+ "flex items-center justify-center text-center rounded-full h-[2rem] w-[2rem] border text-[0.875rem] focus:border-blue-9",
cropOptions.showGrid
- ? "bg-gray-3 text-blue-9 border-blue-9"
- : "text-gray-12"
+ ? "border-blue-9"
+ : "border-transparent"
)}
onClick={() =>
setCropOptions("showGrid", (s) => !s)
}
>
- <IconCapPadding class="w-4" />
- </button>
+ <IconCapPadding class={cx("w-4", cropOptions.showGrid ? "text-blue-9" : "text-gray-12")} />
+ </Button>
</Tooltip>
</div>
<EditorButton
diff --git a/apps/desktop/src/routes/editor/ExportDialog.tsx b/apps/desktop/src/routes/editor/ExportDialog.tsx
index a4274f6ff..1340edbcc 100644
--- a/apps/desktop/src/routes/editor/ExportDialog.tsx
+++ b/apps/desktop/src/routes/editor/ExportDialog.tsx
@@ -50,11 +50,11 @@ export const COMPRESSION_OPTIONS: Array<{
label: string;
value: ExportCompression;
}> = [
- { label: "Minimal", value: "Minimal" },
- { label: "Social Media", value: "Social" },
- { label: "Web", value: "Web" },
- { label: "Potato", value: "Potato" },
-];
+ { label: "Minimal", value: "Minimal" },
+ { label: "Social Media", value: "Social" },
+ { label: "Web", value: "Web" },
+ { label: "Potato", value: "Potato" },
+ ];
export const FPS_OPTIONS = [
{ label: "15 FPS", value: 15 },
@@ -170,9 +170,9 @@ export function ExportDialog() {
}));
const exportButtonIcon: Record<"file" | "clipboard" | "link", JSX.Element> = {
- file: <IconCapFile class="text-solid-white size-4" />,
- clipboard: <IconCapCopy class="text-solid-white size-4" />,
- link: <IconCapLink class="text-solid-white size-4" />,
+ file: <IconCapFile class="text-gray-1 size-4" />,
+ clipboard: <IconCapCopy class="text-gray-1 size-4" />,
+ link: <IconCapLink class="text-gray-1 size-4" />,
};
const copy = createMutation(() => ({
@@ -211,8 +211,7 @@ export function ExportDialog() {
});
} else
toast.success(
- `${
- settings.format === "Gif" ? "GIF" : "Recording"
+ `${settings.format === "Gif" ? "GIF" : "Recording"
} exported to clipboard`
);
},
@@ -337,8 +336,8 @@ export function ExportDialog() {
const result = meta().sharing
? await commands.uploadExportedVideo(projectPath, "Reupload")
: await commands.uploadExportedVideo(projectPath, {
- Initial: { pre_created_video: null },
- });
+ Initial: { pre_created_video: null },
+ });
if (result === "NotAuthenticated")
throw new Error("You need to sign in to share recordings");
@@ -423,8 +422,8 @@ export function ExportDialog() {
return `${hours}:${minutes
.toString()
.padStart(2, "0")}:${seconds
- .toString()
- .padStart(2, "0")}`;
+ .toString()
+ .padStart(2, "0")}`;
}
return `${minutes}:${seconds
.toString()
@@ -455,8 +454,8 @@ export function ExportDialog() {
return `~${hours}:${minutes
.toString()
.padStart(2, "0")}:${seconds
- .toString()
- .padStart(2, "0")}`;
+ .toString()
+ .padStart(2, "0")}`;
}
return `~${minutes}:${seconds
.toString()
@@ -644,10 +643,10 @@ export function ExportDialog() {
settings.format === "Gif"
? [RESOLUTION_OPTIONS._720p]
: [
- RESOLUTION_OPTIONS._720p,
- RESOLUTION_OPTIONS._1080p,
- RESOLUTION_OPTIONS._4k,
- ]
+ RESOLUTION_OPTIONS._720p,
+ RESOLUTION_OPTIONS._1080p,
+ RESOLUTION_OPTIONS._4k,
+ ]
}
>
{(option) => (
@@ -712,12 +711,12 @@ export function ExportDialog() {
{copyState.type === "starting"
? "Preparing..."
: copyState.type === "rendering"
- ? settings.format === "Gif"
- ? "Rendering GIF..."
- : "Rendering video..."
- : copyState.type === "copying"
- ? "Copying to clipboard..."
- : "Copied to clipboard"}
+ ? settings.format === "Gif"
+ ? "Rendering GIF..."
+ : "Rendering video..."
+ : copyState.type === "copying"
+ ? "Copying to clipboard..."
+ : "Copied to clipboard"}
</h1>
<Show
when={
@@ -754,12 +753,12 @@ export function ExportDialog() {
{saveState.type === "starting"
? "Preparing..."
: saveState.type === "rendering"
- ? settings.format === "Gif"
- ? "Rendering GIF..."
- : "Rendering video..."
- : saveState.type === "copying"
- ? "Exporting to file..."
- : "Export completed"}
+ ? settings.format === "Gif"
+ ? "Rendering GIF..."
+ : "Rendering video..."
+ : saveState.type === "copying"
+ ? "Exporting to file..."
+ : "Export completed"}
</h1>
<Show
when={
@@ -937,8 +936,7 @@ export function ExportDialog() {
}, 2000);
await commands.copyVideoToClipboard(path);
toast.success(
- `${
- settings.format === "Gif" ? "GIF" : "Video"
+ `${settings.format === "Gif" ? "GIF" : "Video"
} copied to clipboard`
);
}
@@ -968,15 +966,14 @@ function RenderProgress(props: { state: RenderState; format?: ExportFormat }) {
amount={
props.state.type === "rendering"
? (props.state.progress.renderedCount /
- props.state.progress.totalFrames) *
- 100
+ props.state.progress.totalFrames) *
+ 100
: 0
}
label={
props.state.type === "rendering"
- ? `Rendering ${props.format === "Gif" ? "GIF" : "video"} (${
- props.state.progress.renderedCount
- }/${props.state.progress.totalFrames} frames)`
+ ? `Rendering ${props.format === "Gif" ? "GIF" : "video"} (${props.state.progress.renderedCount
+ }/${props.state.progress.totalFrames} frames)`
: "Preparing to render..."
}
/>
diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsx
index 89f6d3a20..dcf28760b 100644
--- a/apps/desktop/src/routes/editor/Header.tsx
+++ b/apps/desktop/src/routes/editor/Header.tsx
@@ -179,7 +179,7 @@ export function Header() {
</Show>
<Button
variant="lightdark"
- class={cx("flex gap-2 justify-center")}
+ class={cx("flex gap-1.5 justify-center h-[40px]")}
onClick={() => {
trackEvent("export_button_clicked");
if (exportState.type === "done") setExportState({ type: "idle" });
@@ -187,7 +187,7 @@ export function Header() {
setDialog({ type: "export", open: true });
}}
>
- <UploadIcon class="text-gray-1 size-5" />
+ <UploadIcon class="text-gray-1 size-4" />
Export
</Button>
{ostype() === "windows" && <CaptionControlsWindows11 />}
diff --git a/apps/desktop/src/routes/editor/ShareButton.tsx b/apps/desktop/src/routes/editor/ShareButton.tsx
index 431f9473d..66cb92240 100644
--- a/apps/desktop/src/routes/editor/ShareButton.tsx
+++ b/apps/desktop/src/routes/editor/ShareButton.tsx
@@ -97,8 +97,8 @@ function ShareButton() {
const result = meta().sharing
? await commands.uploadExportedVideo(projectPath, "Reupload")
: await commands.uploadExportedVideo(projectPath, {
- Initial: { pre_created_video: null },
- });
+ Initial: { pre_created_video: null },
+ });
if (result === "NotAuthenticated") {
throw new Error("You need to sign in to share recordings");
@@ -150,8 +150,8 @@ function ShareButton() {
const customUrl = () =>
customDomain.data?.custom_domain
? new URL(
- customDomain.data?.custom_domain + `/s/${meta().sharing?.id}`
- )
+ customDomain.data?.custom_domain + `/s/${meta().sharing?.id}`
+ )
: null;
const normalLink = `${normalUrl().host}${normalUrl().pathname}`;
@@ -190,7 +190,7 @@ function ShareButton() {
disabled={upload.isPending}
onClick={() => upload.mutate()}
variant="primary"
- class="flex justify-center items-center size-[41px] !px-0 !py-0 space-x-1 rounded-xl"
+ class="flex justify-center items-center size-[41px] !px-0 !py-0 space-x-1"
>
{upload.isPending ? (
<IconLucideLoaderCircle class="animate-spin size-4" />
@@ -291,20 +291,19 @@ function ShareButton() {
<div
class="bg-blue-9 h-2.5 rounded-full"
style={{
- width: `${
- uploadState.type === "uploading"
+ width: `${uploadState.type === "uploading"
? uploadState.progress
: uploadState.type === "link-copied"
- ? 100
- : uploadState.type === "rendering"
- ? Math.min(
- (uploadState.renderedFrames /
- uploadState.totalFrames) *
+ ? 100
+ : uploadState.type === "rendering"
+ ? Math.min(
+ (uploadState.renderedFrames /
+ uploadState.totalFrames) *
100,
- 100
- )
- : 0
- }%`,
+ 100
+ )
+ : 0
+ }%`,
}}
/>
</div>
@@ -313,10 +312,10 @@ function ShareButton() {
{uploadState.type == "idle" || uploadState.type === "starting"
? "Preparing to render..."
: uploadState.type === "rendering"
- ? `Rendering video (${uploadState.renderedFrames}/${uploadState.totalFrames} frames)`
- : uploadState.type === "uploading"
- ? `Uploading - ${Math.floor(uploadState.progress)}%`
- : "Link copied to clipboard!"}
+ ? `Rendering video (${uploadState.renderedFrames}/${uploadState.totalFrames} frames)`
+ : uploadState.type === "uploading"
+ ? `Uploading - ${Math.floor(uploadState.progress)}%`
+ : "Link copied to clipboard!"}
</p>
</div>
</DialogContent>
diff --git a/packages/ui-solid/src/Button.tsx b/packages/ui-solid/src/Button.tsx
index 80954fe22..9063de969 100644
--- a/packages/ui-solid/src/Button.tsx
+++ b/packages/ui-solid/src/Button.tsx
@@ -2,7 +2,7 @@ import { cva, type VariantProps } from "cva";
import type { ComponentProps } from "solid-js";
const styles = cva(
- "outline-offset-2 outline-2 focus-visible:outline rounded-full transition-all will-change-transform duration-200",
+ "outline-offset-2 outline-2 flex justify-center items-center focus-visible:outline rounded-full transition-all will-change-transform duration-200",
{
defaultVariants: {
variant: "primary",
@@ -10,6 +10,7 @@ const styles = cva(
},
variants: {
variant: {
+ blue: "bg-blue-9 text-white hover:bg-blue-10 disabled:bg-blue-400 disabled:text-gray-10 outline-blue-300 disabled:outline-blue-400",
primary:
"bg-gray-12 text-gray-1 hover:bg-gray-11 disabled:text-gray-10 outline-blue-300 disabled:bg-gray-4 disabled:dark:text-gray-9",
secondary: