2019-06-24 18:40:59 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="referral-stats">
|
|
|
|
<p class="referral-stats__title"> {{ title }} </p>
|
|
|
|
<div class="referral-stats__wrapper">
|
|
|
|
<div class="referral-stats__card"
|
|
|
|
v-for="(stat, key) in stats"
|
|
|
|
:key="key"
|
2019-07-08 14:45:25 +01:00
|
|
|
:style="stat.background">
|
2019-07-09 16:04:51 +01:00
|
|
|
<span class="referral-stats__card-text">
|
|
|
|
<span class="referral-stats__card-title">{{ stat.title }}</span>
|
|
|
|
<span class="referral-stats__card-description">{{ stat.description }}</span>
|
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<span class="referral-stats__card-number">{{ stat.symbol + usage[key] }}</span>
|
2019-06-24 18:40:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-07-08 14:45:25 +01:00
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
|
|
|
import { CREDIT_USAGE_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
|
2019-06-24 18:40:59 +01:00
|
|
|
|
2019-07-08 14:45:25 +01:00
|
|
|
@Component({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
stats: {
|
|
|
|
referred: {
|
2019-07-18 14:39:39 +01:00
|
|
|
title: 'referrals made',
|
|
|
|
description: 'People you referred who signed up',
|
|
|
|
symbol: '',
|
2019-07-08 14:45:25 +01:00
|
|
|
background: {
|
2019-07-18 14:39:39 +01:00
|
|
|
backgroundColor: '#FFFFFF',
|
2019-07-08 14:45:25 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
availableCredits: {
|
2019-07-18 14:39:39 +01:00
|
|
|
title: 'earned credits',
|
|
|
|
description: 'Free credits that will apply to your upcoming bill',
|
|
|
|
symbol: '$',
|
2019-07-08 14:45:25 +01:00
|
|
|
background: {
|
2019-07-18 14:39:39 +01:00
|
|
|
backgroundColor: 'rgba(217, 225, 236, 0.5)',
|
2019-07-08 14:45:25 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
usedCredits: {
|
2019-07-18 14:39:39 +01:00
|
|
|
title: 'applied credits',
|
|
|
|
description: 'Free credits that have already been applied to your bill',
|
|
|
|
symbol: '$',
|
2019-07-08 14:45:25 +01:00
|
|
|
background: {
|
2019-07-18 14:39:39 +01:00
|
|
|
backgroundColor: '#D1D7E0',
|
2019-07-08 14:45:25 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
};
|
2019-07-08 14:45:25 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fetch: async function() {
|
|
|
|
const creditUsageResponse = await this.$store.dispatch(CREDIT_USAGE_ACTIONS.FETCH);
|
|
|
|
if (!creditUsageResponse.isSuccess) {
|
|
|
|
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch credit usage: ' + creditUsageResponse.errorMessage);
|
|
|
|
}
|
2019-06-24 18:40:59 +01:00
|
|
|
}
|
|
|
|
},
|
2019-07-08 14:45:25 +01:00
|
|
|
mounted() {
|
|
|
|
(this as any).fetch();
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
title() {
|
2019-07-18 14:39:39 +01:00
|
|
|
let name = this.$store.state.usersModule.fullName || '' ;
|
|
|
|
let text = 'Here Are Your Referrals So Far';
|
|
|
|
|
2019-07-08 14:45:25 +01:00
|
|
|
return name.length > 0 ? `${name}, ${text}` : text;
|
|
|
|
},
|
|
|
|
usage() {
|
|
|
|
return this.$store.state.creditUsageModule.creditUsage;
|
|
|
|
}
|
2019-06-24 18:40:59 +01:00
|
|
|
}
|
2019-07-08 14:45:25 +01:00
|
|
|
})
|
|
|
|
export default class ReferralStats extends Vue {}
|
2019-06-24 18:40:59 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2019-07-10 10:55:40 +01:00
|
|
|
.referral-stats {
|
2019-06-24 18:40:59 +01:00
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__title {
|
|
|
|
text-align: center;
|
2019-06-24 18:40:59 +01:00
|
|
|
font-family: 'font_bold';
|
|
|
|
}
|
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__wrapper {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-around;
|
|
|
|
left: 15%;
|
|
|
|
right: 15%;
|
|
|
|
font-family: 'font_regular';
|
2019-06-24 18:40:59 +01:00
|
|
|
}
|
|
|
|
|
2019-07-10 10:55:40 +01:00
|
|
|
&__card {
|
|
|
|
color: #354049;
|
|
|
|
min-height: 176px;
|
|
|
|
max-width: 276px;
|
|
|
|
flex-basis: 25%;
|
|
|
|
border-radius: 24px;
|
|
|
|
padding-top: 25px;
|
|
|
|
padding-left: 26px;
|
|
|
|
padding-right: 29px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-evenly;
|
|
|
|
|
|
|
|
&-text {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-title {
|
|
|
|
display: block;
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-family: 'font_bold';
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 18px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-description {
|
|
|
|
display: block;
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 21px;
|
|
|
|
margin-top: 7px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-number {
|
|
|
|
display: block;
|
|
|
|
font-family: 'font_bold';
|
|
|
|
font-size: 46px;
|
|
|
|
line-height: 60px;
|
|
|
|
margin-bottom: 27px;
|
|
|
|
}
|
2019-06-24 18:40:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|