Commit 1361f996 authored by lynn's avatar lynn Committed by GitHub

fix: remove ALL in time periods (temporary until v2 backend data available) (#4780)

* remove ALL

* fix to zach comments

* fix comment
parent d70a87a8
......@@ -35,9 +35,7 @@ function SparklineChart({ width, height, tokenData, pricePercentChange, timePeri
[0, 110]
)
const rdScale = scaleLinear().domain(getPriceBounds(pricePoints)).range([30, 0])
/* Default curve doesn't look good for the ALL chart */
const curveTension = timePeriod === TimePeriod.ALL ? 0.75 : 0.9
const curveTension = 0.9
return (
<LineChart
......
......@@ -5,17 +5,7 @@ import { GlyphCircle } from '@visx/glyph'
import { Line } from '@visx/shape'
import AnimatedInLineChart from 'components/Charts/AnimatedInLineChart'
import { filterTimeAtom } from 'components/Tokens/state'
import {
bisect,
curveCardinal,
NumberValue,
scaleLinear,
timeDay,
timeHour,
timeMinute,
timeMonth,
timeTicks,
} from 'd3'
import { bisect, curveCardinal, NumberValue, scaleLinear, timeDay, timeHour, timeMinute, timeMonth } from 'd3'
import { PricePoint } from 'graphql/data/Token'
import { TimePeriod } from 'graphql/data/util'
import { useActiveLocale } from 'hooks/useActiveLocale'
......@@ -29,7 +19,6 @@ import {
monthDayFormatter,
monthTickFormatter,
monthYearDayFormatter,
monthYearFormatter,
weekFormatter,
} from 'utils/formatChartTimes'
......@@ -221,12 +210,6 @@ export function PriceChart({ width, height, prices }: PriceChartProps) {
monthYearDayFormatter(locale),
timeMonth.range(startDateWithOffset, endDateWithOffset, 2).map((x) => x.valueOf() / 1000),
]
case TimePeriod.ALL:
return [
monthYearFormatter(locale),
monthYearDayFormatter(locale),
timeTicks(startDateWithOffset, endDateWithOffset, 6).map((x) => x.valueOf() / 1000),
]
}
}
......@@ -276,8 +259,12 @@ export function PriceChart({ width, height, prices }: PriceChartProps) {
const crosshairEdgeMax = width * 0.85
const crosshairAtEdge = !!crosshair && crosshair > crosshairEdgeMax
/* Default curve doesn't look good for the HOUR/ALL chart */
const curveTension = timePeriod === TimePeriod.ALL ? 0.75 : timePeriod === TimePeriod.HOUR ? 1 : 0.9
/*
* Default curve doesn't look good for the HOUR chart.
* Higher values make the curve more rigid, lower values smooth the curve but make it less "sticky" to real data points,
* making it unacceptable for shorter durations / smaller variances.
*/
const curveTension = timePeriod === TimePeriod.HOUR ? 1 : 0.9
return (
<>
......
......@@ -17,16 +17,14 @@ export const DISPLAYS: Record<TimePeriod, string> = {
[TimePeriod.WEEK]: '1W',
[TimePeriod.MONTH]: '1M',
[TimePeriod.YEAR]: '1Y',
[TimePeriod.ALL]: 'All',
}
export const ORDERED_TIMES = [
export const ORDERED_TIMES: TimePeriod[] = [
TimePeriod.HOUR,
TimePeriod.DAY,
TimePeriod.WEEK,
TimePeriod.MONTH,
TimePeriod.YEAR,
TimePeriod.ALL,
]
const InternalMenuItem = styled.div`
......
......@@ -92,7 +92,6 @@ const tokenPriceQuery = graphql`
$skip1W: Boolean!
$skip1M: Boolean!
$skip1Y: Boolean!
$skipMax: Boolean!
) {
tokens(contracts: [$contract]) {
market(currency: USD) {
......@@ -116,10 +115,6 @@ const tokenPriceQuery = graphql`
timestamp
value
}
priceHistoryMAX: priceHistory(duration: MAX) @skip(if: $skipMax) {
timestamp
value
}
}
}
}
......@@ -161,7 +156,6 @@ export function useTokenPricesCached(token: SingleTokenData) {
skip1W: timePeriod === TimePeriod.WEEK && !!fetchedTokenPrices,
skip1M: timePeriod === TimePeriod.MONTH && !!fetchedTokenPrices,
skip1Y: timePeriod === TimePeriod.YEAR && !!fetchedTokenPrices,
skipMax: timePeriod === TimePeriod.ALL && !!fetchedTokenPrices,
}).subscribe({
next: (data) => {
const market = data.tokens?.[0]?.market
......@@ -171,7 +165,6 @@ export function useTokenPricesCached(token: SingleTokenData) {
market.priceHistory1W && updatePrices(TimePeriod.WEEK, filterPrices(market.priceHistory1W))
market.priceHistory1M && updatePrices(TimePeriod.MONTH, filterPrices(market.priceHistory1M))
market.priceHistory1Y && updatePrices(TimePeriod.YEAR, filterPrices(market.priceHistory1Y))
market.priceHistoryMAX && updatePrices(TimePeriod.ALL, filterPrices(market.priceHistoryMAX))
}
},
})
......
......@@ -9,7 +9,6 @@ export enum TimePeriod {
WEEK,
MONTH,
YEAR,
ALL,
}
export function toHistoryDuration(timePeriod: TimePeriod): HistoryDuration {
......@@ -24,8 +23,6 @@ export function toHistoryDuration(timePeriod: TimePeriod): HistoryDuration {
return 'MONTH'
case TimePeriod.YEAR:
return 'YEAR'
case TimePeriod.ALL:
return 'MAX'
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment