Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
feat: adds actions page
Browse files Browse the repository at this point in the history
  • Loading branch information
Draichi committed Nov 4, 2020
1 parent 1b7c3be commit 5a04b3e
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 104 deletions.
4 changes: 2 additions & 2 deletions components/Actions/ActionListHeader.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div class="flex justify-around">
<div class="">
<div class="text-center grid grid-cols-3">
<h4>Coin</h4>
<h4>Status</h4>
<h4>Rate</h4>
Expand Down
69 changes: 62 additions & 7 deletions components/Actions/ActionListItem.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,73 @@
<template>
<div>
<div class="flex justify-around">
<h4>Lucas</h4>
<h4>Jose</h4>
<h4>carlos</h4>
<div class="grid grid-cols-3 text-center mt-3 rounded py-1 bg-gray-400">
<div class="flex items-center justify-evenly">
<img
:src="actionItem.icon"
alt=""
class="h-8 w-8 rounded-full"
/>
<h4>{{ actionItem.coin }}</h4>
</div>
<div
class="flex items-center justify-center border-l-2 border-r-2 border-gray-500"
>
<h4 class="capitalize">{{ actionItem.type }}</h4>
</div>
<div class="flex items-center justify-evenly">
<div class="py-1">
<DoughtChart
:data="portfolioData"
:width="40"
:height="40"
:options="options"
/>
</div>
<h4>{{ actionItem.rate * 100 }}%</h4>
</div>
</div>
</div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { Vue, Component, Prop } from 'vue-property-decorator'
import { IAction } from '~/types/IAction'
@Component
export default class ActionListItem extends Vue {}
@Component({
components: {
DoughtChart: () => import('@/components/Charts/DoughtChart'),
},
})
export default class ActionListItem extends Vue {
@Prop({ default: {} as IAction })
actionItem!: IAction
options = {
legend: {
display: false,
},
tooltips: {
enabled: false,
},
}
get portfolioData() {
return {
datasets: [
{
data: [ 1 - this.actionItem.rate, this.actionItem.rate],
borderColor: ['#fd5d93', '#36a2eb', '#cc65fe', '#ffce56'], // #fd5d93 pink option
borderWidth: 2,
backgroundColor: [
'rgba(253, 93, 147,0.1)',
'rgba(54, 162, 235, 0.1)',
'rgba(204, 101, 254, 0.1)',
'rgba(255, 206, 86, 0.1)',
],
},
],
}
}
}
</script>

<style lang="postcss"></style>
11 changes: 2 additions & 9 deletions components/Charts/DoughtChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@ import { Doughnut } from 'vue-chartjs'

export default {
extends: Doughnut,
props: {
data: Object,
},
props: ['data', 'options'],
mounted() {
// Overwriting base render method with actual data.
this.renderChart(this.data, {
responsive: true,
legend: {
position: 'right',
},
})
this.renderChart(this.data, this.options)
},
}
4 changes: 2 additions & 2 deletions components/Earnings/LineChartTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export default class LineChartTile extends Vue {
letter-spacing: 1px;
}
.graph-tile {
@apply inline-block w-2/3 mx-1 rounded-2xl;
@apply inline-block w-2/4 mx-2 rounded-2xl;
}
#my-earings-chart {
width: 80% !important;
margin: auto;
height: 19em;
height: 23vh;
}
</style>
2 changes: 2 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export default class Default extends Vue {}
.layout-container {
@apply mx-auto bg-gray-300;
max-width: 512px;
margin-bottom: 60px;
}
html {
background: #84919e;
font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
Roboto, 'Helvetica Neue', Arial, sans-serif;
word-spacing: 1em;
Expand Down
19 changes: 18 additions & 1 deletion pages/actions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<ActionListItem
v-for="(actionItem, i) in actionList"
:key="`action-item-${i}`"
:actionItem="actionItem"
/>
</div>
</div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { IAction } from 'types/IAction'
@Component({
components: {
Expand All @@ -23,7 +25,22 @@ import { Vue, Component } from 'vue-property-decorator'
},
})
export default class Index extends Vue {
actionList = {
actionList: IAction[] = [
{
icon:
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Ethereum-icon-purple.svg/1200px-Ethereum-icon-purple.svg.png',
coin: 'ETH',
type: 'buy',
rate: 0.235,
},
{
icon: 'https://www.altbags.com/wp-content/uploads/2020/08/Chainlink.jpg',
coin: 'LINK',
type: 'sell',
rate: 0.4,
},
]
actionList_ = {
labels: ['January', 'February', 'March', 'April', 'lucsa', 'draichi'],
datasets: [
{
Expand Down
22 changes: 20 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</div>
<div>
<h1 class="title">Portfolio</h1>
<div class="p-16">
<DoughtChart :data="portfolioData" />
<div class="px-16">
<DoughtChart :data="portfolioData" :options="options" />
</div>
</div>
</div>
Expand All @@ -30,6 +30,12 @@ import { Vue, Component } from 'vue-property-decorator'
},
})
export default class Index extends Vue {
options = {
responsive: true,
legend: {
position: 'right',
},
}
portfolioData = {
labels: ['January', 'February', 'March', 'April', 'lucsa', 'draichi'],
datasets: [
Expand Down Expand Up @@ -72,6 +78,18 @@ export default class Index extends Vue {
},
backgroundColor: 'red',
},
{
graphData: {
labels: ['January', 'February', 'March', 'April'],
datasets: [
{
label: 'GitHub Commits',
data: [20, 90, 20, 39],
},
],
},
backgroundColor: 'blue',
},
]
}
</script>
Expand Down
87 changes: 6 additions & 81 deletions pages/signin/index.vue
Original file line number Diff line number Diff line change
@@ -1,101 +1,26 @@
<template>
<div class="container overflow-x-hidden">
<div class="main">
<div>
<h1 class="title">Sign in</h1>
</div>
<div class="graphs">
<LineChartTile
v-for="(chartTile, i) in chartTiles"
:key="`chart-tile-${i}`"
:graph-data="chartTile.graphData"
:background-color="chartTile.backgroundColor"
/>
<h2>Sign in to the wait list</h2>
</div>
<div>
<h1 class="title">Portfolio</h1>
<div class="p-16">
<DoughtChart :data="portfolioData" />
</div>
<input type="text">
</div>
</div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
@Component({
components: {
LineChartTile: () => import('@/components/Earnings/LineChartTile.vue'),
DoughtChart: () => import('@/components/Charts/DoughtChart'),
},
})
@Component
export default class Index extends Vue {
portfolioData = {
labels: ['January', 'February', 'March', 'April', 'lucsa', 'draichi'],
datasets: [
{
label: 'GitHub Commits',
data: [40, 20, 12, 39, 51, 42],
borderColor: ['#fd5d93', '#36a2eb', '#cc65fe', '#ffce56'], // #fd5d93 pink option
borderWidth: 2,
backgroundColor: [
'rgba(253, 93, 147,0.1)',
'rgba(54, 162, 235, 0.1)',
'rgba(204, 101, 254, 0.1)',
'rgba(255, 206, 86, 0.1)',
],
},
],
}
chartTiles = [
{
graphData: {
labels: ['January', 'February', 'March', 'April'],
datasets: [
{
label: 'GitHub Commits',
data: [40, 60, 20, 39],
},
],
},
backgroundColor: 'blue',
},
{
graphData: {
labels: ['January', 'February', 'March', 'April'],
datasets: [
{
label: 'GitHub Commits',
data: [20, 90, 20, 39],
},
],
},
backgroundColor: 'red',
},
]
}
</script>

<style lang="postcss">
.container {
margin: 0 auto;
.main {
margin: auto;
min-height: 100vh;
justify-content: center;
}
.title {
font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
display: block;
font-weight: 300;
font-size: 1.5em;
@apply pl-2 pt-2;
color: #35495e;
letter-spacing: 1px;
}
.graphs {
@apply p-2;
overflow-x: auto;
white-space: nowrap;
}
</style>
6 changes: 6 additions & 0 deletions types/IAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface IAction {
icon: string,
coin: string,
type: 'buy' | 'sell' | 'hold',
rate: number,
}

0 comments on commit 5a04b3e

Please sign in to comment.