Skip to content

Commit

Permalink
Fixed warning message about updated purposes
Browse files Browse the repository at this point in the history
When the modal is forced open on startup, this message should only be
shown if the purposes were updated since the last visit.
  • Loading branch information
felixgirault committed Jun 9, 2023
1 parent 53c30f5 commit e3925f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ui/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const Main: ForwardRefRenderFunction<MainHandle> = (_, ref) => {
<Modal
key="modal"
isForced={config.forceModal && manager.isDirty()}
needsUpdate={manager.needsUpdate()}
privacyPolicyUrl={config.privacyPolicyUrl}
onClose={closeModal}
onSave={commit}
Expand Down
1 change: 1 addition & 0 deletions src/ui/components/types/Modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {FC} from 'react';

export interface ModalProps {
isForced: boolean;
needsUpdate: boolean;
privacyPolicyUrl: string;
onClose: () => void;
onSave: () => void;
Expand Down
3 changes: 2 additions & 1 deletion src/ui/themes/dsfr/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {ModalComponent} from '../../components/types/Modal';

const Modal: ModalComponent = ({
isForced,
needsUpdate,
privacyPolicyUrl,
onClose,
onSave,
Expand Down Expand Up @@ -47,7 +48,7 @@ const Modal: ModalComponent = ({
</h1>

<div>
{isForced ? (
{isForced && needsUpdate ? (
<p>
<strong>{t.misc.updateNeeded}</strong>
</p>
Expand Down
5 changes: 4 additions & 1 deletion src/ui/themes/orejime/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PoweredByLink from '../../components/PoweredByLink';

const Modal: ModalComponent = ({
isForced,
needsUpdate,
privacyPolicyUrl,
onClose,
onSave,
Expand Down Expand Up @@ -40,14 +41,16 @@ const Modal: ModalComponent = ({
<h1 className="orejime-Modal-title" id="orejime-modal-title">
{t.modal.title}
</h1>

<p className="orejime-Modal-description">
{isForced ? (
{isForced && needsUpdate ? (
<p className="orejime-Modal-description">
<strong className="orejime-Modal-changes">
{t.misc.updateNeeded}
</strong>
</p>
) : null}

{template(t.modal.description, {
privacyPolicy: (
<a
Expand Down

0 comments on commit e3925f5

Please sign in to comment.