Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Oct 24, 2024
2 parents e028967 + d02abeb commit 2984e8b
Show file tree
Hide file tree
Showing 14 changed files with 641 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ES_INDEX_DATACITE=bso-datacite
ES_INDEX_ORCID=bso-orcid
ES_INDEX_PUBLICATIONS=bso-publications
ES_INDEX_STUDIES=bso-clinical-trials
ES_INDEX_DATASETS=bso-datacite
REACT_APP_ENV=production
REACT_APP_ES_API_SOURCES_STUDIES=["clinical_trials", "euctr"]
REACT_APP_ES_API_URL_DATACITE=https://cluster-production.elasticsearch.dataesr.ovh/$ES_INDEX_DATACITE/_search
Expand All @@ -12,4 +13,4 @@ REACT_APP_LAST_OBSERVATION=2023Q4
REACT_APP_LAST_OBSERVATION_THESIS=2023Q4
REACT_APP_PIWIK_SITE=34
REACT_APP_PIWIK_URL=https://piwik.enseignementsup-recherche.pro
REACT_APP_VERSION=$npm_package_version
REACT_APP_VERSION=$npm_package_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import Highcharts from 'highcharts';
import HCExportingData from 'highcharts/modules/export-data';
import HCExporting from 'highcharts/modules/exporting';
import HighchartsReact from 'highcharts-react-official';
import PropTypes from 'prop-types';
import React, { useEffect, useRef, useState } from 'react';
import { useIntl } from 'react-intl';

import customComments from '../../../../../utils/chartComments';
import { chartOptions } from '../../../../../utils/chartOptions';
import { domains, graphIds } from '../../../../../utils/constants';
import { getObservationLabel, withDomain } from '../../../../../utils/helpers';
import useGlobals from '../../../../../utils/Hooks/useGetGlobals';
import WrapperChart from '../../../../WrapperChart';
import GraphComments from '../../../graph-comments';
import useGetData from './get-data';

HCExporting(Highcharts);
HCExportingData(Highcharts);

const Chart = ({ domain, hasComments, hasFooter, id }) => {
const chartRef = useRef();
const intl = useIntl();
const [chartComments, setChartComments] = useState('');
const { lastObservationSnap } = useGlobals();
const { allData, isError, isLoading } = useGetData(
lastObservationSnap,
domain,
'format',
6,
);
const { categories, dataGraph } = allData;
const dataTitle = {
observationYear: getObservationLabel(lastObservationSnap, intl),
};
const idWithDomain = withDomain(id, domain);
const optionsGraph = chartOptions[id].getOptions(
idWithDomain,
intl,
categories,
dataGraph,
dataTitle,
);
const hasBeta = true;
useEffect(() => {
setChartComments(customComments(allData, idWithDomain, intl));
}, [allData, idWithDomain, intl]);

return (
<WrapperChart
chartRef={chartRef}
dataTitle={dataTitle}
domain={domain}
hasBeta={hasBeta}
hasComments={false}
hasFooter={hasFooter}
id={id}
isError={isError}
isLoading={isLoading || !dataGraph || !categories}
>
<HighchartsReact
highcharts={Highcharts}
id={idWithDomain}
options={optionsGraph}
ref={chartRef}
/>
{hasComments && chartComments && (
<GraphComments comments={chartComments} hasFooter={hasFooter} />
)}
</WrapperChart>
);
};

Chart.defaultProps = {
domain: '',
hasComments: true,
hasFooter: true,
id: 'data.general.repositories.datasets-by-format',
};
Chart.propTypes = {
domain: PropTypes.oneOf(domains),
hasComments: PropTypes.bool,
hasFooter: PropTypes.bool,
id: PropTypes.oneOf(graphIds),
};

export default Chart;
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import Highcharts from 'highcharts';
import HCExportingData from 'highcharts/modules/export-data';
import HCExporting from 'highcharts/modules/exporting';
import HighchartsReact from 'highcharts-react-official';
import PropTypes from 'prop-types';
import React, { useEffect, useRef, useState } from 'react';
import { useIntl } from 'react-intl';

import customComments from '../../../../../utils/chartComments';
import { chartOptions } from '../../../../../utils/chartOptions';
import { domains, graphIds } from '../../../../../utils/constants';
import { getObservationLabel, withDomain } from '../../../../../utils/helpers';
import useGlobals from '../../../../../utils/Hooks/useGetGlobals';
import WrapperChart from '../../../../WrapperChart';
import GraphComments from '../../../graph-comments';
import useGetData from './get-data';

HCExporting(Highcharts);
HCExportingData(Highcharts);

const Chart = ({ domain, hasComments, hasFooter, id }) => {
const chartRef = useRef();
const intl = useIntl();
const [chartComments, setChartComments] = useState('');
const { lastObservationSnap } = useGlobals();
const { allData, isError, isLoading } = useGetData(
lastObservationSnap,
domain,
'publisher',
12,
);
const { categories, dataGraph } = allData;
const dataTitle = {
observationYear: getObservationLabel(lastObservationSnap, intl),
};
const idWithDomain = withDomain(id, domain);
const optionsGraph = chartOptions[id].getOptions(
idWithDomain,
intl,
categories,
dataGraph,
dataTitle,
);
const hasBeta = true;
useEffect(() => {
setChartComments(customComments(allData, idWithDomain, intl));
}, [allData, idWithDomain, intl]);

return (
<WrapperChart
chartRef={chartRef}
dataTitle={dataTitle}
domain={domain}
hasBeta={hasBeta}
hasComments={false}
hasFooter={hasFooter}
id={id}
isError={isError}
isLoading={isLoading || !dataGraph || !categories}
>
<HighchartsReact
highcharts={Highcharts}
id={idWithDomain}
options={optionsGraph}
ref={chartRef}
/>
{hasComments && chartComments && (
<GraphComments comments={chartComments} hasFooter={hasFooter} />
)}
</WrapperChart>
);
};

Chart.defaultProps = {
domain: '',
hasComments: true,
hasFooter: true,
id: 'data.general.repositories.datasets-by-publisher',
};
Chart.propTypes = {
domain: PropTypes.oneOf(domains),
hasComments: PropTypes.bool,
hasFooter: PropTypes.bool,
id: PropTypes.oneOf(graphIds),
};

export default Chart;
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import Highcharts from 'highcharts';
import HCExportingData from 'highcharts/modules/export-data';
import HCExporting from 'highcharts/modules/exporting';
import HighchartsReact from 'highcharts-react-official';
import PropTypes from 'prop-types';
import React, { useEffect, useRef, useState } from 'react';
import { useIntl } from 'react-intl';

import customComments from '../../../../../utils/chartComments';
import { chartOptions } from '../../../../../utils/chartOptions';
import { domains, graphIds } from '../../../../../utils/constants';
import { getObservationLabel, withDomain } from '../../../../../utils/helpers';
import useGlobals from '../../../../../utils/Hooks/useGetGlobals';
import WrapperChart from '../../../../WrapperChart';
import GraphComments from '../../../graph-comments';
import useGetData from './get-data';

HCExporting(Highcharts);
HCExportingData(Highcharts);

const Chart = ({ domain, hasComments, hasFooter, id }) => {
const chartRef = useRef();
const intl = useIntl();
const [chartComments, setChartComments] = useState('');
const { lastObservationSnap } = useGlobals();
const { allData, isError, isLoading } = useGetData(
lastObservationSnap,
domain,
'size_cat',
10,
);
const { categories, dataGraph } = allData;
const dataTitle = {
observationYear: getObservationLabel(lastObservationSnap, intl),
};
const idWithDomain = withDomain(id, domain);
const optionsGraph = chartOptions[id].getOptions(
idWithDomain,
intl,
categories,
dataGraph,
dataTitle,
);
const hasBeta = true;
useEffect(() => {
setChartComments(customComments(allData, idWithDomain, intl));
}, [allData, idWithDomain, intl]);

return (
<WrapperChart
chartRef={chartRef}
dataTitle={dataTitle}
domain={domain}
hasBeta={hasBeta}
hasComments={false}
hasFooter={hasFooter}
id={id}
isError={isError}
isLoading={isLoading || !dataGraph || !categories}
>
<HighchartsReact
highcharts={Highcharts}
id={idWithDomain}
options={optionsGraph}
ref={chartRef}
/>
{hasComments && chartComments && (
<GraphComments comments={chartComments} hasFooter={hasFooter} />
)}
</WrapperChart>
);
};

Chart.defaultProps = {
domain: '',
hasComments: true,
hasFooter: true,
id: 'data.general.repositories.datasets-by-size',
};
Chart.propTypes = {
domain: PropTypes.oneOf(domains),
hasComments: PropTypes.bool,
hasFooter: PropTypes.bool,
id: PropTypes.oneOf(graphIds),
};

export default Chart;
Loading

0 comments on commit 2984e8b

Please sign in to comment.