Skip to content

Commit

Permalink
fix(charts): remplacer le loader par un template lorsque les données …
Browse files Browse the repository at this point in the history
…sont vides ou nulles
  • Loading branch information
jerem1508 committed Jan 14, 2025
1 parent 285f613 commit bc3e3c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions client/src/pages/atlas/charts/genders-pie/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Highcharts from "highcharts";
import HighchartsReact from "highcharts-react-official";
import Template from "../../../../components/template";

type GenderData = {
name: string;
Expand All @@ -13,8 +14,8 @@ export default function GenderChart({
data: GenderData;
isLoading: boolean;
}) {
if (isLoading || !data || !data.length) {
return <div>Loader</div>;
if (isLoading || !data || (data[0].y === 0 && data[1].y === 0)) {
return <Template height="250px" />;
}
const rootStyles = getComputedStyle(document.documentElement);
const secteursOptions = {
Expand Down
7 changes: 5 additions & 2 deletions client/src/pages/atlas/charts/sectors-pie/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Highcharts from "highcharts";
import HighchartsReact from "highcharts-react-official";
import Template from "../../../../components/template";

type SectorData = {
name: string;
Expand All @@ -13,8 +14,10 @@ export default function SectortsChart({
data: SectorData;
isLoading: boolean;
}) {
if (isLoading || !data || !data.length) {
return <div>Loader</div>;
console.log(data);

if (isLoading || !data || (data[0].y === 0 && data[1].y === 0)) {
return <Template height="250px" />;
}
const rootStyles = getComputedStyle(document.documentElement);
const secteursOptions = {
Expand Down
8 changes: 3 additions & 5 deletions client/src/pages/atlas/components/main/tabs/sectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { useSearchParams, useNavigate } from "react-router-dom";
import {
Container,
Row,
Col,
Title,
Text,
Badge,
Button,
Container, Row, Col,
Text,
Title,
} from "@dataesr/dsfr-plus";

import MapPieSectors from "../../../charts/map-pie-sectors/index.jsx";
Expand Down

0 comments on commit bc3e3c9

Please sign in to comment.