import { DragDropContext, Droppable, OnDragEndResponder, } from "@hello-pangea/dnd"; import { useAppConfig, useChatStore } from "@/app/store"; import Locale from "@/app/locales"; import { Path } from "@/app/constant"; import { useEffect } from "react"; import AddIcon from "@/app/icons/addIcon.svg"; import NextChatTitle from "@/app/icons/nextchatTitle.svg"; import MenuLayout from "@/app/components/MenuLayout"; import Panel from "./ChatPanel"; import Modal from "@/app/components/Modal"; import SessionItem from "./components/SessionItem"; import { usePathname, useRouter } from "next/navigation"; export default MenuLayout(function SessionList(props) { const { setShowPanel } = props; const [sessions, selectedIndex, selectSession, moveSession] = useChatStore( (state) => [ state.sessions, state.currentSessionIndex, state.selectSession, state.moveSession, ], ); const config = useAppConfig(); const { isMobileScreen } = config; const chatStore = useChatStore(); const router = useRouter(); const pathname = usePathname(); useEffect(() => { setShowPanel?.(pathname === Path.Chat); }, [pathname]); const onDragEnd: OnDragEndResponder = (result) => { const { destination, source } = result; if (!destination) { return; } if ( destination.droppableId === source.droppableId && destination.index === source.index ) { return; } moveSession(source.index, destination.index); }; return (