Newer
Older
Eliot Berriot
committed
<template>
<main class="main pusher" v-title="labels.usernameProfile">
Eliot Berriot
committed
<div v-if="isLoading" class="ui vertical segment">
<div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
</div>
Eliot Berriot
committed
<div :class="['ui', 'head', 'vertical', 'center', 'aligned', 'stripe', 'segment']">
<h2 class="ui center aligned icon header">
<i v-if="!profile.avatar.square_crop" class="circular inverted user green icon"></i>
<img class="ui big circular image" v-else v-lazy="$store.getters['instance/absoluteUrl'](profile.avatar.square_crop)" />
Eliot Berriot
committed
<div class="content">
<div class="sub header" v-translate="{date: signupDate}">Member since %{ date }</div>
Eliot Berriot
committed
</div>
</h2>
<translate :translate-context="'Content/Profile/Button.Paragraph'">This is you!</translate>
<a v-if="profile.is_staff"
class="ui yellow label"
:href="$store.getters['instance/absoluteUrl']('/api/admin')"
target="_blank">
Eliot Berriot
committed
<i class="star icon"></i>
<translate :translate-context="'Content/Profile/Button.Label'">Staff member</translate>
Eliot Berriot
committed
</div>
</template>
</main>
Eliot Berriot
committed
</template>
<script>
import { mapState } from "vuex"
const dateFormat = require("dateformat")
Eliot Berriot
committed
export default {
props: ["username"],
created() {
this.$store.dispatch("auth/fetchProfile")
Eliot Berriot
committed
},
computed: {
...mapState({
profile: state => state.auth.profile
}),
labels() {
let msg = this.$pgettext('Head/Profile/Title', "%{ username }'s profile")
let usernameProfile = this.$gettextInterpolate(msg, {
username: this.username
})
signupDate() {
return dateFormat(d, "longDate")
Eliot Berriot
committed
},
isLoading() {
Eliot Berriot
committed
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.ui.header > img.image {
width: 8em;
}