|
@@ -0,0 +1,84 @@
|
|
|
|
+import React from "react";
|
|
|
|
+import { Row, Col, Tooltip, Button, Progress, Space, Typography, Card, theme } from "antd";
|
|
|
|
+import { DeleteOutlined, RollbackOutlined, RestOutlined } from "@ant-design/icons";
|
|
|
|
+
|
|
|
|
+const { Text } = Typography;
|
|
|
|
+
|
|
|
|
+interface BinActionPanelProps {
|
|
|
|
+ totalCapacity: number; // 总容量,单位GB
|
|
|
|
+ freeSpace: number; // 剩余空间,单位GB
|
|
|
|
+ binCapacity: number; // 回收站容量,单位GB
|
|
|
|
+ onDelete: () => void;
|
|
|
|
+ onRestore: () => void;
|
|
|
|
+ onEmpty: () => void;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const BinActionPanel: React.FC<BinActionPanelProps> = ({
|
|
|
|
+ totalCapacity,
|
|
|
|
+ freeSpace,
|
|
|
|
+ binCapacity,
|
|
|
|
+ onDelete,
|
|
|
|
+ onRestore,
|
|
|
|
+ onEmpty,
|
|
|
|
+}) => {
|
|
|
|
+ const usedSpace = totalCapacity - freeSpace;
|
|
|
|
+ const usedPercent = Math.round((usedSpace / totalCapacity) * 100);
|
|
|
|
+ const binPercent = Math.round((binCapacity / totalCapacity) * 100);
|
|
|
|
+
|
|
|
|
+ // 使用Card组件和theme.token适配多主题
|
|
|
|
+ return (
|
|
|
|
+ <Card
|
|
|
|
+ style={{ borderRadius: 8 }}
|
|
|
|
+ bodyStyle={{ padding: 24 }}
|
|
|
|
+ bordered={false}
|
|
|
|
+ >
|
|
|
|
+ <Space direction="vertical" size="middle" style={{ width: "100%" }}>
|
|
|
|
+ <Space direction="vertical" size={4} style={{ width: "100%" }}>
|
|
|
|
+ <Text strong>磁盘容量:</Text>
|
|
|
|
+ <Text type="secondary">{totalCapacity} GB</Text>
|
|
|
|
+ <Progress percent={usedPercent} size="small" showInfo={false} />
|
|
|
|
+ </Space>
|
|
|
|
+ <Space direction="vertical" size={4} style={{ width: "100%" }}>
|
|
|
|
+ <Text strong>剩余空间:</Text>
|
|
|
|
+ <Text type="secondary">{freeSpace} GB</Text>
|
|
|
|
+ </Space>
|
|
|
|
+ <Space direction="vertical" size={4} style={{ width: "100%" }}>
|
|
|
|
+ <Text strong>回收站容量:</Text>
|
|
|
|
+ <Text type="secondary">{binCapacity} GB</Text>
|
|
|
|
+ <Progress percent={binPercent} size="small" showInfo={false} strokeColor="#faad14" />
|
|
|
|
+ </Space>
|
|
|
|
+ <Row justify="center">
|
|
|
|
+ <Space>
|
|
|
|
+ <Tooltip title="删除">
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ shape="circle"
|
|
|
|
+ icon={<DeleteOutlined />}
|
|
|
|
+ onClick={onDelete}
|
|
|
|
+ danger
|
|
|
|
+ />
|
|
|
|
+ </Tooltip>
|
|
|
|
+ <Tooltip title="恢复">
|
|
|
|
+ <Button
|
|
|
|
+ type="default"
|
|
|
|
+ shape="circle"
|
|
|
|
+ icon={<RollbackOutlined />}
|
|
|
|
+ onClick={onRestore}
|
|
|
|
+ />
|
|
|
|
+ </Tooltip>
|
|
|
|
+ <Tooltip title="清空">
|
|
|
|
+ <Button
|
|
|
|
+ type="default"
|
|
|
|
+ shape="circle"
|
|
|
|
+ icon={<RestOutlined />}
|
|
|
|
+ onClick={onEmpty}
|
|
|
|
+ />
|
|
|
|
+ </Tooltip>
|
|
|
|
+ </Space>
|
|
|
|
+ </Row>
|
|
|
|
+ </Space>
|
|
|
|
+ </Card>
|
|
|
|
+ );
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+export default BinActionPanel;
|