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 ...@@ -35,9 +35,7 @@ function SparklineChart({ width, height, tokenData, pricePercentChange, timePeri
[0, 110] [0, 110]
) )
const rdScale = scaleLinear().domain(getPriceBounds(pricePoints)).range([30, 0]) const rdScale = scaleLinear().domain(getPriceBounds(pricePoints)).range([30, 0])
const curveTension = 0.9
/* Default curve doesn't look good for the ALL chart */
const curveTension = timePeriod === TimePeriod.ALL ? 0.75 : 0.9
return ( return (
<LineChart <LineChart
......
...@@ -5,17 +5,7 @@ import { GlyphCircle } from '@visx/glyph' ...@@ -5,17 +5,7 @@ import { GlyphCircle } from '@visx/glyph'
import { Line } from '@visx/shape' import { Line } from '@visx/shape'
import AnimatedInLineChart from 'components/Charts/AnimatedInLineChart' import AnimatedInLineChart from 'components/Charts/AnimatedInLineChart'
import { filterTimeAtom } from 'components/Tokens/state' import { filterTimeAtom } from 'components/Tokens/state'
import { import { bisect, curveCardinal, NumberValue, scaleLinear, timeDay, timeHour, timeMinute, timeMonth } from 'd3'
bisect,
curveCardinal,
NumberValue,
scaleLinear,
timeDay,
timeHour,
timeMinute,
timeMonth,
timeTicks,
} from 'd3'
import { PricePoint } from 'graphql/data/Token' import { PricePoint } from 'graphql/data/Token'
import { TimePeriod } from 'graphql/data/util' import { TimePeriod } from 'graphql/data/util'
import { useActiveLocale } from 'hooks/useActiveLocale' import { useActiveLocale } from 'hooks/useActiveLocale'
...@@ -29,7 +19,6 @@ import { ...@@ -29,7 +19,6 @@ import {
monthDayFormatter, monthDayFormatter,
monthTickFormatter, monthTickFormatter,
monthYearDayFormatter, monthYearDayFormatter,
monthYearFormatter,
weekFormatter, weekFormatter,
} from 'utils/formatChartTimes' } from 'utils/formatChartTimes'
...@@ -221,12 +210,6 @@ export function PriceChart({ width, height, prices }: PriceChartProps) { ...@@ -221,12 +210,6 @@ export function PriceChart({ width, height, prices }: PriceChartProps) {
monthYearDayFormatter(locale), monthYearDayFormatter(locale),
timeMonth.range(startDateWithOffset, endDateWithOffset, 2).map((x) => x.valueOf() / 1000), 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) { ...@@ -276,8 +259,12 @@ export function PriceChart({ width, height, prices }: PriceChartProps) {
const crosshairEdgeMax = width * 0.85 const crosshairEdgeMax = width * 0.85
const crosshairAtEdge = !!crosshair && crosshair > crosshairEdgeMax 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 ( return (
<> <>
......
...@@ -17,16 +17,14 @@ export const DISPLAYS: Record<TimePeriod, string> = { ...@@ -17,16 +17,14 @@ export const DISPLAYS: Record<TimePeriod, string> = {
[TimePeriod.WEEK]: '1W', [TimePeriod.WEEK]: '1W',
[TimePeriod.MONTH]: '1M', [TimePeriod.MONTH]: '1M',
[TimePeriod.YEAR]: '1Y', [TimePeriod.YEAR]: '1Y',
[TimePeriod.ALL]: 'All',
} }
export const ORDERED_TIMES = [ export const ORDERED_TIMES: TimePeriod[] = [
TimePeriod.HOUR, TimePeriod.HOUR,
TimePeriod.DAY, TimePeriod.DAY,
TimePeriod.WEEK, TimePeriod.WEEK,
TimePeriod.MONTH, TimePeriod.MONTH,
TimePeriod.YEAR, TimePeriod.YEAR,
TimePeriod.ALL,
] ]
const InternalMenuItem = styled.div` const InternalMenuItem = styled.div`
......
...@@ -92,7 +92,6 @@ const tokenPriceQuery = graphql` ...@@ -92,7 +92,6 @@ const tokenPriceQuery = graphql`
$skip1W: Boolean! $skip1W: Boolean!
$skip1M: Boolean! $skip1M: Boolean!
$skip1Y: Boolean! $skip1Y: Boolean!
$skipMax: Boolean!
) { ) {
tokens(contracts: [$contract]) { tokens(contracts: [$contract]) {
market(currency: USD) { market(currency: USD) {
...@@ -116,10 +115,6 @@ const tokenPriceQuery = graphql` ...@@ -116,10 +115,6 @@ const tokenPriceQuery = graphql`
timestamp timestamp
value value
} }
priceHistoryMAX: priceHistory(duration: MAX) @skip(if: $skipMax) {
timestamp
value
}
} }
} }
} }
...@@ -161,7 +156,6 @@ export function useTokenPricesCached(token: SingleTokenData) { ...@@ -161,7 +156,6 @@ export function useTokenPricesCached(token: SingleTokenData) {
skip1W: timePeriod === TimePeriod.WEEK && !!fetchedTokenPrices, skip1W: timePeriod === TimePeriod.WEEK && !!fetchedTokenPrices,
skip1M: timePeriod === TimePeriod.MONTH && !!fetchedTokenPrices, skip1M: timePeriod === TimePeriod.MONTH && !!fetchedTokenPrices,
skip1Y: timePeriod === TimePeriod.YEAR && !!fetchedTokenPrices, skip1Y: timePeriod === TimePeriod.YEAR && !!fetchedTokenPrices,
skipMax: timePeriod === TimePeriod.ALL && !!fetchedTokenPrices,
}).subscribe({ }).subscribe({
next: (data) => { next: (data) => {
const market = data.tokens?.[0]?.market const market = data.tokens?.[0]?.market
...@@ -171,7 +165,6 @@ export function useTokenPricesCached(token: SingleTokenData) { ...@@ -171,7 +165,6 @@ export function useTokenPricesCached(token: SingleTokenData) {
market.priceHistory1W && updatePrices(TimePeriod.WEEK, filterPrices(market.priceHistory1W)) market.priceHistory1W && updatePrices(TimePeriod.WEEK, filterPrices(market.priceHistory1W))
market.priceHistory1M && updatePrices(TimePeriod.MONTH, filterPrices(market.priceHistory1M)) market.priceHistory1M && updatePrices(TimePeriod.MONTH, filterPrices(market.priceHistory1M))
market.priceHistory1Y && updatePrices(TimePeriod.YEAR, filterPrices(market.priceHistory1Y)) market.priceHistory1Y && updatePrices(TimePeriod.YEAR, filterPrices(market.priceHistory1Y))
market.priceHistoryMAX && updatePrices(TimePeriod.ALL, filterPrices(market.priceHistoryMAX))
} }
}, },
}) })
......
...@@ -9,7 +9,6 @@ export enum TimePeriod { ...@@ -9,7 +9,6 @@ export enum TimePeriod {
WEEK, WEEK,
MONTH, MONTH,
YEAR, YEAR,
ALL,
} }
export function toHistoryDuration(timePeriod: TimePeriod): HistoryDuration { export function toHistoryDuration(timePeriod: TimePeriod): HistoryDuration {
...@@ -24,8 +23,6 @@ export function toHistoryDuration(timePeriod: TimePeriod): HistoryDuration { ...@@ -24,8 +23,6 @@ export function toHistoryDuration(timePeriod: TimePeriod): HistoryDuration {
return 'MONTH' return 'MONTH'
case TimePeriod.YEAR: case TimePeriod.YEAR:
return '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