Skip to content

Commit

Permalink
replaced const of chart config to info dashboard directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehor Podporinov authored and Yehor Podporinov committed Apr 8, 2024
1 parent c6b5f47 commit ba1bb80
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 64 deletions.
60 changes: 60 additions & 0 deletions src/common/InfoDashboard/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { type ChartConfig } from '@/types'

export const CHART_CONFIG: Readonly<ChartConfig> = Object.freeze({
type: 'line',
options: {
maintainAspectRatio: false,
plugins: {
legend: { display: false },
},
scales: {
x: {
border: {
dash: [2],
},
grid: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
color: (ctx: any) => {
return ctx.index === 0 || (ctx.index + 1) % 5 === 0
? '#b1b1b1'
: '#4f4f4f'
},
},
ticks: {
color: '#ffffff',
autoSkip: false,
maxRotation: 0,
callback: function (value: unknown, idx: number) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const label = (this as any).getLabelForValue(value)
return idx === 0 || (idx + 1) % 5 === 0 ? label : ''
},
},
},
y: {
border: {
dash: [2],
},
grid: {
color: '#4f4f4f',
},
ticks: {
color: '#ffffff',
callback: (val: unknown) => String(val).replace(/000$/, 'K'),
stepSize: 5000,
},
},
},
},
data: {
datasets: [
{
backgroundColor: 'transparent',
borderColor: '#ff7c03',
pointBackgroundColor: '#ff7c03',
pointRadius: 4,
data: [],
},
],
},
})
4 changes: 2 additions & 2 deletions src/common/InfoDashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
</template>

<script lang="ts" setup>
import { AMOUNT_OF_DEPOSIT_CHART_CONFIG } from '@/const'
import { SelectField } from '@/fields'
import { ErrorHandler } from '@/helpers'
import { useWeb3ProvidersStore } from '@/store'
Expand All @@ -79,6 +78,7 @@ import type {
} from '@/types'
import { Time, formatEther } from '@/utils'
import { onMounted, reactive, ref, watch } from 'vue'
import { CHART_CONFIG } from './const'
import { getChartData } from './helpers'
import AppIcon from '../AppIcon.vue'
import AppChart from '../AppChart.vue'
Expand Down Expand Up @@ -116,7 +116,7 @@ const selectedMonth = ref(monthOptions[monthOptions.length - 1])
const isChartDataUpdating = ref(false)
const chartConfig = reactive<ChartConfig>({ ...AMOUNT_OF_DEPOSIT_CHART_CONFIG })
const chartConfig = reactive<ChartConfig>({ ...CHART_CONFIG })
const web3ProvidersStore = useWeb3ProvidersStore()
Expand Down
61 changes: 0 additions & 61 deletions src/const/chart.const.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/const/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import { constants } from 'ethers'
const { MaxUint256: MAX_UINT_256 } = constants

export { MAX_UINT_256 }
export * from './chart.const'
export * from './time.const'

0 comments on commit ba1bb80

Please sign in to comment.