2019-10-05 21:17:18 +02:00
|
|
|
<docs>
|
|
|
|
```vue
|
|
|
|
<participant-card :participant="{ actor: { preferredUsername: 'user1', name: 'someoneIDontLike' }, role: 'REJECTED' }" />
|
|
|
|
```
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<participant-card :participant="{ actor: { preferredUsername: 'user2', name: 'someoneWhoWillWait' }, role: 'NOT_APPROVED' }" />
|
|
|
|
```
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<participant-card :participant="{ actor: { preferredUsername: 'user3', name: 'a_participant' }, role: 'PARTICIPANT' }" />
|
|
|
|
```
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<participant-card :participant="{ actor: { preferredUsername: 'me', name: 'myself' }, role: 'CREATOR' }" />
|
|
|
|
```
|
|
|
|
</docs>
|
2019-09-20 18:22:03 +02:00
|
|
|
<template>
|
|
|
|
<article class="card">
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="media">
|
|
|
|
<div class="media-left" v-if="participant.actor.avatar">
|
|
|
|
<figure class="image is-48x48">
|
|
|
|
<img :src="participant.actor.avatar.url" />
|
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
<div class="media-content">
|
2020-02-18 08:57:00 +01:00
|
|
|
<span ref="title">{{ actorDisplayName }}</span
|
|
|
|
><br />
|
|
|
|
<small class="has-text-grey" v-if="participant.actor.domain"
|
|
|
|
>@{{ participant.actor.preferredUsername }}@{{ participant.actor.domain }}</small
|
|
|
|
>
|
2019-12-03 11:29:51 +01:00
|
|
|
<small class="has-text-grey" v-else>@{{ participant.actor.preferredUsername }}</small>
|
2019-09-20 18:22:03 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<footer class="card-footer">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-button
|
|
|
|
v-if="[ParticipantRole.NOT_APPROVED, ParticipantRole.REJECTED].includes(participant.role)"
|
|
|
|
@click="accept(participant)"
|
|
|
|
type="is-success"
|
|
|
|
class="card-footer-item"
|
|
|
|
>{{ $t("Approve") }}</b-button
|
|
|
|
>
|
|
|
|
<b-button
|
|
|
|
v-if="participant.role === ParticipantRole.NOT_APPROVED"
|
|
|
|
@click="reject(participant)"
|
|
|
|
type="is-danger"
|
|
|
|
class="card-footer-item"
|
|
|
|
>{{ $t("Reject") }}</b-button
|
|
|
|
>
|
|
|
|
<b-button
|
|
|
|
v-if="participant.role === ParticipantRole.PARTICIPANT"
|
|
|
|
@click="exclude(participant)"
|
|
|
|
type="is-danger"
|
|
|
|
class="card-footer-item"
|
|
|
|
>{{ $t("Exclude") }}</b-button
|
|
|
|
>
|
|
|
|
<span v-if="participant.role === ParticipantRole.CREATOR" class="card-footer-item">{{
|
|
|
|
$t("Creator")
|
|
|
|
}}</span>
|
|
|
|
</footer>
|
2019-09-20 18:22:03 +02:00
|
|
|
</article>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
2020-11-06 11:34:32 +01:00
|
|
|
import { IParticipant, ParticipantRole } from "../../types/participant.model";
|
|
|
|
import { IPerson, Person } from "../../types/actor";
|
2019-09-20 18:22:03 +02:00
|
|
|
|
|
|
|
@Component
|
2019-10-05 21:17:18 +02:00
|
|
|
export default class ParticipantCard extends Vue {
|
2019-09-20 18:22:03 +02:00
|
|
|
@Prop({ required: true }) participant!: IParticipant;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
@Prop({ type: Function }) accept!: Function;
|
|
|
|
|
|
|
|
@Prop({ type: Function }) reject!: Function;
|
|
|
|
|
|
|
|
@Prop({ type: Function }) exclude!: Function;
|
2019-09-20 18:22:03 +02:00
|
|
|
|
|
|
|
ParticipantRole = ParticipantRole;
|
|
|
|
|
|
|
|
get actorDisplayName(): string {
|
2020-11-06 11:34:32 +01:00
|
|
|
const actor = new Person(this.participant.actor as IPerson);
|
2019-09-20 18:22:03 +02:00
|
|
|
return actor.displayName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2020-02-18 08:57:00 +01:00
|
|
|
.card-footer-item {
|
|
|
|
height: $control-height;
|
|
|
|
}
|
2019-09-20 18:22:03 +02:00
|
|
|
</style>
|