improve some ui
This commit is contained in:
parent
58c2c2d447
commit
a9ae654957
@ -41,6 +41,7 @@
|
|||||||
"history": "^5.3.0",
|
"history": "^5.3.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"mousetrap": "^1.6.5",
|
"mousetrap": "^1.6.5",
|
||||||
|
"openseadragon": "^4.1.1",
|
||||||
"pdfjs-dist": "^3.11.174",
|
"pdfjs-dist": "^3.11.174",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
@ -8,10 +8,9 @@ import { Button, Tag } from 'antd';
|
|||||||
const FileCard = ({ file, isSelected, onClick }) => {
|
const FileCard = ({ file, isSelected, onClick }) => {
|
||||||
const fileName = file['File Name'];
|
const fileName = file['File Name'];
|
||||||
const extensionType = fileName.split('.').pop();
|
const extensionType = fileName.split('.').pop();
|
||||||
let status = true;
|
const isRequired = file['Is Required'];
|
||||||
if (file['Is Required'] && !file['Is Reviewed']) {
|
const isReviewd = file['Is Reviewed'];
|
||||||
status = false;
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@ -52,20 +51,29 @@ const FileCard = ({ file, isSelected, onClick }) => {
|
|||||||
>
|
>
|
||||||
{fileName
|
{fileName
|
||||||
? fileName.substring(0, 25).replace('temp_', '')
|
? fileName.substring(0, 25).replace('temp_', '')
|
||||||
: fileName}
|
: fileName}{' '}
|
||||||
{' '}({extensionType})
|
({extensionType})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div style={{display: 'flex', justifyContent: 'space-between', alignItems:'center'}}>
|
||||||
<Tag
|
<Tag
|
||||||
color={status ? 'success' : 'warning'}
|
color={isRequired ? 'warning' : ''}
|
||||||
icon={
|
style={{ display: 'inline-block', fontWeight: 'bold' , textTransform: 'capitalize' }}
|
||||||
status ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />
|
|
||||||
}
|
|
||||||
style={{ display: 'inline-block', fontWeight: 'bold' }}
|
|
||||||
// bordered={false}
|
// bordered={false}
|
||||||
>
|
>
|
||||||
{status ? 'Good' : 'Warning'}{' '}
|
Required: {isRequired.toString()}
|
||||||
</Tag>
|
</Tag>
|
||||||
|
|
||||||
|
|
||||||
|
<Tag
|
||||||
|
color={isReviewd ? 'success' : 'warning'}
|
||||||
|
style={{ display: 'inline-block', fontWeight: 'bold', textTransform: 'capitalize' }}
|
||||||
|
// bordered={false}
|
||||||
|
>
|
||||||
|
Reviewed: {isReviewd.toString()}
|
||||||
|
</Tag>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
|
@ -56,7 +56,7 @@ export const updateRevisedData = async (requestID: any) => {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
if (result.status != 200) {
|
if (!result.ok) {
|
||||||
throw new Error('Could not update revised data');
|
throw new Error('Could not update revised data');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -53,6 +53,8 @@ import {
|
|||||||
} from './const';
|
} from './const';
|
||||||
import FileCard from './FileCard';
|
import FileCard from './FileCard';
|
||||||
import RecentRequest from './RecentRequest';
|
import RecentRequest from './RecentRequest';
|
||||||
|
import './style.css';
|
||||||
|
|
||||||
const ReviewPage = () => {
|
const ReviewPage = () => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [fullscreen, setFullscreen] = useState(false);
|
const [fullscreen, setFullscreen] = useState(false);
|
||||||
@ -137,14 +139,20 @@ const ReviewPage = () => {
|
|||||||
SOURCE_OBJECT_NAMES.forEach((name) => {
|
SOURCE_OBJECT_NAMES.forEach((name) => {
|
||||||
tempData[k][name] = fileContent[name][k];
|
tempData[k][name] = fileContent[name][k];
|
||||||
});
|
});
|
||||||
if (
|
if (!isEmpty(tempData[k][PREDICTED_RESULT])) {
|
||||||
(isEmpty(tempData[k][REVIEWED_RESULT]) ||
|
let isEmptyResult = false;
|
||||||
(tempData[k][REVIEWED_RESULT].length == 1 &&
|
if (isEmpty(tempData[k][REVIEWED_RESULT])) {
|
||||||
isEmpty(tempData[k][REVIEWED_RESULT][0]))) &&
|
isEmptyResult = true;
|
||||||
!isEmpty(tempData[k][PREDICTED_RESULT])
|
}
|
||||||
) {
|
if (tempData[k][REVIEWED_RESULT].length > 0) {
|
||||||
|
isEmptyResult = tempData[k][REVIEWED_RESULT].every((r: any) =>
|
||||||
|
isEmpty(r),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (isEmptyResult) {
|
||||||
tempData[k][REVIEWED_RESULT] = tempData[k][PREDICTED_RESULT];
|
tempData[k][REVIEWED_RESULT] = tempData[k][PREDICTED_RESULT];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setSelectedFileDataSource(tempData);
|
setSelectedFileDataSource(tempData);
|
||||||
@ -277,8 +285,8 @@ const ReviewPage = () => {
|
|||||||
);
|
);
|
||||||
if (isConfirmed) {
|
if (isConfirmed) {
|
||||||
try {
|
try {
|
||||||
addRecentRequest(currentRequest?.RequestID);
|
|
||||||
await updateRevisedData(currentRequest?.RequestID);
|
await updateRevisedData(currentRequest?.RequestID);
|
||||||
|
addRecentRequest(currentRequest?.RequestID);
|
||||||
setCurrentRequest({
|
setCurrentRequest({
|
||||||
...currentRequest,
|
...currentRequest,
|
||||||
['Is Reviewed']: true,
|
['Is Reviewed']: true,
|
||||||
@ -327,6 +335,8 @@ const ReviewPage = () => {
|
|||||||
// use left/right keys to navigate
|
// use left/right keys to navigate
|
||||||
useHotkeys('left', gotoPreviousRequest);
|
useHotkeys('left', gotoPreviousRequest);
|
||||||
useHotkeys('right', gotoNextRequest);
|
useHotkeys('right', gotoNextRequest);
|
||||||
|
useHotkeys('u', submitRevisedData);
|
||||||
|
useHotkeys('c', handleConfirmReview);
|
||||||
|
|
||||||
const fileExtension = selectedFileName
|
const fileExtension = selectedFileName
|
||||||
? selectedFileName.split('.').pop()
|
? selectedFileName.split('.').pop()
|
||||||
@ -527,13 +537,12 @@ const ReviewPage = () => {
|
|||||||
overflowX: 'visible',
|
overflowX: 'visible',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Spin spinning={imageLoading}>
|
<Spin spinning={imageLoading} wrapperClassName='image-spin'>
|
||||||
<img
|
<img
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
height: '100%',
|
||||||
maxWidth: '100%',
|
width: '100%',
|
||||||
height: 'auto',
|
objectFit: 'contain',
|
||||||
width: 'auto',
|
|
||||||
cursor: 'zoom-in',
|
cursor: 'zoom-in',
|
||||||
}}
|
}}
|
||||||
src={selectedFileData}
|
src={selectedFileData}
|
||||||
@ -666,7 +675,7 @@ const ReviewPage = () => {
|
|||||||
style={{ minWidth: '120px' }}
|
style={{ minWidth: '120px' }}
|
||||||
onClick={handleConfirmReview}
|
onClick={handleConfirmReview}
|
||||||
>
|
>
|
||||||
Confirm request
|
(C) Confirm request
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -721,7 +730,7 @@ const ReviewPage = () => {
|
|||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
return (
|
return (
|
||||||
<div style={{ margin: '0 0 8px' }}>
|
<div style={{ margin: '0 0 8px' }} className='file-input-group'>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -828,7 +837,7 @@ const ReviewPage = () => {
|
|||||||
}}
|
}}
|
||||||
onClick={submitRevisedData}
|
onClick={submitRevisedData}
|
||||||
>
|
>
|
||||||
Update File
|
(U) Update File
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user