Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
1361f996
Unverified
Commit
1361f996
authored
Oct 03, 2022
by
lynn
Committed by
GitHub
Oct 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove ALL in time periods (temporary until v2 backend data available) (#4780)
* remove ALL * fix to zach comments * fix comment
parent
d70a87a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
36 deletions
+9
-36
SparklineChart.tsx
src/components/Charts/SparklineChart.tsx
+1
-3
PriceChart.tsx
src/components/Tokens/TokenDetails/PriceChart.tsx
+7
-20
TimeSelector.tsx
src/components/Tokens/TokenTable/TimeSelector.tsx
+1
-3
Token.ts
src/graphql/data/Token.ts
+0
-7
util.ts
src/graphql/data/util.ts
+0
-3
No files found.
src/components/Charts/SparklineChart.tsx
View file @
1361f996
...
...
@@ -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
...
...
src/components/Tokens/TokenDetails/PriceChart.tsx
View file @
1361f996
...
...
@@ -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
(
<>
...
...
src/components/Tokens/TokenTable/TimeSelector.tsx
View file @
1361f996
...
...
@@ -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
`
...
...
src/graphql/data/Token.ts
View file @
1361f996
...
...
@@ -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
))
}
},
})
...
...
src/graphql/data/util.ts
View file @
1361f996
...
...
@@ -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
'
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment