-
-
-
+
+
);
}
diff --git a/apps/app/src/components/tables/api-keys/create-api-key-dialog.tsx b/apps/app/src/components/tables/api-keys/create-api-key-dialog.tsx
index c4f651b6fd..099c4c6a87 100644
--- a/apps/app/src/components/tables/api-keys/create-api-key-dialog.tsx
+++ b/apps/app/src/components/tables/api-keys/create-api-key-dialog.tsx
@@ -11,6 +11,14 @@ import {
DialogHeader,
DialogTitle,
} from "@bubba/ui/dialog";
+import {
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetFooter,
+ SheetHeader,
+ SheetTitle,
+} from "@bubba/ui/sheet";
import { Input } from "@bubba/ui/input";
import {
Select,
@@ -23,7 +31,7 @@ import { Copy, Check, Loader2 } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
import { useState } from "react";
import { toast } from "sonner";
-import type { z } from "zod";
+import { useMediaQuery } from "@bubba/ui/hooks";
interface CreateApiKeyDialogProps {
open: boolean;
@@ -43,6 +51,7 @@ export function CreateApiKeyDialog({
>("never");
const [createdApiKey, setCreatedApiKey] = useState
(null);
const [copied, setCopied] = useState(false);
+ const isMobile = useMediaQuery("(max-width: 640px)");
const { execute: createApiKey, status: isCreating } = useAction(
createApiKeyAction,
@@ -96,9 +105,155 @@ export function CreateApiKeyDialog({
}
};
+ // Form content for reuse in both Dialog and Sheet
+ const renderFormContent = () => (
+
+ );
+
+ // Created key content for reuse in both Dialog and Sheet
+ const renderCreatedKeyContent = () => (
+ <>
+
+
+
+ {t("settings.api_keys.api_key")}
+
+
+
+
+
+
+
+
+ {t("settings.api_keys.save_warning")}
+
+
+
+
+
+
+ >
+ );
+
+ // Render different UI components for mobile vs desktop
+ if (isMobile) {
+ return (
+
+
+
+ {createdApiKey ? (
+ <>
+
+
+ {t("settings.api_keys.created_title")}
+
+
+ {t("settings.api_keys.created_description")}
+
+
+ {renderCreatedKeyContent()}
+ >
+ ) : (
+ <>
+
+ {t("settings.api_keys.create_title")}
+
+ {t("settings.api_keys.create_description")}
+
+
+ {renderFormContent()}
+ >
+ )}
+
+
+
+ );
+ }
+
return (