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
c1042c6b
Commit
c1042c6b
authored
Feb 15, 2021
by
ianlapham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update chart font
parent
3cb38237
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
19 deletions
+5
-19
index.tsx
src/components/LineChart/index.tsx
+2
-19
index.tsx
src/pages/Swap/index.tsx
+3
-0
No files found.
src/components/LineChart/index.tsx
View file @
c1042c6b
import
React
,
{
useRef
,
useState
,
useEffect
,
useCallback
,
Dispatch
,
SetStateAction
,
ReactNode
}
from
'
react
'
import
React
,
{
useRef
,
useState
,
useEffect
,
useCallback
,
Dispatch
,
SetStateAction
,
ReactNode
}
from
'
react
'
import
{
createChart
,
IChartApi
,
ISeriesApi
}
from
'
lightweight-charts
'
import
{
createChart
,
IChartApi
}
from
'
lightweight-charts
'
import
{
darken
}
from
'
polished
'
import
{
darken
}
from
'
polished
'
import
{
RowBetween
}
from
'
components/Row
'
import
{
RowBetween
}
from
'
components/Row
'
import
Card
from
'
../Card
'
import
Card
from
'
../Card
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
useTheme
from
'
hooks/useTheme
'
import
useTheme
from
'
hooks/useTheme
'
import
{
useDarkModeManager
}
from
'
state/user/hooks
'
import
usePrevious
from
'
hooks/usePrevious
'
const
Wrapper
=
styled
(
Card
)
`
const
Wrapper
=
styled
(
Card
)
`
width: 100%;
width: 100%;
...
@@ -69,22 +67,7 @@ const LineChart = ({
...
@@ -69,22 +67,7 @@ const LineChart = ({
return
()
=>
window
.
removeEventListener
(
'
resize
'
,
handleResize
)
return
()
=>
window
.
removeEventListener
(
'
resize
'
,
handleResize
)
},
[
isClient
,
chartRef
,
handleResize
])
// Empty array ensures that effect is only run on mount and unmount
},
[
isClient
,
chartRef
,
handleResize
])
// Empty array ensures that effect is only run on mount and unmount
const
[
currentTheme
]
=
useDarkModeManager
()
const
textColor
=
theme
.
text2
const
textColor
=
theme
.
text2
const
previousTheme
=
usePrevious
(
currentTheme
)
const
[
activeSeries
,
setActiveSeries
]
=
useState
<
ISeriesApi
<
'
Area
'
>
|
undefined
>
(
undefined
)
// reset the chart if theme switches
useEffect
(()
=>
{
if
(
chartCreated
&&
activeSeries
&&
previousTheme
&&
previousTheme
!==
currentTheme
)
{
// remove the tooltip element
chartCreated
.
removeSeries
(
activeSeries
)
chartCreated
.
resize
(
0
,
0
)
setActiveSeries
(
undefined
)
setChart
(
undefined
)
}
},
[
activeSeries
,
chartCreated
,
currentTheme
,
previousTheme
])
// if chart not instantiated in canvas, create it
// if chart not instantiated in canvas, create it
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -95,6 +78,7 @@ const LineChart = ({
...
@@ -95,6 +78,7 @@ const LineChart = ({
layout
:
{
layout
:
{
backgroundColor
:
'
transparent
'
,
backgroundColor
:
'
transparent
'
,
textColor
:
textColor
,
textColor
:
textColor
,
fontFamily
:
'
Inter
'
,
},
},
rightPriceScale
:
{
rightPriceScale
:
{
scaleMargins
:
{
scaleMargins
:
{
...
@@ -143,7 +127,6 @@ const LineChart = ({
...
@@ -143,7 +127,6 @@ const LineChart = ({
priceLineVisible
:
false
,
priceLineVisible
:
false
,
})
})
setActiveSeries
(
series
)
series
.
setData
(
data
)
series
.
setData
(
data
)
// update the title when hovering on the chart
// update the title when hovering on the chart
...
...
src/pages/Swap/index.tsx
View file @
c1042c6b
...
@@ -48,6 +48,8 @@ import Loader from '../../components/Loader'
...
@@ -48,6 +48,8 @@ import Loader from '../../components/Loader'
import
{
useIsTransactionUnsupported
}
from
'
hooks/Trades
'
import
{
useIsTransactionUnsupported
}
from
'
hooks/Trades
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
{
isTradeBetter
}
from
'
utils/trades
'
import
{
isTradeBetter
}
from
'
utils/trades
'
import
LineChart
from
'
components/LineChart
'
import
{
dummyData
}
from
'
components/LineChart/data
'
export
default
function
Swap
()
{
export
default
function
Swap
()
{
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
...
@@ -300,6 +302,7 @@ export default function Swap() {
...
@@ -300,6 +302,7 @@ export default function Swap() {
/>
/>
<
SwapPoolTabs
active=
{
'
swap
'
}
/>
<
SwapPoolTabs
active=
{
'
swap
'
}
/>
<
AppBody
>
<
AppBody
>
<
LineChart
data=
{
dummyData
}
/>
<
SwapHeader
/>
<
SwapHeader
/>
<
Wrapper
id=
"swap-page"
>
<
Wrapper
id=
"swap-page"
>
<
ConfirmSwapModal
<
ConfirmSwapModal
...
...
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