Skip to content

Commit

Permalink
fix(structures): comment patents graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Oct 8, 2024
1 parent cff41e0 commit f0ff781
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
44 changes: 22 additions & 22 deletions client/src/pages/organizations/[id]/components/patents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Button, Row, Col, Text } from "@dataesr/dsfr-plus";
import useScreenSize from "../../../../../hooks/useScreenSize";
import YearBars from "../../../../../components/year-bars";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
import PatentChart from "../../../../../components/patent-chart";
import { getCpcAggregation } from "../../../../../api/patents/[id]";
// import { useQuery } from "@tanstack/react-query";
// import PatentChart from "../../../../../components/patent-chart";
// import { getCpcAggregation } from "../../../../../api/patents/[id]";
import { OrganizationPatentsData } from "../../../../../types/organization";
import CpcWordCloud from "../../../../../components/patent-chart/indexA";
// import CpcWordCloud from "../../../../../components/patent-chart/indexA";

type OrganizationPatentsProps = {
data: OrganizationPatentsData;
Expand All @@ -28,22 +28,22 @@ export default function OrganizationPatents({
"applicants.ids.id": { values: [{ value, label }], type: "terms" },
};

const patentId = searchFilters["applicants.ids.id"].values[0].value;
const { data: patentsData = [] } = useQuery({
queryKey: ["patent", patentId],
queryFn: () => getCpcAggregation(patentId),
throwOnError: true,
});
// const patentId = searchFilters["applicants.ids.id"].values[0].value;
// const { data: patentsData = [] } = useQuery({
// queryKey: ["patent", patentId],
// queryFn: () => getCpcAggregation(patentId),
// throwOnError: true,
// });

const prepareCpcGraphData = (patentsData) => {
return patentsData.map((item) => ({
code: item.code,
doc_count: item.doc_count,
label: item.label,
}));
};
// const prepareCpcGraphData = (patentsData) => {
// return patentsData.map((item) => ({
// code: item.code,
// doc_count: item.doc_count,
// label: item.label,
// }));
// };

const graphData = prepareCpcGraphData(patentsData);
// const graphData = prepareCpcGraphData(patentsData);

const patentsFilterUrl = `/search/patents?filters=${encodeURIComponent(
JSON.stringify(searchFilters)
Expand Down Expand Up @@ -135,7 +135,7 @@ export default function OrganizationPatents({
</label>
</div>

<div className="fr-segmented__element">
{/* <div className="fr-segmented__element">
<input
checked={projectGraph === "cpc"}
type="radio"
Expand All @@ -160,7 +160,7 @@ export default function OrganizationPatents({
id: "organizations.patents.nav.cpc-2",
})}
</label>
</div>
</div> */}
</div>
</fieldset>
</Col>
Expand All @@ -175,12 +175,12 @@ export default function OrganizationPatents({
years={patents.byYear.map((year) => year.label)}
/>
)}
{projectGraph === "cpc" && patentsData && (
{/* {projectGraph === "cpc" && patentsData && (
<PatentChart data={graphData} />
)}
{projectGraph === "cpc2" && patentsData && (
<CpcWordCloud data={graphData} />
)}
)} */}
</Col>
</Row>
<hr />
Expand Down
2 changes: 0 additions & 2 deletions client/src/pages/organizations/[id]/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
"organizations.patents.count": "Familles de brevets répertoriés par scanR",
"organizations.patents.search": "Voir la liste des brevets",
"organizations.patents.nav.year": "Répartition par année",
"organizations.patents.nav.cpc-1": "Répartition par classification TEST 1 ",
"organizations.patents.nav.cpc-2": "Répartition par classification TEST 2 ",
"organizations.patents.year-bars.name": "Familles de brevets",
"organizations.projects.count": "financements répertoriés par scanR",
"organizations.projects.search": "Voir la liste des financements",
Expand Down

0 comments on commit f0ff781

Please sign in to comment.