diff --git a/web/src/app/assistants/SidebarWrapper.tsx b/web/src/app/assistants/SidebarWrapper.tsx index 3b700b34f46..9d3b6d78265 100644 --- a/web/src/app/assistants/SidebarWrapper.tsx +++ b/web/src/app/assistants/SidebarWrapper.tsx @@ -9,7 +9,7 @@ import { useRouter } from "next/navigation"; import FixedLogo from "../../components/logo/FixedLogo"; import { SettingsContext } from "@/components/settings/SettingsProvider"; import { useChatContext } from "@/components/context/ChatContext"; -import { HistorySidebar } from "../chat/sessionSidebar/HistorySidebar"; +import { HistorySidebar } from "@/components/sidebar/HistorySidebar"; import { useAssistants } from "@/components/context/AssistantsContext"; import AssistantModal from "./mine/AssistantModal"; import { useSidebarShortcut } from "@/lib/browserUtilities"; @@ -35,11 +35,9 @@ export default function SidebarWrapper({ const toggleSidebar = useCallback(() => { Cookies.set( SIDEBAR_TOGGLED_COOKIE_NAME, - String(!sidebarVisible).toLocaleLowerCase() - ), - { - path: "/", - }; + String(!sidebarVisible).toLocaleLowerCase(), + { path: "/" } + ); setSidebarVisible((sidebarVisible) => !sidebarVisible); }, [sidebarVisible]); diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 81052d5dd45..475e0102d58 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -28,7 +28,7 @@ import { import Prism from "prismjs"; import Cookies from "js-cookie"; -import { HistorySidebar } from "./sessionSidebar/HistorySidebar"; +import { HistorySidebar } from "@/components/sidebar/HistorySidebar"; import { MinimalPersonaSnapshot } from "../admin/assistants/interfaces"; import { HealthCheckBanner } from "@/components/health/healthcheck"; import { @@ -150,6 +150,15 @@ export enum UploadIntent { ADD_TO_DOCUMENTS, // For files uploaded via FilePickerModal or similar (just add to repo) } +type ChatPageProps = { + toggle: (toggled?: boolean) => void; + documentSidebarInitialWidth?: number; + sidebarVisible: boolean; + firstMessage?: string; + initialFolders?: any; + initialFiles?: any; +}; + // --- // File Attachment Behavior in ChatPage // @@ -171,14 +180,7 @@ export function ChatPage({ firstMessage, initialFolders, initialFiles, -}: { - toggle: (toggled?: boolean) => void; - documentSidebarInitialWidth?: number; - sidebarVisible: boolean; - firstMessage?: string; - initialFolders?: any; - initialFiles?: any; -}) { +}: ChatPageProps) { const router = useRouter(); const searchParams = useSearchParams(); diff --git a/web/src/app/chat/folders/FolderList.tsx b/web/src/app/chat/folders/FolderList.tsx index f92a0450d67..89d9f08a756 100644 --- a/web/src/app/chat/folders/FolderList.tsx +++ b/web/src/app/chat/folders/FolderList.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from "react"; import { Folder } from "./interfaces"; -import { ChatSessionDisplay } from "../sessionSidebar/ChatSessionDisplay"; // Ensure this is correctly imported +import { ChatSessionDisplay } from "@/components/sidebar/ChatSessionDisplay"; // Ensure this is correctly imported import { FiChevronDown, FiChevronRight, diff --git a/web/src/app/chat/sessionSidebar/ChatGroup.tsx b/web/src/app/chat/sessionSidebar/ChatGroup.tsx deleted file mode 100644 index c9b98b25bd2..00000000000 --- a/web/src/app/chat/sessionSidebar/ChatGroup.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { useRouter } from "next/router"; -import { ChatSession } from "../interfaces"; - -export const ChatGroup = ({ - groupName, - toggled, - chatSessions, -}: { - groupName: string; - toggled: boolean; - chatSessions: ChatSession[]; -}) => { - const router = useRouter(); - - return toggled ? ( -
-

{groupName}

-
- ) : null; -}; diff --git a/web/src/app/providers.tsx b/web/src/app/providers.tsx index bf5a296abae..c278694203d 100644 --- a/web/src/app/providers.tsx +++ b/web/src/app/providers.tsx @@ -7,7 +7,9 @@ const isPostHogEnabled = !!( process.env.NEXT_PUBLIC_POSTHOG_KEY && process.env.NEXT_PUBLIC_POSTHOG_HOST ); -export function PHProvider({ children }: { children: React.ReactNode }) { +type PHProviderProps = { children: React.ReactNode }; + +export function PHProvider({ children }: PHProviderProps) { useEffect(() => { if (isPostHogEnabled) { posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { diff --git a/web/src/components/UserDropdown.tsx b/web/src/components/UserDropdown.tsx index 2fadb894991..56631ba3af6 100644 --- a/web/src/components/UserDropdown.tsx +++ b/web/src/components/UserDropdown.tsx @@ -10,7 +10,7 @@ import { Popover } from "./popover/Popover"; import { LOGOUT_DISABLED } from "@/lib/constants"; import { SettingsContext } from "./settings/SettingsProvider"; import { BellIcon, LightSettingsIcon, UserIcon } from "./icons/icons"; -import { pageType } from "@/app/chat/sessionSidebar/types"; +import { pageType } from "@/components/sidebar/types"; import { NavigationItem, Notification } from "@/app/admin/settings/interfaces"; import DynamicFaIcon, { preloadIcons } from "./icons/DynamicFaIcon"; import { useUser } from "./user/UserProvider"; diff --git a/web/src/components/chat/Header.tsx b/web/src/components/chat/Header.tsx index fbbeaad5227..afae5ed19d4 100644 --- a/web/src/components/chat/Header.tsx +++ b/web/src/components/chat/Header.tsx @@ -4,7 +4,7 @@ import { FiShare2 } from "react-icons/fi"; import { SetStateAction, useContext, useEffect } from "react"; import { ChatSession } from "@/app/chat/interfaces"; import Link from "next/link"; -import { pageType } from "@/app/chat/sessionSidebar/types"; +import { pageType } from "@/components/sidebar/types"; import { useRouter } from "next/navigation"; import { ChatBanner } from "@/app/chat/ChatBanner"; import LogoWithText from "../header/LogoWithText"; diff --git a/web/src/components/header/LogoWithText.tsx b/web/src/components/header/LogoWithText.tsx index 89ec3346824..98a304b841c 100644 --- a/web/src/components/header/LogoWithText.tsx +++ b/web/src/components/header/LogoWithText.tsx @@ -9,7 +9,7 @@ import { TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; -import { pageType } from "@/app/chat/sessionSidebar/types"; +import { pageType } from "@/components/sidebar/types"; import { Logo } from "../logo/Logo"; import Link from "next/link"; import { LogoComponent } from "@/components/logo/FixedLogo"; diff --git a/web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx b/web/src/components/sidebar/ChatSessionDisplay.tsx similarity index 98% rename from web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx rename to web/src/components/sidebar/ChatSessionDisplay.tsx index bdcfaeb74a9..c6f64d14741 100644 --- a/web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx +++ b/web/src/components/sidebar/ChatSessionDisplay.tsx @@ -1,13 +1,13 @@ "use client"; import { useRouter } from "next/navigation"; -import { ChatSession } from "../interfaces"; +import { ChatSession } from "@/app/chat/interfaces"; import { useState, useEffect, useContext, useRef, useCallback } from "react"; import { deleteChatSession, getChatRetentionInfo, renameChatSession, -} from "../lib"; +} from "@/app/chat/lib"; import { BasicSelectable } from "@/components/BasicClickable"; import Link from "next/link"; import { @@ -20,7 +20,7 @@ import { } from "react-icons/fi"; import { DefaultDropdownElement } from "@/components/Dropdown"; import { Popover } from "@/components/popover/Popover"; -import { ShareChatSessionModal } from "../modal/ShareChatSessionModal"; +import { ShareChatSessionModal } from "@/app/chat/modal/ShareChatSessionModal"; import { CHAT_SESSION_ID_KEY, FOLDER_ID_KEY } from "@/lib/drag/constants"; import { SettingsContext } from "@/components/settings/SettingsProvider"; import { DragHandle } from "@/components/table/DragHandle"; diff --git a/web/src/app/chat/sessionSidebar/HistorySidebar.tsx b/web/src/components/sidebar/HistorySidebar.tsx similarity index 98% rename from web/src/app/chat/sessionSidebar/HistorySidebar.tsx rename to web/src/components/sidebar/HistorySidebar.tsx index 0905a68bdb5..130ea332315 100644 --- a/web/src/app/chat/sessionSidebar/HistorySidebar.tsx +++ b/web/src/components/sidebar/HistorySidebar.tsx @@ -15,8 +15,8 @@ import { } from "@/components/ui/tooltip"; import { useRouter, useSearchParams } from "next/navigation"; -import { ChatSession } from "../interfaces"; -import { Folder } from "../folders/interfaces"; +import { ChatSession } from "@/app/chat/interfaces"; +import { Folder } from "@/app/chat/folders/interfaces"; import { SettingsContext } from "@/components/settings/SettingsProvider"; import { @@ -31,7 +31,7 @@ import { MinimalPersonaSnapshot } from "@/app/admin/assistants/interfaces"; import { DragEndEvent } from "@dnd-kit/core"; import { useAssistants } from "@/components/context/AssistantsContext"; import { AssistantIcon } from "@/components/assistants/AssistantIcon"; -import { buildChatUrl } from "../lib"; +import { buildChatUrl } from "@/app/chat/lib"; import { reorderPinnedAssistants } from "@/lib/assistants/updateAssistantPreferences"; import { useUser } from "@/components/user/UserProvider"; import { DragHandle } from "@/components/table/DragHandle"; diff --git a/web/src/app/chat/sessionSidebar/PagesTab.tsx b/web/src/components/sidebar/PagesTab.tsx similarity index 98% rename from web/src/app/chat/sessionSidebar/PagesTab.tsx rename to web/src/components/sidebar/PagesTab.tsx index f282dd03e4c..c433968a7d9 100644 --- a/web/src/app/chat/sessionSidebar/PagesTab.tsx +++ b/web/src/components/sidebar/PagesTab.tsx @@ -1,20 +1,20 @@ -import { ChatSession } from "../interfaces"; +import { ChatSession } from "@/app/chat/interfaces"; import { createFolder, updateFolderName, deleteFolder, addChatToFolder, updateFolderDisplayPriorities, -} from "../folders/FolderManagement"; -import { Folder } from "../folders/interfaces"; +} from "@/app/chat/folders/FolderManagement"; +import { Folder } from "@/app/chat/folders/interfaces"; import { usePopup } from "@/components/admin/connectors/Popup"; import { useRouter } from "next/navigation"; import { FiPlus, FiCheck, FiX } from "react-icons/fi"; -import { FolderDropdown } from "../folders/FolderDropdown"; +import { FolderDropdown } from "@/app/chat/folders/FolderDropdown"; import { ChatSessionDisplay } from "./ChatSessionDisplay"; import { useState, useCallback, useRef, useContext, useEffect } from "react"; import { Caret } from "@/components/icons/icons"; -import { groupSessionsByDateRange } from "../lib"; +import { groupSessionsByDateRange } from "@/app/chat/lib"; import React from "react"; import { Tooltip, diff --git a/web/src/app/chat/sessionSidebar/types.ts b/web/src/components/sidebar/types.ts similarity index 100% rename from web/src/app/chat/sessionSidebar/types.ts rename to web/src/components/sidebar/types.ts