From a40f848e158c6a3b36f0182b0262610d3ca7e567 Mon Sep 17 00:00:00 2001 From: NogaNHS Date: Tue, 22 Oct 2024 16:34:48 +0100 Subject: [PATCH] [prmp-1035] PR changes --- .../LloydGeorgeViewRecordStage.tsx | 49 ++++++++----------- .../generic/pdfViewer/PdfViewer.tsx | 2 +- .../generic/recordCard/RecordCard.tsx | 5 +- .../recordMenuCard/RecordMenuCard.test.tsx | 46 +++-------------- .../generic/recordMenuCard/RecordMenuCard.tsx | 8 ++- .../LloydGeorgeRecordPage.test.tsx | 1 + 6 files changed, 36 insertions(+), 75 deletions(-) diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx index d1f678a49..0d42e19e6 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx @@ -211,34 +211,16 @@ function LloydGeorgeViewRecordStage({

{pageHeader}

{!fullScreen ? ( - <> - <> -
- +
+ -
- } - isFullScreen={fullScreen} - refreshRecord={refreshRecord} - cloudFrontUrl={cloudFrontUrl} - /> -
-
- - - ) : ( - <> -
+
- +
+ ) : ( +
+ } + isFullScreen={fullScreen} + refreshRecord={refreshRecord} + cloudFrontUrl={cloudFrontUrl} + /> +
)}
); diff --git a/app/src/components/generic/pdfViewer/PdfViewer.tsx b/app/src/components/generic/pdfViewer/PdfViewer.tsx index 70b14b96f..af2031733 100644 --- a/app/src/components/generic/pdfViewer/PdfViewer.tsx +++ b/app/src/components/generic/pdfViewer/PdfViewer.tsx @@ -5,7 +5,7 @@ type Props = { fileUrl: String }; const PdfViewer = ({ fileUrl }: Props) => { useEffect(() => { const pdfObject = require('pdfobject'); - pdfObject.embed(fileUrl + '#toolbar', '#pdf-viewer'); + pdfObject.embed(fileUrl + '#toolbar=0', '#pdf-viewer'); }, [fileUrl]); if (!fileUrl) return null; diff --git a/app/src/components/generic/recordCard/RecordCard.tsx b/app/src/components/generic/recordCard/RecordCard.tsx index ed8886bac..f5c7f7b48 100644 --- a/app/src/components/generic/recordCard/RecordCard.tsx +++ b/app/src/components/generic/recordCard/RecordCard.tsx @@ -36,10 +36,7 @@ function RecordCard({ }, [refreshRecord]); const Record = () => { - if (!cloudFrontUrl) { - return null; - } - return ; + return cloudFrontUrl ? : null; }; const RecordLayout = ({ children }: { children: ReactNode }) => { diff --git a/app/src/components/generic/recordMenuCard/RecordMenuCard.test.tsx b/app/src/components/generic/recordMenuCard/RecordMenuCard.test.tsx index c6feafee7..d0a5e256b 100644 --- a/app/src/components/generic/recordMenuCard/RecordMenuCard.test.tsx +++ b/app/src/components/generic/recordMenuCard/RecordMenuCard.test.tsx @@ -49,8 +49,6 @@ const mockLinks: Array = [ }, ]; -const className = 'lloydgeorge_record-stage_flex-row'; - jest.mock('react-router-dom', () => ({ Link: (props: LinkProps) => , useNavigate: () => mockedUseNavigate, @@ -69,12 +67,7 @@ describe('RecordMenuCard', () => { describe('Rendering', () => { it('renders menu', () => { render( - , + , ); expect(screen.getByRole('heading', { name: 'Download record' })).toBeInTheDocument(); expect(screen.getByRole('heading', { name: 'Update record' })).toBeInTheDocument(); @@ -92,7 +85,6 @@ describe('RecordMenuCard', () => { , ); @@ -111,7 +103,6 @@ describe('RecordMenuCard', () => { , ); @@ -127,24 +118,14 @@ describe('RecordMenuCard', () => { it('does not render anything if the given record links array is empty', () => { const { container } = render( - , + , ); expect(container).toBeEmptyDOMElement(); }); it('render menu item as a