2018-10-23 13:38:03 +00:00
|
|
|
<template>
|
|
|
|
<div class="social__wrapper">
|
|
|
|
<div class="social__container">
|
2018-11-14 11:47:30 +00:00
|
|
|
<transition name="slide-fade">
|
|
|
|
<div v-if="showInfo" class="social__welcome">
|
|
|
|
<a class="close icon-close" href="#" @click="hideInfo()"><span class="hidden-visually">Close</span></a>
|
|
|
|
<h2>🎉 {{ t('social', 'Nextcloud becomes part of the federated social networks!') }}</h2>
|
|
|
|
<p>
|
|
|
|
{{ t('social', 'We automatically created a social account for you. Your social ID is the same as your federated cloud ID:') }}
|
|
|
|
<span class="social-id">{{ socialId }}</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</transition>
|
2018-10-23 13:38:03 +00:00
|
|
|
<div class="social__timeline">
|
2018-11-21 12:13:21 +00:00
|
|
|
<composer />
|
2018-11-15 14:52:06 +00:00
|
|
|
<timeline-entry v-for="entry in timeline" :item="entry" :key="entry.id" />
|
2018-11-21 11:36:46 +00:00
|
|
|
<infinite-loading ref="infiniteLoading" @infinite="infiniteHandler">
|
|
|
|
<div slot="spinner"><div class="icon-loading" /></div>
|
|
|
|
<div slot="no-more"><div class="list-end" /></div>
|
|
|
|
<div slot="no-results">
|
|
|
|
<div id="emptycontent">
|
|
|
|
<div class="icon-social" />
|
|
|
|
<h2>{{ t('social', 'No posts found.') }}</h2>
|
|
|
|
</div>
|
2018-11-13 14:20:43 +00:00
|
|
|
</div>
|
|
|
|
</infinite-loading>
|
2018-10-23 13:38:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.social__wrapper {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.social__container {
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
.social__profile {
|
|
|
|
max-width: 500px;
|
|
|
|
flex-grow: 1;
|
|
|
|
border-right: 1px solid var(--color-background-dark);
|
|
|
|
text-align: center;
|
|
|
|
padding-top: 20px;
|
|
|
|
}
|
|
|
|
.social__welcome {
|
|
|
|
max-width: 700px;
|
|
|
|
margin: 15px auto;
|
|
|
|
padding: 15px;
|
2018-11-01 03:48:51 +00:00
|
|
|
border-bottom: 1px solid var(--color-border);
|
2018-10-23 13:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.social__welcome h3 {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.social__welcome .icon-close {
|
2018-11-01 03:48:51 +00:00
|
|
|
float: right;
|
|
|
|
padding: 22px;
|
|
|
|
margin: -15px;
|
|
|
|
opacity: .3;
|
|
|
|
}
|
|
|
|
|
|
|
|
.social__welcome .icon-close:hover,
|
|
|
|
.social__welcome .icon-close:focus {
|
|
|
|
opacity: 1;
|
2018-10-23 13:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.social__welcome .social-id {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.social__timeline {
|
|
|
|
max-width: 700px;
|
|
|
|
margin: 15px auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
#app-content {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
2018-11-14 11:47:30 +00:00
|
|
|
.slide-fade-leave-active {
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
transition: all .5s ease-out;
|
|
|
|
max-height: 200px;
|
|
|
|
}
|
|
|
|
.slide-fade-leave-to {
|
|
|
|
max-height: 0;
|
|
|
|
opacity: 0;
|
|
|
|
padding-top: 0;
|
|
|
|
padding-bottom: 0;
|
|
|
|
}
|
|
|
|
|
2018-10-23 13:38:03 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
2018-10-26 08:33:27 +00:00
|
|
|
import {
|
|
|
|
PopoverMenu,
|
|
|
|
AppNavigation,
|
2018-11-21 12:13:21 +00:00
|
|
|
Multiselect
|
2018-10-26 08:33:27 +00:00
|
|
|
} from 'nextcloud-vue'
|
2018-11-13 14:20:43 +00:00
|
|
|
import InfiniteLoading from 'vue-infinite-loading'
|
2018-10-26 08:33:27 +00:00
|
|
|
import TimelineEntry from './../components/TimelineEntry'
|
2018-11-12 20:12:28 +00:00
|
|
|
import Composer from './../components/Composer'
|
|
|
|
import CurrentUserMixin from './../mixins/currentUserMixin'
|
2018-10-23 13:38:03 +00:00
|
|
|
|
2018-10-26 08:33:27 +00:00
|
|
|
export default {
|
|
|
|
name: 'Timeline',
|
|
|
|
components: {
|
2018-11-21 11:36:46 +00:00
|
|
|
PopoverMenu,
|
|
|
|
AppNavigation,
|
|
|
|
TimelineEntry,
|
|
|
|
Multiselect,
|
2018-11-12 20:12:28 +00:00
|
|
|
Composer,
|
2018-11-13 14:20:43 +00:00
|
|
|
InfiniteLoading
|
2018-10-26 08:33:27 +00:00
|
|
|
},
|
2018-11-12 20:12:28 +00:00
|
|
|
mixins: [CurrentUserMixin],
|
2018-10-26 08:33:27 +00:00
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
infoHidden: false,
|
|
|
|
state: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2018-11-22 14:42:10 +00:00
|
|
|
type: function() {
|
|
|
|
if (this.$route.params.type) {
|
|
|
|
return this.$route.params.type
|
|
|
|
}
|
|
|
|
return 'home'
|
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
url: function() {
|
|
|
|
return OC.linkTo('social', 'img/nextcloud.png')
|
2018-10-23 13:38:03 +00:00
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
timeline: function() {
|
|
|
|
return this.$store.getters.getTimeline
|
2018-10-23 13:38:03 +00:00
|
|
|
},
|
2018-11-14 11:47:30 +00:00
|
|
|
showInfo() {
|
|
|
|
return this.$store.getters.getServerData.firstrun && !this.infoHidden
|
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
menu: function() {
|
|
|
|
let defaultCategories = [
|
|
|
|
{
|
|
|
|
id: 'social-timeline',
|
|
|
|
classes: [],
|
|
|
|
href: '#',
|
|
|
|
icon: 'icon-category-monitoring',
|
|
|
|
text: t('social', 'Timeline')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'social-account',
|
|
|
|
classes: [],
|
|
|
|
href: '#',
|
|
|
|
icon: 'icon-category-user',
|
2018-11-01 03:55:33 +00:00
|
|
|
text: t('social', 'Profile')
|
2018-10-26 08:33:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'social-friends',
|
|
|
|
classes: [],
|
|
|
|
href: '#',
|
|
|
|
icon: 'icon-category-social',
|
|
|
|
text: t('social', 'Friends')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'social-favorites',
|
|
|
|
classes: [],
|
|
|
|
href: '#',
|
|
|
|
icon: 'icon-favorite',
|
|
|
|
text: t('social', 'Favorites')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'social-direct-messages',
|
|
|
|
classes: [],
|
|
|
|
href: '#',
|
|
|
|
icon: 'icon-comment',
|
|
|
|
utils: {
|
|
|
|
counter: 3
|
2018-10-23 13:38:03 +00:00
|
|
|
},
|
2018-10-26 08:33:27 +00:00
|
|
|
text: t('social', 'Direct messages')
|
2018-10-23 13:38:03 +00:00
|
|
|
}
|
2018-10-26 08:33:27 +00:00
|
|
|
]
|
|
|
|
return {
|
|
|
|
items: defaultCategories,
|
|
|
|
loading: false
|
2018-10-23 13:38:03 +00:00
|
|
|
}
|
|
|
|
}
|
2018-10-26 08:33:27 +00:00
|
|
|
},
|
|
|
|
beforeMount: function() {
|
2018-11-22 14:42:10 +00:00
|
|
|
this.$store.dispatch('changeTimelineType', this.type)
|
2018-10-26 08:33:27 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
hideInfo() {
|
|
|
|
this.infoHidden = true
|
2018-11-13 14:20:43 +00:00
|
|
|
},
|
|
|
|
infiniteHandler($state) {
|
|
|
|
this.$store.dispatch('fetchTimeline', {
|
|
|
|
account: this.currentUser.uid
|
2018-11-19 20:54:26 +00:00
|
|
|
}).then((response) => {
|
2018-11-21 11:49:31 +00:00
|
|
|
if (response.status === -1) {
|
|
|
|
OC.Notification.showTemporary('Failed to load more timeline entries')
|
|
|
|
console.error('Failed to load more timeline entries', response)
|
|
|
|
$state.complete()
|
|
|
|
return
|
2018-11-19 20:54:26 +00:00
|
|
|
}
|
2018-11-21 13:48:07 +00:00
|
|
|
response.result.length > 0 ? $state.loaded() : $state.complete()
|
2018-11-19 20:54:26 +00:00
|
|
|
}).catch((error) => {
|
2018-11-21 11:49:31 +00:00
|
|
|
OC.Notification.showTemporary('Failed to load more timeline entries')
|
|
|
|
console.error('Failed to load more timeline entries', error)
|
2018-11-22 14:42:10 +00:00
|
|
|
$state.complete()
|
2018-11-21 11:49:31 +00:00
|
|
|
})
|
|
|
|
}
|
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>
|