Skip to content

Commit

Permalink
[PMRP-1035] add resetDocStage to RecordCard, stop reusing old cloudfr…
Browse files Browse the repository at this point in the history
…ont URL on fullscreen toggle
  • Loading branch information
steph-torres-nhs committed Oct 28, 2024
1 parent bd43803 commit 9a8ff4a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ const renderComponent = (propsOverride?: Partial<Props>) => {
refreshRecord: jest.fn(),
cloudFrontUrl: 'http://test.com',
showMenu: true,
resetDocState: jest.fn(),
...propsOverride,
};
render(<TestApp {...props} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type Props = {
refreshRecord: () => void;
cloudFrontUrl: string;
showMenu: boolean;
resetDocState: () => void;
};

function LloydGeorgeViewRecordStage({
Expand All @@ -52,6 +53,7 @@ function LloydGeorgeViewRecordStage({
refreshRecord,
cloudFrontUrl,
showMenu,
resetDocState,
}: Props) {
const navigate = useNavigate();
const [fullScreen, setFullScreen] = useState(false);
Expand Down Expand Up @@ -121,6 +123,7 @@ function LloydGeorgeViewRecordStage({
onClick={(e) => {
e.preventDefault();
setFullScreen(false);
resetDocState();
}}
>
Exit full screen
Expand Down Expand Up @@ -228,6 +231,7 @@ function LloydGeorgeViewRecordStage({
isFullScreen={fullScreen}
refreshRecord={refreshRecord}
cloudFrontUrl={cloudFrontUrl}
resetDocStage={resetDocState}
/>
</div>
</div>
Expand All @@ -240,6 +244,7 @@ function LloydGeorgeViewRecordStage({
isFullScreen={fullScreen}
refreshRecord={refreshRecord}
cloudFrontUrl={cloudFrontUrl}
resetDocStage={resetDocState}
/>
</div>
)}
Expand Down
1 change: 1 addition & 0 deletions app/src/components/generic/recordCard/RecordCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('RecordCard Component', () => {
isFullScreen: false,
refreshRecord: jest.fn(),
cloudFrontUrl: 'https://test.com',
resetDocStage: jest.fn(),
};

beforeEach(() => {
Expand Down
3 changes: 3 additions & 0 deletions app/src/components/generic/recordCard/RecordCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type Props = {
isFullScreen: boolean;
refreshRecord: () => void;
cloudFrontUrl: string;
resetDocStage: () => void;
};

function RecordCard({
Expand All @@ -20,6 +21,7 @@ function RecordCard({
isFullScreen,
cloudFrontUrl,
refreshRecord,
resetDocStage,
}: Props) {
const role = useRole();
const userIsGpClinical = role === REPOSITORY_ROLE.GP_CLINICAL;
Expand Down Expand Up @@ -63,6 +65,7 @@ function RecordCard({
data-testid="full-screen-btn"
onClick={() => {
fullScreenHandler(true);
resetDocStage();
}}
>
View in full screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function LloydGeorgeRecordPage() {
refreshRecord={refreshRecord}
cloudFrontUrl={cloudFrontUrl}
showMenu={showMenu}
resetDocState={resetDocState}
/>
}
/>
Expand Down

0 comments on commit 9a8ff4a

Please sign in to comment.