Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

disable fields not in use

Brendan Allanf5090b9fd144
diff --git a/apps/desktop-solid/src/routes/editor/Editor.tsx b/apps/desktop-solid/src/routes/editor/Editor.tsx
index 6451359ec..a5a379425 100644
--- a/apps/desktop-solid/src/routes/editor/Editor.tsx
+++ b/apps/desktop-solid/src/routes/editor/Editor.tsx
@@ -245,7 +245,9 @@ function Inner() {
<div class="flex-1" />
<div class="flex flex-row items-center justify-center gap-[0.5rem] text-gray-400 text-[0.875rem]">
<span>{formatTime(playbackTime())}</span>
- <IconCapFrameFirst class="size-[1.2rem]" />
+ <button type="button" disabled>
+ <IconCapFrameFirst class="size-[1.2rem]" />
+ </button>
{!playing() ? (
<button
type="button"
@@ -269,11 +271,14 @@ function Inner() {
<IconCapStopCircle class="size-[1.5rem]" />
</button>
)}
- <IconCapFrameLast class="size-[1rem]" />
+ <button type="button" disabled>
+ <IconCapFrameLast class="size-[1rem]" />
+ </button>
<span>{formatTime(duration())}</span>
</div>
<div class="flex-1 flex flex-row justify-end">
<EditorButton<typeof KToggleButton>
+ disabled
as={KToggleButton}
variant="danger"
leftIcon={<IconCapScissors />}
@@ -639,6 +644,7 @@ function SettingsSidebar() {
<KTabs.Trigger
class="flex-1 text-gray-400 py-1 z-10 ui-selected:text-gray-500 peer outline-none transition-colors duration-100"
value={item}
+ disabled={item === "wallpaper" || item === "image"}
>
{BACKGROUND_SOURCES[item]}
</KTabs.Trigger>
@@ -743,8 +749,10 @@ function SettingsSidebar() {
</KTabs.Content>
</KTabs>
</Field>
+
<Field name="Background Blur" icon={<IconCapBlur />}>
<Slider
+ disabled
value={[state.background.blur]}
onChange={(v) => setState("background", "blur", v[0])}
minValue={0}
@@ -771,6 +779,7 @@ function SettingsSidebar() {
</Field>
<Field name="Inset" icon={<IconCapInset />}>
<Slider
+ disabled
value={[state.background.inset]}
onChange={(v) => setState("background", "inset", v[0])}
minValue={0}
@@ -877,7 +886,7 @@ function SettingsSidebar() {
<Toggle />
</Subfield>
<Subfield name="Improve Mic Quality">
- <Toggle />
+ <Toggle disabled />
</Subfield>
</div>
</Field>
@@ -885,11 +894,12 @@ function SettingsSidebar() {
<KTabs.Content value="cursor" class="flex flex-col gap-6">
<Field name="Cursor" icon={<IconCapCursor />}>
<Subfield name="Hide cursor when not moving">
- <Toggle />
+ <Toggle disabled />
</Subfield>
</Field>
<Field name="Size" icon={<IconCapEnlarge />}>
<Slider
+ disabled
value={[state.cursor.size]}
onChange={(v) => setState("cursor", "size", v[0])}
minValue={0}
@@ -912,10 +922,11 @@ function SettingsSidebar() {
{(item) => (
<li>
<button
+ disabled
type="button"
onClick={() => setState("cursor", "type", item.type)}
data-selected={state.cursor.type === item.type}
- class="border border-black-transparent-5 bg-gray-100 rounded-lg p-[0.625rem] text-gray-400 data-[selected='true']:text-gray-500 focus-visible:outline-blue-300 focus-visible:outline outline-1 outline-offset-1"
+ class="border border-black-transparent-5 bg-gray-100 rounded-lg p-[0.625rem] text-gray-400 data-[selected='true']:text-gray-500 disabled:text-gray-300 focus-visible:outline-blue-300 focus-visible:outline outline-1 outline-offset-1"
>
<Dynamic
component={item.icon}
@@ -931,7 +942,7 @@ function SettingsSidebar() {
<KTabs.Content value="hotkeys">
<Field name="Hotkeys" icon={<IconCapHotkeys />}>
<Subfield name="Show hotkeys">
- <Toggle />
+ <Toggle disabled />
</Subfield>
</Field>
</KTabs.Content>
@@ -945,6 +956,7 @@ function AspectRatioSelect() {
return (
<KSelect<AspectRatio | "auto">
+ disabled
value={state.aspectRatio ?? "auto"}
onChange={(v) => {
if (v === null) return;
diff --git a/apps/desktop-solid/src/routes/editor/ui.tsx b/apps/desktop-solid/src/routes/editor/ui.tsx
index aa12c859e..5fd3bcf38 100644
--- a/apps/desktop-solid/src/routes/editor/ui.tsx
+++ b/apps/desktop-solid/src/routes/editor/ui.tsx
@@ -50,7 +50,7 @@ export function Toggle(props: ComponentProps<typeof KSwitch>) {
return (
<KSwitch {...props}>
<KSwitch.Input class="peer" />
- <KSwitch.Control class="rounded-full bg-gray-300 w-[3rem] h-[1.5rem] p-[0.125rem] ui-checked:bg-blue-300 transition-colors peer-focus-visible:outline outline-2 outline-offset-2 outline-blue-300">
+ <KSwitch.Control class="rounded-full bg-gray-300 ui-disabled:bg-gray-200 w-[3rem] h-[1.5rem] p-[0.125rem] ui-checked:bg-blue-300 transition-colors peer-focus-visible:outline outline-2 outline-offset-2 outline-blue-300">
<KSwitch.Thumb class="bg-gray-50 rounded-full size-[1.25rem] transition-transform ui-checked:translate-x-[calc(100%+0.25rem)]" />
</KSwitch.Control>
</KSwitch>
@@ -78,8 +78,12 @@ export function Slider(props: ComponentProps<typeof KSlider>) {
}}
>
<KSlider.Track class="h-[0.5rem] relative mx-1">
- <KSlider.Fill class="absolute bg-blue-100 h-full rounded-full -ml-2" />
- <KSlider.Thumb class="size-[1.25rem] bg-blue-300 -top-1.5 rounded-full outline-none outline-2 outline-offset-2 focus-visible:outline-blue-300" />
+ <KSlider.Fill class="absolute bg-blue-100 ui-disabled:bg-gray-300 h-full rounded-full -ml-2" />
+ <KSlider.Thumb
+ class={cx(
+ "size-[1.25rem] bg-blue-300 -top-1.5 rounded-full outline-none outline-2 outline-offset-2 focus-visible:outline-blue-300 ui-disabled:bg-gray-400"
+ )}
+ />
</KSlider.Track>
</KSlider>
);
@@ -227,14 +231,15 @@ const editorButtonStyles = cva(
[
"group flex flex-row items-center px-[0.375rem] gap-[0.375rem] h-[2rem] rounded-[0.5rem] text-[0.875rem]",
"focus-visible:outline outline-2 outline-offset-2 transition-colors duration-100",
+ "disabled:bg-gray-100 disabled:text-gray-400",
],
{
variants: {
variant: {
primary:
- "text-gray-500 hover:ui-not-pressed:bg-gray-100 ui-expanded:bg-gray-100 disabled:bg-gray-100 disabled:text-gray-400 outline-blue-300",
+ "text-gray-500 hover:ui-not-pressed:bg-gray-100 ui-expanded:bg-gray-100 outline-blue-300",
danger:
- "text-gray-500 hover:ui-not-pressed:bg-gray-100 ui-expanded:bg-red-300 ui-pressed:bg-red-300 ui-expanded:text-gray-50 ui-pressed:text-gray-50 disabled:bg-gray-100 outline-red-300",
+ "text-gray-500 hover:ui-not-pressed:bg-gray-100 ui-expanded:bg-red-300 ui-pressed:bg-red-300 ui-expanded:text-gray-50 ui-pressed:text-gray-50 outline-red-300",
},
},
defaultVariants: { variant: "primary" },