Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat: Move header to index only
Richie McIlroy0fcad3bb88d2
diff --git a/apps/desktop-solid/src/App.tsx b/apps/desktop-solid/src/App.tsxindex 073ee20c1..00b78d8c5 100644--- a/apps/desktop-solid/src/App.tsx+++ b/apps/desktop-solid/src/App.tsx@@ -2,7 +2,6 @@ import { Router } from "@solidjs/router";import { FileRoutes } from "@solidjs/start/router";import { Suspense } from "solid-js";import { QueryClient, QueryClientProvider } from "@tanstack/solid-query";-import Header from "./components/Header";import "@cap/ui-solid/main.css";@@ -11,14 +10,11 @@ const queryClient = new QueryClient();export default function App() {return (<>- <Header />- <div class="px-3">- <QueryClientProvider client={queryClient}>- <Router root={(props) => <Suspense>{props.children}</Suspense>}>- <FileRoutes />- </Router>- </QueryClientProvider>- </div>+ <QueryClientProvider client={queryClient}>+ <Router root={(props) => <Suspense>{props.children}</Suspense>}>+ <FileRoutes />+ </Router>+ </QueryClientProvider></>);}diff --git a/apps/desktop-solid/src/routes/index.tsx b/apps/desktop-solid/src/routes/index.tsxindex cf1958d38..3fa9e80c6 100644--- a/apps/desktop-solid/src/routes/index.tsx+++ b/apps/desktop-solid/src/routes/index.tsx@@ -4,6 +4,7 @@ import { For, Show, Suspense, createSignal } from "solid-js";import { createCameraForLabel, createCameras } from "../utils/media";import { createOptionsQuery, createWindowsQuery } from "../utils/queries";import { commands, events } from "../utils/tauri";+import Header from "../components/Header";export default function () {const cameras = createCameras();@@ -65,176 +66,179 @@ export default function () {return (<>- <button- type="button"- onClick={() => commands.showPreviousRecordingsWindow()}- >- Open prev recordings window- </button>- <Suspense fallback="LOADING">- <Show when={options.data}>- {(options) => (- <>- <div class="max-w-64 space-y-4">- <div class="flex flex-col gap-1">- <label>Camera</label>- <div>- <select- class="w-full"- value={camera()?.deviceId}- onChange={(e) => {- const o = options();- const deviceId = e.target.value;- const label = cameras().find(- (c) => c.deviceId === deviceId- )?.label;- if (!label) return;-- commands.setRecordingOptions({- ...o,- cameraLabel: label,- });- }}- >- <For each={cameras()}>- {(camera) => (- <option value={camera.deviceId}>- {camera.label}- </option>- )}- </For>- </select>- {options().cameraLabel && (- <button- type="button"- onClick={() =>- commands.setRecordingOptions({- ...options(),- cameraLabel: null,- })- }- >- Remove- </button>- )}- </div>- </div>- <div>- <label>Capture</label>- <div class="flex flex-row justify-between gap-1">- <button- type="button"- class={cx(- "flex-1",- "screen" === options().captureTarget- ? "bg-neutral-200"- : "bg-neutral-100"- )}- onClick={() =>- commands.setRecordingOptions({- ...options(),- captureTarget: "screen",- })- }- >- Screen- </button>- <Show when={windows.data?.[0]}>- {(window) => (- <button- type="button"- class={cx(- "flex-1",- options().captureTarget !== "screen"- ? "bg-neutral-200"- : "bg-neutral-100"- )}- onClick={() => {- const captureTarget = options();- if (- typeof captureTarget === "object" &&- "window" in captureTarget- )- return;-- commands.setRecordingOptions({- ...options(),- captureTarget: { window: window().id },- });- }}- >- Window- </button>- )}- </Show>- </div>- <Show- when={(() => {- const captureTarget = options().captureTarget;- if (captureTarget === "screen") return;-- return {- windows: windows.data,- windowId: captureTarget.window,- };- })()}- >- {(data) => (+ <Header />+ <div class="px-3">+ <button+ type="button"+ onClick={() => commands.showPreviousRecordingsWindow()}+ >+ Open prev recordings window+ </button>+ <Suspense fallback="LOADING">+ <Show when={options.data}>+ {(options) => (+ <>+ <div class="max-w-64 space-y-4">+ <div class="flex flex-col gap-1">+ <label>Camera</label>+ <div><selectclass="w-full"- value={data().windowId}+ value={camera()?.deviceId}onChange={(e) => {const o = options();+ const deviceId = e.target.value;+ const label = cameras().find(+ (c) => c.deviceId === deviceId+ )?.label;+ if (!label) return;+commands.setRecordingOptions({...o,- captureTarget: { window: Number(e.target.value) },+ cameraLabel: label,});}}>- <For each={data().windows}>- {(window) => (- <option value={window.id}>{window.name}</option>+ <For each={cameras()}>+ {(camera) => (+ <option value={camera.deviceId}>+ {camera.label}+ </option>)}</For></select>- )}- </Show>- </div>- {+ {options().cameraLabel && (+ <button+ type="button"+ onClick={() =>+ commands.setRecordingOptions({+ ...options(),+ cameraLabel: null,+ })+ }+ >+ Remove+ </button>+ )}+ </div>+ </div><div>- {!isRecording() ? (- <button- type="button"- onClick={() =>- commands- .startRecording()- .then(() => setIsRecording(true))- }- >- Start Recording- </button>- ) : (+ <label>Capture</label>+ <div class="flex flex-row justify-between gap-1"><buttontype="button"+ class={cx(+ "flex-1",+ "screen" === options().captureTarget+ ? "bg-neutral-200"+ : "bg-neutral-100"+ )}onClick={() =>- commands- .stopRecording()- .then(() => setIsRecording(false))+ commands.setRecordingOptions({+ ...options(),+ captureTarget: "screen",+ })}>- Stop Recording+ Screen</button>- )}- <button type="button" onClick={testRender}>- Test Render- </button>+ <Show when={windows.data?.[0]}>+ {(window) => (+ <button+ type="button"+ class={cx(+ "flex-1",+ options().captureTarget !== "screen"+ ? "bg-neutral-200"+ : "bg-neutral-100"+ )}+ onClick={() => {+ const captureTarget = options();+ if (+ typeof captureTarget === "object" &&+ "window" in captureTarget+ )+ return;++ commands.setRecordingOptions({+ ...options(),+ captureTarget: { window: window().id },+ });+ }}+ >+ Window+ </button>+ )}+ </Show>+ </div>+ <Show+ when={(() => {+ const captureTarget = options().captureTarget;+ if (captureTarget === "screen") return;++ return {+ windows: windows.data,+ windowId: captureTarget.window,+ };+ })()}+ >+ {(data) => (+ <select+ class="w-full"+ value={data().windowId}+ onChange={(e) => {+ const o = options();+ commands.setRecordingOptions({+ ...o,+ captureTarget: { window: Number(e.target.value) },+ });+ }}+ >+ <For each={data().windows}>+ {(window) => (+ <option value={window.id}>{window.name}</option>+ )}+ </For>+ </select>+ )}+ </Show></div>- }- </div>- </>- )}- </Show>- </Suspense>+ {+ <div>+ {!isRecording() ? (+ <button+ type="button"+ onClick={() =>+ commands+ .startRecording()+ .then(() => setIsRecording(true))+ }+ >+ Start Recording+ </button>+ ) : (+ <button+ type="button"+ onClick={() =>+ commands+ .stopRecording()+ .then(() => setIsRecording(false))+ }+ >+ Stop Recording+ </button>+ )}+ <button type="button" onClick={testRender}>+ Test Render+ </button>+ </div>+ }+ </div>+ </>+ )}+ </Show>+ </Suspense>+ </div></>);}