Skip to content

Commit

Permalink
10217 - revert to original flow of tab selection without using docume…
Browse files Browse the repository at this point in the history
…nt id
  • Loading branch information
Absolutestunna committed Feb 25, 2024
1 parent 85fe347 commit 6713062
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 43 deletions.
13 changes: 12 additions & 1 deletion shared/src/business/entities/EntityConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,35 +598,46 @@ export const INITIAL_DOCUMENT_TYPES = {
eventCode: 'APW',
tabTitle: 'APW',
sort: 5,
fileName: 'applicationForWaiverOfFilingFeeFile',
},
corporateDisclosure: {
documentTitle: 'Corporate Disclosure Statement',
documentType: 'Corporate Disclosure Statement',
eventCode: 'DISC',
tabTitle: 'CDS',
sort: 4,
fileName: 'corporateDisclosureFile',
},
petition: {
documentTitle: 'Petition',
documentType: 'Petition',
eventCode: 'P',
tabTitle: 'Petition',
sort: 0,
fileName: 'petitionFile',
},
requestForPlaceOfTrial: {
documentTitle: 'Request for Place of Trial at [Place]',
documentType: 'Request for Place of Trial',
eventCode: 'RQT',
tabTitle: 'RQT',
sort: 3,
fileName: 'requestForPlaceOfTrialFile',
},
stin: {
documentType: 'Statement of Taxpayer Identification',
eventCode: 'STIN',
sort: 1,
tabTitle: 'STIN',
fileName: 'stinFile',
},
stin: STIN_DOCKET_ENTRY_TYPE,
attachmentToPetition: {
documentTitle: 'Attachment to Petition',
documentType: 'Attachment to Petition',
eventCode: 'ATP',
tabTitle: 'ATP',
sort: 2,
fileName: 'attachmentToPetitionFile',
},
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@ describe('getDocumentSelectedForPreviewAction', () => {
presenter.providers.applicationContext = applicationContext;
});

it('should return documentInS3 if there is a selected document', async () => {
const documentId = 'docId1';
const { output } = await runAction(getDocumentSelectedForPreviewAction, {
modules: {
presenter,
},
props: {
documentId,
},
state: {},
});

expect(output).toEqual({ documentInS3: { docketEntryId: documentId } });
});

it('should return props.fileFromBrowserMemory when state.form has an entry equal to documentSelectedForPreview', async () => {
const { output } = await runAction(getDocumentSelectedForPreviewAction, {
modules: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,7 @@ import { state } from '@web-client/presenter/app.cerebral';
export const getDocumentSelectedForPreviewAction = ({
applicationContext,
get,
props,
}: ActionProps<{
documentId?: string;
}>) => {
const { documentId } = props;

if (documentId) {
return {
documentInS3: {
docketEntryId: documentId,
},
};
}

}: ActionProps) => {
const { INITIAL_DOCUMENT_TYPES_MAP } = applicationContext.getConstants();
const documentSelectedForPreview = get(
state.currentViewMetadata.documentSelectedForPreview,
Expand Down
3 changes: 2 additions & 1 deletion web-client/src/presenter/presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,8 @@ export const presenterSequences = {
setCurrentPageIndexSequence:
setCurrentPageIndexSequence as unknown as Function,
setCustomCaseReportFiltersSequence,
setDocumentForPreviewSequence,
setDocumentForPreviewSequence:
setDocumentForPreviewSequence as unknown as Function,
setDocumentForUploadSequence:
setDocumentForUploadSequence as unknown as Function,
setDocumentUploadModeSequence:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ export const setDocumentForPreviewSequence = [
setDocumentUploadModeAction('preview'),
],
},
] as unknown as (props: { documentId?: string }) => void;
];
16 changes: 5 additions & 11 deletions web-client/src/views/PetitionQcScanBatchPreviewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,14 @@ export const PetitionQcScanBatchPreviewer = connect(
);
};

const getDocumentId = (tabSelected: string): string | undefined => {
const documentId = tabSelected.split('_')[1];
return documentId === 'undefined' ? undefined : documentId;
};

const renderTabs = documentTabsList => {
if (documentTabsList && documentTabsList.length > 1) {
return (
<Tabs
bind="currentViewMetadata.documentSelectedForPreview"
className="document-select container-tabs margin-top-neg-205 margin-x-neg-205"
onSelect={tabSelected => {
const documentId = getDocumentId(tabSelected);
setDocumentForPreviewSequence({ documentId });
onSelect={() => {
setDocumentForPreviewSequence();
}}
>
{documentTabsList.map(documentTab => {
Expand All @@ -453,7 +447,7 @@ export const PetitionQcScanBatchPreviewer = connect(

return (
<Tab
data-testid={`${documentTab.eventCode}_${documentTab.documentId}`}
data-testid={documentTab.documentType}
icon={
isFileUploaded && (
<FontAwesomeIcon
Expand All @@ -462,8 +456,8 @@ export const PetitionQcScanBatchPreviewer = connect(
/>
)
}
key={`${documentTab.eventCode}_${documentTab.documentId}`}
tabName={`${documentTab.tabTitle}_${documentTab.documentId}`}
key={documentTab.documentType}
tabName={documentTab.fileName} // may need some refactor (established in constants)
title={documentTab.tabTitle}
/>
);
Expand Down

0 comments on commit 6713062

Please sign in to comment.