2019-09-26 16:38:58 +02:00
|
|
|
<template>
|
|
|
|
<div class="identity-picker">
|
|
|
|
<img class="image" v-if="currentIdentity.avatar" :src="currentIdentity.avatar.url" :alt="currentIdentity.avatar.alt"/> {{ currentIdentity.name || `@${currentIdentity.preferredUsername}` }}
|
|
|
|
<b-button type="is-text" @click="isComponentModalActive = true">
|
|
|
|
{{ $t('Change') }}
|
|
|
|
</b-button>
|
|
|
|
<b-modal :active.sync="isComponentModalActive" has-modal-card>
|
2019-10-02 17:59:07 +02:00
|
|
|
<identity-picker v-model="currentIdentity" @input="relay" />
|
2019-09-26 16:38:58 +02:00
|
|
|
</b-modal>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
import { IActor } from '@/types/actor';
|
|
|
|
import IdentityPicker from './IdentityPicker.vue';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: { IdentityPicker },
|
|
|
|
})
|
|
|
|
export default class IdentityPickerWrapper extends Vue {
|
|
|
|
@Prop() value!: IActor;
|
|
|
|
isComponentModalActive: boolean = false;
|
|
|
|
currentIdentity: IActor = this.value;
|
|
|
|
|
|
|
|
relay(identity: IActor) {
|
|
|
|
this.currentIdentity = identity;
|
|
|
|
this.$emit('input', identity);
|
|
|
|
this.isComponentModalActive = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
|
|
.identity-picker img.image {
|
|
|
|
display: inline;
|
|
|
|
height: 1.5em;
|
|
|
|
vertical-align: text-bottom;
|
|
|
|
}
|
|
|
|
</style>
|