From 73199300482aac3634ae6469d6325a852e6708e7 Mon Sep 17 00:00:00 2001 From: Harshith Mullapudi Date: Thu, 9 Oct 2025 12:24:27 +0530 Subject: [PATCH] feat: add copy --- .../app/components/logs/log-options.tsx | 50 +++-- .../app/components/spaces/space-options.tsx | 25 ++- apps/webapp/app/components/ui/index.ts | 2 + apps/webapp/app/components/ui/toast.tsx | 133 +++++++++++++ apps/webapp/app/components/ui/toaster.tsx | 33 ++++ apps/webapp/app/hooks/use-toast.ts | 186 ++++++++++++++++++ apps/webapp/app/root.tsx | 2 + apps/webapp/app/services/mcp.server.ts | 21 -- apps/webapp/app/utils/mcp/memory.ts | 46 +++-- 9 files changed, 448 insertions(+), 50 deletions(-) create mode 100644 apps/webapp/app/components/ui/toast.tsx create mode 100644 apps/webapp/app/components/ui/toaster.tsx create mode 100644 apps/webapp/app/hooks/use-toast.ts diff --git a/apps/webapp/app/components/logs/log-options.tsx b/apps/webapp/app/components/logs/log-options.tsx index 8a3b132..be7bead 100644 --- a/apps/webapp/app/components/logs/log-options.tsx +++ b/apps/webapp/app/components/logs/log-options.tsx @@ -1,4 +1,4 @@ -import { EllipsisVertical, Trash } from "lucide-react"; +import { EllipsisVertical, Trash, Copy } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, @@ -18,6 +18,7 @@ import { } from "../ui/alert-dialog"; import { useState, useEffect } from "react"; import { useFetcher, useNavigate } from "@remix-run/react"; +import { toast } from "~/hooks/use-toast"; interface LogOptionsProps { id: string; @@ -40,6 +41,23 @@ export const LogOptions = ({ id }: LogOptionsProps) => { setDeleteDialogOpen(false); }; + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(id); + toast({ + title: "Copied", + description: "Episode ID copied to clipboard", + }); + } catch (err) { + console.error("Failed to copy:", err); + toast({ + title: "Error", + description: "Failed to copy ID", + variant: "destructive", + }); + } + }; + useEffect(() => { if (deleteFetcher.state === "idle" && deleteFetcher.data?.success) { navigate(`/home/inbox`); @@ -48,16 +66,26 @@ export const LogOptions = ({ id }: LogOptionsProps) => { return ( <> - +
+ + +
diff --git a/apps/webapp/app/components/spaces/space-options.tsx b/apps/webapp/app/components/spaces/space-options.tsx index d2170c3..95fc0ba 100644 --- a/apps/webapp/app/components/spaces/space-options.tsx +++ b/apps/webapp/app/components/spaces/space-options.tsx @@ -1,4 +1,4 @@ -import { EllipsisVertical, RefreshCcw, Trash, Edit } from "lucide-react"; +import { EllipsisVertical, RefreshCcw, Trash, Edit, Copy } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, @@ -19,6 +19,7 @@ import { import { useEffect, useState } from "react"; import { useFetcher, useNavigate } from "@remix-run/react"; import { EditSpaceDialog } from "./edit-space-dialog.client"; +import { toast } from "~/hooks/use-toast"; interface SpaceOptionsProps { id: string; @@ -64,6 +65,23 @@ export const SpaceOptions = ({ id, name, description }: SpaceOptionsProps) => { // revalidator.revalidate(); }; + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(id); + toast({ + title: "Copied", + description: "Space ID copied to clipboard", + }); + } catch (err) { + console.error("Failed to copy:", err); + toast({ + title: "Error", + description: "Failed to copy ID", + variant: "destructive", + }); + } + }; + return ( <> @@ -79,6 +97,11 @@ export const SpaceOptions = ({ id, name, description }: SpaceOptionsProps) => { + + + setEditDialogOpen(true)}>