add knowledge base list

This commit is contained in:
cca313 2024-03-30 19:40:03 +08:00
parent 7a32e8ba10
commit 3d5d1a00fa
6 changed files with 81 additions and 17 deletions

View File

@ -0,0 +1,39 @@
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
import { Card, Skeleton } from 'antd';
import React, { useState } from 'react';
const { Meta } = Card;
interface KnowLedgeCardProps {
intro: string;
name: string;
}
const App: React.FC = (props: KnowLedgeCardProps) => {
const [loading, setLoading] = useState(false);
const { name, intro } = props;
const onChange = (checked: boolean) => {
setLoading(!checked);
};
return (
<Card
actions={[
<SettingOutlined key="setting" />,
<EditOutlined key="edit" />,
<EllipsisOutlined key="ellipsis" />,
]}
bordered={false}
style={{ marginTop: 16, width: 300 }}
>
<Skeleton active avatar loading={loading}>
<Meta
// avatar={<Avatar src="https://api.dicebear.com/7.x/miniavs/svg?seed=2" />}
description={intro}
title={name}
/>
</Skeleton>
</Card>
);
};
export default App;

View File

@ -0,0 +1,26 @@
import React, { memo } from 'react';
import KnowledgeCard from './KnowledgeCard';
const list = [
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
{ intro: 'aaaaa', name: '321' },
];
const RenderList = memo(() =>
list.map((item, index) => {
return <KnowledgeCard key={index} {...item} />;
}),
);
const KnowledgeCardList = memo(() => {
return <RenderList />;
});
export default KnowledgeCardList;

View File

@ -1,27 +1,20 @@
'use client'; 'use client';
import dynamic from 'next/dynamic'; import { memo } from 'react';
import { FC, memo } from 'react';
import { Flexbox } from 'react-layout-kit'; import { Flexbox } from 'react-layout-kit';
import ResponsiveIndex from '@/components/ResponsiveIndex'; import ResponsiveIndex from '@/components/ResponsiveIndex';
import PageTitle from '../features/PageTitle'; import KnowledgeCardList from './features/KnowledgeList';
import ChatHeader from './features/ChatHeader';
import Conversation from './features/Conversation';
import SideBar from './features/SideBar';
import Layout from './layout.desktop'; import Layout from './layout.desktop';
const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC; // const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
const DesktopPage = memo(() => ( const DesktopPage = memo(() => (
<ResponsiveIndex Mobile={Mobile}> <ResponsiveIndex Mobile={() => <div>321</div>}>
<Layout> <Layout>
<PageTitle /> <Flexbox gap={20} horizontal justify="flex-start" wrap="wrap">
<ChatHeader /> <KnowledgeCardList />
<Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
<Conversation />
<SideBar />
</Flexbox> </Flexbox>
</Layout> </Layout>
</ResponsiveIndex> </ResponsiveIndex>

View File

@ -6,15 +6,14 @@ import { Flexbox } from 'react-layout-kit';
import AppLayoutDesktop from '@/layout/AppLayout.desktop'; import AppLayoutDesktop from '@/layout/AppLayout.desktop';
import { SidebarTabKey } from '@/store/global/initialState'; import { SidebarTabKey } from '@/store/global/initialState';
export default memo(({ children }: PropsWithChildren) => { export default memo(({ children }: PropsWithChildren) => {
return ( return (
<AppLayoutDesktop sidebarKey={SidebarTabKey.Chat}> <AppLayoutDesktop sidebarKey={SidebarTabKey.Knowledge}>
<Flexbox <Flexbox
flex={1} flex={1}
height={'100%'} height={'100%'}
id={'lobe-conversion-container'} id={'lobe-conversion-container'}
style={{ position: 'relative' }} style={{ paddingLeft: 20, paddingRight: 20, position: 'relative' }}
> >
{children} {children}
</Flexbox> </Flexbox>

View File

@ -1,9 +1,16 @@
import DesktopPage from './(desktop)';
// import MobilePage from './(mobile)';
// import SessionHydration from './components/SessionHydration';
// import Migration from './features/Migration';
const Page = () => { const Page = () => {
// const mobile = isMobileDevice(); // const mobile = isMobileDevice();
// const Page = mobile ? MobilePage : DesktopPage; // const Page = mobile ? MobilePage : DesktopPage;
const Page = DesktopPage;
return <div>321</div>; return <Page />;
}; };
export default Page; export default Page;