2018-10-23 13:38:03 +00:00
|
|
|
<!--
|
|
|
|
- @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
|
|
|
-
|
|
|
|
- @author Julius Härtl <jus@bitgrid.net>
|
|
|
|
-
|
|
|
|
- @license GNU AGPL version 3 or any later version
|
|
|
|
-
|
|
|
|
- This program is free software: you can redistribute it and/or modify
|
|
|
|
- it under the terms of the GNU Affero General Public License as
|
|
|
|
- published by the Free Software Foundation, either version 3 of the
|
|
|
|
- License, or (at your option) any later version.
|
|
|
|
-
|
|
|
|
- This program is distributed in the hope that it will be useful,
|
|
|
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
- GNU Affero General Public License for more details.
|
|
|
|
-
|
|
|
|
- You should have received a copy of the GNU Affero General Public License
|
|
|
|
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
2018-12-21 16:33:29 +00:00
|
|
|
<div v-if="account && accountInfo" class="user-profile">
|
2018-10-23 13:38:03 +00:00
|
|
|
<div class="user-profile--info">
|
2018-12-21 16:33:29 +00:00
|
|
|
<avatar v-if="accountInfo.local" :user="uid" :disable-tooltip="true"
|
2019-01-09 14:59:59 +00:00
|
|
|
:size="128" />
|
2018-12-21 16:33:29 +00:00
|
|
|
<avatar v-else :url="avatarUrl" :disable-tooltip="true"
|
2019-01-09 14:59:59 +00:00
|
|
|
:size="128" />
|
2018-10-23 14:20:38 +00:00
|
|
|
<h2>{{ displayName }}</h2>
|
2019-01-11 09:50:40 +00:00
|
|
|
<p>@{{ accountInfo.account }}</p>
|
2019-01-02 23:25:44 +00:00
|
|
|
<p v-if="accountInfo.website">
|
|
|
|
Website: <a :href="accountInfo.website.value">
|
|
|
|
{{ accountInfo.website.value }}
|
|
|
|
</a>
|
|
|
|
</p>
|
2018-12-21 16:33:29 +00:00
|
|
|
<follow-button :account="accountInfo.account" />
|
2019-02-06 10:48:46 +00:00
|
|
|
<button v-if="serverData.public" class="primary" @click="followRemote">
|
|
|
|
{{ t('social', 'Follow') }}
|
|
|
|
</button>
|
2018-10-23 13:38:03 +00:00
|
|
|
</div>
|
2018-12-21 16:33:29 +00:00
|
|
|
<!-- TODO: we have no details, timeline and follower list for non-local accounts for now -->
|
|
|
|
<ul v-if="accountInfo.details && accountInfo.local" class="user-profile--sections">
|
2018-10-23 14:20:38 +00:00
|
|
|
<li>
|
2019-01-02 23:25:44 +00:00
|
|
|
<router-link :to="{ name: 'profile', params: { account: uid } }" class="icon-category-monitoring">
|
|
|
|
{{ getCount('post') }} {{ t('social', 'posts') }}
|
|
|
|
</router-link>
|
2018-10-23 13:38:03 +00:00
|
|
|
</li>
|
2018-10-23 14:20:38 +00:00
|
|
|
<li>
|
2019-01-02 23:25:44 +00:00
|
|
|
<router-link :to="{ name: 'profile.following', params: { account: uid } }" class="icon-category-social">
|
|
|
|
{{ getCount('following') }} {{ t('social', 'following') }}
|
|
|
|
</router-link>
|
2018-10-23 13:38:03 +00:00
|
|
|
</li>
|
2018-10-23 14:20:38 +00:00
|
|
|
<li>
|
2019-01-02 23:25:44 +00:00
|
|
|
<router-link :to="{ name: 'profile.followers', params: { account: uid } }" class="icon-category-social">
|
|
|
|
{{ getCount('followers') }} {{ t('social', 'followers') }}
|
|
|
|
</router-link>
|
2018-10-23 13:38:03 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<style scoped>
|
|
|
|
.user-profile {
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
text-align: center;
|
|
|
|
padding-top: 20px;
|
|
|
|
align-items: flex-end;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
h2 {
|
|
|
|
margin-bottom: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-profile--info {
|
|
|
|
width: 40%;
|
|
|
|
}
|
|
|
|
.user-profile--sections {
|
|
|
|
width: 60%;
|
|
|
|
display: flex;
|
|
|
|
margin-bottom: 30px;
|
|
|
|
}
|
|
|
|
.user-profile--sections li {
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
.user-profile--sections li a {
|
2018-12-03 11:39:18 +00:00
|
|
|
padding: 10px;
|
2018-10-23 13:38:03 +00:00
|
|
|
padding-left: 24px;
|
2018-12-03 11:39:18 +00:00
|
|
|
display: inline-block;
|
2018-10-23 14:20:38 +00:00
|
|
|
background-position: 0 center;
|
2018-10-23 13:38:03 +00:00
|
|
|
height: 40px;
|
2018-10-23 20:07:46 +00:00
|
|
|
opacity: .6;
|
|
|
|
}
|
2018-12-03 11:39:18 +00:00
|
|
|
.user-profile--sections li a.router-link-exact-active,
|
|
|
|
.user-profile--sections li a:focus{
|
2018-10-23 20:07:46 +00:00
|
|
|
opacity: 1;
|
2018-12-03 11:39:18 +00:00
|
|
|
border-bottom: 1px solid var(--color-main-text);
|
2018-10-23 13:38:03 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
|
2018-10-26 08:33:27 +00:00
|
|
|
import { Avatar } from 'nextcloud-vue'
|
2018-11-29 10:50:59 +00:00
|
|
|
import serverData from '../mixins/serverData'
|
2018-12-03 09:02:46 +00:00
|
|
|
import currentUser from '../mixins/currentUserMixin'
|
|
|
|
import follow from '../mixins/follow'
|
2018-12-21 16:33:29 +00:00
|
|
|
import FollowButton from './FollowButton'
|
2018-10-23 13:38:03 +00:00
|
|
|
|
2018-10-26 08:33:27 +00:00
|
|
|
export default {
|
|
|
|
name: 'ProfileInfo',
|
|
|
|
components: {
|
2018-12-21 16:33:29 +00:00
|
|
|
FollowButton,
|
2018-10-26 08:33:27 +00:00
|
|
|
Avatar
|
|
|
|
},
|
2018-12-05 08:48:02 +00:00
|
|
|
mixins: [
|
|
|
|
serverData,
|
|
|
|
currentUser,
|
|
|
|
follow
|
|
|
|
],
|
2018-10-26 08:33:27 +00:00
|
|
|
props: {
|
|
|
|
uid: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
}
|
|
|
|
},
|
2018-12-03 10:40:44 +00:00
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
followingText: t('social', 'Following')
|
|
|
|
}
|
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
computed: {
|
2018-12-21 16:33:29 +00:00
|
|
|
account() {
|
|
|
|
return (this.uid.indexOf('@') === -1) ? this.uid + '@' + this.hostname : this.uid
|
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
displayName() {
|
2018-12-03 09:02:46 +00:00
|
|
|
if (typeof this.accountInfo.name !== 'undefined' && this.accountInfo.name !== '') {
|
|
|
|
return this.accountInfo.name
|
|
|
|
}
|
2018-12-21 16:33:29 +00:00
|
|
|
return this.account
|
2018-10-23 13:38:03 +00:00
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
accountInfo: function() {
|
2018-12-21 16:33:29 +00:00
|
|
|
return this.$store.getters.getAccount(this.account)
|
|
|
|
},
|
|
|
|
getCount() {
|
|
|
|
return (field) => this.accountInfo.details.count ? this.accountInfo.details.count[field] : ''
|
|
|
|
},
|
|
|
|
avatarUrl() {
|
|
|
|
return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
|
2018-10-26 08:33:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2019-02-06 10:48:46 +00:00
|
|
|
followRemote() {
|
|
|
|
window.open(OC.generateUrl('/apps/social/api/v1/ostatus/followRemote/' + encodeURI(this.uid)), 'followRemote', 'width=433,height=600toolbar=no,menubar=no,scrollbars=yes,resizable=yes')
|
|
|
|
}
|
2018-10-23 13:38:03 +00:00
|
|
|
}
|
2018-10-26 08:33:27 +00:00
|
|
|
}
|
2018-10-23 13:38:03 +00:00
|
|
|
|
|
|
|
</script>
|