2019-04-26 15:22:16 +02:00
|
|
|
<template>
|
|
|
|
<section>
|
|
|
|
<h1 class="title">
|
2019-09-12 11:34:01 +02:00
|
|
|
{{ $t('My identities') }}
|
2019-04-26 15:22:16 +02:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
<ul class="identities">
|
|
|
|
<li v-for="identity in identities" :key="identity.id">
|
2019-06-17 17:15:27 +02:00
|
|
|
<router-link
|
|
|
|
:to="{ name: 'UpdateIdentity', params: { identityName: identity.preferredUsername } }"
|
|
|
|
class="media identity" v-bind:class="{ 'is-current-identity': isCurrentIdentity(identity) }"
|
|
|
|
>
|
2019-04-26 15:22:16 +02:00
|
|
|
<div class="media-left">
|
2019-05-22 14:12:11 +02:00
|
|
|
<figure class="image is-48x48" v-if="identity.avatar">
|
|
|
|
<img class="is-rounded" :src="identity.avatar.url">
|
2019-04-26 15:22:16 +02:00
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="media-content">
|
|
|
|
{{ identity.displayName() }}
|
|
|
|
</div>
|
2019-06-17 17:15:27 +02:00
|
|
|
</router-link>
|
2019-04-26 15:22:16 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2019-06-17 17:15:27 +02:00
|
|
|
<router-link :to="{ name: 'CreateIdentity' }" class="button create-identity is-primary" >
|
2019-09-12 11:34:01 +02:00
|
|
|
{{ $t('Create a new identity') }}
|
2019-06-17 17:15:27 +02:00
|
|
|
</router-link>
|
2019-04-26 15:22:16 +02:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-06-17 17:15:27 +02:00
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
2019-09-11 09:59:01 +02:00
|
|
|
import { IDENTITIES } from '@/graphql/actor';
|
2019-06-17 17:15:27 +02:00
|
|
|
import { IPerson, Person } from '@/types/actor';
|
2019-04-26 15:22:16 +02:00
|
|
|
|
2019-06-17 17:15:27 +02:00
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
identities: {
|
|
|
|
query: IDENTITIES,
|
|
|
|
|
|
|
|
update (result) {
|
|
|
|
return result.identities.map(i => new Person(i));
|
2019-04-26 15:22:16 +02:00
|
|
|
},
|
|
|
|
},
|
2019-06-17 17:15:27 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class Identities extends Vue {
|
|
|
|
@Prop({ type: String }) currentIdentityName!: string;
|
2019-04-26 15:22:16 +02:00
|
|
|
|
2019-06-17 17:15:27 +02:00
|
|
|
identities: Person[] = [];
|
|
|
|
errors: string[] = [];
|
2019-04-26 15:22:16 +02:00
|
|
|
|
2019-06-17 17:15:27 +02:00
|
|
|
isCurrentIdentity(identity: IPerson) {
|
|
|
|
return identity.preferredUsername === this.currentIdentityName;
|
2019-04-26 15:22:16 +02:00
|
|
|
}
|
2019-06-17 17:15:27 +02:00
|
|
|
}
|
2019-04-26 15:22:16 +02:00
|
|
|
</script>
|
2019-10-05 21:17:18 +02:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.identities {
|
|
|
|
border-right: 1px solid grey;
|
|
|
|
|
|
|
|
padding: 15px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.media.identity {
|
|
|
|
align-items: center;
|
|
|
|
font-size: 1.3rem;
|
|
|
|
padding-bottom: 0;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
color: #000;
|
|
|
|
|
|
|
|
&.is-current-identity {
|
|
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
margin-bottom: 30px;
|
|
|
|
}
|
|
|
|
</style>
|