Skip to content

Commit

Permalink
fix: Rename any mention of "currency" as "unit"
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Dec 21, 2020
1 parent a6afd5e commit d1b9ec7
Show file tree
Hide file tree
Showing 43 changed files with 308 additions and 319 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sheikah-witnet-wallet",
"productName": "Sheikah Witnet wallet",
"version": "1.5.0",
"version": "1.6.0",
"private": true,
"description": "A Witnet compatible desktop wallet interface and data requests development environment.",
"author": "Witnet Foundation <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
async created() {
this.pollData()
this.getNotifications()
this.getCurrency()
this.getUnit()
// Disable back and forward from keyboard and mouse buttons
window.onpopstate = function(event) {
event.stopImmediatePropagation()
Expand All @@ -63,7 +63,7 @@ export default {
...mapActions({
getWalletInfos: 'getWalletInfos',
getNotifications: 'getNotifications',
getCurrency: 'getCurrency',
getUnit: 'getUnit',
}),
pollData() {
this.polling = setInterval(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ export class LocalStorageApi {
return this._set('notificationsSettings', notifications)
}

getCurrencySettings() {
return this._get('currencySettings')
getUnitSettings() {
return this._get('unitSettings')
}

setCurrencySettings(currency) {
return this._set('currencySettings', currency)
setUnitSettings(unit) {
return this._set('unitSettings', unit)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/AddressList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default {
index: 0,
used: false,
amount: 5000,
currency: 'nanoWits',
unit: 'nanoWits',
firstPaymentDate: new Date(),
lastPaymentDate: new Date(),
payments: 0,
Expand All @@ -117,7 +117,7 @@ export default {
index: 0,
used: false,
amount: 5000,
currency: 'nanoWits',
unit: 'nanoWits',
firstPaymentDate: new Date(),
lastPaymentDate: new Date(),
payments: 1,
Expand Down
28 changes: 13 additions & 15 deletions src/components/Amount.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<template>
<div class="amount-container" data-test="amount" @click="callChangeCurrency">
<div class="amount-container" data-test="amount" @click="callChangeUnit">
<span>
{{
formatNumber(standardizeWitUnits(amount, currency, WIT_UNIT.NANO, 2))
}}
{{ formatNumber(standardizeWitUnits(amount, unit, WIT_UNIT.NANO, 2)) }}
</span>
<span
data-test="currency"
class="currency"
:class="{ ['keep-dark']: currencyDark, ['keep-light']: currencyLight }"
data-test="unit"
class="unit"
:class="{ ['keep-dark']: unitDark, ['keep-light']: unitLight }"
>
{{ currency }}
{{ unit }}
</span>
</div>
</template>
Expand All @@ -27,11 +25,11 @@ export default {
type: [String, Number],
required: true,
},
currencyLight: {
unitLight: {
type: Boolean,
default: false,
},
currencyDark: {
unitDark: {
type: Boolean,
default: false,
},
Expand All @@ -43,18 +41,18 @@ export default {
},
computed: {
...mapState({
currency: state => state.wallet.currency,
unit: state => state.wallet.unit,
}),
},
methods: {
callChangeCurrency(e) {
this.changeCurrency()
callChangeUnit(e) {
this.changeUnit()
e.stopPropagation()
},
standardizeWitUnits,
formatNumber,
cropString,
...mapMutations(['changeCurrency']),
...mapMutations(['changeUnit']),
},
}
</script>
Expand All @@ -69,7 +67,7 @@ export default {
cursor: pointer;
}
.currency {
.unit {
color: inherit;
font-size: 13px;
margin-left: 4px;
Expand Down
31 changes: 0 additions & 31 deletions src/components/AppendCurrency.vue

This file was deleted.

31 changes: 31 additions & 0 deletions src/components/AppendUnit.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<div class="unit" @click="change">{{ unit }}</div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
name: 'AppendUnit',
computed: {
...mapState({
unit: state => state.wallet.unit,
prevUnit: state => state.wallet.prevUnit,
}),
},
methods: {
...mapMutations(['changeUnit']),
change() {
this.changeUnit()
this.$emit('change-unit', this.prevUnit, this.unit)
},
},
}
</script>

<style lang="scss" scoped>
.unit {
cursor: pointer;
user-select: none;
}
</style>
4 changes: 2 additions & 2 deletions src/components/Balance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:available="available"
:locked="locked"
:total="total"
:currency="currency"
:unit="unit"
/>
<BalanceButtons @receive="onReceive" @send="onSend" />

Expand Down Expand Up @@ -38,7 +38,7 @@ export default {
},
computed: {
...mapState({
currency: state => state.wallet.currency,
unit: state => state.wallet.unit,
balance: state => {
return state.wallet.balance
},
Expand Down
14 changes: 7 additions & 7 deletions src/components/BalanceData.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="table">
<p class="label">Available</p>
<Amount :currency-light="true" class="amount" :amount="available" />
<Amount :unit-light="true" class="amount" :amount="available" />
<p class="label"
>Locked
<el-tooltip trigger="hover" effect="light">
Expand All @@ -17,9 +17,9 @@
</div>
</el-tooltip>
</p>
<Amount :currency-light="true" class="amount" :amount="locked" />
<Amount :unit-light="true" class="amount" :amount="locked" />
<p class="label total">Total</p>
<Amount :currency-light="true" class="amount" :amount="total" />
<Amount :unit-light="true" class="amount" :amount="total" />
</div>
</template>

Expand All @@ -37,10 +37,10 @@ export default {
},
props: {
/**
* Specify in which currency display wits
* Specify in which unit display wits
* @values wit, microWit, nanoWit
*/
currency: {
unit: {
type: String,
required: true,
},
Expand Down Expand Up @@ -131,7 +131,7 @@ export default {
justify-self: end;
width: max-content;
.currency {
.unit {
font-size: 11px;
font-weight: normal;
}
Expand All @@ -152,7 +152,7 @@ export default {
locked="10"
available="40"
total="50"
currency="nanoWit"
unit="nanoWit"

:style="{ width: '300px' }"
/>
Expand Down
Loading

0 comments on commit d1b9ec7

Please sign in to comment.