diff --git a/src/atoms/uiAtoms.ts b/src/atoms/uiAtoms.ts new file mode 100644 index 0000000..d995ce4 --- /dev/null +++ b/src/atoms/uiAtoms.ts @@ -0,0 +1,4 @@ +import { atom } from "jotai"; + +// Atom to track if any dropdown is currently open in the UI +export const dropdownOpenAtom = atom(false); diff --git a/src/components/ChatList.tsx b/src/components/ChatList.tsx index 1a74ad9..ccc1e4a 100644 --- a/src/components/ChatList.tsx +++ b/src/components/ChatList.tsx @@ -6,6 +6,7 @@ import { PlusCircle, MoreVertical, Trash2 } from "lucide-react"; import { useAtom } from "jotai"; import { selectedChatIdAtom } from "@/atoms/chatAtoms"; import { selectedAppIdAtom } from "@/atoms/appAtoms"; +import { dropdownOpenAtom } from "@/atoms/uiAtoms"; import { IpcClient } from "@/ipc/ipc_client"; import { showError, showSuccess } from "@/lib/toast"; import { @@ -28,6 +29,7 @@ export function ChatList({ show }: { show?: boolean }) { const navigate = useNavigate(); const [selectedChatId, setSelectedChatId] = useAtom(selectedChatIdAtom); const [selectedAppId, setSelectedAppId] = useAtom(selectedAppIdAtom); + const [isDropdownOpen, setIsDropdownOpen] = useAtom(dropdownOpenAtom); const { chats, loading, refreshChats } = useChats(selectedAppId); const routerState = useRouterState(); const isChatRoute = routerState.location.pathname === "/chat"; @@ -136,7 +138,7 @@ export function ChatList({ show }: { show?: boolean }) { {chats.map((chat) => ( -
+
{selectedChatId === chat.id && ( - + setIsDropdownOpen(open)} + >