Skip to content

Commit

Permalink
Merge pull request #67 from nattvara/add-copy-btn-to-assignments
Browse files Browse the repository at this point in the history
add button that copies the text content of an assignment to the clipboard
  • Loading branch information
nattvara authored Oct 5, 2023
2 parents 30e2960 + 88eeede commit 6e41b74
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion web-ui/src/components/image/image-progress/image-progress.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import {
CheckCircleOutlined,
CopyOutlined,
ExclamationCircleOutlined,
SyncOutlined,
} from '@ant-design/icons';
import styles from './image-progress.less';
import { Row, Col, Space, Progress, Tag, Collapse, Typography } from 'antd';
import {
Row,
Col,
Space,
Progress,
Tag,
Collapse,
Typography,
Button,
Tooltip,
} from 'antd';
import { Image } from '@/types/search';
import { useEffect } from 'react';

Expand Down Expand Up @@ -80,6 +91,12 @@ export default function ImageProgress(props: ImageProgressProps) {
progressStatus = 'success';
}

const copyTextContentToClipboard = () => {
if (image.text_content) {
navigator.clipboard.writeText(image.text_content);
}
};

useEffect(() => {
if (failed !== 0) {
onUpdate({ failed: true });
Expand All @@ -104,6 +121,15 @@ export default function ImageProgress(props: ImageProgressProps) {
<Row>
<Title level={4} style={{ margin: 0 }}>
Parsing Assignment
<span> </span>
<Tooltip title="Copy assignment text">
<Button
type="text"
icon={<CopyOutlined />}
onClick={() => copyTextContentToClipboard()}
disabled={progressStatus !== 'success'}
></Button>
</Tooltip>
</Title>
<Paragraph className={styles.meta}>
This usually takes around 30 seconds
Expand Down

0 comments on commit 6e41b74

Please sign in to comment.