2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
2019-04-03 17:29:03 +02:00
|
|
|
<section class="container">
|
|
|
|
<div v-if="person">
|
|
|
|
<div class="card-image" v-if="person.bannerUrl">
|
|
|
|
<figure class="image">
|
|
|
|
<img :src="person.bannerUrl">
|
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="media">
|
|
|
|
<div class="media-left">
|
|
|
|
<figure class="image is-48x48">
|
|
|
|
<img :src="person.avatarUrl">
|
2019-03-21 20:23:42 +01:00
|
|
|
</figure>
|
|
|
|
</div>
|
2019-04-03 17:29:03 +02:00
|
|
|
<div class="media-content">
|
|
|
|
<p class="title">{{ person.name }}</p>
|
|
|
|
<p class="subtitle">@{{ person.preferredUsername }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
<div class="content">
|
|
|
|
<vue-simple-markdown :source="person.summary"></vue-simple-markdown>
|
|
|
|
</div>
|
2019-03-21 20:23:42 +01:00
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
<b-dropdown hoverable has-link aria-role="list">
|
|
|
|
<button class="button is-primary" slot="trigger">
|
|
|
|
<translate>Public feeds</translate>
|
|
|
|
<b-icon icon="menu-down"></b-icon>
|
|
|
|
</button>
|
2019-03-21 20:23:42 +01:00
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
<b-dropdown-item aria-role="listitem">
|
|
|
|
<a :href="feedUrls('atom', true)">
|
|
|
|
<translate>Public RSS/Atom Feed</translate>
|
|
|
|
</a>
|
|
|
|
</b-dropdown-item>
|
|
|
|
<b-dropdown-item aria-role="listitem">
|
|
|
|
<a :href="feedUrls('ics', true)">
|
|
|
|
<translate>Public iCal Feed</translate>
|
|
|
|
</a>
|
|
|
|
</b-dropdown-item>
|
|
|
|
</b-dropdown>
|
2019-03-21 20:23:42 +01:00
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
<b-dropdown hoverable has-link aria-role="list" v-if="person.feedTokens.length > 0">
|
|
|
|
<button class="button is-info" slot="trigger">
|
|
|
|
<translate>Private feeds</translate>
|
|
|
|
<b-icon icon="menu-down"></b-icon>
|
|
|
|
</button>
|
2019-03-21 20:23:42 +01:00
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
<b-dropdown-item aria-role="listitem">
|
|
|
|
<a :href="feedUrls('atom', false)">
|
|
|
|
<translate>RSS/Atom Feed</translate>
|
2019-03-21 20:23:42 +01:00
|
|
|
</a>
|
2019-04-03 17:29:03 +02:00
|
|
|
</b-dropdown-item>
|
|
|
|
<b-dropdown-item aria-role="listitem">
|
|
|
|
<a :href="feedUrls('ics', false)">
|
|
|
|
<translate>iCal Feed</translate>
|
|
|
|
</a>
|
|
|
|
</b-dropdown-item>
|
|
|
|
</b-dropdown>
|
|
|
|
<a class="button" v-else-if="loggedPerson" @click="createToken">
|
|
|
|
<translate>Create token</translate>
|
|
|
|
</a>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-04-03 17:29:03 +02:00
|
|
|
<section v-if="person.organizedEvents.length > 0">
|
|
|
|
<h2 class="subtitle">
|
|
|
|
<translate>Organized</translate>
|
|
|
|
</h2>
|
|
|
|
<div class="columns">
|
|
|
|
<EventCard
|
|
|
|
v-for="event in person.organizedEvents"
|
|
|
|
:event="event"
|
|
|
|
:options="{ hideDetails: true, organizerActor: person }"
|
|
|
|
:key="event.uuid"
|
|
|
|
class="column is-one-third"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<p class="control">
|
|
|
|
<a
|
|
|
|
class="button"
|
|
|
|
@click="deleteProfile()"
|
|
|
|
v-if="loggedPerson && loggedPerson.id === person.id"
|
|
|
|
>
|
|
|
|
<translate>Delete</translate>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</section>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-03-21 20:23:42 +01:00
|
|
|
</section>
|
2019-01-21 15:08:22 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-03-22 10:57:14 +01:00
|
|
|
import { FETCH_PERSON, LOGGED_PERSON } from '@/graphql/actor';
|
|
|
|
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
|
|
|
|
import EventCard from '@/components/Event/EventCard.vue';
|
|
|
|
import { RouteName } from '@/router';
|
2019-03-21 20:23:42 +01:00
|
|
|
import { MOBILIZON_INSTANCE_HOST } from '@/api/_entrypoint';
|
|
|
|
import { IPerson } from '@/types/actor.model';
|
|
|
|
import { CREATE_FEED_TOKEN_ACTOR } from '@/graphql/feed_tokens';
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
person: {
|
|
|
|
query: FETCH_PERSON,
|
|
|
|
variables() {
|
|
|
|
return {
|
2019-03-22 10:57:14 +01:00
|
|
|
name: this.$route.params.name,
|
2019-01-21 15:08:22 +01:00
|
|
|
};
|
2019-03-22 10:57:14 +01:00
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
},
|
|
|
|
loggedPerson: {
|
2019-03-22 10:57:14 +01:00
|
|
|
query: LOGGED_PERSON,
|
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
},
|
|
|
|
components: {
|
2019-03-22 10:57:14 +01:00
|
|
|
EventCard,
|
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
})
|
|
|
|
export default class Profile extends Vue {
|
|
|
|
@Prop({ type: String, required: true }) name!: string;
|
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
person!: IPerson;
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
// call again the method if the route changes
|
2019-03-22 10:57:14 +01:00
|
|
|
@Watch('$route')
|
2019-03-21 20:23:42 +01:00
|
|
|
onRouteChange() {
|
|
|
|
// this.fetchData()
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
nl2br(text) {
|
2019-03-22 10:57:14 +01:00
|
|
|
return text.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
2019-03-21 20:23:42 +01:00
|
|
|
|
|
|
|
feedUrls(format, isPublic = true): string {
|
|
|
|
let url = format === 'ics' ? 'webcal:' : '';
|
|
|
|
url += `//${MOBILIZON_INSTANCE_HOST}/`;
|
|
|
|
if (isPublic === true) {
|
|
|
|
url += `@${this.person.preferredUsername}/feed/`;
|
|
|
|
} else {
|
|
|
|
url += `events/going/${this.person.feedTokens[0].token}/`;
|
|
|
|
}
|
|
|
|
return url + (format === 'ics' ? 'ics' : 'atom');
|
|
|
|
}
|
|
|
|
|
|
|
|
async createToken() {
|
|
|
|
const { data } = await this.$apollo.mutate({
|
|
|
|
mutation: CREATE_FEED_TOKEN_ACTOR,
|
|
|
|
variables: { actor_id: this.person.id },
|
|
|
|
});
|
|
|
|
|
|
|
|
this.person.feedTokens.push(data);
|
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
</script>
|
2019-04-03 17:29:03 +02:00
|
|
|
<style lang="scss">
|
|
|
|
@import "../../variables";
|
|
|
|
@import "~bulma/sass/utilities/_all";
|
|
|
|
@import "~bulma/sass/components/dropdown.sass";
|
|
|
|
</style>
|