kopia lustrzana https://github.com/nextcloud/social
Add proper eslint settings
Signed-off-by: Julius Härtl <jus@bitgrid.net>pull/8/head
rodzic
a25b0bc69e
commit
f7ed53a5fb
68
.eslintrc.js
68
.eslintrc.js
|
@ -1,3 +1,67 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"extends": "standard"
|
root: true,
|
||||||
};
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es6: true,
|
||||||
|
node: true,
|
||||||
|
jest: true
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
t: true,
|
||||||
|
n: true,
|
||||||
|
OC: true,
|
||||||
|
OCA: true,
|
||||||
|
Vue: true,
|
||||||
|
VueRouter: true
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
parser: 'babel-eslint',
|
||||||
|
ecmaVersion: 6
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:node/recommended',
|
||||||
|
'plugin:vue/essential',
|
||||||
|
'plugin:vue/recommended',
|
||||||
|
'standard'
|
||||||
|
],
|
||||||
|
plugins: ['vue', 'node'],
|
||||||
|
rules: {
|
||||||
|
// space before function ()
|
||||||
|
'space-before-function-paren': ['error', 'never'],
|
||||||
|
// curly braces always space
|
||||||
|
'object-curly-spacing': ['error', 'always'],
|
||||||
|
// stay consistent with array brackets
|
||||||
|
'array-bracket-newline': ['error', 'consistent'],
|
||||||
|
// 1tbs brace style
|
||||||
|
'brace-style': 'error',
|
||||||
|
// tabs only
|
||||||
|
indent: ['error', 'tab'],
|
||||||
|
'no-tabs': 0,
|
||||||
|
'vue/html-indent': ['error', 'tab'],
|
||||||
|
// only debug console
|
||||||
|
'no-console': ['error', { allow: ['error', 'warn', 'debug'] }],
|
||||||
|
// classes blocks
|
||||||
|
'padded-blocks': ['error', { classes: 'always' }],
|
||||||
|
// always have the operator in front
|
||||||
|
'operator-linebreak': ['error', 'before'],
|
||||||
|
// ternary on multiline
|
||||||
|
'multiline-ternary': ['error', 'always-multiline'],
|
||||||
|
// es6 import/export and require
|
||||||
|
'node/no-unpublished-require': ['off'],
|
||||||
|
'node/no-unsupported-features/es-syntax': ['off'],
|
||||||
|
// space before self-closing elements
|
||||||
|
'vue/html-closing-bracket-spacing': 'error',
|
||||||
|
// code spacing with attributes
|
||||||
|
'vue/max-attributes-per-line': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
singleline: 3,
|
||||||
|
multiline: {
|
||||||
|
max: 3,
|
||||||
|
allowFirstLine: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
241
src/App.vue
241
src/App.vue
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-social">
|
<div class="app-social">
|
||||||
<div id="app-navigation" v-if="!serverData.public">
|
<div v-if="!serverData.public" id="app-navigation">
|
||||||
<app-navigation :menu="menu"></app-navigation>
|
<app-navigation :menu="menu" />
|
||||||
</div>
|
</div>
|
||||||
<div id="app-content">
|
<div id="app-content">
|
||||||
<router-view :key="$route.fullPath"></router-view>
|
<router-view :key="$route.fullPath" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,133 +15,136 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
|
PopoverMenu,
|
||||||
|
AppNavigation,
|
||||||
|
Multiselect,
|
||||||
|
Avatar
|
||||||
|
} from 'nextcloud-vue'
|
||||||
|
import TimelineEntry from './components/TimelineEntry'
|
||||||
|
import ProfileInfo from './components/ProfileInfo'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'App',
|
||||||
|
components: {
|
||||||
PopoverMenu,
|
PopoverMenu,
|
||||||
AppNavigation,
|
AppNavigation,
|
||||||
|
TimelineEntry,
|
||||||
Multiselect,
|
Multiselect,
|
||||||
Avatar
|
Avatar,
|
||||||
} from 'nextcloud-vue';
|
ProfileInfo
|
||||||
import TimelineEntry from './components/TimelineEntry';
|
},
|
||||||
import ProfileInfo from './components/ProfileInfo';
|
data: function() {
|
||||||
|
return {
|
||||||
export default {
|
infoHidden: false,
|
||||||
name: 'App',
|
state: []
|
||||||
components: {
|
}
|
||||||
PopoverMenu, AppNavigation, TimelineEntry, Multiselect, Avatar,
|
},
|
||||||
ProfileInfo
|
computed: {
|
||||||
|
url: function() {
|
||||||
|
return OC.linkTo('social', 'img/nextcloud.png')
|
||||||
},
|
},
|
||||||
data: function () {
|
currentUser: function() {
|
||||||
return {
|
return OC.getCurrentUser()
|
||||||
infoHidden: false,
|
|
||||||
state: [],
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
beforeMount: function() {
|
socialId: function() {
|
||||||
// importing server data into the store
|
return '@' + OC.getCurrentUser().uid + '@' + OC.getHost()
|
||||||
const serverDataElmt = document.getElementById('serverData');
|
|
||||||
if (serverDataElmt !== null) {
|
|
||||||
this.$store.commit('setServerData', JSON.parse(document.getElementById('serverData').dataset.server));
|
|
||||||
}
|
|
||||||
|
|
||||||
let example = {
|
|
||||||
message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n' +
|
|
||||||
'\n' +
|
|
||||||
'Get started right now: https://nextcloud.com/signup',
|
|
||||||
author: 'Nextcloud 📱☁️💻',
|
|
||||||
authorId: '@nextcloud@mastodon.xyz',
|
|
||||||
authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
|
|
||||||
timestamp: '1 day ago'
|
|
||||||
};
|
|
||||||
let data = [];
|
|
||||||
for (let i=0; i<3; i++) {
|
|
||||||
example.id = Math.floor((Math.random() * 100));
|
|
||||||
data.push(example);
|
|
||||||
}
|
|
||||||
data.push({
|
|
||||||
message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n' +
|
|
||||||
'\n' +
|
|
||||||
'Get started right now: https://nextcloud.com/signup',
|
|
||||||
author: 'Admin☁️💻',
|
|
||||||
authorId: 'admin',
|
|
||||||
authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
|
|
||||||
timestamp: '1 day ago'
|
|
||||||
})
|
|
||||||
this.$store.commit('addToTimeline', data);
|
|
||||||
},
|
},
|
||||||
methods: {
|
timeline: function() {
|
||||||
hideInfo() {
|
return this.$store.getters.getTimeline
|
||||||
this.infoHidden = true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
serverData: function() {
|
||||||
url: function() {
|
return this.$store.getters.getServerData
|
||||||
return OC.linkTo('social', 'img/nextcloud.png');
|
},
|
||||||
},
|
menu: function() {
|
||||||
currentUser: function() {
|
let defaultCategories = [
|
||||||
return OC.getCurrentUser();
|
{
|
||||||
},
|
id: 'social-timeline',
|
||||||
socialId: function() {
|
classes: [],
|
||||||
return '@' + OC.getCurrentUser().uid + '@' + OC.getHost();
|
icon: 'icon-category-monitoring',
|
||||||
},
|
text: t('social', 'Timeline'),
|
||||||
timeline: function() {
|
router: {
|
||||||
return this.$store.getters.getTimeline;
|
name: 'timeline'
|
||||||
},
|
}
|
||||||
serverData: function() {
|
},
|
||||||
return this.$store.getters.getServerData;
|
{
|
||||||
},
|
id: 'social-account',
|
||||||
menu: function () {
|
classes: [],
|
||||||
let defaultCategories = [
|
icon: 'icon-user',
|
||||||
{
|
text: t('social', 'Your account'),
|
||||||
id: 'social-timeline',
|
router: {
|
||||||
classes: [],
|
name: 'profile',
|
||||||
icon: 'icon-category-monitoring',
|
params: { account: this.currentUser.uid }
|
||||||
text: t('social', 'Timeline'),
|
}
|
||||||
router: {
|
},
|
||||||
name: 'timeline',
|
{
|
||||||
},
|
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
|
||||||
},
|
},
|
||||||
{
|
text: t('social', 'Direct messages')
|
||||||
id: 'social-account',
|
|
||||||
classes: [],
|
|
||||||
icon: 'icon-user',
|
|
||||||
text: t('social', 'Your account'),
|
|
||||||
router: {
|
|
||||||
name: 'profile',
|
|
||||||
params: {account: this.currentUser.uid }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
text: t('social', 'Direct messages'),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
return {
|
|
||||||
items: defaultCategories,
|
|
||||||
loading: false
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
return {
|
||||||
|
items: defaultCategories,
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
beforeMount: function() {
|
||||||
|
// importing server data into the store
|
||||||
|
const serverDataElmt = document.getElementById('serverData')
|
||||||
|
if (serverDataElmt !== null) {
|
||||||
|
this.$store.commit('setServerData', JSON.parse(document.getElementById('serverData').dataset.server))
|
||||||
|
}
|
||||||
|
|
||||||
|
let example = {
|
||||||
|
message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n'
|
||||||
|
+ '\n'
|
||||||
|
+ 'Get started right now: https://nextcloud.com/signup',
|
||||||
|
author: 'Nextcloud 📱☁️💻',
|
||||||
|
authorId: '@nextcloud@mastodon.xyz',
|
||||||
|
authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
|
||||||
|
timestamp: '1 day ago'
|
||||||
|
}
|
||||||
|
let data = []
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
example.id = Math.floor((Math.random() * 100))
|
||||||
|
data.push(example)
|
||||||
|
}
|
||||||
|
data.push({
|
||||||
|
message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n'
|
||||||
|
+ '\n'
|
||||||
|
+ 'Get started right now: https://nextcloud.com/signup',
|
||||||
|
author: 'Admin☁️💻',
|
||||||
|
authorId: 'admin',
|
||||||
|
authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
|
||||||
|
timestamp: '1 day ago'
|
||||||
|
})
|
||||||
|
this.$store.commit('addToTimeline', data)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
hideInfo() {
|
||||||
|
this.infoHidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -21,20 +21,19 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="user-profile" v-if="uid && accountInfo">
|
<div v-if="uid && accountInfo" class="user-profile">
|
||||||
<div class="user-profile--info">
|
<div class="user-profile--info">
|
||||||
<avatar :user="uid" :displayName="displayName" :size="128" />
|
<avatar :user="uid" :display-name="displayName" :size="128" />
|
||||||
<h2>{{ displayName }}</h2>
|
<h2>{{ displayName }}</h2>
|
||||||
<p>{{ accountInfo.cloudId }}</p>
|
<p>{{ accountInfo.cloudId }}</p>
|
||||||
<p v-if="accountInfo.website">Website: <a :href="accountInfo.website.value">{{accountInfo.website.value}}</a></p>
|
<p v-if="accountInfo.website">Website: <a :href="accountInfo.website.value">{{ accountInfo.website.value }}</a></p>
|
||||||
|
|
||||||
<button v-if="!serverData.public" class="primary" @click="follow">Follow this user</button>
|
<button v-if="!serverData.public" class="primary" @click="follow">Follow this user</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<ul class="user-profile--sections">
|
<ul class="user-profile--sections">
|
||||||
<li>
|
<li>
|
||||||
<router-link to="./" class="icon-category-monitoring" >{{ accountInfo.posts }} posts</router-link>
|
<router-link to="./" class="icon-category-monitoring">{{ accountInfo.posts }} posts</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<router-link to="./following" class="icon-category-social">{{ accountInfo.following }} following</router-link>
|
<router-link to="./following" class="icon-category-social">{{ accountInfo.following }} following</router-link>
|
||||||
|
@ -81,32 +80,36 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { Avatar } from 'nextcloud-vue'
|
import { Avatar } from 'nextcloud-vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ProfileInfo',
|
name: 'ProfileInfo',
|
||||||
props: ['uid'],
|
components: {
|
||||||
components: {
|
Avatar
|
||||||
Avatar
|
},
|
||||||
|
props: {
|
||||||
|
uid: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
displayName() {
|
||||||
|
if (typeof this.accountInfo.displayname !== 'undefined') { return this.accountInfo.displayname.value || '' }
|
||||||
|
return this.uid
|
||||||
},
|
},
|
||||||
methods: {
|
serverData: function() {
|
||||||
follow() {
|
return this.$store.getters.getServerData
|
||||||
console.log('TODO: implement following users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
accountInfo: function() {
|
||||||
displayName() {
|
return this.$store.getters.getAccount(this.uid)
|
||||||
if (typeof this.accountInfo.displayname !== 'undefined')
|
}
|
||||||
return this.accountInfo.displayname.value || '';
|
},
|
||||||
return this.uid;
|
methods: {
|
||||||
},
|
follow() {
|
||||||
serverData: function() {
|
// TODO: implement following users
|
||||||
return this.$store.getters.getServerData;
|
|
||||||
},
|
|
||||||
accountInfo: function() {
|
|
||||||
return this.$store.getters.getAccount(this.uid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
<span class="post-author-id">{{ item.authorId }}</span>
|
<span class="post-author-id">{{ item.authorId }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-message" v-html="formatedMessage">
|
<div class="post-message" v-html="formatedMessage" />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="post-timestamp">{{ item.timestamp }}</div>
|
<div class="post-timestamp">{{ item.timestamp }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,27 +19,29 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Avatar } from 'nextcloud-vue'
|
import { Avatar } from 'nextcloud-vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TimelineEntry',
|
name: 'TimelineEntry',
|
||||||
props: ['item'],
|
components: {
|
||||||
components: {
|
Avatar
|
||||||
Avatar
|
},
|
||||||
},
|
props: {
|
||||||
data: function () {
|
item: { type: Object, default: () => {} }
|
||||||
return {
|
},
|
||||||
|
data: function() {
|
||||||
|
return {
|
||||||
|
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formatedMessage: function() {
|
formatedMessage: function() {
|
||||||
let message = this.item.message;
|
let message = this.item.message
|
||||||
message = message.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
message = message.replace(/(?:\r\n|\r|\n)/g, '<br />')
|
||||||
return message;
|
return message
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.timeline-entry {
|
.timeline-entry {
|
||||||
|
|
12
src/main.js
12
src/main.js
|
@ -19,16 +19,16 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import "@babel/polyfill";
|
import '@babel/polyfill'
|
||||||
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import {sync} from 'vuex-router-sync';
|
import { sync } from 'vuex-router-sync'
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import store from './store';
|
import store from './store'
|
||||||
import router from './router';
|
import router from './router'
|
||||||
|
|
||||||
sync(store, router);
|
sync(store, router)
|
||||||
|
|
||||||
// CSP config for webpack dynamic chunk loading
|
// CSP config for webpack dynamic chunk loading
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
@ -48,5 +48,5 @@ Vue.prototype.OCA = OCA
|
||||||
new Vue({
|
new Vue({
|
||||||
router: router,
|
router: router,
|
||||||
render: h => h(App),
|
render: h => h(App),
|
||||||
store: store
|
store: store
|
||||||
}).$mount('#vue-content')
|
}).$mount('#vue-content')
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import Vue from 'vue';
|
import Vue from 'vue'
|
||||||
import Router from 'vue-router';
|
import Router from 'vue-router'
|
||||||
|
|
||||||
// Dynamic loading
|
// Dynamic loading
|
||||||
const Timeline = () => import('./views/Timeline');
|
const Timeline = () => import('./views/Timeline')
|
||||||
const Profile = () => import('./views/Profile');
|
const Profile = () => import('./views/Profile')
|
||||||
const ProfileTimeline = () => import('./views/ProfileTimeline');
|
const ProfileTimeline = () => import('./views/ProfileTimeline')
|
||||||
const ProfileFollowers = () => import('./views/ProfileFollowers');
|
const ProfileFollowers = () => import('./views/ProfileFollowers')
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router)
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
|
@ -42,7 +42,7 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/:index(index.php/)?apps/social/',
|
path: '/:index(index.php/)?apps/social/',
|
||||||
components: {
|
components: {
|
||||||
default: Timeline,
|
default: Timeline
|
||||||
},
|
},
|
||||||
props: true,
|
props: true,
|
||||||
name: 'timeline'
|
name: 'timeline'
|
||||||
|
@ -50,7 +50,7 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/:index(index.php/)?apps/social/account/:account',
|
path: '/:index(index.php/)?apps/social/account/:account',
|
||||||
components: {
|
components: {
|
||||||
default: Profile,
|
default: Profile
|
||||||
},
|
},
|
||||||
props: true,
|
props: true,
|
||||||
name: 'profile',
|
name: 'profile',
|
||||||
|
@ -58,22 +58,22 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
components: {
|
components: {
|
||||||
details: ProfileTimeline,
|
details: ProfileTimeline
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'followers',
|
path: 'followers',
|
||||||
components: {
|
components: {
|
||||||
default: Profile,
|
default: Profile,
|
||||||
details: ProfileFollowers,
|
details: ProfileFollowers
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'following',
|
path: 'following',
|
||||||
components: {
|
components: {
|
||||||
default: Profile,
|
default: Profile,
|
||||||
details: ProfileFollowers,
|
details: ProfileFollowers
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -81,7 +81,7 @@ export default new Router({
|
||||||
path: '/:index(index.php/)?apps/social/:account',
|
path: '/:index(index.php/)?apps/social/:account',
|
||||||
component: Profile,
|
component: Profile,
|
||||||
props: true,
|
props: true,
|
||||||
name: 'public',
|
name: 'public'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
})
|
||||||
|
|
|
@ -20,29 +20,28 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import axios from 'nextcloud-axios';
|
import axios from 'nextcloud-axios'
|
||||||
import Vue from 'vue';
|
import Vue from 'vue'
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
accounts: {}
|
accounts: {}
|
||||||
};
|
}
|
||||||
const mutations = {
|
const mutations = {
|
||||||
addAccount(state, {uid, data}) {
|
addAccount(state, { uid, data }) {
|
||||||
Vue.set(state.accounts, uid, data);
|
Vue.set(state.accounts, uid, data)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const getters = {
|
const getters = {
|
||||||
getAccount(state) {
|
getAccount(state) {
|
||||||
return (uid) => state.accounts[uid];
|
return (uid) => state.accounts[uid]
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const actions = {
|
const actions = {
|
||||||
fetchAccountInfo(context, uid) {
|
fetchAccountInfo(context, uid) {
|
||||||
axios.get(OC.generateUrl('apps/social/local/account/' + uid)).then((response) => {
|
axios.get(OC.generateUrl('apps/social/local/account/' + uid)).then((response) => {
|
||||||
console.log(response.data);
|
context.commit('addAccount', { uid: uid, data: response.data })
|
||||||
context.commit('addAccount', {uid: uid, data:response.data});
|
})
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default {state, mutations, getters, actions};
|
export default { state, mutations, getters, actions }
|
||||||
|
|
|
@ -21,15 +21,15 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Vue from 'vue';
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex'
|
||||||
import timeline from './timeline';
|
import timeline from './timeline'
|
||||||
import account from './account';
|
import account from './account'
|
||||||
import settings from './settings';
|
import settings from './settings'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
const debug = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
|
@ -37,5 +37,5 @@ export default new Vuex.Store({
|
||||||
account,
|
account,
|
||||||
settings
|
settings
|
||||||
},
|
},
|
||||||
strict: debug,
|
strict: debug
|
||||||
});
|
})
|
||||||
|
|
|
@ -22,17 +22,17 @@
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
serverData: {}
|
serverData: {}
|
||||||
};
|
}
|
||||||
const mutations = {
|
const mutations = {
|
||||||
setServerData(state, data) {
|
setServerData(state, data) {
|
||||||
state.serverData = data;
|
state.serverData = data
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const getters = {
|
const getters = {
|
||||||
getServerData(state) {
|
getServerData(state) {
|
||||||
return state.serverData;
|
return state.serverData
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const actions = {};
|
const actions = {}
|
||||||
|
|
||||||
export default {state, mutations, getters, actions};
|
export default { state, mutations, getters, actions }
|
||||||
|
|
|
@ -22,19 +22,19 @@
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
timeline: []
|
timeline: []
|
||||||
};
|
}
|
||||||
const mutations = {
|
const mutations = {
|
||||||
addToTimeline(state, data) {
|
addToTimeline(state, data) {
|
||||||
for (let item in data) {
|
for (let item in data) {
|
||||||
state.timeline.push(data[item]);
|
state.timeline.push(data[item])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const getters = {
|
const getters = {
|
||||||
getTimeline(state) {
|
getTimeline(state) {
|
||||||
return state.timeline;
|
return state.timeline
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const actions = {};
|
const actions = {}
|
||||||
|
|
||||||
export default {state, mutations, getters, actions};
|
export default { state, mutations, getters, actions }
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="social__wrapper">
|
<div class="social__wrapper">
|
||||||
<profile-info :uid="uid"></profile-info>
|
<profile-info :uid="uid" />
|
||||||
<div class="social__container">
|
<div class="social__container">
|
||||||
<router-view name="details"></router-view>
|
<router-view name="details" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -106,48 +106,51 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
|
PopoverMenu,
|
||||||
|
AppNavigation,
|
||||||
|
Multiselect,
|
||||||
|
Avatar
|
||||||
|
} from 'nextcloud-vue'
|
||||||
|
import TimelineEntry from './../components/TimelineEntry'
|
||||||
|
import ProfileInfo from './../components/ProfileInfo'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Profile',
|
||||||
|
components: {
|
||||||
PopoverMenu,
|
PopoverMenu,
|
||||||
AppNavigation,
|
AppNavigation,
|
||||||
|
TimelineEntry,
|
||||||
Multiselect,
|
Multiselect,
|
||||||
Avatar
|
Avatar,
|
||||||
} from 'nextcloud-vue';
|
ProfileInfo
|
||||||
import TimelineEntry from './../components/TimelineEntry';
|
},
|
||||||
import ProfileInfo from './../components/ProfileInfo';
|
data: function() {
|
||||||
|
return {
|
||||||
export default {
|
state: [],
|
||||||
name: 'Profile',
|
uid: null
|
||||||
components: {
|
|
||||||
PopoverMenu, AppNavigation, TimelineEntry, Multiselect, Avatar,
|
|
||||||
ProfileInfo
|
|
||||||
},
|
|
||||||
beforeMount() {
|
|
||||||
this.uid = this.$route.params.account;
|
|
||||||
this.$store.dispatch('fetchAccountInfo', this.uid);
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
state: [],
|
|
||||||
uid: null,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
serverData: function() {
|
|
||||||
return this.$store.getters.getServerData;
|
|
||||||
},
|
|
||||||
currentUser: function() {
|
|
||||||
return OC.getCurrentUser();
|
|
||||||
},
|
|
||||||
socialId: function() {
|
|
||||||
return '@' + OC.getCurrentUser().uid + '@' + OC.getHost();
|
|
||||||
},
|
|
||||||
timeline: function() {
|
|
||||||
return this.$store.getters.getTimeline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
serverData: function() {
|
||||||
|
return this.$store.getters.getServerData
|
||||||
|
},
|
||||||
|
currentUser: function() {
|
||||||
|
return OC.getCurrentUser()
|
||||||
|
},
|
||||||
|
socialId: function() {
|
||||||
|
return '@' + OC.getCurrentUser().uid + '@' + OC.getHost()
|
||||||
|
},
|
||||||
|
timeline: function() {
|
||||||
|
return this.$store.getters.getTimeline
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeMount() {
|
||||||
|
this.uid = this.$route.params.account
|
||||||
|
this.$store.dispatch('fetchAccountInfo', this.uid)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -35,19 +35,18 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TimelineEntry from './../components/TimelineEntry';
|
import TimelineEntry from './../components/TimelineEntry'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ProfileFollowers',
|
name: 'ProfileFollowers',
|
||||||
components: {
|
components: {
|
||||||
TimelineEntry,
|
TimelineEntry
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
timeline: function() {
|
timeline: function() {
|
||||||
return this.$store.getters.getTimeline;
|
return this.$store.getters.getTimeline
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="social__timeline">
|
<div class="social__timeline">
|
||||||
<timeline-entry v-for="entry in timeline" :item="entry"></timeline-entry>
|
<timeline-entry v-for="entry in timeline" :item="entry" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -33,19 +33,18 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TimelineEntry from './../components/TimelineEntry';
|
import TimelineEntry from './../components/TimelineEntry'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ProfileTimeline',
|
name: 'ProfileTimeline',
|
||||||
components: {
|
components: {
|
||||||
TimelineEntry,
|
TimelineEntry
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
timeline: function() {
|
timeline: function() {
|
||||||
return this.$store.getters.getTimeline;
|
return this.$store.getters.getTimeline
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="social__wrapper">
|
<div class="social__wrapper">
|
||||||
<div class="social__container">
|
<div class="social__container">
|
||||||
<div class="social__welcome" v-if="!infoHidden">
|
<div v-if="!infoHidden" class="social__welcome">
|
||||||
<a class="close icon-close" @click="hideInfo()" href="#"><span class="hidden-visually">Close</span></a>
|
<a class="close icon-close" href="#" @click="hideInfo()"><span class="hidden-visually">Close</span></a>
|
||||||
<h3>🎉{{ t('social', 'Nextcloud becomes part of the federated social networks!') }}</h3>
|
<h3>🎉{{ t('social', 'Nextcloud becomes part of the federated social networks!') }}</h3>
|
||||||
<p>
|
<p>
|
||||||
{{ t('social', 'We have automatically created a social account for you. Your social id is the same as the federated cloud id:') }}
|
{{ t('social', 'We have automatically created a social account for you. Your social id is the same as the federated cloud id:') }}
|
||||||
|
@ -12,19 +12,20 @@
|
||||||
<div class="social__timeline">
|
<div class="social__timeline">
|
||||||
<div class="new-post" data-id="">
|
<div class="new-post" data-id="">
|
||||||
<div class="new-post-author">
|
<div class="new-post-author">
|
||||||
<avatar :user="currentUser.uid" :displayName="currentUser.displayName" :size="32" />
|
<avatar :user="currentUser.uid" :display-name="currentUser.displayName" :size="32" />
|
||||||
</div>
|
</div>
|
||||||
<form class="new-post-form">
|
<form class="new-post-form">
|
||||||
<div class="author currentUser">
|
<div class="author currentUser">
|
||||||
{{ currentUser.displayName }}
|
{{ currentUser.displayName }}
|
||||||
<span class="social-id">{{ socialId }}</span>
|
<span class="social-id">{{ socialId }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div contenteditable="true" class="message" placeholder="Share a thought…"></div>
|
<div contenteditable="true" class="message" placeholder="Share a thought…" />
|
||||||
<input class="submit icon-confirm has-tooltip" type="submit" value="" title="" data-original-title="Post">
|
<input class="submit icon-confirm has-tooltip" type="submit" value=""
|
||||||
<div class="submitLoading icon-loading-small hidden"></div>
|
title="" data-original-title="Post">
|
||||||
|
<div class="submitLoading icon-loading-small hidden" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<timeline-entry v-for="entry in timeline" :item="entry"></timeline-entry>
|
<timeline-entry v-for="entry in timeline" :item="entry" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -116,110 +117,108 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
PopoverMenu,
|
PopoverMenu,
|
||||||
AppNavigation,
|
AppNavigation,
|
||||||
Multiselect,
|
Multiselect,
|
||||||
Avatar
|
Avatar
|
||||||
} from 'nextcloud-vue';
|
} from 'nextcloud-vue'
|
||||||
import TimelineEntry from './../components/TimelineEntry';
|
import TimelineEntry from './../components/TimelineEntry'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Timeline',
|
name: 'Timeline',
|
||||||
components: {
|
components: {
|
||||||
PopoverMenu, AppNavigation, TimelineEntry, Multiselect, Avatar
|
PopoverMenu, AppNavigation, TimelineEntry, Multiselect, Avatar
|
||||||
|
},
|
||||||
|
data: function() {
|
||||||
|
return {
|
||||||
|
infoHidden: false,
|
||||||
|
state: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
url: function() {
|
||||||
|
return OC.linkTo('social', 'img/nextcloud.png')
|
||||||
},
|
},
|
||||||
data: function () {
|
currentUser: function() {
|
||||||
return {
|
return OC.getCurrentUser()
|
||||||
infoHidden: false,
|
|
||||||
state: [],
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
beforeMount: function() {
|
socialId: function() {
|
||||||
let example = {
|
return '@' + OC.getCurrentUser().uid + '@' + OC.getHost()
|
||||||
message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n' +
|
|
||||||
'\n' +
|
|
||||||
'Get started right now: https://nextcloud.com/signup',
|
|
||||||
author: 'Nextcloud 📱☁️💻',
|
|
||||||
authorId: '@nextcloud@mastodon.xyz',
|
|
||||||
authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
|
|
||||||
timestamp: '1 day ago'
|
|
||||||
};
|
|
||||||
let data = [];
|
|
||||||
for (let i=0; i<20; i++) {
|
|
||||||
let item = Object.assign({}, example);
|
|
||||||
item.id = i;
|
|
||||||
data.push(item);
|
|
||||||
}
|
|
||||||
console.log(data);
|
|
||||||
this.$store.commit('addToTimeline', data);
|
|
||||||
},
|
},
|
||||||
methods: {
|
timeline: function() {
|
||||||
hideInfo() {
|
return this.$store.getters.getTimeline
|
||||||
this.infoHidden = true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
menu: function() {
|
||||||
url: function() {
|
let defaultCategories = [
|
||||||
return OC.linkTo('social', 'img/nextcloud.png');
|
{
|
||||||
},
|
id: 'social-timeline',
|
||||||
currentUser: function() {
|
classes: [],
|
||||||
return OC.getCurrentUser();
|
href: '#',
|
||||||
},
|
icon: 'icon-category-monitoring',
|
||||||
socialId: function() {
|
text: t('social', 'Timeline')
|
||||||
return '@' + OC.getCurrentUser().uid + '@' + OC.getHost();
|
},
|
||||||
},
|
{
|
||||||
timeline: function() {
|
id: 'social-account',
|
||||||
return this.$store.getters.getTimeline;
|
classes: [],
|
||||||
},
|
href: '#',
|
||||||
menu: function () {
|
icon: 'icon-category-user',
|
||||||
let defaultCategories = [
|
text: t('social', 'Your account')
|
||||||
{
|
},
|
||||||
id: 'social-timeline',
|
{
|
||||||
classes: [],
|
id: 'social-friends',
|
||||||
href: '#',
|
classes: [],
|
||||||
icon: 'icon-category-monitoring',
|
href: '#',
|
||||||
text: t('social', 'Timeline'),
|
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
|
||||||
},
|
},
|
||||||
{
|
text: t('social', 'Direct messages')
|
||||||
id: 'social-account',
|
|
||||||
classes: [],
|
|
||||||
href: '#',
|
|
||||||
icon: 'icon-category-user',
|
|
||||||
text: t('social', 'Your account'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
text: t('social', 'Direct messages'),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
return {
|
|
||||||
items: defaultCategories,
|
|
||||||
loading: false
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
return {
|
||||||
|
items: defaultCategories,
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
beforeMount: function() {
|
||||||
|
let example = {
|
||||||
|
message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n'
|
||||||
|
+ '\n'
|
||||||
|
+ 'Get started right now: https://nextcloud.com/signup',
|
||||||
|
author: 'Nextcloud 📱☁️💻',
|
||||||
|
authorId: '@nextcloud@mastodon.xyz',
|
||||||
|
authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
|
||||||
|
timestamp: '1 day ago'
|
||||||
|
}
|
||||||
|
let data = []
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
let item = Object.assign({}, example)
|
||||||
|
item.id = i
|
||||||
|
data.push(item)
|
||||||
|
}
|
||||||
|
this.$store.commit('addToTimeline', data)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
hideInfo() {
|
||||||
|
this.infoHidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Ładowanie…
Reference in New Issue