Commit 3da94271 by weiw

fix:按消金的需求整改布局

parent 732073e6
import Tools from '@/assets/svg/tools.svg?react'
import AddNewChat from '@/assets/svg/addNewChat.svg?react'
import HistoryChat from '@/assets/svg/historyChat.svg?react'
import Collect from '@/assets/svg/collect.svg?react'
......@@ -10,6 +9,6 @@ export const NAV_BAR_ITEMS = [
{ icon: HistoryChat, label: '历史对话', key: 'history' },
{ icon: Collect, label: '收藏', key: 'collect' },
{ icon: '', label: '', key: 'line2' },
{ icon: Tools, label: '工具', key: 'tools' },
{ icon: '', label: '', key: 'line3' },
// { icon: Tools, label: '工具', key: 'tools' },
// { icon: '', label: '', key: 'line3' },
]
......@@ -70,7 +70,7 @@ export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
<motion.div
animate={navBarVisibleLocal === '0' ? isHistoryVisible ? 'shrunk' : 'expanded' : 'navTween'}
variants={contentVariants}
className={`fixed right-[-12px] top-[10px] z-[49] h-auto sm:relative flex sm:h-full pl-[12px] items-center ${isHistoryVisible && !isMobile() ? 'w-[340px]' : 'w-[90px]'} box-border`}
className={`fixed right-[-12px] top-[10px] z-[49] h-auto sm:relative flex sm:h-full items-center ${isHistoryVisible && !isMobile() ? 'w-[340px]' : 'w-[90px]'} box-border`}
>
<Navbar
......
......@@ -5,7 +5,6 @@ import { useNavigate } from 'react-router-dom'
import { useClickAway, useSessionStorageState } from 'ahooks'
import styles from './Navbar.module.less'
import { NavBarItem } from './components/NavBarItem'
import { User } from './components/User'
import { clearNavigationFlag, createConversation } from '@/store/conversationSlice'
import type { WithAuthProps } from '@/auth/withAuth'
import { withAuth } from '@/auth/withAuth'
......@@ -67,10 +66,10 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
navigate('/tools')
}
}
const handleLogout = () => {
onSetHistoryVisible(false)
navigate('/')
}
// const handleLogout = () => {
// onSetHistoryVisible(false)
// navigate('/')
// }
const [navBarVisibleLocal, setNavBarVisibleLocal] = useSessionStorageState<string | undefined>(
'__NAV_BAR_VISIBLE_LOCAL__',
......@@ -112,7 +111,7 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
<NavBarItem isHistoryVisible={isHistoryVisible} onClick={handleClick} icon={item.icon} label={item.label} key={item.key} type={item.key} />
)
})}
<User onLogout={handleLogout} />
{/* <User onLogout={handleLogout} /> */}
</motion.div>
<div onClick={toggleNavBarVisible} className={`${styles.sidebarAction} ${navBarVisibleLocal === '0' ? styles.open : ''}`}></div>
</motion.nav>
......
......@@ -56,7 +56,7 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ from
</div>
)}
{/* 附件:引用文件 */}
{attachment.type === 'reference' && attachment.content.docList.length !== 0 && (
{attachment.type === 'reference' && attachment.content?.docList && attachment.content.docList.length !== 0 && (
<div>
<p className="text-[14px] text-[#8D9795] mb-[12px]">
已为您找到
......
import type React from 'react'
import { motion } from 'framer-motion'
import { Outlet, useLocation } from 'react-router-dom'
import styles from './Home.module.less'
import { QuestionList } from './components/QuestionList'
import { Slogan } from './components/Slogan/Slogan'
import HomeIcon1 from '@/assets/homeIcon1.png'
import HomeIcon2 from '@/assets/homeIcon2.png'
import { GradientBackground } from '@/components/GradientBackground'
import { ChatEditor } from '@/components/ChatEditor'
import { RECOMMEND_QUESTIONS_OTHER, RECOMMEND_QUESTIONS_PRODUCT } from '@/config/recommendQuestion'
import { createConversation } from '@/store/conversationSlice'
import { useAppDispatch } from '@/store/hook'
function getAnimationProps(delay: number) {
return {
variants: {
hidden: {
opacity: 0,
y: 50,
scale: 0.9,
rotateX: -6,
},
visible: {
opacity: 1,
y: 0,
scale: 1,
rotateX: 0,
transition: {
duration: 0.4,
delay: delay * 0.1,
ease: [0.25, 0.1, 0.25, 1],
},
},
},
initial: 'hidden',
animate: 'visible',
}
}
export const Home: React.FC = () => {
const dispatch = useAppDispatch()
const location = useLocation()
// 检查当前路径是否包含 "/chat/"
const showOutlet = location.pathname.includes('/chat/')
const handleCreateConversation = (question: string) => {
dispatch(
createConversation({
conversationData: {},
shouldNavigate: true,
shouldSendQuestion: question,
}),
)
}
return (
<div className={styles.homePage}>
<GradientBackground />
<div className="h-full w-full">
<div className="box flex flex-col h-full w-full">
<div className="flex-1 items-center pt-[24px] overflow-y-scroll sm:pt-[32px] scrollbar-hide sm:overflow-hidden">
<div className="w-full">
<div className="flex justify-center gap-[20px] mt-[22px] sm:mt-[62px]">
{/* 左侧区域 - 产品问答和您可以试着问我 */}
<div className="flex flex-col gap-[20px]">
<motion.div className="w-full hidden sm:block sm:w-auto" {...getAnimationProps(2)}>
<QuestionList
questions={RECOMMEND_QUESTIONS_PRODUCT}
dotColor="#D4CCFF"
title="产品问答"
iconImg={HomeIcon1}
/>
</motion.div>
<motion.div className="w-full sm:w-auto" {...getAnimationProps(3)}>
<QuestionList
questions={RECOMMEND_QUESTIONS_OTHER}
dotColor="#CBECFF"
title="您可以试着问我"
iconImg={HomeIcon2}
/>
</motion.div>
</div>
{/* 右侧区域 */}
<div className="hidden sm:flex flex-1 h-full sm:mt-[-62px]">
<div
className="w-full h-full bg-transparent box-border rounded-[24px]"
style={{ height: 'calc(100vh - 64px)' }}
>
{showOutlet
? (
<Outlet />
)
: (
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'space-between', height: '100%' }}>
<Slogan />
<div className="box-border px-[0] mx-auto iptContainer w-full max-w-[912px] flex-shrink-0 sm:px-0 pb-[18px]">
<ChatEditor
showContentTips
onSubmit={handleCreateConversation}
placeholders={RECOMMEND_QUESTIONS_OTHER}
/>
<div className="hidden sm:block w-full text-center mt-[12px] text-[#3333334d] text-[12px]">
内容由AI模型生成,其准确性和完整性无法保证,仅供参考
</div>
</div>
</div>
)}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
export { Home } from './Home'
// export { Home } from './Home'
export { Home } from './HomeNew'
......@@ -10,8 +10,9 @@ import { withRouteChangeHandler } from './RouteChangeHandler'
const AppRoutesComponent: React.FC = () => {
return (
<Routes>
<Route path="/" element={<Home />} />
<Route path="/chat/:id" element={<Chat />} />
<Route path="/" element={<Home />}>
<Route path="/chat/:id" element={<Chat />} />
</Route>
<Route path="/collect" element={<Collect />} />
<Route path="/tools" element={<Tools />} />
<Route path="/protocol/:id" element={<Protocol />} />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment