Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluesmile82 committed Jan 15, 2024
2 parents 6818870 + 23cdccc commit cf1a40e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
31 changes: 4 additions & 27 deletions frontend/scripts/react-components/popup/popup-component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,14 @@ function PopUp({ handleOnRequestClose }) {
<div className="c-popup">
<div className="popup-content">
<Heading as="h3" weight="bold" size="md">
Recent updates to {`"`}Deforestation Exposure{`"`}
A new look is coming to Trase very soon.
</Heading>
<Text as="p" size="md" lineHeight="md" className="description">
On 10 November 2022, the term{' '}
<Text as="span" weight="bold" size="md">
‘deforestation risk’
</Text>{' '}
was replaced with{' '}
<Text as="span" weight="bold" size="md">
‘deforestation exposure’
</Text>{' '}
as a measure of the exposure of supply chain actors to deforestation from commodity
production based on sourcing patterns.
</Text>
<Text as="p" size="md" lineHeight="md" className="description">
Improvements in how commodity deforestation exposure is calculated were made on 7
December 2022. Numbers accessed before that date will differ from those accessed after.
</Text>
<Text as="p" size="md" lineHeight="md">
For more information, see{' '}
<a
className="link"
target="_blank"
rel="noopener noreferrer"
href="https://schema-cms-api-pages127dfd1a-1100pd61xro1g.s3.amazonaws.com/280/blocks/1043/Trase-deforestation-exposure.pdf"
>
Commodity deforestation exposure and carbon emissions assessment.
</a>
From 23 January, explore Trase’s trusted data through fresh and intuitive tools,
supported by expert analysis.
</Text>
<Button size="md" color="pink" onClick={handleOnRequestClose} className="button">
I understand
Ok
</Button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/scripts/react-components/popup/popup-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.c-popup {
max-height: 90vh;
overflow: scroll;
overflow: auto;

.popup-content {
padding: 40px;
Expand Down
7 changes: 6 additions & 1 deletion frontend/scripts/react-components/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ import { createElement, useState } from 'react';
import Component from './popup-component';

const TRASE_POPUP_DISMISSED = 'TRASE_POPUP_DISMISSED';
const TRASE_CURRENT_POPUP = 'TRASE_CURRENT_POPUP';

const CURRENT_POPUP = 'new look';

const PopupContainer = () => {
const isDismissed = localStorage.getItem(TRASE_POPUP_DISMISSED);
const [popupDismissed, setPopupDismissed] = useState(JSON.parse(isDismissed) || false);
const currentPopup = localStorage.getItem(TRASE_CURRENT_POPUP);
const [popupDismissed, setPopupDismissed] = useState(JSON.parse(isDismissed) && currentPopup === CURRENT_POPUP || false);
if (!ENABLE_POPUP || popupDismissed) {
return null;
}

const handleOnRequestClose = () => {
setPopupDismissed(true);
localStorage.setItem(TRASE_POPUP_DISMISSED, true);
localStorage.setItem(TRASE_CURRENT_POPUP, CURRENT_POPUP);
};

return createElement(Component, {
Expand Down

0 comments on commit cf1a40e

Please sign in to comment.