Skip to content

Commit

Permalink
add button that copies the text content of an assignment to the clipb…
Browse files Browse the repository at this point in the history
…oard
  • Loading branch information
nattvara committed Oct 5, 2023
1 parent 30e2960 commit ba3b673
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 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,11 @@
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 +81,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 +111,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 ba3b673

Please sign in to comment.