From 22d662e318fab77655819513ae6fde0c51223e5e Mon Sep 17 00:00:00 2001 From: Mihoub Debache Date: Mon, 23 Oct 2023 16:39:13 +0200 Subject: [PATCH] fix(geographical-categories): delete date from card and display categories instead --- .../[id]/structuresList.js | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/pages/categories-geographiques/[id]/structuresList.js b/src/pages/categories-geographiques/[id]/structuresList.js index 7a94a088..67a07c88 100644 --- a/src/pages/categories-geographiques/[id]/structuresList.js +++ b/src/pages/categories-geographiques/[id]/structuresList.js @@ -3,28 +3,21 @@ import PropTypes from 'prop-types'; import { Link as RouterLink } from 'react-router-dom'; import { useState } from 'react'; import { getName } from '../../../utils/structures'; -import { formatDescriptionDates } from '../../../utils/dates'; -import { capitalize } from '../../../utils/strings'; import ExpendableListCards from '../../../components/card/expendable-list-cards'; const getDescription = (item) => { - let description = ''; - description += item?.category ? item.category : ''; - if (item?.city) { - description += item.city.length > 0 ? ` à ${item.city[0]}` : ''; - } else { - description += item?.locality && item.locality.length > 0 ? ` à ${item.locality[0]}` : ''; - } - description += item?.creationDate ? ` ${formatDescriptionDates(item?.creationDate)}` : ''; - - return capitalize(description.trim()); + const filteredCategories = item.categories + .filter((el) => el.priority >= 1 && el.priority <= 70) + .map((el) => el.usualNameFr) + .join(' - '); + return filteredCategories; }; + export function StructuresList({ data }) { const [filter, setFilter] = useState(''); if (!data && !data?.data) { return null; } - const list = data .filter((item) => item.currentName.usualName.toLowerCase().indexOf(filter.toLowerCase()) > -1) .map((item) => ( @@ -38,9 +31,6 @@ export function StructuresList({ data }) { {getName(item)}

- {item.structureStatus === 'inactive' ? ( - - ) : null}

{getDescription(item)}