mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: add OperateDropdown feat: send debug message #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { formatDate } from '@/utils/date';
|
|
import { CalendarOutlined, UserOutlined } from '@ant-design/icons';
|
|
import { Avatar, Card } from 'antd';
|
|
import { useNavigate } from 'umi';
|
|
|
|
import OperateDropdown from '@/components/operate-dropdown';
|
|
import { useDeleteFlow } from '@/hooks/flow-hooks';
|
|
import { IFlow } from '@/interfaces/database/flow';
|
|
import { useCallback } from 'react';
|
|
import styles from './index.less';
|
|
|
|
interface IProps {
|
|
item: IFlow;
|
|
}
|
|
|
|
const FlowCard = ({ item }: IProps) => {
|
|
const navigate = useNavigate();
|
|
const { deleteFlow } = useDeleteFlow();
|
|
|
|
const removeFlow = useCallback(() => {
|
|
return deleteFlow([item.id]);
|
|
}, [deleteFlow, item]);
|
|
|
|
const handleCardClick = () => {
|
|
navigate(`/flow/${item.id}`);
|
|
};
|
|
|
|
return (
|
|
<Card className={styles.card} onClick={handleCardClick}>
|
|
<div className={styles.container}>
|
|
<div className={styles.content}>
|
|
<Avatar size={34} icon={<UserOutlined />} src={item.avatar} />
|
|
<OperateDropdown deleteItem={removeFlow}></OperateDropdown>
|
|
</div>
|
|
<div className={styles.titleWrapper}>
|
|
<span className={styles.title}>{item.title}</span>
|
|
<p>{item.description}</p>
|
|
</div>
|
|
<div className={styles.footer}>
|
|
<div className={styles.bottom}>
|
|
<div className={styles.bottomLeft}>
|
|
<CalendarOutlined className={styles.leftIcon} />
|
|
<span className={styles.rightText}>
|
|
{formatDate(item.update_time)}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
export default FlowCard;
|