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
e19e150f
Commit
e19e150f
authored
Jul 29, 2019
by
ian-jh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combine swap and send pages into one component
parent
38dcc1ba
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
806 additions
and
1492 deletions
+806
-1492
ExchangePage.jsx
src/components/ExchangePage/ExchangePage.jsx
+0
-6
index.jsx
src/components/ExchangePage/index.jsx
+722
-0
index.js
src/components/TransactionDetails/index.js
+74
-5
App.js
src/pages/App.js
+2
-2
index.js
src/pages/Send/index.js
+4
-781
index.js
src/pages/Swap/index.js
+4
-698
No files found.
src/components/ExchangePage/ExchangePage.jsx
deleted
100644 → 0
View file @
38dcc1ba
import
React
from
'
react
'
export
default
function
ExchangePage
({
sending
})
{
}
\ No newline at end of file
src/components/ExchangePage/index.jsx
0 → 100644
View file @
e19e150f
This diff is collapsed.
Click to expand it.
src/components/TransactionDetails/index.js
View file @
e19e150f
import
React
,
{
useState
}
from
'
react
'
import
ReactGA
from
'
react-ga
'
import
{
useTranslation
}
from
'
react-i18next
'
import
styled
from
'
styled-components
'
import
{
amountFormatter
}
from
'
../../utils
'
import
{
isAddress
,
amountFormatter
}
from
'
../../utils
'
import
questionMark
from
'
../../assets/images/question-mark.svg
'
import
NewContextualInfo
from
'
../../components/ContextualInfoNew
'
...
...
@@ -194,6 +195,10 @@ export default function TransactionDetails(props) {
contextualInfo
=
t
(
'
selectTokenCont
'
)
}
else
if
(
!
props
.
independentValue
)
{
contextualInfo
=
t
(
'
enterValueCont
'
)
}
else
if
(
props
.
sending
&&
!
props
.
recipientAddress
)
{
contextualInfo
=
t
(
'
noRecipient
'
)
}
else
if
(
props
.
sending
&&
!
isAddress
(
props
.
recipientAddress
))
{
contextualInfo
=
t
(
'
invalidRecipient
'
)
}
else
if
(
!
props
.
account
)
{
contextualInfo
=
t
(
'
noWallet
'
)
isError
=
true
...
...
@@ -211,7 +216,13 @@ export default function TransactionDetails(props) {
closeDetailsText
=
{
t
(
'
hideDetails
'
)}
contextualInfo
=
{
contextualInfo
?
contextualInfo
:
slippageWarningText
}
allowExpand
=
{
!!
(
props
.
inputCurrency
&&
props
.
outputCurrency
&&
props
.
inputValueParsed
&&
props
.
outputValueParsed
)
!!
(
props
.
inputCurrency
&&
props
.
outputCurrency
&&
props
.
inputValueParsed
&&
props
.
outputValueParsed
&&
(
props
.
sending
?
props
.
recipientAddress
:
true
)
)
}
isError
=
{
isError
}
slippageWarning
=
{
props
.
slippageWarning
&&
!
contextualInfo
}
...
...
@@ -405,8 +416,40 @@ export default function TransactionDetails(props) {
const
b
=
text
=>
<
Bold
>
{
text
}
<
/Bold
>
const
renderTransactionDetails
=
()
=>
{
ReactGA
.
event
({
category
:
'
TransactionDetail
'
,
action
:
'
Open
'
})
if
(
props
.
independentField
===
props
.
INPUT
)
{
return
(
return
props
.
sending
?
(
<
div
>
<
div
>
{
t
(
'
youAreSelling
'
)}{
'
'
}
{
b
(
`
${
amountFormatter
(
props
.
independentValueParsed
,
props
.
independentDecimals
,
Math
.
min
(
4
,
props
.
independentDecimals
)
)}
${
props
.
inputSymbol
}
`
)}
.
<
/div
>
<
LastSummaryText
>
{
b
(
props
.
recipientAddress
)}
{
t
(
'
willReceive
'
)}{
'
'
}
{
b
(
`
${
amountFormatter
(
props
.
dependentValueMinumum
,
props
.
dependentDecimals
,
Math
.
min
(
4
,
props
.
dependentDecimals
)
)}
${
props
.
outputSymbol
}
`
)}{
'
'
}
<
/LastSummaryText
>
<
LastSummaryText
>
{
t
(
'
priceChange
'
)}
{
b
(
`
${
props
.
percentSlippageFormatted
}
%`
)}.
<
/LastSummaryText
>
<
/div
>
)
:
(
<
div
>
<
div
>
{
t
(
'
youAreSelling
'
)}{
'
'
}
...
...
@@ -433,7 +476,34 @@ export default function TransactionDetails(props) {
<
/div
>
)
}
else
{
return
(
return
props
.
sending
?
(
<
div
>
<
div
>
{
t
(
'
youAreSending
'
)}{
'
'
}
{
b
(
`
${
amountFormatter
(
props
.
independentValueParsed
,
props
.
independentDecimals
,
Math
.
min
(
4
,
props
.
independentDecimals
)
)}
${
props
.
outputSymbol
}
`
)}{
'
'
}
{
t
(
'
to
'
)}
{
b
(
props
.
recipientAddress
)}.
<
/div
>
<
LastSummaryText
>
{
t
(
'
itWillCost
'
)}{
'
'
}
{
b
(
`
${
amountFormatter
(
props
.
dependentValueMaximum
,
props
.
dependentDecimals
,
Math
.
min
(
4
,
props
.
dependentDecimals
)
)}
${
props
.
inputSymbol
}
`
)}{
'
'
}
<
/LastSummaryText
>
<
LastSummaryText
>
{
t
(
'
priceChange
'
)}
{
b
(
`
${
props
.
percentSlippageFormatted
}
%`
)}.
<
/LastSummaryText
>
<
/div
>
)
:
(
<
div
>
<
div
>
{
t
(
'
youAreBuying
'
)}{
'
'
}
...
...
@@ -455,7 +525,6 @@ export default function TransactionDetails(props) {
Math
.
min
(
4
,
props
.
dependentDecimals
)
)}
${
props
.
inputSymbol
}
`
)}{
'
'
}
{
t
(
'
orTransFail
'
)}
<
/LastSummaryText
>
<
LastSummaryText
>
{
t
(
'
priceChange
'
)}
{
b
(
`
${
props
.
percentSlippageFormatted
}
%`
)}.
...
...
src/pages/App.js
View file @
e19e150f
...
...
@@ -46,7 +46,7 @@ export default function App() {
{
/* this Suspense is for route code-splitting */
}
<
Suspense
fallback
=
{
null
}
>
<
Switch
>
<
Route
exact
strict
path
=
"
/swap
"
component
=
{()
=>
<
Swap
sending
=
{
true
}
/>} /
>
<
Route
exact
strict
path
=
"
/swap
"
component
=
{()
=>
<
Swap
/>
}
/
>
<
Route
exact
strict
...
...
@@ -59,7 +59,7 @@ export default function App() {
}
}}
/
>
<
Route
exact
strict
path
=
"
/send
"
component
=
{
Send
}
/
>
<
Route
exact
strict
path
=
"
/send
"
component
=
{
()
=>
<
Send
/>
}
/
>
<
Route
exact
strict
...
...
src/pages/Send/index.js
View file @
e19e150f
This diff is collapsed.
Click to expand it.
src/pages/Swap/index.js
View file @
e19e150f
This diff is collapsed.
Click to expand it.
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