2019-09-11 09:59:01 +02:00
|
|
|
<template>
|
2019-09-26 16:38:58 +02:00
|
|
|
<div class="modal-card">
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<p class="modal-card-title">{{ $t('Pick an identity') }}</p>
|
|
|
|
</header>
|
|
|
|
<section class="modal-card-body">
|
|
|
|
<div class="list is-hoverable">
|
|
|
|
<a class="list-item" v-for="identity in identities" :class="{ 'is-active': identity.id === currentIdentity.id }" @click="changeCurrentIdentity(identity)">
|
|
|
|
<div class="media">
|
2019-12-03 11:29:51 +01:00
|
|
|
<img class="media-left image is-48x48" v-if="identity.avatar" :src="identity.avatar.url" alt="" />
|
2019-11-15 18:36:47 +01:00
|
|
|
<b-icon class="media-left" v-else size="is-large" icon="account-circle" />
|
2019-09-26 16:38:58 +02:00
|
|
|
<div class="media-content">
|
|
|
|
<h3>@{{ identity.preferredUsername }}</h3>
|
|
|
|
<small>{{ identity.name }}</small>
|
|
|
|
</div>
|
2019-09-11 09:59:01 +02:00
|
|
|
</div>
|
2019-09-26 16:38:58 +02:00
|
|
|
</a>
|
2019-09-11 09:59:01 +02:00
|
|
|
</div>
|
2019-09-26 16:38:58 +02:00
|
|
|
</section>
|
2019-12-03 11:29:51 +01:00
|
|
|
<slot name="footer" />
|
2019-09-11 09:59:01 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
import { IActor } from '@/types/actor';
|
|
|
|
import { IDENTITIES } from '@/graphql/actor';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
identities: {
|
|
|
|
query: IDENTITIES,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class IdentityPicker extends Vue {
|
|
|
|
@Prop() value!: IActor;
|
|
|
|
identities: IActor[] = [];
|
|
|
|
currentIdentity: IActor = this.value;
|
|
|
|
|
|
|
|
changeCurrentIdentity(identity: IActor) {
|
|
|
|
this.currentIdentity = identity;
|
|
|
|
this.$emit('input', identity);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-09-26 16:38:58 +02:00
|
|
|
</script>
|