Skip to content

Commit

Permalink
WIP: Draft transactions timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
davibusanello committed Oct 9, 2018
1 parent 597dd31 commit 0c8a273
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@

<div v-if="api.loaded" class="charts">
<span class="title">Categories</span>
<bar-chart :data=this.api.data.categories></bar-chart>
<bar-chart :data=this.api.data.categories></bar-chart>
</div>

<div id="timeline" v-if="api.loaded">
<span class="title">Transactions Timeline</span>
<transactions-timeline :transactions=this.api.data.feedData></transactions-timeline>
</div>

</div>
Expand All @@ -32,10 +37,11 @@
<script>

import BarChart from './Charts/CategoriesChart.vue';
import TransactionsTimeline from './TransactionsTimeline.vue';

export default {
name: 'Login',
components: { BarChart },
components: { BarChart, TransactionsTimeline },
data: () => ({
username: null,
password: null,
Expand Down
41 changes: 41 additions & 0 deletions src/components/TransactionsTimeline.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<div class="container">
<span class="title">Last 30 Transactions</span>
<div v-if="data !== []">
<ul id="transactions">
<li v-for="transaction in transactions" :key="transaction.id">
<span class="date">{{transaction.date}}</span>
<span class="description">{{ transaction.description }}</span>
<span class="amount">Amount: {{transaction.amount}}</span>
<span v-if="transaction.dollar">Dollar: {{transaction.dollar}}</span>
</li>
</ul>

</div>
</div>
</template>
<script>
export default {
name: 'TransactionsTimeline',
props: {
transactions: {
type: Array,
default: () => [],
},
},
data() {
return {};
},
mounted() {
this.transactions = Object.entries(this.transactions)
.slice(0, 30)
.map(item => item[1]);
},
};
</script>

<style scoped>
span {
padding: 5px;
}
</style>

0 comments on commit 0c8a273

Please sign in to comment.