From fe2cc1a672242978a2da221f2ca1154fef50868a Mon Sep 17 00:00:00 2001 From: Simon Demaziere Date: Fri, 12 Apr 2024 22:32:28 +0200 Subject: [PATCH] feat: all surveys in mySurveys --- package.json | 2 +- src/i18n/trackingMessage.js | 4 ++++ src/pages/SuiviPage.jsx | 25 ++++--------------------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index c9bcc914d..f25f6ab1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pearl", - "version": "2.0.5", + "version": "2.0.6", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/src/i18n/trackingMessage.js b/src/i18n/trackingMessage.js index d63ffd8f4..331ac004c 100644 --- a/src/i18n/trackingMessage.js +++ b/src/i18n/trackingMessage.js @@ -4,6 +4,10 @@ const trackingMessage = { en: 'To access the details, click on a campaign', }, trackingSelect: { fr: 'Sélectionnez...', en: 'Select...' }, + trackingToggleAria: { + fr: 'Choisissez de voir une/toutes les enquêtes', + en: 'Choose one/all survey to view', + }, trackingSelectCampaign: { fr: 'Sélectionnez une enquête dans la liste déroulante ci-dessus.', en: 'Select a campaign from the drop-down list above.', diff --git a/src/pages/SuiviPage.jsx b/src/pages/SuiviPage.jsx index d677977dc..214bc74a4 100644 --- a/src/pages/SuiviPage.jsx +++ b/src/pages/SuiviPage.jsx @@ -71,10 +71,6 @@ export function SuiviPage() { setSearchText(event.target.value); }; - const resetCampaignSelection = () => { - setCampaign(''); - setTab('stats'); - }; return ( @@ -96,7 +92,7 @@ export function SuiviPage() { options={campaigns} /> {campaign && ( - + setCampaign('')}> )} @@ -121,7 +117,7 @@ export function SuiviPage() { setTab(tab)} - aria-label="Choose one/all survey to view" + aria-label={D.trackingToggleAria} textColor="secondary" > @@ -247,20 +243,6 @@ function SuiviTable({ surveyUnits, campaign, searchText }) { setSortConfig({ key, direction }); }; const maxHeight = 'calc(100vh - 230px)'; - if (!campaign) { - return ( - - - {D.trackingSelectCampaign} - - - ); - } const compareValues = (a, b, isAscending) => { if (a < b) return isAscending ? -1 : 1; if (a > b) return isAscending ? 1 : -1; @@ -291,8 +273,9 @@ function SuiviTable({ surveyUnits, campaign, searchText }) { const filteredSurveyUnits = surveyUnits .filter(su => { const person = getprivilegedPerson(su); + const filteredByCampaign = campaign === '' || su.campaign === campaign; return ( - su.campaign === campaign && + filteredByCampaign && (searchText === '' || person.lastName.toUpperCase().includes(searchText.toUpperCase()) || person.firstName.toUpperCase().includes(searchText.toUpperCase()))