move hint inside Timeline component

This commit is contained in:
Xiaofeng An 2019-02-05 15:43:56 -05:00
parent bf642ebab7
commit d2436fb9e5
4 changed files with 52 additions and 56 deletions

View file

@ -4,8 +4,7 @@ const PublicTimeline = {
Timeline Timeline
}, },
computed: { computed: {
timeline () { return this.$store.state.statuses.timelines.public }, timeline () { return this.$store.state.statuses.timelines.public }
currentUser () { return this.$store.state.users.currentUser }
}, },
created () { created () {
this.$store.dispatch('startFetching', 'public') this.$store.dispatch('startFetching', 'public')

View file

@ -1,32 +1,5 @@
<template> <template>
<div> <Timeline :title="$t('nav.public_tl')" v-bind:timeline="timeline" v-bind:timeline-name="'public'"/>
<div v-if="!currentUser" class="login-hint panel panel-default">
<div class="panel-body">
<router-link :to="{ name: 'login' }">
{{ $t("login.hint") }}
</router-link>
</div>
</div>
<Timeline :title="$t('nav.public_tl')" v-bind:timeline="timeline" v-bind:timeline-name="'public'"/>
</div>
</template> </template>
<script src="./public_timeline.js"></script> <script src="./public_timeline.js"></script>
<style lang="scss">
@import '../../_variables.scss';
.login-hint {
text-align: center;
@media all and (min-width: 801px) {
display: none;
}
a {
display: inline-block;
padding: 1em 0px;
width: 100%;
}
}
</style>

View file

@ -39,7 +39,8 @@ const Timeline = {
body: ['timeline-body'].concat(!this.embedded ? ['panel-body'] : []), body: ['timeline-body'].concat(!this.embedded ? ['panel-body'] : []),
footer: ['timeline-footer'].concat(!this.embedded ? ['panel-footer'] : []) footer: ['timeline-footer'].concat(!this.embedded ? ['panel-footer'] : [])
} }
} },
currentUser () { return this.$store.state.users.currentUser }
}, },
components: { components: {
Status, Status,

View file

@ -1,33 +1,42 @@
<template> <template>
<div :class="classes.root"> <div>
<div :class="classes.header"> <div v-if="!currentUser" class="login-hint panel panel-default">
<div class="title"> <div class="panel-body">
{{title}} <router-link :to="{ name: 'login' }">
</div> {{ $t("login.hint") }}
<div @click.prevent class="loadmore-error alert error" v-if="timelineError"> </router-link>
{{$t('timeline.error_fetching')}}
</div>
<button @click.prevent="showNewStatuses" class="loadmore-button" v-if="timeline.newStatusCount > 0 && !timelineError">
{{$t('timeline.show_new')}}{{newStatusCountStr}}
</button>
<div @click.prevent class="loadmore-text faint" v-if="!timeline.newStatusCount > 0 && !timelineError">
{{$t('timeline.up_to_date')}}
</div> </div>
</div> </div>
<div :class="classes.body"> <div :class="classes.root">
<div class="timeline"> <div :class="classes.header">
<status-or-conversation v-for="status in timeline.visibleStatuses" :key="status.id" v-bind:statusoid="status" class="status-fadein"></status-or-conversation> <div class="title">
{{title}}
</div>
<div @click.prevent class="loadmore-error alert error" v-if="timelineError">
{{$t('timeline.error_fetching')}}
</div>
<button @click.prevent="showNewStatuses" class="loadmore-button" v-if="timeline.newStatusCount > 0 && !timelineError">
{{$t('timeline.show_new')}}{{newStatusCountStr}}
</button>
<div @click.prevent class="loadmore-text faint" v-if="!timeline.newStatusCount > 0 && !timelineError">
{{$t('timeline.up_to_date')}}
</div>
</div> </div>
</div> <div :class="classes.body">
<div :class="classes.footer"> <div class="timeline">
<div v-if="bottomedOut" class="new-status-notification text-center panel-footer faint"> <status-or-conversation v-for="status in timeline.visibleStatuses" :key="status.id" v-bind:statusoid="status" class="status-fadein"></status-or-conversation>
{{$t('timeline.no_more_statuses')}} </div>
</div> </div>
<a v-else-if="!timeline.loading" href="#" v-on:click.prevent='fetchOlderStatuses()'> <div :class="classes.footer">
<div class="new-status-notification text-center panel-footer">{{$t('timeline.load_older')}}</div> <div v-if="bottomedOut" class="new-status-notification text-center panel-footer faint">
</a> {{$t('timeline.no_more_statuses')}}
<div v-else class="new-status-notification text-center panel-footer"> </div>
<i class="icon-spin3 animate-spin"/> <a v-else-if="!timeline.loading" href="#" v-on:click.prevent='fetchOlderStatuses()'>
<div class="new-status-notification text-center panel-footer">{{$t('timeline.load_older')}}</div>
</a>
<div v-else class="new-status-notification text-center panel-footer">
<i class="icon-spin3 animate-spin"/>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -56,4 +65,18 @@
background-color: $fallback--fg; background-color: $fallback--fg;
background-color: var(--panel, $fallback--fg); background-color: var(--panel, $fallback--fg);
} }
.login-hint {
text-align: center;
@media all and (min-width: 801px) {
display: none;
}
a {
display: inline-block;
padding: 1em 0px;
width: 100%;
}
}
</style> </style>