Updated dependencies and fixed coding styles

This commit is contained in:
Alejandro Celaya
2021-02-28 12:56:56 +01:00
parent fb2194d2d1
commit 47fb26368b
20 changed files with 3687 additions and 2136 deletions

View File

@@ -55,7 +55,7 @@ const generateGraphData = (
'#DCDCDC',
'#463730',
],
borderColor: isBarChart ? MAIN_COLOR : (isDarkThemeEnabled() ? PRIMARY_DARK_COLOR : PRIMARY_LIGHT_COLOR),
borderColor: isBarChart ? MAIN_COLOR : isDarkThemeEnabled() ? PRIMARY_DARK_COLOR : PRIMARY_LIGHT_COLOR,
borderWidth: 2,
},
highlightedData && {
@@ -127,7 +127,7 @@ const DefaultChart = (
}, { ...stats }),
);
const highlightedData = statsAreDefined(highlightedStats) ? fillTheGaps(highlightedStats, labels) : undefined;
const [ chartRef, setChartRef ] = useState<HorizontalBar | Doughnut | undefined>()
const [ chartRef, setChartRef ] = useState<HorizontalBar | Doughnut | undefined>();
const options: ChartOptions = {
legend: { display: false },
@@ -137,7 +137,6 @@ const DefaultChart = (
{
ticks: {
beginAtZero: true,
// @ts-expect-error
precision: 0,
callback: prettify,
max,

View File

@@ -81,17 +81,18 @@ const groupVisitsByStep = (step: Step, visits: NormalizedVisit[]): Stats => visi
{},
);
const visitsToDatasetGroups = (step: Step, visits: NormalizedVisit[]) => visits.reduce(
(acc, visit) => {
const key = STEP_TO_DATE_FORMAT[step](visit.date);
const visitsToDatasetGroups = (step: Step, visits: NormalizedVisit[]) =>
visits.reduce<Record<string, NormalizedVisit[]>>(
(acc, visit) => {
const key = STEP_TO_DATE_FORMAT[step](visit.date);
acc[key] = acc[key] ?? [];
acc[key].push(visit);
acc[key] = acc[key] ?? [];
acc[key].push(visit);
return acc;
},
{} as Record<string, NormalizedVisit[]>,
);
return acc;
},
{},
);
const generateLabels = (step: Step, visits: NormalizedVisit[]): string[] => {
const unit = STEP_TO_DATE_UNIT_MAP[step];
@@ -186,7 +187,6 @@ const LineChartCard = (
{
ticks: {
beginAtZero: true,
// @ts-expect-error
precision: 0,
callback: prettify,
},

View File

@@ -9,7 +9,7 @@ import { Stats, StatsRow } from '../types';
import GraphCard from './GraphCard';
import { DefaultChartProps } from './DefaultChart';
const toLowerIfString = (value: any) => type(value) === 'String' ? toLower(value) : value;
const toLowerIfString = (value: any) => type(value) === 'String' ? toLower(value) : value; // eslint-disable-line @typescript-eslint/no-unsafe-return
const pickKeyFromPair = ([ key ]: StatsRow) => key;
const pickValueFromPair = ([ , value ]: StatsRow) => value;