Fix account component

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-11-07 08:32:22 +01:00
parent a082b85ccb
commit 07b9676f0d

View File

@ -1,18 +1,16 @@
<template> <template>
<v-layout row> <v-layout row>
<v-flex xs12 sm6 offset-sm3> <v-flex xs12 sm6 offset-sm3>
<ApolloQuery :query="FETCH_ACTOR" :variables="{ name }"> <v-progress-circular v-if="$apollo.loading" indeterminate color="primary"></v-progress-circular>
<template slot-scope="{ result: { loading, error, data } }"> <v-card v-if="actor">
<v-progress-circular v-if="loading" indeterminate color="primary"></v-progress-circular> <v-img :src="actor.banner || 'https://picsum.photos/400/'" height="300px">
<v-card v-if="data">
<v-img :src="data.actor.banner || 'https://picsum.photos/400/'" height="300px">
<v-layout column class="media"> <v-layout column class="media">
<v-card-title> <v-card-title>
<v-btn icon @click="$router.go(-1)"> <v-btn icon @click="$router.go(-1)">
<v-icon>chevron_left</v-icon> <v-icon>chevron_left</v-icon>
</v-btn> </v-btn>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<!-- <v-btn icon class="mr-3" v-if="actor.id === data.actor.id"> <!-- <v-btn icon class="mr-3" v-if="actor.id === actor.id">
<v-icon>edit</v-icon> <v-icon>edit</v-icon>
</v-btn> --> </v-btn> -->
<v-menu bottom left> <v-menu bottom left>
@ -20,10 +18,10 @@
<v-icon>more_vert</v-icon> <v-icon>more_vert</v-icon>
</v-btn> </v-btn>
<v-list> <v-list>
<!-- <v-list-tile @click="logoutUser()" v-if="actor.id === data.actor.id"> <!-- <v-list-tile @click="logoutUser()" v-if="actor.id === actor.id">
<v-list-tile-title>User logout</v-list-tile-title> <v-list-tile-title>User logout</v-list-tile-title>
</v-list-tile> </v-list-tile>
<v-list-tile @click="deleteAccount()" v-if="actor.id === data.actor.id"> <v-list-tile @click="deleteAccount()" v-if="actor.id === actor.id">
<v-list-tile-title>Delete</v-list-tile-title> <v-list-tile-title>Delete</v-list-tile-title>
</v-list-tile> --> </v-list-tile> -->
</v-list> </v-list>
@ -32,22 +30,22 @@
<v-spacer></v-spacer> <v-spacer></v-spacer>
<div class="text-xs-center"> <div class="text-xs-center">
<v-avatar size="125px"> <v-avatar size="125px">
<img v-if="!data.actor.avatarUrl" <img v-if="!actor.avatarUrl"
class="img-circle elevation-7 mb-1" class="img-circle elevation-7 mb-1"
src="https://picsum.photos/125/125/" src="https://picsum.photos/125/125/"
> >
<img v-else <img v-else
class="img-circle elevation-7 mb-1" class="img-circle elevation-7 mb-1"
:src="data.actor.avatarUrl" :src="actor.avatarUrl"
> >
</v-avatar> </v-avatar>
</div> </div>
<v-container fluid grid-list-lg> <v-container fluid grid-list-lg>
<v-layout row> <v-layout row>
<v-flex xs7> <v-flex xs7>
<div class="headline">{{ data.actor.name }}</div> <div class="headline">{{ actor.name }}</div>
<div><span class="subheading">@{{ data.actor.preferredUsername }}<span v-if="data.actor.domain">@{{ data.actor.domain }}</span></span></div> <div><span class="subheading">@{{ actor.preferredUsername }}<span v-if="actor.domain">@{{ actor.domain }}</span></span></div>
<v-card-text v-if="data.actor.description" v-html="data.actor.description"></v-card-text> <v-card-text v-if="actor.description" v-html="actor.description"></v-card-text>
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>
@ -87,10 +85,10 @@
</v-list-tile-content> </v-list-tile-content>
</v-list-tile> </v-list-tile>
</v-list> </v-list>
<v-container fluid grid-list-md v-if="data.actor.participatingEvents && data.actor.participatingEvents.length > 0"> <v-container fluid grid-list-md v-if="actor.participatingEvents && actor.participatingEvents.length > 0">
<v-subheader>Participated at</v-subheader> <v-subheader>Participated at</v-subheader>
<v-layout row wrap> <v-layout row wrap>
<v-flex v-for="event in data.actor.participatingEvents" :key="event.id"> <v-flex v-for="event in actor.participatingEvents" :key="event.id">
<v-card> <v-card>
<v-img <v-img
class="black--text" class="black--text"
@ -128,10 +126,10 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>
<v-container fluid grid-list-md v-if="data.actor.organizedEvents && data.actor.organizedEvents.length > 0"> <v-container fluid grid-list-md v-if="actor.organizedEvents && actor.organizedEvents.length > 0">
<v-subheader>Organized events</v-subheader> <v-subheader>Organized events</v-subheader>
<v-layout row wrap> <v-layout row wrap>
<v-flex v-for="event in data.actor.organizedEvents" :key="event.id" md6> <v-flex v-for="event in actor.organizedEvents" :key="event.id" md6>
<v-card> <v-card>
<v-img <v-img
height="200px" height="200px"
@ -169,8 +167,6 @@
</v-layout> </v-layout>
</v-container> </v-container>
</v-card> </v-card>
</template>
</ApolloQuery>
</v-flex> </v-flex>
</v-layout> </v-layout>
</template> </template>
@ -182,7 +178,7 @@ export default {
name: 'Account', name: 'Account',
data() { data() {
return { return {
loading: true, actor: null,
}; };
}, },
props: { props: {
@ -191,6 +187,16 @@ export default {
required: true, required: true,
}, },
}, },
apollo: {
actor: {
query: FETCH_ACTOR,
variables() {
return {
name: this.$route.params.name,
};
},
},
},
created() { created() {
}, },
watch: { watch: {