Skip to content

Commit

Permalink
- static.json added for heroku deployment
Browse files Browse the repository at this point in the history
- QR reader component done and added to transactions
  • Loading branch information
AVA LABS authored and AVA LABS committed Jan 15, 2020
1 parent 3f3b20c commit 5641320
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 126 deletions.
121 changes: 121 additions & 0 deletions src/components/misc/QRReader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<template>
<div class="qr_reader">
<div class="clickStart" @click="start"></div>
<slot class="qr_slot" ></slot>
<div class="qr_popup" v-show="isActive">
<div class="progress">
<v-progress-circular :size="20" indeterminate color="#ffcc66"></v-progress-circular>
<p>Waiting for a QR Code</p>
</div>
<button @click="stop"><fa icon="times-circle"></fa></button>
<video ref="preview"></video>
</div>
</div>
</template>
<script>
import { BrowserQRCodeReader } from '@zxing/library';
export default {
data(){
return {
scanner: null,
isActive: false,
}
},
methods: {
start(){
let camera = this.camera;
if(!camera){
alert("No Cameras Found");
return;
}
this.isActive = true;
this.scanner
.decodeFromInputVideoDevice(this.camera.deviceId, this.$refs.preview)
.then(this.onscan)
},
onscan(result){
this.$emit("change", result.text);
this.stop();
},
stop(){
if(this.scanner){
this.scanner.reset();
}
this.isActive = false;
}
},
mounted(){
let parent = this;
const codeReader = new BrowserQRCodeReader();
codeReader
.listVideoInputDevices()
.then(videoInputDevices => {
if(videoInputDevices.length > 0){
let camera = videoInputDevices[0];
parent.camera = camera;
}else{
console.error('No Cameras Found');
}
})
.catch(err => console.error(err));
this.scanner = codeReader;
}
}
</script>
<style scoped>
.qr_reader{
position: relative;
}
.qr_popup{
position: fixed;
max-width: 80%;
overflow: hidden;
left: 50%;
top: 50%;
/*transform: translateX(-50%);*/
transform: translate(-50%, -50%);
z-index: 10;
}
.qr_popup video{
background-color: #202020;
/*max-width: 100%;*/
}
.qr_popup button{
position: absolute;
top: 6px;
right: 12px;
z-index: 2;
}
.clickStart{
position: absolute;
width: 100%;
height: 100%;
}
.qr_slot{
cursor: pointer;
/*user-select: none;*/
/*pointer-events: none;*/
}
.progress{
position: absolute;
bottom: 15px;
left: 50%;
transform: translateX(-50%);
}
.progress p{
font-size: 12px;
margin: 0;
}
.v-progress-circular{
}
</style>
21 changes: 0 additions & 21 deletions src/components/wallet/assets/AssetCard.vue

This file was deleted.

6 changes: 4 additions & 2 deletions src/components/wallet/ava/Assets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<th>Balance</th>
<th>USD Total</th>
<th>BTC Total</th>
<th>AVA Total</th>
<th class="buts"></th>
</tr>
</thead>
Expand All @@ -17,6 +18,7 @@
<td>{{asset.balance}}</td>
<td>{{(asset.balance * asset.usd_price).toFixed(4)}}</td>
<td>{{(asset.balance * asset.btc_price).toFixed(4)}}</td>
<td>{{(asset.balance * asset.ava_price).toFixed(4)}}</td>
<td class="buts">
<v-btn :to="'/wallet/transfer?asset='+asset.key" color="transparent" depressed height="28">Send</v-btn>
<v-btn :to="'/wallet/transfer?asset='+asset.key" color="transparent" depressed height="28">Receive</v-btn>
Expand Down Expand Up @@ -48,8 +50,8 @@
</script>
<style scoped>
table{
/*width: 100%;*/
min-width: 50%;
width: 100%;
/*min-width: 50%;*/
background-color: #303030;
color: #d2d2d2;
border-collapse: collapse;
Expand Down
33 changes: 29 additions & 4 deletions src/components/wallet/transfer/Send.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@
</div>
</div>
<div class="checkout">

<label>Send to:</label>
<v-text-field v-model="addressIn" class="addressIn" color="#d88383" placeholder="####" height="40" background-color="#404040" dense flat :loading="isAjax" hide-details></v-text-field>
<q-r-reader class="readerBut" @change="onQrRead">
<button><fa icon="camera"></fa></button>
</q-r-reader>
<!-- <div class="sendToInputs">-->

<v-text-field v-model="addressIn" class="addressIn" color="#d88383" placeholder="####" height="40" background-color="#404040" dense flat :loading="isAjax" hide-details></v-text-field>
<!-- </div>-->
<v-btn block color="#d88383" :loading="isAjax" :ripple="false" @click="send">Send</v-btn>
</div>
</div>
Expand All @@ -40,11 +47,13 @@
</template>
<script>
import CurrencyInput from "@/components/misc/CurrencyInput";
import QRReader from '@/components/misc/QRReader';
import router from "@/router";
export default {
components: {
CurrencyInput
CurrencyInput,
QRReader
},
data(){
return{
Expand All @@ -68,6 +77,9 @@
}
},
methods: {
onQrRead(value){
this.addressIn = value;
},
select(asset){
this.selected = asset;
this.amountIn = null;
Expand Down Expand Up @@ -262,8 +274,21 @@
flex-grow: 1;
}
.readerBut{
margin-top: 4px;
display: flex;
background-color: #404040;
/*cursor: pointer;*/
}
.readerBut button{
opacity: 0.6;
outline: none;
padding: 6px 12px;
margin: 0px auto;
}
.readerBut:hover button{
opacity: 1;
}
@media only screen and (max-width: 600px) {
.order_form{
Expand Down
6 changes: 1 addition & 5 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

import Ava from '../views/wallet/Ava.vue';
import Assets from '../views/wallet/Assets.vue';
// import Assets from '../views/wallet/Assets.vue';
import History from '../views/wallet/History.vue';
import Transfer from '../views/wallet/Transfer.vue';
import Advanced from '../views/wallet/Advanced.vue';
Expand Down Expand Up @@ -32,10 +32,6 @@ const routes = [
path: 'ava',
component: Ava
},
{
path: 'assets',
component: Assets
},
{
path: 'history',
component: History
Expand Down
17 changes: 16 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default new Vuex.Store({
key: "AVA",
balance: 23097.34442,
usd_price: 0.08,
btc_price: 1,
btc_price: 0.4311,
ava_price: 1,
address: 'asdflhjv235adg'
},
{
Expand All @@ -26,6 +27,7 @@ export default new Vuex.Store({
balance: 37.34442,
usd_price: 4.8,
btc_price: 1,
ava_price: 19400,
address: 'asdflhjv235adg'
},
{
Expand All @@ -34,6 +36,7 @@ export default new Vuex.Store({
balance: 12.4700,
usd_price: 4.8,
btc_price: 2.8,
ava_price: 1.2,
address: 'asdfadsf24'
},
{
Expand All @@ -42,6 +45,7 @@ export default new Vuex.Store({
balance: 32.554,
usd_price: 4.8,
btc_price: 2.8,
ava_price: 1,
address: 'klaubl3223rfa'
},
{
Expand All @@ -50,6 +54,7 @@ export default new Vuex.Store({
balance: 499.5,
usd_price: 4.8,
btc_price: 2.8,
ava_price: 1,
address: 'fasvnklkdvb;a'
},
{
Expand All @@ -58,6 +63,7 @@ export default new Vuex.Store({
balance: 21.9,
usd_price: 4.8,
btc_price: 2.8,
ava_price: 1,
address: 'vadfbhtrsgfbwer'
},
{
Expand All @@ -66,6 +72,7 @@ export default new Vuex.Store({
balance: 12,
usd_price: 4.8,
btc_price: 2.8,
ava_price: 1,
address: 'verhsdfgreynrtsd'
},
{
Expand All @@ -74,6 +81,7 @@ export default new Vuex.Store({
balance: 999,
usd_price: 0.008,
btc_price: 2.8,
ava_price: 1,
address: 'sldkhfgvoiuglg97i'
}
],
Expand Down Expand Up @@ -134,6 +142,13 @@ export default new Vuex.Store({
return total + (asset.balance*asset.btc_price)
}, 0);
return res;
},
wallet_value_ava(state: RootState){
let res = 0;
res = state.assets.reduce((total: number, asset: AssetType) => {
return total + (asset.balance*asset.ava_price)
}, 0);
return res;
}
},
mutations: {
Expand Down
1 change: 1 addition & 0 deletions src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface AssetType {
balance: number,
usd_price: number,
btc_price: number,
ava_price: number,
address: string
}

Expand Down
5 changes: 0 additions & 5 deletions src/views/About.vue

This file was deleted.

2 changes: 1 addition & 1 deletion src/views/wallet/Advanced.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
</template>
<script>
import { QRCodeReader, BrowserQRCodeReader } from '@zxing/library';
import { BrowserQRCodeReader } from '@zxing/library';
export default {
data(){
Expand Down
Loading

0 comments on commit 5641320

Please sign in to comment.