You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import RenameModal from '@/components/rename-modal';
  2. import { PlusOutlined } from '@ant-design/icons';
  3. import { Button, Empty, Flex, Spin } from 'antd';
  4. import FlowCard from './flow-card';
  5. import { useFetchDataOnMount, useSaveFlow } from './hooks';
  6. import styles from './index.less';
  7. const FlowList = () => {
  8. const {
  9. showFlowSettingModal,
  10. hideFlowSettingModal,
  11. flowSettingVisible,
  12. flowSettingLoading,
  13. onFlowOk,
  14. } = useSaveFlow();
  15. const { list, loading } = useFetchDataOnMount();
  16. return (
  17. <Flex className={styles.flowListWrapper} vertical flex={1} gap={'large'}>
  18. <Flex justify={'end'}>
  19. <Button
  20. type="primary"
  21. icon={<PlusOutlined />}
  22. onClick={showFlowSettingModal}
  23. >
  24. create canvas
  25. </Button>
  26. </Flex>
  27. <Spin spinning={loading}>
  28. <Flex gap={'large'} wrap="wrap" className={styles.flowCardContainer}>
  29. {list.length > 0 ? (
  30. list.map((item: any) => {
  31. return <FlowCard item={item} key={item.name}></FlowCard>;
  32. })
  33. ) : (
  34. <Empty className={styles.knowledgeEmpty}></Empty>
  35. )}
  36. </Flex>
  37. </Spin>
  38. <RenameModal
  39. visible={flowSettingVisible}
  40. onOk={onFlowOk}
  41. loading={flowSettingLoading}
  42. hideModal={hideFlowSettingModal}
  43. initialName=""
  44. ></RenameModal>
  45. </Flex>
  46. );
  47. };
  48. export default FlowList;