Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

improve s3 connection page (#578)

Brendan Allan2a42da226365
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index ff39e3669..0e8410872 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -24,6 +24,7 @@
"@solid-primitives/context": "^0.2.3",
"@solid-primitives/date": "^2.0.23",
"@solid-primitives/deep": "^0.2.9",
+ "@solid-primitives/event-bus": "^1.1.1",
"@solid-primitives/event-listener": "^2.3.3",
"@solid-primitives/history": "^0.1.5",
"@solid-primitives/memo": "^1.4.2",
diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx
index 9117cbdcf..f790834e5 100644
--- a/apps/desktop/src/App.tsx
+++ b/apps/desktop/src/App.tsx
@@ -25,12 +25,13 @@ import { generalSettingsStore } from "./store";
import { initAnonymousUser } from "./utils/analytics";
import { commands, type AppTheme } from "./utils/tauri";
import titlebar from "./utils/titlebar-state";
+import { CapErrorBoundary } from "./components/CapErrorBoundary";
const queryClient = new QueryClient({
defaultOptions: {
mutations: {
onError: (e) => {
- message(`An error occured, here are the details:\n${e}`);
+ message(`Error\n${e.message}`);
},
},
},
@@ -74,39 +75,7 @@ function Inner() {
},
}}
/>
- <ErrorBoundary
- fallback={(e: Error) => {
- console.error(e);
- return (
- <div class="w-screen h-screen flex flex-col justify-center items-center bg-gray-2 border-gray-3 max-h-screen overflow-hidden transition-[border-radius] duration-200 text-[--text-secondary] gap-y-4 max-sm:gap-y-2 px-8 text-center">
- <IconCapLogo class="max-sm:size-16" />
- <h1 class="text-[--text-primary] text-3xl max-sm:text-xl font-bold">
- An Error Occured
- </h1>
- <p class="mb-2 max-sm:text-sm">
- We're very sorry, but something has gone wrong.
- </p>
- <div class="flex flex-row gap-4 max-sm:flex-col max-sm:gap-2">
- <Button
- onClick={() => {
- writeText(`${e.toString()}\n\n${e.stack}`);
- }}
- >
- Copy Error to Clipboard
- </Button>
- <Button
- onClick={() => {
- location.reload();
- }}
- variant="secondary"
- >
- Reload
- </Button>
- </div>
- </div>
- );
- }}
- >
+ <CapErrorBoundary>
<Router
root={(props) => {
const matches = useCurrentMatches();
@@ -134,7 +103,7 @@ function Inner() {
>
<FileRoutes />
</Router>
- </ErrorBoundary>
+ </CapErrorBoundary>
</>
);
}
diff --git a/apps/desktop/src/components/CapErrorBoundary.tsx b/apps/desktop/src/components/CapErrorBoundary.tsx
new file mode 100644
index 000000000..2de3d7258
--- /dev/null
+++ b/apps/desktop/src/components/CapErrorBoundary.tsx
@@ -0,0 +1,43 @@
+import { Button } from "@cap/ui-solid";
+import { writeText } from "@tauri-apps/plugin-clipboard-manager";
+import { ErrorBoundary, ParentProps } from "solid-js";
+
+export function CapErrorBoundary(props: ParentProps) {
+ return (
+ <ErrorBoundary
+ fallback={(e: Error) => {
+ console.error(e);
+ return (
+ <div class="w-full h-full flex flex-col justify-center items-center bg-gray-2 border-gray-3 max-h-screen overflow-hidden transition-[border-radius] duration-200 text-[--text-secondary] gap-y-4 max-sm:gap-y-2 px-8 text-center">
+ <IconCapLogo class="max-sm:size-16" />
+ <h1 class="text-[--text-primary] text-3xl max-sm:text-xl font-bold">
+ An Error Occured
+ </h1>
+ <p class="mb-2 max-sm:text-sm">
+ We're very sorry, but something has gone wrong.
+ </p>
+ <div class="flex flex-row gap-4 max-sm:flex-col max-sm:gap-2">
+ <Button
+ onClick={() => {
+ writeText(`${e.toString()}\n\n${e.stack}`);
+ }}
+ >
+ Copy Error to Clipboard
+ </Button>
+ <Button
+ onClick={() => {
+ location.reload();
+ }}
+ variant="secondary"
+ >
+ Reload
+ </Button>
+ </div>
+ </div>
+ );
+ }}
+ >
+ {props.children}
+ </ErrorBoundary>
+ );
+}
diff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsx
index c3f886498..5bf375911 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx
@@ -3,6 +3,7 @@ import { A, type RouteSectionProps } from "@solidjs/router";
import { getVersion } from "@tauri-apps/api/app";
import "@total-typescript/ts-reset/filter-boolean";
import { createResource, For, Show, Suspense } from "solid-js";
+import { CapErrorBoundary } from "~/components/CapErrorBoundary";
import { SignInButton } from "~/components/SignInButton";
import { authStore } from "~/store";
@@ -19,7 +20,6 @@ export default function Settings(props: RouteSectionProps) {
}
};
-
return (
<div class="flex-1 flex flex-row divide-x divide-gray-5 text-[0.875rem] leading-[1.25rem] overflow-y-hidden">
<div class="flex flex-col h-full bg-gray-2">
@@ -96,7 +96,9 @@ export default function Settings(props: RouteSectionProps) {
</div>
</div>
<div class="overflow-y-hidden flex-1 animate-in">
- <Suspense>{props.children}</Suspense>
+ <CapErrorBoundary>
+ <Suspense>{props.children}</Suspense>
+ </CapErrorBoundary>
</div>
</div>
);
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/integrations/index.tsx b/apps/desktop/src/routes/(window-chrome)/settings/integrations/index.tsx
index 9c311f78c..cc71c02ea 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/integrations/index.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/integrations/index.tsx
@@ -1,20 +1,19 @@
import { Button } from "@cap/ui-solid";
import { useNavigate } from "@solidjs/router";
-import { For, createResource } from "solid-js";
+import { For, createResource, onMount } from "solid-js";
import "@total-typescript/ts-reset/filter-boolean";
import { commands } from "~/utils/tauri";
+import { authStore } from "~/store";
export default function AppsTab() {
const navigate = useNavigate();
- // Add error handling for plan fetching
- const [isUpgraded] = createResource(async () => {
- try {
- return await commands.checkUpgradedAndUpdate();
- } catch (error) {
- console.error("Failed to fetch plan:", error);
- return false; // Default to not upgraded on error
- }
+ const auth = authStore.createQuery();
+
+ const isPro = () => auth.data?.plan?.upgraded;
+
+ onMount(() => {
+ void commands.checkUpgradedAndUpdate();
});
const apps = [
@@ -30,7 +29,7 @@ export default function AppsTab() {
const handleAppClick = async (app: (typeof apps)[number]) => {
try {
- if (app.pro && !isUpgraded()) {
+ if (app.pro && !isPro()) {
await commands.showWindow("Upgrade");
return;
}
@@ -57,15 +56,10 @@ export default function AppsTab() {
</div>
</div>
<Button
- variant={app.pro && !isUpgraded() ? "primary" : "secondary"}
+ variant={app.pro && !isPro() ? "primary" : "secondary"}
onClick={() => handleAppClick(app)}
- disabled={isUpgraded.loading}
>
- {isUpgraded.loading
- ? "Loading..."
- : app.pro && !isUpgraded()
- ? "Upgrade to Pro"
- : "Configure"}
+ {app.pro && !isPro() ? "Upgrade to Pro" : "Configure"}
</Button>
</div>
<div class="p-2">
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/integrations/s3-config.tsx b/apps/desktop/src/routes/(window-chrome)/settings/integrations/s3-config.tsx
index 7f3478159..040ab9e53 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/integrations/s3-config.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/integrations/s3-config.tsx
@@ -1,16 +1,20 @@
import { Button } from "@cap/ui-solid";
-import { getCurrentWindow } from "@tauri-apps/api/window";
-import { createSignal, onMount } from "solid-js";
+import { createWritableMemo } from "@solid-primitives/memo";
+import { useMutation } from "@tanstack/solid-query";
+import { createResource, Suspense } from "solid-js";
+import { createEventBus } from "@solid-primitives/event-bus";
+
import { commands } from "~/utils/tauri";
import { apiClient, protectedHeaders } from "~/utils/web-api";
+import { message } from "@tauri-apps/plugin-dialog";
interface S3Config {
provider: string;
- accessKeyId: string | null;
- secretAccessKey: string | null;
- endpoint: string | null;
- bucketName: string | null;
- region: string | null;
+ accessKeyId: string;
+ secretAccessKey: string;
+ endpoint: string;
+ bucketName: string;
+ region: string;
}
const DEFAULT_CONFIG = {
@@ -23,344 +27,245 @@ const DEFAULT_CONFIG = {
};
export default function S3ConfigPage() {
- const [provider, setProvider] = createSignal(DEFAULT_CONFIG.provider);
- const [accessKeyId, setAccessKeyId] = createSignal(
- DEFAULT_CONFIG.accessKeyId
- );
- const [secretAccessKey, setSecretAccessKey] = createSignal(
- DEFAULT_CONFIG.secretAccessKey
- );
- const [endpoint, setEndpoint] = createSignal(DEFAULT_CONFIG.endpoint);
- const [bucketName, setBucketName] = createSignal(DEFAULT_CONFIG.bucketName);
- const [region, setRegion] = createSignal(DEFAULT_CONFIG.region);
- const [saving, setSaving] = createSignal(false);
- const [loading, setLoading] = createSignal(true);
- const [deleting, setDeleting] = createSignal(false);
- const [hasConfig, setHasConfig] = createSignal(false);
- const [testing, setTesting] = createSignal(false);
-
- const resetForm = () => {
- setProvider(DEFAULT_CONFIG.provider);
- setAccessKeyId(DEFAULT_CONFIG.accessKeyId);
- setSecretAccessKey(DEFAULT_CONFIG.secretAccessKey);
- setEndpoint(DEFAULT_CONFIG.endpoint);
- setBucketName(DEFAULT_CONFIG.bucketName);
- setRegion(DEFAULT_CONFIG.region);
- setHasConfig(false);
- };
-
- const handleAuthError = async () => {
- console.error("User not authenticated");
- const window = getCurrentWindow();
- window.close();
- };
+ const [_s3Config, { refetch }] = createResource(async () => {
+ const response = await apiClient.desktop.getS3Config({
+ headers: await protectedHeaders(),
+ });
- onMount(async () => {
- try {
- const response = await apiClient.desktop.getS3Config({
- headers: await protectedHeaders(),
- });
-
- if (response.status !== 200) throw new Error("Failed to fetch S3 config");
+ if (response.status !== 200) throw new Error("Failed to fetch S3 config");
- if (response.body.config) {
- const config = response.body.config;
- if (!config.accessKeyId) return;
-
- setProvider(config.provider || DEFAULT_CONFIG.provider);
- setAccessKeyId(config.accessKeyId || DEFAULT_CONFIG.accessKeyId);
- setSecretAccessKey(
- config.secretAccessKey || DEFAULT_CONFIG.secretAccessKey
- );
- setEndpoint(config.endpoint || DEFAULT_CONFIG.endpoint);
- setBucketName(config.bucketName || DEFAULT_CONFIG.bucketName);
- setRegion(config.region || DEFAULT_CONFIG.region);
- setHasConfig(true);
- }
- } catch (error) {
- console.error("Failed to fetch S3 config:", error);
- } finally {
- setLoading(false);
- }
+ return response.body.config;
});
- const handleSave = async () => {
- setSaving(true);
- try {
+ const hasConfig = () => !!_s3Config()?.accessKeyId;
+
+ const saveConfig = useMutation(() => ({
+ mutationFn: async (config: S3Config) => {
const response = await apiClient.desktop.setS3Config({
- body: {
- provider: provider(),
- accessKeyId: accessKeyId(),
- secretAccessKey: secretAccessKey(),
- endpoint: endpoint(),
- bucketName: bucketName(),
- region: region(),
- },
+ body: config,
headers: await protectedHeaders(),
});
- if (response.status === 200) {
- setHasConfig(true);
- await commands.globalMessageDialog(
- "S3 configuration saved successfully"
- );
- }
- } catch (error) {
- console.error("Failed to save S3 config:", error);
- await commands.globalMessageDialog(
- "Failed to save S3 configuration. Please check your settings and try again."
- );
- } finally {
- setSaving(false);
- }
- };
+ if (response.status !== 200) throw new Error("Failed to save S3 config");
+ return response;
+ },
+ onSuccess: async () => {
+ await refetch();
+ await commands.globalMessageDialog("S3 configuration saved successfully");
+ },
+ }));
- const handleDelete = async () => {
- setDeleting(true);
- try {
+ const deleteConfig = useMutation(() => ({
+ mutationFn: async () => {
const response = await apiClient.desktop.deleteS3Config({
headers: await protectedHeaders(),
});
- if (response.status === 200) {
- resetForm();
- await commands.globalMessageDialog(
- "S3 configuration deleted successfully"
- );
- }
- } catch (error) {
- console.error("Failed to delete S3 config:", error);
+ if (response.status !== 200)
+ throw new Error("Failed to delete S3 config");
+ return response;
+ },
+ onSuccess: async () => {
+ await refetch();
await commands.globalMessageDialog(
- "Failed to delete S3 configuration. Please try again."
+ "S3 configuration deleted successfully"
);
- } finally {
- setDeleting(false);
- }
- };
+ },
+ }));
- const handleTest = async () => {
- setTesting(true);
- try {
+ const testConfig = useMutation(() => ({
+ mutationFn: async (config: S3Config) => {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5500); // 5.5s timeout (slightly longer than backend)
- const response = await apiClient.desktop.testS3Config({
- body: {
- provider: provider(),
- accessKeyId: accessKeyId(),
- secretAccessKey: secretAccessKey(),
- endpoint: endpoint(),
- bucketName: bucketName(),
- region: region(),
- },
- headers: await protectedHeaders(),
- });
+ try {
+ const response = await apiClient.desktop.testS3Config({
+ body: config,
+ headers: await protectedHeaders(),
+ fetchOptions: { signal: controller.signal },
+ });
- clearTimeout(timeoutId);
+ clearTimeout(timeoutId);
- if (response.status === 200) {
- await commands.globalMessageDialog(
- "S3 configuration test successful! Connection is working."
- );
- }
- } catch (error) {
- console.error("Failed to test S3 config:", error);
- let errorMessage =
- "Failed to connect to S3. Please check your settings and try again.";
+ if (response.status !== 200)
+ throw new Error(
+ `S3 connection test failed. Check your config and network connection.`
+ );
- if (error instanceof Error) {
- if (error.name === "AbortError") {
- errorMessage =
- "Connection test timed out after 5 seconds. Please check your endpoint URL and network connection.";
- } else if ("response" in error) {
- try {
- const errorResponse = (error as { response: Response }).response;
- const errorData = await errorResponse.json();
- if (errorData?.error) {
- errorMessage = errorData.error;
- }
- } catch (e) {
- // If we can't parse the error response, use the default message
- }
+ return response;
+ } catch (error) {
+ clearTimeout(timeoutId);
+
+ if (error instanceof Error) {
+ if (error.name === "AbortError")
+ throw new Error(
+ "Connection test timed out after 5 seconds. Please check your endpoint URL and network connection."
+ );
}
- }
- await commands.globalMessageDialog(errorMessage);
- } finally {
- setTesting(false);
- }
- };
+ throw error;
+ }
+ },
+ onSuccess: async () => {
+ await commands.globalMessageDialog(
+ "S3 configuration test successful! Connection is working."
+ );
+ },
+ }));
- const renderInput = (
- label: string,
- value: () => string,
- setter: (value: string) => void,
- placeholder: string,
- type: "text" | "password" = "text"
- ) => (
- <div>
- <label class="text-sm text-gray-12">{label}</label>
- <input
- type={type}
- value={value()}
- onInput={(e: InputEvent & { currentTarget: HTMLInputElement }) =>
- setter(e.currentTarget.value)
- }
- placeholder={placeholder}
- class="px-3 py-2 w-full rounded-lg border border-gray-3 focus:outline-none focus:ring-2 focus:ring-blue-500"
- autocomplete="off"
- autocapitalize="off"
- autocorrect="off"
- spellcheck={false}
- />
- </div>
- );
+ const events = createEventBus<"save" | "test">();
return (
<div class="flex flex-col h-full">
- <div class="overflow-y-auto flex-1">
- <div class="p-4 space-y-4">
- {loading() ? (
- <div class="flex justify-center items-center h-32">
- <div class="w-8 h-8 rounded-full border-b-2 border-gray-900 animate-spin"></div>
+ <div class="overflow-y-auto flex-1 p-4">
+ <Suspense
+ fallback={
+ <div class="flex w-full h-full justify-center items-center">
+ <IconCapLogo class="size-16 animate-spin" />
</div>
- ) : (
- <div class="space-y-4">
+ }
+ >
+ {(() => {
+ const [s3Config, setS3Config] = createWritableMemo(
+ () => _s3Config.latest ?? DEFAULT_CONFIG
+ );
+
+ const renderInput = (
+ label: string,
+ key: keyof ReturnType<typeof s3Config>,
+ placeholder: string,
+ type: "text" | "password" = "text"
+ ) => (
<div>
- <p class="text-sm text-gray-11">
- It should take under 10 minutes to set up and connect your
- storage bucket to Cap. View the{" "}
- <a
- href="https://cap.so/docs/s3-config"
- target="_blank"
- class="font-semibold text-gray-12 underline"
- >
- Storage Config Guide
- </a>{" "}
- to get started.
- </p>
+ <label class="text-sm text-gray-12">{label}</label>
+ <input
+ type={type}
+ value={s3Config()[key] ?? ""}
+ onInput={(
+ e: InputEvent & { currentTarget: HTMLInputElement }
+ ) =>
+ setS3Config({ ...s3Config(), [key]: e.currentTarget.value })
+ }
+ placeholder={placeholder}
+ class="px-3 py-2 w-full rounded-lg bg-gray-1 border border-gray-3 focus:outline-none focus:ring-2 focus:ring-blue-500"
+ autocomplete="off"
+ autocapitalize="off"
+ autocorrect="off"
+ spellcheck={false}
+ />
</div>
+ );
- <div>
- <label class="text-sm text-gray-12">Storage Provider</label>
- <div class="relative">
- <select
- value={provider()}
- onChange={(e) => setProvider(e.currentTarget.value)}
- class="px-3 py-2 pr-10 w-full bg-white rounded-lg border border-gray-3 appearance-none focus:outline-none focus:ring-2 focus:ring-blue-500"
- >
- <option value="aws">AWS S3</option>
- <option value="cloudflare">Cloudflare R2</option>
- <option value="supabase">Supabase</option>
- <option value="minio">MinIO</option>
- <option value="other">Other S3-Compatible</option>
- </select>
- <div class="flex absolute inset-y-0 right-0 items-center px-2 pointer-events-none">
- <svg
- class="w-4 h-4 text-gray-11"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 20 20"
- fill="currentColor"
+ events.listen((v) => {
+ if (v === "save") saveConfig.mutate(s3Config());
+ else if (v === "test") testConfig.mutate(s3Config());
+ });
+
+ return (
+ <div class="space-y-4 animate-in fade-in">
+ <div>
+ <p class="text-sm text-gray-11">
+ It should take under 10 minutes to set up and connect your
+ storage bucket to Cap. View the{" "}
+ <a
+ href="https://cap.so/docs/s3-config"
+ target="_blank"
+ class="font-semibold text-gray-12 underline"
+ >
+ Storage Config Guide
+ </a>{" "}
+ to get started.
+ </p>
+ </div>
+
+ <div>
+ <label class="text-sm text-gray-12">Storage Provider</label>
+ <div class="relative">
+ <select
+ value={s3Config().provider}
+ onChange={(e) =>
+ setS3Config((c) => ({
+ ...c,
+ provider: e.currentTarget.value,
+ }))
+ }
+ class="px-3 py-2 pr-10 w-full bg-gray-1 rounded-lg border border-gray-3 appearance-none focus:outline-none focus:ring-2 focus:ring-blue-500"
>
- <path
- fill-rule="evenodd"
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
- clip-rule="evenodd"
- />
- </svg>
+ <option value="aws">AWS S3</option>
+ <option value="cloudflare">Cloudflare R2</option>
+ <option value="supabase">Supabase</option>
+ <option value="minio">MinIO</option>
+ <option value="other">Other S3-Compatible</option>
+ </select>
+ <div class="flex absolute inset-y-0 right-0 items-center px-2 pointer-events-none">
+ <svg
+ class="w-4 h-4 text-gray-11"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 20 20"
+ fill="currentColor"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ </div>
</div>
</div>
- </div>
- {renderInput(
- "Access Key ID",
- accessKeyId,
- setAccessKeyId,
- "PL31OADSQNK",
- "password"
- )}
- {renderInput(
- "Secret Access Key",
- secretAccessKey,
- setSecretAccessKey,
- "PL31OADSQNK",
- "password"
- )}
- {renderInput(
- "Endpoint",
- endpoint,
- setEndpoint,
- "https://s3.amazonaws.com"
- )}
- {renderInput(
- "Bucket Name",
- bucketName,
- setBucketName,
- "my-bucket"
- )}
- {renderInput("Region", region, setRegion, "us-east-1")}
- </div>
- )}
- </div>
+ {renderInput(
+ "Access Key ID",
+ "accessKeyId",
+ "PL31OADSQNK",
+ "password"
+ )}
+ {renderInput(
+ "Secret Access Key",
+ "secretAccessKey",
+ "PL31OADSQNK",
+ "password"
+ )}
+ {renderInput(
+ "Endpoint",
+ "endpoint",
+ "https://s3.amazonaws.com"
+ )}
+ {renderInput("Bucket Name", "bucketName", "my-bucket")}
+ {renderInput("Region", "region", "us-east-1")}
+ </div>
+ );
+ })()}
+ </Suspense>
</div>
<div class="flex-shrink-0 p-4 border-t">
- <div class="flex justify-between items-center">
+ <fieldset
+ class="flex justify-between items-center"
+ disabled={
+ _s3Config.loading ||
+ saveConfig.isPending ||
+ deleteConfig.isPending ||
+ testConfig.isPending
+ }
+ >
<div class="flex gap-2">
- {hasConfig() && (
+ {!_s3Config.loading && hasConfig() && (
<Button
variant="destructive"
- onClick={handleDelete}
- disabled={deleting() || loading() || saving() || testing()}
- class={
- deleting() || loading() || saving() || testing()
- ? "opacity-50 cursor-not-allowed"
- : ""
- }
+ onClick={() => deleteConfig.mutate()}
>
- {deleting() ? "Removing..." : "Remove Config"}
+ {deleteConfig.isPending ? "Removing..." : "Remove Config"}
</Button>
)}
- <Button
- variant="secondary"
- onClick={handleTest}
- disabled={
- saving() ||
- loading() ||
- deleting() ||
- testing() ||
- !accessKeyId() ||
- !secretAccessKey() ||
- !bucketName()
- }
- class={
- saving() ||
- loading() ||
- deleting() ||
- testing() ||
- !accessKeyId() ||
- !secretAccessKey() ||
- !bucketName()
- ? "opacity-50 cursor-not-allowed"
- : ""
- }
- >
- {testing() ? "Testing..." : "Test Connection"}
+ <Button variant="secondary" onClick={() => events.emit("test")}>
+ {testConfig.isPending ? "Testing..." : "Test Connection"}
</Button>
</div>
- <Button
- variant="primary"
- onClick={handleSave}
- disabled={saving() || loading() || deleting() || testing()}
- class={
- saving() || loading() || deleting() || testing()
- ? "opacity-50 cursor-not-allowed"
- : ""
- }
- >
- {saving() ? "Saving..." : "Save"}
+ <Button variant="primary" onClick={() => events.emit("save")}>
+ {saveConfig.isPending ? "Saving..." : "Save"}
</Button>
- </div>
+ </fieldset>
</div>
</div>
);
diff --git a/apps/web/app/dashboard/caps/components/CapCard.tsx b/apps/web/app/dashboard/caps/components/CapCard.tsx
index a84927726..c1c7ed04b 100644
--- a/apps/web/app/dashboard/caps/components/CapCard.tsx
+++ b/apps/web/app/dashboard/caps/components/CapCard.tsx
@@ -64,9 +64,7 @@ export const CapCard = ({
const [isEditing, setIsEditing] = useState(false);
const [title, setTitle] = useState(cap.name);
const [isSharingDialogOpen, setIsSharingDialogOpen] = useState(false);
- const [, setSharedOrganizations] = useState(
- cap.sharedOrganizations
- );
+ const [, setSharedOrganizations] = useState(cap.sharedOrganizations);
const [isDateEditing, setIsDateEditing] = useState(false);
const [copyPressed, setCopyPressed] = useState(false);
const [dateValue, setDateValue] = useState(
@@ -373,7 +371,7 @@ export const CapCard = ({
"block group",
anyCapSelected && "cursor-pointer pointer-events-none"
)}
- href={capUrl}
+ href={`/s/${cap.id}`}
>
<VideoThumbnail
imageClass={`${
@@ -391,7 +389,9 @@ export const CapCard = ({
)}
>
<div>
- <div className="h-[1.25rem] mb-1"> {/* Fixed height container */}
+ <div className="h-[1.25rem] mb-1">
+ {" "}
+ {/* Fixed height container */}
{isEditing && !sharedCapCard ? (
<textarea
rows={1}
@@ -418,7 +418,9 @@ export const CapCard = ({
)}
</div>
{renderSharedStatus()}
- <div className="mb-1 h-[1.5rem]"> {/* Fixed height container */}
+ <div className="mb-1 h-[1.5rem]">
+ {" "}
+ {/* Fixed height container */}
{isDateEditing && !sharedCapCard ? (
<div className="flex items-center h-full">
<input
diff --git a/packages/ui-solid/src/Button.tsx b/packages/ui-solid/src/Button.tsx
index 802c9eb81..22215f503 100644
--- a/packages/ui-solid/src/Button.tsx
+++ b/packages/ui-solid/src/Button.tsx
@@ -15,7 +15,7 @@ const styles = cva(
secondary:
"bg-gray-4 enabled:hover:opacity-80 text-gray-500 disabled:bg-gray-3 disabled:text-gray-10 outline-blue-300",
destructive:
- "bg-red-300 text-gray-50 dark:text-gray-500 enabled:hover:bg-red-400 disabled:bg-red-200 outline-red-300",
+ "bg-red-300 text-gray-50 dark:text-gray-12 dark:disabled:text-gray-10 enabled:hover:bg-red-400 disabled:bg-red-200 outline-red-300",
white:
"bg-gray-1 dark:bg-gray-12 enabled:hover:opacity-80 text-gray-500 dark:disabled:bg-gray-300 dark:disabled:text-gray-8 dark:text-gray-1 disabled:bg-gray-400 disabled:text-gray-8 outline-blue-300",
lightdark:
diff --git a/packages/web-api-contract/src/desktop.ts b/packages/web-api-contract/src/desktop.ts
index 689dcee49..e0899495a 100644
--- a/packages/web-api-contract/src/desktop.ts
+++ b/packages/web-api-contract/src/desktop.ts
@@ -70,11 +70,11 @@ const protectedContract = c.router(
200: z.object({
config: z.custom<{
provider: string;
- accessKeyId: string | null;
- secretAccessKey: string | null;
- endpoint: string | null;
- bucketName: string | null;
- region: string | null;
+ accessKeyId: string;
+ secretAccessKey: string;
+ endpoint: string;
+ bucketName: string;
+ region: string;
}>(),
}),
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e6c775b9f..3f2224203 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -68,6 +68,9 @@ importers:
'@solid-primitives/deep':
specifier: ^0.2.9
version: 0.2.10([email protected])
+ '@solid-primitives/event-bus':
+ specifier: ^1.1.1
+ version: 1.1.1([email protected])
'@solid-primitives/event-listener':
specifier: ^2.3.3
version: 2.4.1([email protected])
@@ -4823,6 +4826,11 @@ packages:
peerDependencies:
solid-js: ^1.6.12
+ '@solid-primitives/[email protected]':
+ resolution: {integrity: sha512-UV164rO0k6wFyRoN1WukQ7OFxsll167TtBWZPdBtuFfNIbgb71Gj5obSc5eGEq/M1y3pq9VeHHuGDG/Uu1b2XA==}
+ peerDependencies:
+ solid-js: ^1.6.12
+
'@solid-primitives/[email protected]':
resolution: {integrity: sha512-Xc/lBCeuh9LwzR4lYbMDtopwWK7N9b4o+FmI4uoI8DOtVGYi0Ip20DG8PtwHk+g31lHgvwtFFVKfnUx2UaqZJg==}
peerDependencies:
@@ -5017,10 +5025,10 @@ packages:
react-dom:
optional: true
- '@storybook/[email protected]':
- resolution: {integrity: sha512-MUNSYSc30qO2Ppdz454PCp8IJyV56h+1DR+BjAYzLmF1857jIND3rdjGDHi/6cTjN7owlpFytSMzlQFUDgEXJg==}
+ '@storybook/[email protected]':
+ resolution: {integrity: sha512-xyE9Wyz/gc+TEsGSc9BIM0V5Y1RQgEUBEsUdBmC/7rV2JGwzjG31H7JaWgC/3q3rG2kUr24vjLAEsRDEIMeGhA==}
peerDependencies:
- storybook: ^9.0.0-rc.4
+ storybook: ^9.1.0-alpha.0
vite: ^5.0.0 || ^6.0.0
'@storybook/[email protected]':
@@ -5036,10 +5044,10 @@ packages:
peerDependencies:
storybook: ^8.6.12
- '@storybook/[email protected]':
- resolution: {integrity: sha512-ljiVNS+6Y7kYT0S5YmnLL20cVyPTwM4yUKGUbwH5xno6baS5MPAAIGrZD9zu0silC527NfEI1m3Yax8u9sSGKQ==}
+ '@storybook/[email protected]':
+ resolution: {integrity: sha512-8WDOzqago5Dt41cNjzyISYUAqzA22HPXc0SU8kb9JS1oYyOADbX2dvwngxybdcGRPxK0EMcgnZub96qKD4f+/g==}
peerDependencies:
- storybook: ^9.0.0-rc.4
+ storybook: ^9.1.0-alpha.0
'@storybook/[email protected]':
resolution: {integrity: sha512-bOmTNJE4FM6+3/1hPQVgha8cLxX2Nyi/4Z+tYq0pCDEyQqGRTD2KXre9XsSCnziRaGxiW80OrKkmqWY8Otuu4A==}
@@ -17576,6 +17584,11 @@ snapshots:
'@solid-primitives/memo': 1.4.2([email protected])
solid-js: 1.9.6
+ '@solid-primitives/[email protected]([email protected])':
+ dependencies:
+ '@solid-primitives/utils': 6.3.1([email protected])
+ solid-js: 1.9.6
+
'@solid-primitives/[email protected]([email protected])':
dependencies:
'@solid-primitives/utils': 6.3.1([email protected])
@@ -17821,9 +17834,9 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1([email protected])
dependencies:
- '@storybook/csf-plugin': 9.0.0-rc.4([email protected]([email protected]))
+ '@storybook/csf-plugin': 9.1.0-alpha.0([email protected]([email protected]))
storybook: 8.6.12([email protected])
ts-dedent: 2.2.0
@@ -17854,7 +17867,7 @@ snapshots:
storybook: 8.6.12([email protected])
unplugin: 1.16.1
dependencies:
storybook: 8.6.12([email protected])
unplugin: 1.16.1
@@ -20834,7 +20847,7 @@ snapshots:
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.10.1([email protected]([email protected]))([email protected])
eslint-plugin-jsx-a11y: 6.10.2([email protected])
eslint-plugin-react: 7.37.5([email protected])
eslint-plugin-react-hooks: 4.6.2([email protected])
@@ -20873,7 +20886,7 @@ snapshots:
tinyglobby: 0.2.13
unrs-resolver: 1.7.2
optionalDependencies:
transitivePeerDependencies:
- supports-color
@@ -20892,17 +20905,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- debug: 3.2.7
- optionalDependencies:
- '@typescript-eslint/parser': 5.62.0([email protected])([email protected])
- eslint: 8.57.1
- eslint-import-resolver-node: 0.3.9
- eslint-import-resolver-typescript: 3.10.1([email protected]([email protected]))([email protected])
- transitivePeerDependencies:
- - supports-color
-
dependencies:
debug: 3.2.7
@@ -20925,35 +20927,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- '@rtsao/scc': 1.1.0
- array-includes: 3.1.8
- array.prototype.findlastindex: 1.2.6
- array.prototype.flat: 1.3.3
- array.prototype.flatmap: 1.3.3
- debug: 3.2.7
- doctrine: 2.1.0
- eslint: 8.57.1
- eslint-import-resolver-node: 0.3.9
- hasown: 2.0.2
- is-core-module: 2.16.1
- is-glob: 4.0.3
- minimatch: 3.1.2
- object.fromentries: 2.0.8
- object.groupby: 1.0.3
- object.values: 1.2.1
- semver: 6.3.1
- string.prototype.trimend: 1.0.9
- tsconfig-paths: 3.15.0
- optionalDependencies:
- '@typescript-eslint/parser': 5.62.0([email protected])([email protected])
- transitivePeerDependencies:
- - eslint-import-resolver-typescript
- - eslint-import-resolver-webpack
- - supports-color
-
dependencies:
'@rtsao/scc': 1.1.0
@@ -26231,7 +26204,7 @@ snapshots:
dependencies:
'@storybook/types': 9.0.0-alpha.1([email protected]([email protected]))
magic-string: 0.30.17
solid-js: 1.9.6