major refactor of the dashboard and react-openapi integration #1
@@ -25,7 +25,7 @@ export default function DashboardView({
|
|||||||
}: ViewProps) {
|
}: ViewProps) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const themeMode = theme.palette.mode;
|
const themeMode = theme.palette.mode;
|
||||||
const { mode, period, comparison } = state;
|
const { mode, periodType, comparison } = state;
|
||||||
|
|
||||||
// Resolve colors with fallbacks
|
// Resolve colors with fallbacks
|
||||||
const colors = React.useMemo(() => {
|
const colors = React.useMemo(() => {
|
||||||
@@ -139,8 +139,8 @@ export default function DashboardView({
|
|||||||
title={section.title}
|
title={section.title}
|
||||||
accentColor={colors.primary}
|
accentColor={colors.primary}
|
||||||
colorScheme={colors}
|
colorScheme={colors}
|
||||||
periodType={period}
|
periodType={periodType}
|
||||||
onPeriodTypeChange={(p: any) => setState(prev => ({ ...prev, period: p }))}
|
onPeriodTypeChange={(p: any) => setState(prev => ({ ...prev, periodType: p }))}
|
||||||
comparison={comparison}
|
comparison={comparison}
|
||||||
setComparison={(c: any) => setState(prev => ({ ...prev, comparison: c }))}
|
setComparison={(c: any) => setState(prev => ({ ...prev, comparison: c }))}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ChartDataPoint, HistoryChartProps, ChartData } from "./HistoryChart.mod
|
|||||||
import HistoryChartView from "./HistoryChart.view";
|
import HistoryChartView from "./HistoryChart.view";
|
||||||
|
|
||||||
export default function HistoryChart(props: HistoryChartProps) {
|
export default function HistoryChart(props: HistoryChartProps) {
|
||||||
const { tabs, data, period, comparison } = props;
|
const { tabs, data, periodType, comparison } = props;
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = React.useState<string>(tabs[0] || "");
|
const [activeTab, setActiveTab] = React.useState<string>(tabs[0] || "");
|
||||||
const [startIndex, setStartIndex] = React.useState(0);
|
const [startIndex, setStartIndex] = React.useState(0);
|
||||||
@@ -16,7 +16,7 @@ export default function HistoryChart(props: HistoryChartProps) {
|
|||||||
rawData = data.daily || [];
|
rawData = data.daily || [];
|
||||||
} else {
|
} else {
|
||||||
const section = data[activeDataKey];
|
const section = data[activeDataKey];
|
||||||
rawData = section?.[period] || [];
|
rawData = section?.[periodType] || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentData = rawData;
|
const currentData = rawData;
|
||||||
|
|||||||
Reference in New Issue
Block a user