Multiple improvements
This commit is contained in:
parent
132f8ba934
commit
1a60476ad6
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="this.className">
|
<div>
|
||||||
<div class="channels--channel" v-for="channel in channels" :key="channel.uid">
|
<div class="channels--channel" v-for="channel in channels" :key="channel.uid">
|
||||||
<slot :channel="channel"></slot>
|
<slot :channel="channel"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: "Channels",
|
name: "Channels",
|
||||||
components: {ChannelCreator},
|
components: {ChannelCreator},
|
||||||
props: ['className', 'channels'],
|
props: ['channels'],
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
this.$store.dispatch('openChannelCreator')
|
this.$store.dispatch('openChannelCreator')
|
||||||
|
|
@ -22,4 +22,5 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
</style>
|
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="level" v-if="hasHiddenContent">
|
<div class="level">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
<button class="is-link" @click.prevent="toggleHiddenContent">Read more</button>
|
<button class="is-link" v-if="hasHiddenContent" @click.prevent="toggleHiddenContent">Read more</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
<small>
|
<small>
|
||||||
|
|
@ -133,6 +133,7 @@ export default {
|
||||||
destinations: [],
|
destinations: [],
|
||||||
selectedDestinations: [],
|
selectedDestinations: [],
|
||||||
categories: [],
|
categories: [],
|
||||||
|
hasHiddenContent: true,
|
||||||
hiddenContentVisible: false
|
hiddenContentVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -215,23 +216,18 @@ export default {
|
||||||
},
|
},
|
||||||
toggleHiddenContent() {
|
toggleHiddenContent() {
|
||||||
this.hiddenContentVisible = !this.hiddenContentVisible
|
this.hiddenContentVisible = !this.hiddenContentVisible
|
||||||
|
const el = this.$refs['content-container']
|
||||||
|
el.scrollIntoView(true)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.showFooterButtons = true
|
this.showFooterButtons = true
|
||||||
|
const el = this.$refs['content-container']
|
||||||
|
this.hasHiddenContent = el.scrollHeight > el.clientHeight
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
hasHiddenContent () {
|
|
||||||
const el = this.$refs['content-container']
|
|
||||||
if (!el) {
|
|
||||||
// eslint-disable-next-line
|
|
||||||
console.log('ref content-container not found')
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return el.scrollHeight > el.clientHeight
|
|
||||||
},
|
|
||||||
currentItem() {
|
currentItem() {
|
||||||
if (this.isRef) {
|
if (this.isRef) {
|
||||||
return this.innerRef
|
return this.innerRef
|
||||||
|
|
@ -363,6 +359,19 @@ export default {
|
||||||
}
|
}
|
||||||
return this.currentItem.author.photo
|
return this.currentItem.author.photo
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
item(newItem, oldItem) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const el = this.$refs['content-container']
|
||||||
|
if (!el) {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
console.log('ref content-container not found')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.hasHiddenContent = el.scrollHeight > el.clientHeight
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
13
src/store.js
13
src/store.js
|
|
@ -91,13 +91,10 @@ export default new Vuex.Store({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
state.eventSource.addEventListener('new item', evt => {
|
state.eventSource.addEventListener('new item', evt => {
|
||||||
// eslint-disable-next-line
|
|
||||||
console.log(evt)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let newItemMsg = JSON.parse(evt.data)
|
let newItemMsg = JSON.parse(evt.data)
|
||||||
if (state.channel.uid === newItemMsg.channel) {
|
if (state.channel.uid === newItemMsg.channel) {
|
||||||
state.timeline.items = [...state.timeline.items, newItemMsg.item]
|
state.timeline.items = [newItemMsg.item, ...state.timeline.items]
|
||||||
}
|
}
|
||||||
state.globalTimeline.items = _.takeRight([...state.globalTimeline.items, newItemMsg.item], 10)
|
state.globalTimeline.items = _.takeRight([...state.globalTimeline.items, newItemMsg.item], 10)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -205,7 +202,7 @@ export default new Vuex.Store({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
configQuery: function (key) {
|
configQuery ({commit}, key) {
|
||||||
let micropub = new Micropub({
|
let micropub = new Micropub({
|
||||||
token: this.state.access_token,
|
token: this.state.access_token,
|
||||||
micropubEndpoint: this.state.micropubEndpoint
|
micropubEndpoint: this.state.micropubEndpoint
|
||||||
|
|
@ -213,10 +210,10 @@ export default new Vuex.Store({
|
||||||
return micropub.query(key)
|
return micropub.query(key)
|
||||||
},
|
},
|
||||||
fetchSyndicationTargets() {
|
fetchSyndicationTargets() {
|
||||||
return this.configQuery('syndicate-to')
|
return this.dispatch('configQuery', 'syndicate-to')
|
||||||
},
|
},
|
||||||
fetchDestinations() {
|
fetchDestinations() {
|
||||||
return this.configQuery('destination');
|
return this.dispatch('configQuery', 'destination')
|
||||||
},
|
},
|
||||||
micropubPost(_, mf2post) {
|
micropubPost(_, mf2post) {
|
||||||
let micropub = new Micropub({
|
let micropub = new Micropub({
|
||||||
|
|
@ -226,7 +223,7 @@ export default new Vuex.Store({
|
||||||
return micropub.create(mf2post)
|
return micropub.create(mf2post)
|
||||||
},
|
},
|
||||||
micropubLikeOf(_, url) {
|
micropubLikeOf(_, url) {
|
||||||
this.dispatch({
|
this.dispatch('micropubPost', {
|
||||||
'type': ['h-entry'],
|
'type': ['h-entry'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'like-of': [url]
|
'like-of': [url]
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,23 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="home columns">
|
<div class="home columns">
|
||||||
<Channels class="channels column" :channels="this.$store.state.channels">
|
<div class="column" style="padding-top: 20px">
|
||||||
<div slot-scope="{ channel }">
|
<button class="channels-toggle button" type="button" @click="showChannels">Channels</button>
|
||||||
<Channel :channel="channel" @channel-selected="selectChannel"></Channel>
|
|
||||||
</div>
|
<Channels :class="channelsClass" :channels="this.$store.state.channels">
|
||||||
</Channels>
|
<div slot-scope="{ channel }">
|
||||||
|
<Channel :channel="channel" @channel-selected="selectChannel"></Channel>
|
||||||
|
</div>
|
||||||
|
</Channels>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="timeline column is-three-fifths">
|
<div class="timeline column is-three-fifths">
|
||||||
<div class="level">
|
<div class="level">
|
||||||
<div class="level-left">
|
<div class="level-left">
|
||||||
<h1 class="title is-5">{{ channel.name }}</h1>
|
<h1 class="title is-5">{{ channel.name }}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right timeline-buttons">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
<button class="button" @click.prevent="openPost">New Post</button>
|
<button class="button" @click.prevent="openPost">New Post</button>
|
||||||
</div>
|
|
||||||
<div class="level-item">
|
|
||||||
<button class="button" @click.prevent="openFeedFollower('')">Add feed</button>
|
<button class="button" @click.prevent="openFeedFollower('')">Add feed</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -59,7 +61,8 @@
|
||||||
return {
|
return {
|
||||||
feedFollowerIsOpen: false,
|
feedFollowerIsOpen: false,
|
||||||
feedFollowerQuery: '',
|
feedFollowerQuery: '',
|
||||||
showPost: false
|
showPost: false,
|
||||||
|
channelsVisible: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -69,6 +72,12 @@
|
||||||
},
|
},
|
||||||
channel() {
|
channel() {
|
||||||
return this.$store.state.channel
|
return this.$store.state.channel
|
||||||
|
},
|
||||||
|
channelsClass () {
|
||||||
|
return {
|
||||||
|
'channels-open': this.channelsVisible,
|
||||||
|
'channels': true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -94,6 +103,9 @@
|
||||||
},
|
},
|
||||||
openPost() {
|
openPost() {
|
||||||
this.showPost = true
|
this.showPost = true
|
||||||
|
},
|
||||||
|
showChannels () {
|
||||||
|
this.channelsVisible = !this.channelsVisible
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -119,6 +131,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.home {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.timeline {
|
.timeline {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
|
|
@ -131,5 +147,28 @@
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
.channels-open {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-buttons {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-buttons .level-item .button + .button {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 600px) {
|
||||||
|
.channels-toggle {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.channels {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user