using new state management
This commit is contained in:
@@ -3,7 +3,7 @@ import { ChartDataPoint, HistoryChartProps, ChartData } from "./HistoryChart.mod
|
||||
import HistoryChartView from "./HistoryChart.view";
|
||||
|
||||
export default function HistoryChart(props: HistoryChartProps) {
|
||||
const { tabs, data, periodType, comparison } = props;
|
||||
const { tabs, data, mode, periodType, comparison } = props;
|
||||
|
||||
const [activeTab, setActiveTab] = React.useState<string>(tabs[0] || "");
|
||||
const [startIndex, setStartIndex] = React.useState(0);
|
||||
@@ -12,12 +12,8 @@ export default function HistoryChart(props: HistoryChartProps) {
|
||||
|
||||
let rawData: ChartDataPoint[] = [];
|
||||
|
||||
if (activeDataKey === "daily") {
|
||||
rawData = data.daily || [];
|
||||
} else {
|
||||
const section = data[activeDataKey];
|
||||
rawData = section?.[periodType] || [];
|
||||
}
|
||||
const section = data[activeDataKey];
|
||||
rawData = section?.[periodType] || [];
|
||||
|
||||
const currentData = rawData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user