-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve transaction pages #168
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f6981f2
init
nylira 03b091b
CardTransaction -> LiTransaction
nylira 3d96630
fix test
nylira a341d65
remove lodash requirement
nylira dc2415a
Merge branch 'develop' into peng/148-improve-tx-view
nylira 2e0e322
Merge branch 'develop' into peng/148-improve-tx-view
faboweb 94d86f7
Merge branch 'develop' into peng/148-improve-tx-view
faboweb a74076a
Merge branch 'develop' into peng/148-improve-tx-view
faboweb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
<template lang='pug'> | ||
.ni-li-tx.ni-li-tx-sent(v-if="sent" @click="viewTransaction") | ||
.tx-icon: i.material-icons remove_circle | ||
.tx-container | ||
.tx-element.tx-coins | ||
.tx-coin(v-for='coin in coinsSent') | ||
.value {{ num.pretty(coin.amount) }} | ||
.key {{ coin.denom }} | ||
.tx-element.tx-date {{ date }} | ||
.tx-element.tx-address {{ receiver }} | ||
|
||
.ni-li-tx.ni-li-tx-received(v-else @click="viewTransaction") | ||
.tx-icon: i.material-icons add_circle | ||
.tx-container | ||
.tx-element.tx-coins | ||
.tx-coin(v-for='coin in coinsReceived') | ||
.value {{ num.pretty(coin.amount) }} | ||
.key {{ coin.denom }} | ||
.tx-element.tx-date {{ date }} | ||
.tx-element.tx-address {{ sender }} | ||
</template> | ||
|
||
<script> | ||
import num from 'scripts/num' | ||
import dateUnixAgo from 'scripts/dateUnixAgo' | ||
export default { | ||
name: 'ni-li-tx', | ||
computed: { | ||
// TODO: sum relevant inputs/outputs | ||
sent () { | ||
return this.transactionValue.tx.inputs[0].sender === this.address | ||
}, | ||
sender () { | ||
return this.transactionValue.tx.inputs[0].sender | ||
}, | ||
coinsSent () { | ||
return this.transactionValue.tx.inputs[0].coins | ||
}, | ||
receiver () { | ||
return this.transactionValue.tx.outputs[0].receiver | ||
}, | ||
coinsReceived () { | ||
return this.transactionValue.tx.inputs[0].coins | ||
}, | ||
date () { | ||
return dateUnixAgo(this.transactionValue.time) | ||
} | ||
}, | ||
data: () => ({ | ||
num: num | ||
}), | ||
methods: { | ||
viewTransaction () { | ||
this.$store.commit('notify', { | ||
title: 'TODO: View Transaction', | ||
body: 'tx details page not implemented yet' | ||
}) | ||
} | ||
}, | ||
props: ['transaction-value', 'address'] | ||
} | ||
</script> | ||
|
||
<style lang="stylus"> | ||
@require '~variables' | ||
|
||
.ni-li-tx | ||
display flex | ||
font-size sm | ||
border-bottom 1px solid bc-dim | ||
min-height 3rem | ||
|
||
.tx-icon | ||
flex 0 0 2rem | ||
background app-fg | ||
display flex | ||
align-items center | ||
justify-content center | ||
|
||
.tx-container | ||
flex 1 | ||
padding 0.5rem 0 | ||
display flex | ||
flex-flow row wrap | ||
align-items flex-start | ||
justify-content center | ||
|
||
min-width 0 // fix text-overflow | ||
|
||
.tx-element | ||
padding 0 0.5rem | ||
line-height 1.5rem | ||
|
||
.tx-coins | ||
flex 0 0 60% | ||
|
||
.tx-coin | ||
display flex | ||
flow-flow row nowrap | ||
.value | ||
flex 3 | ||
text-align right | ||
&:before | ||
content '' | ||
display inline | ||
.key | ||
flex 2 | ||
padding-left 0.5rem | ||
|
||
.tx-date | ||
flex 0 0 40% | ||
color dim | ||
|
||
.tx-address | ||
flex 100% | ||
|
||
white-space nowrap | ||
overflow hidden | ||
text-overflow ellipsis | ||
|
||
color dim | ||
|
||
&.ni-li-tx-sent | ||
.tx-icon | ||
background alpha(mc, 5%) | ||
i | ||
color mc | ||
.tx-coin .value | ||
color mc | ||
&:before | ||
content '-' | ||
|
||
&.ni-li-tx-received | ||
.tx-icon | ||
background alpha(link, 5%) | ||
i | ||
color link | ||
.tx-coin .value | ||
color link | ||
&:before | ||
content '+' | ||
|
||
&:hover | ||
cursor pointer | ||
background app-fg | ||
.tx-coin | ||
.key | ||
color bright | ||
.tx-date, .tx-address | ||
color txt | ||
|
||
@media screen and (min-width: 375px) | ||
.ni-li-tx | ||
font-size 0.875rem | ||
@media screen and (min-width: 414px) | ||
.ni-li-tx | ||
.tx-container | ||
padding 0.5rem | ||
|
||
@media screen and (min-width: 768px) | ||
.ni-li-tx | ||
.tx-icon | ||
flex 0 0 3rem | ||
|
||
.tx-container | ||
flex-flow row nowrap | ||
|
||
.tx-element | ||
line-height 2rem | ||
|
||
.tx-coins | ||
flex 3 | ||
|
||
.tx-date | ||
flex 2 | ||
|
||
.tx-address | ||
flex 6 | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
test/unit/specs/__snapshots__/CardTransaction.spec.js.snap
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍