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';
import dynamic from 'next/dynamic';
import { FC, memo } from 'react';
import { memo } from 'react';
import { Flexbox } from 'react-layout-kit';
import ResponsiveIndex from '@/components/ResponsiveIndex';
import PageTitle from '../features/PageTitle';
import ChatHeader from './features/ChatHeader';
import Conversation from './features/Conversation';
import SideBar from './features/SideBar';
import KnowledgeCardList from './features/KnowledgeList';
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(() => (
<ResponsiveIndex Mobile={Mobile}>
<ResponsiveIndex Mobile={() => <div>321</div>}>
<Layout>
<PageTitle />
<ChatHeader />
<Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
<Conversation />
<SideBar />
<Flexbox gap={20} horizontal justify="flex-start" wrap="wrap">
<KnowledgeCardList />
</Flexbox>
</Layout>
</ResponsiveIndex>

View File

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