Skip to content

Commit

Permalink
minor changes #146
Browse files Browse the repository at this point in the history
  • Loading branch information
ukorvl committed Nov 29, 2023
1 parent b53d39e commit 9e5655b
Show file tree
Hide file tree
Showing 24 changed files with 587 additions and 231 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@loadable/component": "^5.15.3",
"@nilfoundation/react-components": "^0.8.3",
"@nilfoundation/ui-kit": "^2.1.3",
"@nilfoundation/ui-kit": "^2.2.3",
"@reduxjs/toolkit": "^1.8.5",
"@sentry/react": "^7.21.1",
"@sentry/tracing": "^7.21.1",
Expand Down
15 changes: 0 additions & 15 deletions src/components/common/ChartTemplate/ChartBaseProps.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/components/common/ChartTemplate/ChartTemplate.module.scss

This file was deleted.

119 changes: 0 additions & 119 deletions src/components/common/ChartTemplate/ChartTemplate.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/common/ChartTemplate/index.ts

This file was deleted.

51 changes: 0 additions & 51 deletions src/components/common/StatementCharts/ProofCostChart.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/common/StatementCharts/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ export * from './ObjectAsPlainTextViewer';
export * from './GALocationTracker';
export * from './ProgressBar';
export * from './RouterLink';
export * from './ChartTemplate';
export * from './ChartLegend';
export * from './StatementCharts';
export * from './FullScreenLoader';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../../styles/constants.scss";
@import '../../../styles/constants.scss';

$height: 3rem;

Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions src/features/dashboard/components/Charts/ProofCostChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @file React component.
* @copyright Yury Korotovskikh <[email protected]>
*/

import type { ReactElement } from 'react';
import { useState } from 'react';
import { CandlestickSeries, Chart } from '@nilfoundation/ui-kit';
import type { CandlestickData, CandlestickSeriesPartialOptions } from 'lightweight-charts';
import { useGetStatementDashboardData } from '../../hooks/useGetStatementDashboardData';

/**
* Proof cost chart.
*
* @returns React component.
*/
export const ProofCostChart = (): ReactElement => {
const [legendData, setLegendData] = useState<CandlestickData | null>(null);

Check warning on line 18 in src/features/dashboard/components/Charts/ProofCostChart.tsx

View workflow job for this annotation

GitHub Actions / Build

'legendData' is assigned a value but never used

Check warning on line 18 in src/features/dashboard/components/Charts/ProofCostChart.tsx

View workflow job for this annotation

GitHub Actions / Build

'setLegendData' is assigned a value but never used
const {
chartData: { candlestickChartData, volumesData },

Check warning on line 20 in src/features/dashboard/components/Charts/ProofCostChart.tsx

View workflow job for this annotation

GitHub Actions / Build

'volumesData' is assigned a value but never used
loadingData: isLoadingChartData,

Check warning on line 21 in src/features/dashboard/components/Charts/ProofCostChart.tsx

View workflow job for this annotation

GitHub Actions / Build

'isLoadingChartData' is assigned a value but never used
} = useGetStatementDashboardData(props.displayVolumes, props.dataRange);

Check failure on line 22 in src/features/dashboard/components/Charts/ProofCostChart.tsx

View workflow job for this annotation

GitHub Actions / Build

'displayVolumes' is missing in props validation

Check failure on line 22 in src/features/dashboard/components/Charts/ProofCostChart.tsx

View workflow job for this annotation

GitHub Actions / Build

'dataRange' is missing in props validation

return (
<Chart>
<CandlestickSeries
data={candlestickChartData}
reactive
options={seriesDefaultOptions}
/>
</Chart>
);
};

/**
* Series default options.
*/
const seriesDefaultOptions: CandlestickSeriesPartialOptions = {
priceFormat: {
type: 'price',
precision: 4,
minMove: 0.0001,
},
};
File renamed without changes.
51 changes: 51 additions & 0 deletions src/features/dashboard/components/Dashboard/ChartTypeSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @file React component.
* @copyright Yury Korotovskikh <[email protected]>
*/

import type { ReactElement } from 'react';
import { Nav } from '@nilfoundation/react-components';
import { ChartType } from '@/enums';
import { useBreakpoint } from '@/features/shared';
import { BREAKPOINT } from '@/styles/Breakpoint';

/**
* Props.
*/
type ChartTypeSelectProps = {
chartType: ChartType;
onSelectChartType: (chartType: ChartType) => void;
disabled: boolean;
};

/**
* Chart type selector.
*
* @param {ChartTypeSelectProps} props Props.
* @returns React component.
*/
export const ChartTypeSelect = ({
chartType,
onSelectChartType,
disabled,
}: ChartTypeSelectProps): ReactElement => {
const bp = useBreakpoint();

return (
<Nav
tabs
vertical={bp === BREAKPOINT.SM}
>
{Object.values(ChartType).map(x => (
<Nav.Item
key={x}
active={x === chartType}
onClick={() => onSelectChartType(x)}
disabled={disabled}
>
{x}
</Nav.Item>
))}
</Nav>
);
};
Loading

0 comments on commit 9e5655b

Please sign in to comment.