Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Add experimental settings UI and related components
Brendan Allan619109a6944a
diff --git a/apps/desktop/src/routes/(window-chrome)/icons.tsx b/apps/desktop/src/routes/(window-chrome)/icons.tsxnew file mode 100644index 000000000..a706c5b3d--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/icons.tsx@@ -0,0 +1,22 @@+export const IconLucideFlaskConical = (props: { class: string }) => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+ class={props.class}+ >+ <path d="M9 3h6" />+ <path d="M10 9h4" />+ <path d="M9 3v6" />+ <path d="M15 3v6" />+ <path d="M3 20c0-3.5 4-6 4-6s4 2.5 4 6" />+ <path d="M17 20c0-3.5 4-6 4-6s4 2.5 4 6" />+ <path d="M9 20h12" />+ </svg>+ );+};\ No newline at end of filediff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsxindex 25ff9f764..3aee92597 100644--- a/apps/desktop/src/routes/(window-chrome)/settings.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx@@ -46,6 +46,11 @@ export default function Settings(props: RouteSectionProps) {name: "Integrations",icon: IconLucideUnplug,},+ {+ href: "experimental",+ name: "Experimental",+ icon: IconCapSettings,+ },{href: "feedback",name: "Feedback",diff --git a/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsx b/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsxnew file mode 100644index 000000000..7c8c31c4b--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsx@@ -0,0 +1,45 @@+import { Toggle } from "~/components/Toggle";++export function Setting(props: {+ pro?: boolean;+ label: string;+ description?: string;+ children: any;+}) {+ return (+ <div class="flex flex-row gap-2 justify-between items-start py-3 text-sm">+ <div class="flex flex-col justify-between items-start space-y-2">+ {props.pro && (+ <span class="px-2 py-1 text-xs font-medium rounded-lg text-solid-white bg-blue-9">+ Cap Pro+ </span>+ )}+ <div class="flex gap-2 items-center">+ <p class="text-gray-12">{props.label}</p>+ </div>+ {props.description && (+ <p class="text-xs text-gray-11">{props.description}</p>+ )}+ </div>+ {props.children}+ </div>+ );+}++export function ToggleSetting(props: {+ pro?: boolean;+ label: string;+ description?: string;+ value: boolean;+ onChange(v: boolean): void;+}) {+ return (+ <Setting {...props}>+ <Toggle+ size="sm"+ checked={props.value}+ onChange={(v) => props.onChange(v)}+ />+ </Setting>+ );+}diff --git a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsxnew file mode 100644index 000000000..33a4dedc9--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx@@ -0,0 +1,70 @@+import { createResource, Show } from "solid-js";+import { createStore } from "solid-js/store";++import { generalSettingsStore } from "~/store";+import { type GeneralSettingsStore } from "~/utils/tauri";+import { ToggleSetting } from "./Setting";++export default function ExperimentalSettings() {+ const [store] = createResource(() => generalSettingsStore.get());++ return (+ <Show when={store.state === "ready" && ([store()] as const)}>+ {(store) => <Inner initialStore={store()[0] ?? null} />}+ </Show>+ );+}++function Inner(props: { initialStore: GeneralSettingsStore | null }) {+ const [settings, setSettings] = createStore<GeneralSettingsStore>(+ props.initialStore ?? {+ uploadIndividualFiles: false,+ openEditorAfterRecording: false,+ hideDockIcon: false,+ autoCreateShareableLink: false,+ enableNotifications: true,+ }+ );++ const handleChange = async <K extends keyof typeof settings>(+ key: K,+ value: (typeof settings)[K]+ ) => {+ console.log(`Handling settings change for ${key}: ${value}`);++ setSettings(key as keyof GeneralSettingsStore, value);+ generalSettingsStore.set({ [key]: value });+ };++ return (+ <div class="flex flex-col w-full h-full">+ <div class="flex-1 custom-scroll">+ <div class="p-4 space-y-2 divide-y divide-gray-200">+ <div class="py-2 mb-4">+ <h2 class="text-[--text-primary] text-lg font-medium">+ Experimental Features+ </h2>+ <p class="text-[--text-secondary] text-sm">+ These features are still in development and may not work as+ expected.+ </p>+ </div>++ <ToggleSetting+ label="Custom cursor capture in Studio Mode"+ description="Studio Mode recordings will capture cursor state separately for customisation (size, smoothing) in the editor. Currently experimental as cursor events may not be captured accurately."+ value={!!settings.customCursorCapture}+ onChange={(value) => handleChange("customCursorCapture", value)}+ />++ <ToggleSetting+ label="System audio capture"+ description="Provides the option for you to capture audio coming from your system, such as music or video playback."+ value={!!settings.systemAudioCapture}+ onChange={(value) => handleChange("systemAudioCapture", value)}+ />+ </div>+ </div>+ </div>+ );+}diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsxindex 053229834..2cfcd05c1 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx@@ -26,6 +26,7 @@ import themePreviewDark from "~/assets/theme-previews/dark.jpg";import themePreviewLight from "~/assets/theme-previews/light.jpg";import { Toggle } from "~/components/Toggle";import { TextInput } from "~/routes/editor/TextInput";+import { Setting, ToggleSetting } from "./ToggleSetting";export default function GeneralSettings() {const [store] = createResource(() => generalSettingsStore.get());@@ -83,13 +84,10 @@ function AppearanceSection(props: {</div></div><span- class={cx(- `mt-2 text-sm transition-color duration-200`,- {- "text-blue-9": props.currentTheme === theme.id,- "text-gray-11": props.currentTheme !== theme.id,- }- )}+ class={cx(`mt-2 text-sm transition-color duration-200`, {+ "text-blue-9": props.currentTheme === theme.id,+ "text-gray-11": props.currentTheme !== theme.id,+ })}>{theme.name}</span>@@ -143,18 +141,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {value={!!settings.disableAutoOpenLinks}onChange={(value) => handleChange("disableAutoOpenLinks", value)}/>- <ToggleSetting- label="Enable custom cursor capture in Studio Mode (Experimental)"- description="Whether Studio Mode recordings should capture cursor state separately, for customisation (size, smoothing) in the editor. Currently experimental as cursor events may not be captured accurately."- value={!!settings.customCursorCapture}- onChange={(value) => handleChange("customCursorCapture", value)}- />- <ToggleSetting- label="System audio capture (Experimental)"- description="Provides the option for you to capture audio coming from your system, such as music or video playback."- value={!!settings.systemAudioCapture}- onChange={(value) => handleChange("systemAudioCapture", value)}- />+{ostype === "macos" && (<><ToggleSetting@@ -309,7 +296,6 @@ function ServerURLSetting(props: {/><Buttonsize="sm"-disabled={props.value === value()}onClick={() => props.onChange(value())}>@@ -319,48 +305,3 @@ function ServerURLSetting(props: {</Setting>);}--function Setting(- props: {- pro?: boolean;- label: string;- description?: string;- } & ParentProps-) {- return (- <div class="flex flex-row gap-2 justify-between items-start py-3 text-sm">- <div class="flex flex-col justify-between items-start space-y-2">- {props.pro && (- <span class="px-2 py-1 text-xs font-medium rounded-lg text-solid-white bg-blue-9">- Cap Pro- </span>- )}- <div class="flex gap-2 items-center">- <p class="text-gray-12">{props.label}</p>- </div>- {props.description && (- <p class="text-xs text-gray-11">{props.description}</p>- )}- </div>- {props.children}- </div>- );-}--function ToggleSetting(props: {- pro?: boolean;- label: string;- description?: string;- value: boolean;- onChange(v: boolean): void;-}) {- return (- <Setting {...props}>- <Toggle- size="sm"- checked={props.value}- onChange={(v) => props.onChange(v)}- />- </Setting>- );-}