Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(verify): resolve tagging issues #231

Merged
merged 1 commit into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 185 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 4 additions & 27 deletions src/components/Verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@ const Verify = (props) => {
const refContainer = useRef();
const numFilters = verifyContext.filter.countAppliedFilters();

// log.debug(
// 'render: verify',
// 'captures:',
// verifyContext.captureImages.length,
// 'species:',
// speciesContext.speciesList.length,
// 'tags:',
// tagsContext.tagList.length,
// );

/*
* effect to load page when mounted
*/
Expand All @@ -192,14 +182,6 @@ const Verify = (props) => {
setComplete(verifyContext.approveAllComplete);
}, [verifyContext.approveAllComplete]);

/* load more captures when the page or page size changes */
useEffect(() => {
// console.log('-- load images', verifyContext.filter);
const abortController = new AbortController();
verifyContext.loadCaptureImages({ signal: abortController.signal });
return () => abortController.abort();
}, [verifyContext.filter, verifyContext.pageSize, verifyContext.currentPage]);

function handleCaptureClick(e, captureId) {
e.stopPropagation();
e.preventDefault();
Expand Down Expand Up @@ -256,7 +238,6 @@ const Verify = (props) => {
} else if (!approveAction.rememberSelection) {
resetApprovalFields();
}
verifyContext.loadCaptureImages();
}

async function handleShowGrowerDetail(e, capture) {
Expand Down Expand Up @@ -292,6 +273,7 @@ const Verify = (props) => {
}

function handleChangePageSize(event) {
verifyContext.setCurrentPage(0);
verifyContext.setPageSize(event.target.value);
}

Expand All @@ -303,15 +285,10 @@ const Verify = (props) => {
return verifyContext.captureImagesSelected.indexOf(id) >= 0;
}

const captureImages = verifyContext.captureImages.filter((capture, index) => {
return (
index >= verifyContext.currentPage * verifyContext.pageSize &&
index < (verifyContext.currentPage + 1) * verifyContext.pageSize
);
});
const captureImages = verifyContext.captureImages;

const placeholderImages = verifyContext.isLoading
? Array(verifyContext.pageSize - captureImages.length)
? Array(Math.max(verifyContext.pageSize - captureImages.length, 0))
.fill()
.map((_, index) => {
return {
Expand Down Expand Up @@ -406,7 +383,7 @@ const Verify = (props) => {

let imagePagination = (
<TablePagination
rowsPerPageOptions={[12, 24, 48, 96, 192]}
rowsPerPageOptions={[24, 96, 192, 384]}
component="div"
count={verifyContext.captureCount || 0}
rowsPerPage={verifyContext.pageSize}
Expand Down
Loading