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
e12c00e9
Unverified
Commit
e12c00e9
authored
Aug 22, 2022
by
Kaylee George
Committed by
GitHub
Aug 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: time selector updated to align with price chart (#4425)
* fix time * displays
parent
c25971e5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
24 deletions
+25
-24
PriceChart.tsx
src/components/Tokens/TokenDetails/PriceChart.tsx
+4
-11
TimeSelector.tsx
src/components/Tokens/TokenTable/TimeSelector.tsx
+19
-11
TokenRow.tsx
src/components/Tokens/TokenTable/TokenRow.tsx
+2
-2
No files found.
src/components/Tokens/TokenDetails/PriceChart.tsx
View file @
e12c00e9
...
@@ -25,16 +25,9 @@ import {
...
@@ -25,16 +25,9 @@ import {
}
from
'
utils/formatChartTimes
'
}
from
'
utils/formatChartTimes
'
import
LineChart
from
'
../../Charts/LineChart
'
import
LineChart
from
'
../../Charts/LineChart
'
import
{
DISPLAYS
,
ORDERED_TIMES
}
from
'
../TokenTable/TimeSelector
'
// TODO: This should be combined with the logic in TimeSelector.
// TODO: This should be combined with the logic in TimeSelector.
const
TIME_DISPLAYS
:
[
TimePeriod
,
string
][]
=
[
[
TimePeriod
.
HOUR
,
'
1H
'
],
[
TimePeriod
.
DAY
,
'
1D
'
],
[
TimePeriod
.
WEEK
,
'
1W
'
],
[
TimePeriod
.
MONTH
,
'
1M
'
],
[
TimePeriod
.
YEAR
,
'
1Y
'
],
[
TimePeriod
.
ALL
,
'
All
'
],
]
type
PricePoint
=
{
value
:
number
;
timestamp
:
number
}
type
PricePoint
=
{
value
:
number
;
timestamp
:
number
}
...
@@ -307,9 +300,9 @@ export function PriceChart({ width, height, token }: PriceChartProps) {
...
@@ -307,9 +300,9 @@ export function PriceChart({ width, height, token }: PriceChartProps) {
</
LineChart
>
</
LineChart
>
<
TimeOptionsWrapper
>
<
TimeOptionsWrapper
>
<
TimeOptionsContainer
>
<
TimeOptionsContainer
>
{
TIME_DISPLAYS
.
map
(([
value
,
display
]
)
=>
(
{
ORDERED_TIMES
.
map
((
time
)
=>
(
<
TimeButton
key=
{
display
}
active=
{
timePeriod
===
value
}
onClick=
{
()
=>
setTimePeriod
(
valu
e
)
}
>
<
TimeButton
key=
{
DISPLAYS
[
time
]
}
active=
{
timePeriod
===
time
}
onClick=
{
()
=>
setTimePeriod
(
tim
e
)
}
>
{
display
}
{
DISPLAYS
[
time
]
}
</
TimeButton
>
</
TimeButton
>
))
}
))
}
</
TimeOptionsContainer
>
</
TimeOptionsContainer
>
...
...
src/components/Tokens/TokenTable/TimeSelector.tsx
View file @
e12c00e9
...
@@ -10,15 +10,23 @@ import styled, { useTheme } from 'styled-components/macro'
...
@@ -10,15 +10,23 @@ import styled, { useTheme } from 'styled-components/macro'
import
{
MOBILE_MEDIA_BREAKPOINT
,
SMALL_MEDIA_BREAKPOINT
}
from
'
../constants
'
import
{
MOBILE_MEDIA_BREAKPOINT
,
SMALL_MEDIA_BREAKPOINT
}
from
'
../constants
'
import
{
filterTimeAtom
}
from
'
../state
'
import
{
filterTimeAtom
}
from
'
../state
'
export
const
TIME_DISPLAYS
:
{
[
key
:
string
]:
string
}
=
{
export
const
DISPLAYS
:
Record
<
TimePeriod
,
string
>
=
{
hour
:
'
1H
'
,
[
TimePeriod
.
HOUR
]:
'
1H
'
,
day
:
'
1D
'
,
[
TimePeriod
.
DAY
]:
'
1D
'
,
week
:
'
1W
'
,
[
TimePeriod
.
WEEK
]:
'
1W
'
,
month
:
'
1M
'
,
[
TimePeriod
.
MONTH
]:
'
1M
'
,
year
:
'
1Y
'
,
[
TimePeriod
.
YEAR
]:
'
1Y
'
,
[
TimePeriod
.
ALL
]:
'
All
'
,
}
}
const
TIMES
=
[
TimePeriod
.
HOUR
,
TimePeriod
.
DAY
,
TimePeriod
.
WEEK
,
TimePeriod
.
MONTH
,
TimePeriod
.
YEAR
]
export
const
ORDERED_TIMES
=
[
TimePeriod
.
HOUR
,
TimePeriod
.
DAY
,
TimePeriod
.
WEEK
,
TimePeriod
.
MONTH
,
TimePeriod
.
YEAR
,
TimePeriod
.
ALL
,
]
const
InternalMenuItem
=
styled
.
div
`
const
InternalMenuItem
=
styled
.
div
`
flex: 1;
flex: 1;
...
@@ -136,7 +144,7 @@ export default function TimeSelector() {
...
@@ -136,7 +144,7 @@ export default function TimeSelector() {
<
StyledMenu
ref=
{
node
}
>
<
StyledMenu
ref=
{
node
}
>
<
StyledMenuButton
onClick=
{
toggleMenu
}
aria
-
label=
{
`timeSelector`
}
open=
{
open
}
>
<
StyledMenuButton
onClick=
{
toggleMenu
}
aria
-
label=
{
`timeSelector`
}
open=
{
open
}
>
<
StyledMenuContent
>
<
StyledMenuContent
>
{
TIME_
DISPLAYS
[
activeTime
]
}
{
DISPLAYS
[
activeTime
]
}
<
Chevron
open=
{
open
}
>
<
Chevron
open=
{
open
}
>
{
open
?
<
ChevronUp
size=
{
15
}
viewBox=
"0 0 24 20"
/>
:
<
ChevronDown
size=
{
15
}
viewBox=
"0 0 24 20"
/>
}
{
open
?
<
ChevronUp
size=
{
15
}
viewBox=
"0 0 24 20"
/>
:
<
ChevronDown
size=
{
15
}
viewBox=
"0 0 24 20"
/>
}
</
Chevron
>
</
Chevron
>
...
@@ -144,15 +152,15 @@ export default function TimeSelector() {
...
@@ -144,15 +152,15 @@ export default function TimeSelector() {
</
StyledMenuButton
>
</
StyledMenuButton
>
{
open
&&
(
{
open
&&
(
<
MenuTimeFlyout
>
<
MenuTimeFlyout
>
{
TIMES
.
map
((
time
)
=>
(
{
ORDERED_
TIMES
.
map
((
time
)
=>
(
<
InternalLinkMenuItem
<
InternalLinkMenuItem
key=
{
time
}
key=
{
DISPLAYS
[
time
]
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setTime
(
time
)
setTime
(
time
)
toggleMenu
()
toggleMenu
()
}
}
}
}
>
>
<
div
>
{
TIME_
DISPLAYS
[
time
]
}
</
div
>
<
div
>
{
DISPLAYS
[
time
]
}
</
div
>
{
time
===
activeTime
&&
<
Check
color=
{
theme
.
accentAction
}
size=
{
16
}
/>
}
{
time
===
activeTime
&&
<
Check
color=
{
theme
.
accentAction
}
size=
{
16
}
/>
}
</
InternalLinkMenuItem
>
</
InternalLinkMenuItem
>
))
}
))
}
...
...
src/components/Tokens/TokenTable/TokenRow.tsx
View file @
e12c00e9
...
@@ -33,7 +33,7 @@ import {
...
@@ -33,7 +33,7 @@ import {
useToggleFavorite
,
useToggleFavorite
,
}
from
'
../state
'
}
from
'
../state
'
import
{
Category
,
SortDirection
}
from
'
../types
'
import
{
Category
,
SortDirection
}
from
'
../types
'
import
{
TIME_
DISPLAYS
}
from
'
./TimeSelector
'
import
{
DISPLAYS
}
from
'
./TimeSelector
'
const
ArrowCell
=
styled
.
div
`
const
ArrowCell
=
styled
.
div
`
padding-left: 2px;
padding-left: 2px;
...
@@ -294,7 +294,7 @@ const LogoContainer = styled.div`
...
@@ -294,7 +294,7 @@ const LogoContainer = styled.div`
/* formatting for volume with timeframe header display */
/* formatting for volume with timeframe header display */
function
getHeaderDisplay
(
category
:
string
,
timeframe
:
TimePeriod
):
string
{
function
getHeaderDisplay
(
category
:
string
,
timeframe
:
TimePeriod
):
string
{
if
(
category
===
Category
.
volume
)
return
`
${
TIME_
DISPLAYS
[
timeframe
]}
${
category
}
`
if
(
category
===
Category
.
volume
)
return
`
${
DISPLAYS
[
timeframe
]}
${
category
}
`
return
category
return
category
}
}
...
...
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