Skip to content

Commit

Permalink
feat: Added document type to the document list (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
popkinj authored Feb 1, 2025
1 parent e78bc06 commit 6a5cb74
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,5 @@ describe('Test suite for AuthorizationDetails', () => {

screen.getByText('Documents')
screen.getByText('File Description')
screen.getByText('test-file.pdf')
screen.getByText('sample-file.pdf')
})
})
52 changes: 34 additions & 18 deletions frontend/src/pages/authorizationDetails/DocumentsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ export function DocumentsSection({ item }: Readonly<Props>) {
<Typography fontWeight={700} color="#000" fontSize="24px">
Documents
</Typography>
<Typography fontSize="16px" color="#666" fontStyle="italic">
Authorization document(s) presented are publicly available document(s)
hosted on the{' '}
<a
href="https://www2.gov.bc.ca/gov/content/environment/waste-management/waste-discharge-authorization/find-authorization"
target="_blank"
rel="noopener noreferrer"
>
Authorization Management System
</a>
</Typography>
<Stack className="documents-table" direction="column">
<div className="documents-table-cell documents-table-cell--header">
File Description
Expand All @@ -48,24 +59,29 @@ export function DocumentsSection({ item }: Readonly<Props>) {
There are no documents to display.
</div>
)}
{documents.map((doc: OmrrAuthzDocs) => (
<Link
key={`DocumentRow-${doc.DocumentObjectID}`}
className={clsx(
'documents-table-cell',
canDownload && 'documents-table-cell--link',
)}
href={
env.VITE_AMS_URL +
'download.aspx?PosseObjectId=' +
doc.DocumentObjectID
}
target="_blank"
rel={canDownload ? 'noopener noreferrer' : ''}
>
{doc.Description}
</Link>
))}
{documents.map((doc: OmrrAuthzDocs) => {
const extension =
(doc.Filename ?? '').match(/\.([^.]+)$/)?.[1]?.toUpperCase() ||
'DOC'
return (
<Link
key={`DocumentRow-${doc.DocumentObjectID}`}
className={clsx(
'documents-table-cell',
canDownload && 'documents-table-cell--link',
)}
href={
env.VITE_AMS_URL +
'download.aspx?PosseObjectId=' +
doc.DocumentObjectID
}
target="_blank"
rel={canDownload ? 'noopener noreferrer' : ''}
>
{doc.Description} ({extension})
</Link>
)
})}
</Stack>
</Stack>
)
Expand Down

0 comments on commit 6a5cb74

Please sign in to comment.