Skip to content

Commit

Permalink
add proper full preview of current assigment
Browse files Browse the repository at this point in the history
  • Loading branch information
nattvara committed Apr 24, 2023
1 parent 5c20051 commit 481a389
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions web-ui/src/pages/assignments/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@
.full_width {
width: 100%;
}

.image_preview {
width: 100%;
border: 2px dashed #d9d9d9;
border-radius: 8px;
padding: 10px;
overflow: hidden;
}
18 changes: 16 additions & 2 deletions web-ui/src/pages/assignments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ import {
Space,
Typography,
notification,
Image as AntImage,
} from 'antd';
import { useMutation } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import { useParams } from 'umi';
import apiClient, { ServerErrorResponse, ServerResponse } from '@/http';
import apiClient, {
ServerErrorResponse,
ServerResponse,
makeUrl,
} from '@/http';
import { Image } from '@/types/search';
import ImageUpload from '@/components/image/image-upload/image-upload';
import ImageProgress from '@/components/image/image-progress/image-progress';
Expand Down Expand Up @@ -99,6 +104,8 @@ export default function AssignmentsIndexPage() {
fetchImage();
};

const previewUrl = makeUrl(`/assignments/image/${id}/img`);

useEffect(() => {
registerPageLoad();
}, []);
Expand Down Expand Up @@ -174,10 +181,17 @@ export default function AssignmentsIndexPage() {
<Row>
<Col sm={24} md={7} className={styles.padding_left_right}>
<Space direction="vertical" size="large">
<Row>
<AntImage
src={previewUrl}
className={styles.image_preview}
preview={true}
/>
</Row>
<Row>
<ImageUpload
uploadId={uploadId}
noMargin={true}
compact={true}
onUploadComplete={(image) => onImageUploadComplete(image)}
/>
</Row>
Expand Down

0 comments on commit 481a389

Please sign in to comment.