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,177 +1,173 @@
<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-layout column class="media">
<v-img :src="data.actor.banner || 'https://picsum.photos/400/'" height="300px"> <v-card-title>
<v-layout column class="media"> <v-btn icon @click="$router.go(-1)">
<v-card-title> <v-icon>chevron_left</v-icon>
<v-btn icon @click="$router.go(-1)"> </v-btn>
<v-icon>chevron_left</v-icon>
</v-btn>
<v-spacer></v-spacer>
<!-- <v-btn icon class="mr-3" v-if="actor.id === data.actor.id">
<v-icon>edit</v-icon>
</v-btn> -->
<v-menu bottom left>
<v-btn icon slot="activator">
<v-icon>more_vert</v-icon>
</v-btn>
<v-list>
<!-- <v-list-tile @click="logoutUser()" v-if="actor.id === data.actor.id">
<v-list-tile-title>User logout</v-list-tile-title>
</v-list-tile>
<v-list-tile @click="deleteAccount()" v-if="actor.id === data.actor.id">
<v-list-tile-title>Delete</v-list-tile-title>
</v-list-tile> -->
</v-list>
</v-menu>
</v-card-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<div class="text-xs-center"> <!-- <v-btn icon class="mr-3" v-if="actor.id === actor.id">
<v-avatar size="125px"> <v-icon>edit</v-icon>
<img v-if="!data.actor.avatarUrl" </v-btn> -->
class="img-circle elevation-7 mb-1" <v-menu bottom left>
src="https://picsum.photos/125/125/" <v-btn icon slot="activator">
> <v-icon>more_vert</v-icon>
<img v-else </v-btn>
class="img-circle elevation-7 mb-1" <v-list>
:src="data.actor.avatarUrl" <!-- <v-list-tile @click="logoutUser()" v-if="actor.id === actor.id">
> <v-list-tile-title>User logout</v-list-tile-title>
</v-avatar> </v-list-tile>
</div> <v-list-tile @click="deleteAccount()" v-if="actor.id === actor.id">
<v-container fluid grid-list-lg> <v-list-tile-title>Delete</v-list-tile-title>
<v-layout row> </v-list-tile> -->
<v-flex xs7> </v-list>
<div class="headline">{{ data.actor.name }}</div> </v-menu>
<div><span class="subheading">@{{ data.actor.preferredUsername }}<span v-if="data.actor.domain">@{{ data.actor.domain }}</span></span></div> </v-card-title>
<v-card-text v-if="data.actor.description" v-html="data.actor.description"></v-card-text> <v-spacer></v-spacer>
</v-flex> <div class="text-xs-center">
</v-layout> <v-avatar size="125px">
</v-container> <img v-if="!actor.avatarUrl"
</v-layout> class="img-circle elevation-7 mb-1"
</v-img> src="https://picsum.photos/125/125/"
<v-list three-line> >
<v-list-tile> <img v-else
<v-list-tile-action> class="img-circle elevation-7 mb-1"
<v-icon color="indigo">phone</v-icon> :src="actor.avatarUrl"
</v-list-tile-action> >
<v-list-tile-content> </v-avatar>
<v-list-tile-title>(323) 555-6789</v-list-tile-title> </div>
<v-list-tile-sub-title>Work</v-list-tile-sub-title> <v-container fluid grid-list-lg>
</v-list-tile-content> <v-layout row>
<v-list-tile-action> <v-flex xs7>
<v-icon dark>chat</v-icon> <div class="headline">{{ actor.name }}</div>
</v-list-tile-action> <div><span class="subheading">@{{ actor.preferredUsername }}<span v-if="actor.domain">@{{ actor.domain }}</span></span></div>
</v-list-tile> <v-card-text v-if="actor.description" v-html="actor.description"></v-card-text>
<v-divider inset></v-divider> </v-flex>
<v-list-tile> </v-layout>
<v-list-tile-action> </v-container>
<v-icon color="indigo">mail</v-icon> </v-layout>
</v-list-tile-action> </v-img>
<v-list-tile-content> <v-list three-line>
<v-list-tile-title>ali_connors@example.com</v-list-tile-title> <v-list-tile>
<v-list-tile-sub-title>Work</v-list-tile-sub-title> <v-list-tile-action>
</v-list-tile-content> <v-icon color="indigo">phone</v-icon>
</v-list-tile> </v-list-tile-action>
<v-divider inset></v-divider> <v-list-tile-content>
<v-list-tile> <v-list-tile-title>(323) 555-6789</v-list-tile-title>
<v-list-tile-action> <v-list-tile-sub-title>Work</v-list-tile-sub-title>
<v-icon color="indigo">location_on</v-icon> </v-list-tile-content>
</v-list-tile-action> <v-list-tile-action>
<v-list-tile-content> <v-icon dark>chat</v-icon>
<v-list-tile-title>1400 Main Street</v-list-tile-title> </v-list-tile-action>
<v-list-tile-sub-title>Orlando, FL 79938</v-list-tile-sub-title> </v-list-tile>
</v-list-tile-content> <v-divider inset></v-divider>
</v-list-tile> <v-list-tile>
</v-list> <v-list-tile-action>
<v-container fluid grid-list-md v-if="data.actor.participatingEvents && data.actor.participatingEvents.length > 0"> <v-icon color="indigo">mail</v-icon>
<v-subheader>Participated at</v-subheader> </v-list-tile-action>
<v-layout row wrap> <v-list-tile-content>
<v-flex v-for="event in data.actor.participatingEvents" :key="event.id"> <v-list-tile-title>ali_connors@example.com</v-list-tile-title>
<v-card> <v-list-tile-sub-title>Work</v-list-tile-sub-title>
<v-img </v-list-tile-content>
class="black--text" </v-list-tile>
height="200px" <v-divider inset></v-divider>
src="https://picsum.photos/400/200/" <v-list-tile>
> <v-list-tile-action>
<v-container fill-height fluid> <v-icon color="indigo">location_on</v-icon>
<v-layout fill-height> </v-list-tile-action>
<v-flex xs12 align-end flexbox> <v-list-tile-content>
<span class="headline">{{ event.title }}</span> <v-list-tile-title>1400 Main Street</v-list-tile-title>
</v-flex> <v-list-tile-sub-title>Orlando, FL 79938</v-list-tile-sub-title>
</v-layout> </v-list-tile-content>
</v-container> </v-list-tile>
</v-img> </v-list>
<v-card-title> <v-container fluid grid-list-md v-if="actor.participatingEvents && actor.participatingEvents.length > 0">
<div> <v-subheader>Participated at</v-subheader>
<span class="grey--text">{{ event.startDate | formatDate }} à {{ event.location }}</span><br> <v-layout row wrap>
<p>{{ event.description }}</p> <v-flex v-for="event in actor.participatingEvents" :key="event.id">
<p v-if="event.organizer">Organisé par <router-link :to="{name: 'Account', params: {'id': event.organizer.id}}">{{ event.organizer.username }}</router-link></p> <v-card>
</div> <v-img
</v-card-title> class="black--text"
<v-card-actions> height="200px"
<v-spacer></v-spacer> src="https://picsum.photos/400/200/"
<v-btn icon> >
<v-icon>favorite</v-icon> <v-container fill-height fluid>
</v-btn> <v-layout fill-height>
<v-btn icon> <v-flex xs12 align-end flexbox>
<v-icon>bookmark</v-icon> <span class="headline">{{ event.title }}</span>
</v-btn> </v-flex>
<v-btn icon> </v-layout>
<v-icon>share</v-icon> </v-container>
</v-btn> </v-img>
</v-card-actions> <v-card-title>
</v-card> <div>
</v-flex> <span class="grey--text">{{ event.startDate | formatDate }} à {{ event.location }}</span><br>
</v-layout> <p>{{ event.description }}</p>
</v-container> <p v-if="event.organizer">Organisé par <router-link :to="{name: 'Account', params: {'id': event.organizer.id}}">{{ event.organizer.username }}</router-link></p>
<v-container fluid grid-list-md v-if="data.actor.organizedEvents && data.actor.organizedEvents.length > 0"> </div>
<v-subheader>Organized events</v-subheader> </v-card-title>
<v-layout row wrap> <v-card-actions>
<v-flex v-for="event in data.actor.organizedEvents" :key="event.id" md6> <v-spacer></v-spacer>
<v-card> <v-btn icon>
<v-img <v-icon>favorite</v-icon>
height="200px" </v-btn>
src="https://picsum.photos/400/200/" <v-btn icon>
/> <v-icon>bookmark</v-icon>
<v-card-title primary-title> </v-btn>
<div> <v-btn icon>
<router-link :to="{name: 'Event', params: {uuid: event.uuid}}"> <v-icon>share</v-icon>
<div class="headline">{{ event.title }}</div> </v-btn>
</router-link> </v-card-actions>
<span class="grey--text" v-html="nl2br(event.description)"></span> </v-card>
</div> </v-flex>
</v-card-title> </v-layout>
</v-container>
<!-- <v-card-title> <v-container fluid grid-list-md v-if="actor.organizedEvents && actor.organizedEvents.length > 0">
<div> <v-subheader>Organized events</v-subheader>
<span class="grey--text" v-if="event.addressType === 'physical'">{{ event.startDate }} à {{ event.location }}</span><br> <v-layout row wrap>
<p v-if="event.organizer">Organisé par <router-link :to="{name: 'Account', params: {'id': event.organizer.id}}">{{ event.organizer.username }}</router-link></p> <v-flex v-for="event in actor.organizedEvents" :key="event.id" md6>
</div> <v-card>
</v-card-title> --> <v-img
<v-card-actions> height="200px"
<v-spacer></v-spacer> src="https://picsum.photos/400/200/"
<v-btn icon> />
<v-icon>favorite</v-icon> <v-card-title primary-title>
</v-btn> <div>
<v-btn icon> <router-link :to="{name: 'Event', params: {uuid: event.uuid}}">
<v-icon>bookmark</v-icon> <div class="headline">{{ event.title }}</div>
</v-btn> </router-link>
<v-btn icon> <span class="grey--text" v-html="nl2br(event.description)"></span>
<v-icon>share</v-icon> </div>
</v-btn> </v-card-title>
</v-card-actions>
</v-card> <!-- <v-card-title>
</v-flex> <div>
</v-layout> <span class="grey--text" v-if="event.addressType === 'physical'">{{ event.startDate }} à {{ event.location }}</span><br>
</v-container> <p v-if="event.organizer">Organisé par <router-link :to="{name: 'Account', params: {'id': event.organizer.id}}">{{ event.organizer.username }}</router-link></p>
</v-card> </div>
</template> </v-card-title> -->
</ApolloQuery> <v-card-actions>
</v-flex> <v-spacer></v-spacer>
<v-btn icon>
<v-icon>favorite</v-icon>
</v-btn>
<v-btn icon>
<v-icon>bookmark</v-icon>
</v-btn>
<v-btn icon>
<v-icon>share</v-icon>
</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-card>
</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: {