Skip to content

Commit ed6c8da

Browse files
committed
fix(fundings): Better manage data loading and skeleton
1 parent 5130d84 commit ed6c8da

1 file changed

Lines changed: 26 additions & 20 deletions

File tree

  • client/src/boards/financements-par-aap/pages/region/components/projects-data

client/src/boards/financements-par-aap/pages/region/components/projects-data/index.tsx

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,25 @@ export default function ProjectsData() {
7878
} else if (filter.id === 'instrument') {
7979
body.query.bool.filter.push({ match: { 'project_instrument.keyword': filter.value } })
8080
} else if (filter.id === 'label') {
81-
body.query.bool.filter.push({ wildcard: { 'project_label.keyword': {
82-
case_insensitive: true,
83-
value: `*${filter.value.toLowerCase()}*`,
84-
} } })
81+
body.query.bool.filter.push({
82+
wildcard: {
83+
'project_label.keyword': {
84+
case_insensitive: true,
85+
value: `*${filter.value.toLowerCase()}*`,
86+
}
87+
}
88+
})
8589
} else if (filter.id === 'participantId') {
8690
body.query.bool.filter.push({ match: { 'participant_id.keyword': filter.value } })
8791
} else if (filter.id === 'participantLabel') {
88-
body.query.bool.filter.push({ wildcard: { 'participant_label.fr.keyword': {
89-
case_insensitive: true,
90-
value: `*${filter.value.toLowerCase()}*`,
91-
} } })
92+
body.query.bool.filter.push({
93+
wildcard: {
94+
'participant_label.fr.keyword': {
95+
case_insensitive: true,
96+
value: `*${filter.value.toLowerCase()}*`,
97+
}
98+
}
99+
})
92100
} else if (filter.id === 'participationIsCoordinator') {
93101
body.query.bool.filter.push({ term: { participation_is_coordinator: filter.value === "1" } })
94102
} else if (filter.id === 'region') {
@@ -262,7 +270,7 @@ export default function ProjectsData() {
262270
}
263271
}
264272

265-
if (isLoading) return <DefaultSkeleton height="600px" />
273+
if (isLoading || isLoadingAll) return <DefaultSkeleton height="600px" />
266274

267275
return (
268276
<>
@@ -274,17 +282,15 @@ export default function ProjectsData() {
274282
</Text>
275283
</Col>
276284
<Col style={{ display: "flex", justifyContent: "flex-end" }}>
277-
{isLoadingAll ? "Chargement..." : (
278-
<Button
279-
icon="download-line"
280-
iconPosition="left"
281-
onClick={(e) => downloadCsv(e)}
282-
size="sm"
283-
variant="secondary"
284-
>
285-
Télécharger en CSV
286-
</Button>
287-
)}
285+
<Button
286+
icon="download-line"
287+
iconPosition="left"
288+
onClick={(e) => downloadCsv(e)}
289+
size="sm"
290+
variant="secondary"
291+
>
292+
Télécharger en CSV
293+
</Button>
288294
</Col>
289295
</Row>
290296
<Row>

0 commit comments

Comments
 (0)