"use client" import { cn } from "@lib/utils" import { dmSans125ClassName } from "@/lib/fonts" import { RaycastIcon } from "@/components/integration-icons" import { authClient } from "@lib/auth" import { useAuth } from "@lib/auth-context" import { generateId } from "@lib/generate-id" import { RAYCAST_EXTENSION_URL } from "@lib/constants" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogPortal, } from "@ui/components/dialog" import { useMutation } from "@tanstack/react-query" import { Check, Copy, Download, Key, Loader } from "lucide-react" import { useId, useState } from "react" import { toast } from "sonner" function PillButton({ children, onClick, disabled, }: { children: React.ReactNode onClick?: () => void disabled?: boolean }) { return ( ) } export function RaycastDetail() { const { org } = useAuth() const [showModal, setShowModal] = useState(false) const [apiKey, setApiKey] = useState("") const [copied, setCopied] = useState(false) const apiKeyId = useId() const handleCopy = async (key: string) => { try { await navigator.clipboard.writeText(key) setCopied(true) setTimeout(() => setCopied(false), 2000) toast.success("API key copied to clipboard!") } catch { toast.error("Failed to copy API key") } } const createKeyMutation = useMutation({ mutationFn: async () => { if (!org?.id) throw new Error("Organization ID is required") const res = await authClient.apiKey.create({ metadata: { organizationId: org.id, type: "raycast-extension" }, name: `raycast-${generateId().slice(0, 8)}`, prefix: `sm_${org.id}_`, }) return res.key }, onSuccess: (key) => { setApiKey(key) setShowModal(true) setCopied(false) handleCopy(key) }, onError: (error) => { toast.error("Failed to create API key", { description: error instanceof Error ? error.message : "Unknown error", }) }, }) return ( <>
Raycast Extension
Add and search memories from Mac and Windows