Skip to content

Commit 2c0e19b

Browse files
Hdm 27 (#2641)
* feat(dashboard/ui-2024): number formatting changed for custom chart tooltips * fix(dashboard/ui-2024): box shadow and border radius changed for graph containers * feat(dashboard/ui-2024): new moonbeam icon added and all icons aligned in leaderboard and search select inputs * feat(dashboard/ui-2024): custom tooltip component created and implemented to work on mobile * feat(dashboard/ui-2024): date pickers range changes * feat(dashboard/ui-2024): mobile design adjusted for SelectNetwork component * feat(dashboard/ui-2024): copied tooltip proper display * fix(dashboard/ui-2024): help icons color for TransactionsTableHead component changed * fix(dashboard/ui-2024): code cleanup for area chart * fix(dashboard/ui-2024): build problem resolved * fix(dashboard/ui-2024): remove fixed columns width in Leaderboard * feat(dashboard-ui-2024): decrease min column width * fix(dashboard/ui-2024/leaderboard): fix table width on desktop * fix(dashboard/ui-2024): separate charts data queries --------- Co-authored-by: michal rozek <[email protected]>
1 parent 41faa18 commit 2c0e19b

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

packages/apps/dashboard/ui-2024/src/components/Home/GraphSwiper.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ import SmallGraph from '@components/Home/SmallGraph';
44
import 'swiper/css';
55
import 'swiper/css/navigation';
66
import { useGraphPageChartData } from '@services/api/use-graph-page-chart-data';
7+
import { useGraphPageChartParams } from '@utils/hooks/use-graph-page-chart-params';
8+
import { useEffect } from 'react';
79

810
const GraphSwiper = () => {
911
const { data } = useGraphPageChartData();
12+
const { revertToInitialParams } = useGraphPageChartParams();
13+
14+
useEffect(() => {
15+
revertToInitialParams();
16+
// eslint-disable-next-line react-hooks/exhaustive-deps
17+
}, []);
18+
1019
const transactionHistoryData = (data || []).map(
1120
({ totalTransactionCount, date }) => ({
1221
value: totalTransactionCount,

packages/apps/dashboard/ui-2024/src/pages/Graph/Graph.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { AreaChart } from '@components/Charts';
22
import Tabs from '@mui/material/Tabs';
33
import TabPanel from '@mui/lab/TabPanel';
44
import Tab from '@mui/material/Tab';
5-
import { useState } from 'react';
5+
import { useEffect, useState } from 'react';
66
import TabContext from '@mui/lab/TabContext';
77
import Typography from '@mui/material/Typography';
88
import PageWrapper from '@components/PageWrapper';
99
import Breadcrumbs from '@components/Breadcrumbs';
10+
import { useGraphPageChartParams } from '@utils/hooks/use-graph-page-chart-params';
1011

1112
type graphType = 'bucketed';
1213

@@ -15,6 +16,12 @@ const Graph = () => {
1516
const handleGraphTypeChange = (_: unknown, newValue: graphType) => {
1617
setGraphType(newValue);
1718
};
19+
const { revertToInitialParams } = useGraphPageChartParams();
20+
21+
useEffect(() => {
22+
revertToInitialParams();
23+
// eslint-disable-next-line react-hooks/exhaustive-deps
24+
}, []);
1825

1926
return (
2027
<PageWrapper displaySearchBar className="standard-background">

packages/apps/dashboard/ui-2024/src/utils/hooks/use-graph-page-chart-params.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ export interface GraphPageChartParams {
5050
setFromDate: (fromDate: Dayjs | null) => void;
5151
setToDate: (toDate: Dayjs | null) => void;
5252
setEffectiveFromAllTimeDate: (date: Dayjs) => void;
53+
revertToInitialParams: () => void;
5354
}
5455

56+
const INITIAL_RANGE_PARAMS = {
57+
from: oneWeekAgo,
58+
to: dayjs(),
59+
};
60+
5561
export const useGraphPageChartParams = create<GraphPageChartParams>((set) => ({
56-
dateRangeParams: {
57-
from: oneWeekAgo,
58-
to: dayjs(),
59-
},
62+
dateRangeParams: INITIAL_RANGE_PARAMS,
6063
selectedTimePeriod: '1W',
6164
setFromDate: (fromDate: Dayjs | null) => {
6265
if (!fromDate) {
@@ -105,4 +108,10 @@ export const useGraphPageChartParams = create<GraphPageChartParams>((set) => ({
105108
effectiveFromAllTimeDate: date,
106109
}));
107110
},
111+
revertToInitialParams: () => {
112+
set((state) => ({
113+
...state,
114+
dateRangeParams: INITIAL_RANGE_PARAMS,
115+
}));
116+
},
108117
}));

0 commit comments

Comments
 (0)