Newer
Older
Eliot Berriot
committed
<template>
<div class="main pusher" v-title="username + '\'s Profile'">
Eliot Berriot
committed
<div v-if="isLoading" class="ui vertical segment">
<div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
</div>
<template v-if="$store.state.auth.profile">
Eliot Berriot
committed
<div :class="['ui', 'head', 'vertical', 'center', 'aligned', 'stripe', 'segment']">
<h2 class="ui center aligned icon header">
<i class="circular inverted user green icon"></i>
<div class="content">
{{ $store.state.auth.profile.username }}
<div class="sub header" v-translate="{date: signupDate}">Registered since %{ date }</div>
Eliot Berriot
committed
</div>
</h2>
<translate>This is you!</translate>
<div v-if="$store.state.auth.profile.is_staff" class="ui yellow label">
Eliot Berriot
committed
<i class="star icon"></i>
<translate>Staff member</translate>
Eliot Berriot
committed
</div>
Eliot Berriot
committed
<router-link class="ui tiny basic button" :to="{path: '/settings'}">
<translate>Settings...</translate>
Eliot Berriot
committed
</router-link>
Eliot Berriot
committed
</div>
</template>
</div>
</template>
<script>
const dateFormat = require('dateformat')
Eliot Berriot
committed
export default {
name: 'login',
props: ['username'],
created () {
this.$store.dispatch('auth/fetchProfile')
Eliot Berriot
committed
},
computed: {
signupDate () {
let d = new Date(this.$store.state.auth.profile.date_joined)
Eliot Berriot
committed
return dateFormat(d, 'longDate')
},
isLoading () {
return !this.$store.state.auth.profile
Eliot Berriot
committed
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>