diff --git a/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx b/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx index 213868314..4ec8046a4 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx @@ -7,8 +7,7 @@ import { useParams, usePathname, useRouter } from "next/navigation"; import { useTranslations } from "next-intl"; import type React from "react"; import { useEffect, useMemo, useState } from "react"; -import { activeChatIdAtom } from "@/atoms/chats/chat-querie.atoms"; -import { activeChathatUIAtom } from "@/atoms/chats/ui.atoms"; +import { activeChathatUIAtom, activeChatIdAtom } from "@/atoms/chats/ui.atoms"; import { activeSearchSpaceIdAtom } from "@/atoms/seach-spaces/seach-space-queries.atom"; import { ChatPanelContainer } from "@/components/chat/ChatPanel/ChatPanelContainer"; import { DashboardBreadcrumb } from "@/components/dashboard-breadcrumb"; diff --git a/surfsense_web/atoms/chats/chat-querie.atoms.ts b/surfsense_web/atoms/chats/chat-querie.atoms.ts index 803295cf0..cec2802d5 100644 --- a/surfsense_web/atoms/chats/chat-querie.atoms.ts +++ b/surfsense_web/atoms/chats/chat-querie.atoms.ts @@ -1,11 +1,9 @@ -import { atom } from "jotai"; import { atomWithQuery } from "jotai-tanstack-query"; import { activeSearchSpaceIdAtom } from "@/atoms/seach-spaces/seach-space-queries.atom"; import { chatsApiService } from "@/lib/apis/chats-api.service"; import { podcastsApiService } from "@/lib/apis/podcasts-api.service"; import { cacheKeys } from "@/lib/query-client/cache-keys"; - -export const activeChatIdAtom = atom(null); +import { activeChatIdAtom } from "./ui.atoms"; export const activeChatAtom = atomWithQuery((get) => { const activeChatId = get(activeChatIdAtom); diff --git a/surfsense_web/atoms/chats/ui.atoms.ts b/surfsense_web/atoms/chats/ui.atoms.ts index 4d2b64186..deae59fe3 100644 --- a/surfsense_web/atoms/chats/ui.atoms.ts +++ b/surfsense_web/atoms/chats/ui.atoms.ts @@ -7,3 +7,4 @@ type ActiveChathatUIState = { export const activeChathatUIAtom = atom({ isChatPannelOpen: false, }); +export const activeChatIdAtom = atom(null); diff --git a/surfsense_web/components/chat/ChatPanel/ChatPanelContainer.tsx b/surfsense_web/components/chat/ChatPanel/ChatPanelContainer.tsx index 93bcca5b2..019eecd3e 100644 --- a/surfsense_web/components/chat/ChatPanel/ChatPanelContainer.tsx +++ b/surfsense_web/components/chat/ChatPanel/ChatPanelContainer.tsx @@ -2,8 +2,8 @@ import { useAtom, useAtomValue } from "jotai"; import { LoaderIcon, PanelRight, TriangleAlert } from "lucide-react"; import { toast } from "sonner"; -import { activeChatAtom, activeChatIdAtom } from "@/atoms/chats/chat-querie.atoms"; -import { activeChathatUIAtom } from "@/atoms/chats/ui.atoms"; +import { activeChatAtom } from "@/atoms/chats/chat-querie.atoms"; +import { activeChathatUIAtom, activeChatIdAtom } from "@/atoms/chats/ui.atoms"; import type { GeneratePodcastRequest } from "@/contracts/types/podcast.types"; import { podcastsApiService } from "@/lib/apis/podcasts-api.service"; import { cn } from "@/lib/utils"; @@ -32,6 +32,8 @@ export function ChatPanelContainer() { } }; + console.log("activeChatState", activeChatState, activeChatIdState); + return activeChatIdState ? (
) : chatError ? ( -
+
) : null} diff --git a/surfsense_web/components/dashboard-breadcrumb.tsx b/surfsense_web/components/dashboard-breadcrumb.tsx index 65e885ead..d29b54685 100644 --- a/surfsense_web/components/dashboard-breadcrumb.tsx +++ b/surfsense_web/components/dashboard-breadcrumb.tsx @@ -4,7 +4,7 @@ import { useAtomValue } from "jotai"; import { usePathname } from "next/navigation"; import { useTranslations } from "next-intl"; import React, { useEffect } from "react"; -import { activeChatAtom, activeChatIdAtom } from "@/atoms/chats/chat-querie.atoms"; +import { activeChatAtom } from "@/atoms/chats/chat-querie.atoms"; import { Breadcrumb, BreadcrumbItem,