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
c0bdb8db
Unverified
Commit
c0bdb8db
authored
Mar 30, 2022
by
Zach Pomerantz
Committed by
GitHub
Mar 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: break unnecessary hierarchical deps (#3629)
parent
2d8f767d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
22 deletions
+26
-22
WidgetsPropsValidator.tsx
src/lib/components/Error/WidgetsPropsValidator.tsx
+1
-1
SwapPropValidator.tsx
src/lib/components/Swap/SwapPropValidator.tsx
+1
-1
index.tsx
src/lib/components/Swap/index.tsx
+9
-4
Widget.tsx
src/lib/components/Widget.tsx
+15
-16
No files found.
src/lib/components/Error/WidgetsPropsValidator.tsx
View file @
c0bdb8db
...
@@ -26,5 +26,5 @@ export default function WidgetsPropsValidator(props: PropsWithChildren<WidgetPro
...
@@ -26,5 +26,5 @@ export default function WidgetsPropsValidator(props: PropsWithChildren<WidgetPro
}
}
},
[
locale
])
},
[
locale
])
return
<>
{
props
.
children
}
</>
return
null
}
}
src/lib/components/Swap/SwapPropValidator.tsx
View file @
c0bdb8db
...
@@ -81,5 +81,5 @@ export default function SwapPropValidator(props: ValidatorProps) {
...
@@ -81,5 +81,5 @@ export default function SwapPropValidator(props: ValidatorProps) {
}
}
},
[
defaultInputTokenAddress
,
defaultInputAmount
,
defaultOutputTokenAddress
,
defaultOutputAmount
])
},
[
defaultInputTokenAddress
,
defaultInputAmount
,
defaultOutputTokenAddress
,
defaultOutputAmount
])
return
<>
{
props
.
children
}
</>
return
null
}
}
src/lib/components/Swap/index.tsx
View file @
c0bdb8db
...
@@ -47,11 +47,15 @@ export interface SwapProps extends TokenDefaults, FeeOptions {
...
@@ -47,11 +47,15 @@ export interface SwapProps extends TokenDefaults, FeeOptions {
onConnectWallet
?:
()
=>
void
onConnectWallet
?:
()
=>
void
}
}
export
default
function
Swap
(
props
:
SwapProps
)
{
function
Updaters
(
props
:
SwapProps
&
{
disabled
:
boolean
}
)
{
useSyncTokenList
(
props
.
tokenList
)
useSyncTokenList
(
props
.
tokenList
)
useSyncTokenDefaults
(
props
)
useSyncTokenDefaults
(
props
)
useSyncConvenienceFee
(
props
)
useSyncConvenienceFee
(
props
)
return
props
.
disabled
?
null
:
<
SwapInfoUpdater
/>
}
export
default
function
Swap
(
props
:
SwapProps
)
{
const
{
active
,
account
}
=
useActiveWeb3React
()
const
{
active
,
account
}
=
useActiveWeb3React
()
const
[
wrapper
,
setWrapper
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
const
[
wrapper
,
setWrapper
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
...
@@ -71,8 +75,9 @@ export default function Swap(props: SwapProps) {
...
@@ -71,8 +75,9 @@ export default function Swap(props: SwapProps) {
const
isInteractive
=
Boolean
(
active
&&
onSupportedNetwork
)
const
isInteractive
=
Boolean
(
active
&&
onSupportedNetwork
)
return
(
return
(
<
SwapPropValidator
{
...
props
}
>
<>
{
isSwapSupported
&&
<
SwapInfoUpdater
/>
}
<
SwapPropValidator
{
...
props
}
/>
<
Updaters
{
...
props
}
disabled=
{
!
isSwapSupported
}
/>
<
Header
title=
{
<
Trans
>
Swap
</
Trans
>
}
>
<
Header
title=
{
<
Trans
>
Swap
</
Trans
>
}
>
{
active
&&
<
Wallet
disabled=
{
!
account
}
onClick=
{
props
.
onConnectWallet
}
/>
}
{
active
&&
<
Wallet
disabled=
{
!
account
}
onClick=
{
props
.
onConnectWallet
}
/>
}
<
Settings
disabled=
{
!
isInteractive
}
/>
<
Settings
disabled=
{
!
isInteractive
}
/>
...
@@ -92,6 +97,6 @@ export default function Swap(props: SwapProps) {
...
@@ -92,6 +97,6 @@ export default function Swap(props: SwapProps) {
<
StatusDialog
tx=
{
displayTx
}
onClose=
{
()
=>
setDisplayTxHash
()
}
/>
<
StatusDialog
tx=
{
displayTx
}
onClose=
{
()
=>
setDisplayTxHash
()
}
/>
</
Dialog
>
</
Dialog
>
)
}
)
}
</
SwapPropValidator
>
</>
)
)
}
}
src/lib/components/Widget.tsx
View file @
c0bdb8db
...
@@ -117,27 +117,26 @@ export default function Widget(props: PropsWithChildren<WidgetProps>) {
...
@@ -117,27 +117,26 @@ export default function Widget(props: PropsWithChildren<WidgetProps>) {
const
[
dialog
,
setDialog
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
const
[
dialog
,
setDialog
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
return
(
return
(
<
StrictMode
>
<
StrictMode
>
<
I18nProvider
locale=
{
local
e
}
>
<
ThemeProvider
theme=
{
them
e
}
>
<
ThemeProvider
theme=
{
the
me
}
>
<
WidgetWrapper
width=
{
width
}
className=
{
classNa
me
}
>
<
WidgetWrapper
width=
{
width
}
className=
{
classNam
e
}
>
<
I18nProvider
locale=
{
local
e
}
>
<
DialogWrapper
ref=
{
setDialog
}
/>
<
DialogWrapper
ref=
{
setDialog
}
/>
<
DialogProvider
value=
{
userDialog
||
dialog
}
>
<
DialogProvider
value=
{
userDialog
||
dialog
}
>
<
ErrorBoundary
onError=
{
onError
}
>
<
ErrorBoundary
onError=
{
onError
}
>
<
WidgetPropValidator
{
...
props
}
>
<
WidgetPropValidator
{
...
props
}
/>
<
ReduxProvider
store=
{
multicallStore
}
>
<
ReduxProvider
store=
{
multicallStore
}
>
<
AtomProvider
>
<
AtomProvider
>
<
ActiveWeb3Provider
provider=
{
provider
}
jsonRpcEndpoint=
{
jsonRpcEndpoint
}
>
<
ActiveWeb3Provider
provider=
{
provider
}
jsonRpcEndpoint=
{
jsonRpcEndpoint
}
>
<
Updaters
/>
<
Updaters
/>
{
children
}
{
children
}
</
ActiveWeb3Provider
>
</
ActiveWeb3Provider
>
</
AtomProvider
>
</
AtomProvider
>
</
ReduxProvider
>
</
ReduxProvider
>
</
WidgetPropValidator
>
</
ErrorBoundary
>
</
ErrorBoundary
>
</
DialogProvider
>
</
DialogProvider
>
</
WidgetWrapp
er
>
</
I18nProvid
er
>
</
ThemeProvid
er
>
</
WidgetWrapp
er
>
</
I18n
Provider
>
</
Theme
Provider
>
</
StrictMode
>
</
StrictMode
>
)
)
}
}
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