2019-09-11 09:59:01 +02:00
|
|
|
<template>
|
2020-02-18 08:57:00 +01: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"
|
2020-08-31 12:40:30 +02:00
|
|
|
:key="identity.id"
|
2020-02-18 08:57:00 +01:00
|
|
|
:class="{ 'is-active': identity.id === currentIdentity.id }"
|
|
|
|
@click="changeCurrentIdentity(identity)"
|
|
|
|
>
|
|
|
|
<div class="media">
|
|
|
|
<img
|
|
|
|
class="media-left image is-48x48"
|
|
|
|
v-if="identity.avatar"
|
|
|
|
:src="identity.avatar.url"
|
|
|
|
alt=""
|
|
|
|
/>
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-icon
|
|
|
|
class="media-left"
|
|
|
|
v-else
|
|
|
|
size="is-large"
|
|
|
|
icon="account-circle"
|
|
|
|
/>
|
2020-02-18 08:57:00 +01:00
|
|
|
<div class="media-content">
|
|
|
|
<h3>@{{ identity.preferredUsername }}</h3>
|
|
|
|
<small>{{ identity.name }}</small>
|
2019-09-11 09:59:01 +02:00
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<slot name="footer" />
|
|
|
|
</div>
|
2019-09-11 09:59:01 +02:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import { IActor } from "@/types/actor";
|
|
|
|
import { IDENTITIES } from "@/graphql/actor";
|
2019-09-11 09:59:01 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
identities: {
|
|
|
|
query: IDENTITIES,
|
|
|
|
},
|
|
|
|
},
|
2021-05-25 16:21:29 +02:00
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
title: this.$t("Identities") as string,
|
|
|
|
};
|
|
|
|
},
|
2019-09-11 09:59:01 +02:00
|
|
|
})
|
|
|
|
export default class IdentityPicker extends Vue {
|
|
|
|
@Prop() value!: IActor;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-09-11 09:59:01 +02:00
|
|
|
identities: IActor[] = [];
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-09-11 09:59:01 +02:00
|
|
|
currentIdentity: IActor = this.value;
|
|
|
|
|
2020-08-31 12:40:30 +02:00
|
|
|
changeCurrentIdentity(identity: IActor): void {
|
2019-09-11 09:59:01 +02:00
|
|
|
this.currentIdentity = identity;
|
2020-02-18 08:57:00 +01:00
|
|
|
this.$emit("input", identity);
|
2019-09-11 09:59:01 +02:00
|
|
|
}
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
</script>
|