forked from AkkomaGang/akkoma-fe
New status showing.
This commit is contained in:
parent
534f2e8195
commit
eab256a7e5
5 changed files with 23 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
||||||
<div class="timeline panel panel-default">
|
<div class="timeline panel panel-default">
|
||||||
<div class="panel-heading">Friends Timeline</div>
|
<div class="panel-heading">Friends Timeline</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<Timeline v-bind:timeline="timeline" />
|
<Timeline v-bind:timeline="timeline" v-bind:timeline-name="'friends'"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="timeline panel panel-default">
|
<div class="timeline panel panel-default">
|
||||||
<div class="panel-heading">Public Timeline</div>
|
<div class="panel-heading">Public Timeline</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<Timeline v-bind:timeline="timeline" />
|
<Timeline v-bind:timeline="timeline" v-bind:timeline-name="'public'"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,10 +2,16 @@ import Status from '../status/status.vue'
|
||||||
|
|
||||||
const Timeline = {
|
const Timeline = {
|
||||||
props: [
|
props: [
|
||||||
'timeline'
|
'timeline',
|
||||||
|
'timelineName'
|
||||||
],
|
],
|
||||||
components: {
|
components: {
|
||||||
Status
|
Status
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showNewStatuses () {
|
||||||
|
this.$store.commit('showNewStatuses', { timeline: this.timelineName })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="timeline">
|
<div class="timeline">
|
||||||
|
<a href="#" v-on:click.prevent='showNewStatuses()' v-if="timeline.newStatusCount > 0">
|
||||||
|
<div class="new-status-notification">
|
||||||
|
<p class="text-center" >
|
||||||
|
{{timeline.newStatusCount}} new statuses
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
<status v-for="status in timeline.visibleStatuses" v-bind:status="status"></status>
|
<status v-for="status in timeline.visibleStatuses" v-bind:status="status"></status>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { last, intersectionBy, sortBy, unionBy, toInteger, groupBy, differenceBy, each, find } from 'lodash'
|
import { slice, last, intersectionBy, sortBy, unionBy, toInteger, groupBy, differenceBy, each, find } from 'lodash'
|
||||||
// import moment from 'moment'
|
// import moment from 'moment'
|
||||||
|
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
|
@ -93,6 +93,12 @@ const statuses = {
|
||||||
addNewStatuses (state, { statuses, showImmediately = false, timeline }) {
|
addNewStatuses (state, { statuses, showImmediately = false, timeline }) {
|
||||||
state.timelines[timeline] = addStatusesToTimeline(statuses, showImmediately, state.timelines[timeline])
|
state.timelines[timeline] = addStatusesToTimeline(statuses, showImmediately, state.timelines[timeline])
|
||||||
state.allStatuses = unionBy(state.timelines[timeline].statuses, state.allStatuses.id)
|
state.allStatuses = unionBy(state.timelines[timeline].statuses, state.allStatuses.id)
|
||||||
|
},
|
||||||
|
showNewStatuses (state, { timeline }) {
|
||||||
|
const oldTimeline = (state.timelines[timeline])
|
||||||
|
|
||||||
|
oldTimeline.newStatusCount = 0
|
||||||
|
oldTimeline.visibleStatuses = slice(oldTimeline.statuses, 0, 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue