2018-02-15 17:50:19 +09:00
|
|
|
<template>
|
2018-02-24 02:46:09 +09:00
|
|
|
<mk-ui>
|
2018-04-26 14:01:41 +09:00
|
|
|
<span slot="header" @click="showNav = true">
|
2018-09-19 14:18:34 +09:00
|
|
|
<span :class="$style.title">
|
2018-11-09 03:44:35 +09:00
|
|
|
<span v-if="src == 'home'"><fa icon="home"/>{{ $t('home') }}</span>
|
|
|
|
<span v-if="src == 'local'"><fa :icon="['far', 'comments']"/>{{ $t('local') }}</span>
|
|
|
|
<span v-if="src == 'hybrid'"><fa icon="share-alt"/>{{ $t('hybrid') }}</span>
|
|
|
|
<span v-if="src == 'global'"><fa icon="globe"/>{{ $t('global') }}</span>
|
|
|
|
<span v-if="src == 'mentions'"><fa icon="at"/>{{ $t('mentions') }}</span>
|
|
|
|
<span v-if="src == 'messages'"><fa :icon="['far', 'envelope']"/>{{ $t('messages') }}</span>
|
2018-11-06 01:40:11 +09:00
|
|
|
<span v-if="src == 'list'"><fa icon="list"/>{{ list.title }}</span>
|
|
|
|
<span v-if="src == 'tag'"><fa icon="hashtag"/>{{ tagTl.title }}</span>
|
2018-04-26 14:01:41 +09:00
|
|
|
</span>
|
2018-02-24 02:46:09 +09:00
|
|
|
<span style="margin-left:8px">
|
2018-11-06 01:40:11 +09:00
|
|
|
<template v-if="!showNav"><fa icon="angle-down"/></template>
|
|
|
|
<template v-else><fa icon="angle-up"/></template>
|
2018-02-24 02:46:09 +09:00
|
|
|
</span>
|
2018-11-06 01:40:11 +09:00
|
|
|
<i :class="$style.badge" v-if="$store.state.i.hasUnreadMentions || $store.state.i.hasUnreadSpecifiedNotes"><fa icon="circle"/></i>
|
2018-02-24 02:46:09 +09:00
|
|
|
</span>
|
2018-04-26 14:01:41 +09:00
|
|
|
|
2018-02-24 02:46:09 +09:00
|
|
|
<template slot="func">
|
2018-11-06 01:40:11 +09:00
|
|
|
<button @click="fn"><fa icon="pencil-alt"/></button>
|
2018-02-24 02:46:09 +09:00
|
|
|
</template>
|
2018-04-26 14:01:41 +09:00
|
|
|
|
2018-09-28 14:26:20 +09:00
|
|
|
<main>
|
2018-04-26 14:01:41 +09:00
|
|
|
<div class="nav" v-if="showNav">
|
|
|
|
<div class="bg" @click="showNav = false"></div>
|
2018-09-18 02:14:12 +09:00
|
|
|
<div class="pointer"></div>
|
2018-04-26 14:01:41 +09:00
|
|
|
<div class="body">
|
2018-04-26 14:38:37 +09:00
|
|
|
<div>
|
2018-11-09 03:44:35 +09:00
|
|
|
<span :data-active="src == 'home'" @click="src = 'home'"><fa icon="home"/> {{ $t('home') }}</span>
|
|
|
|
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline"><fa :icon="['far', 'comments']"/> {{ $t('local') }}</span>
|
|
|
|
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('hybrid') }}</span>
|
|
|
|
<span :data-active="src == 'global'" @click="src = 'global'"><fa icon="globe"/> {{ $t('global') }}</span>
|
2018-09-18 02:14:12 +09:00
|
|
|
<div class="hr"></div>
|
2018-11-09 03:44:35 +09:00
|
|
|
<span :data-active="src == 'mentions'" @click="src = 'mentions'"><fa icon="at"/> {{ $t('mentions') }}<i class="badge" v-if="$store.state.i.hasUnreadMentions"><fa icon="circle"/></i></span>
|
|
|
|
<span :data-active="src == 'messages'" @click="src = 'messages'"><fa :icon="['far', 'envelope']"/> {{ $t('messages') }}<i class="badge" v-if="$store.state.i.hasUnreadSpecifiedNotes"><fa icon="circle"/></i></span>
|
2018-04-26 14:38:37 +09:00
|
|
|
<template v-if="lists">
|
2018-09-18 13:12:41 +09:00
|
|
|
<div class="hr" v-if="lists.length > 0"></div>
|
2018-11-06 01:40:11 +09:00
|
|
|
<span v-for="l in lists" :data-active="src == 'list' && list == l" @click="src = 'list'; list = l" :key="l.id"><fa icon="list"/> {{ l.title }}</span>
|
2018-04-26 14:38:37 +09:00
|
|
|
</template>
|
2018-09-18 02:14:12 +09:00
|
|
|
<div class="hr" v-if="$store.state.settings.tagTimelines && $store.state.settings.tagTimelines.length > 0"></div>
|
2018-11-06 01:40:11 +09:00
|
|
|
<span v-for="tl in $store.state.settings.tagTimelines" :data-active="src == 'tag' && tagTl == tl" @click="src = 'tag'; tagTl = tl" :key="tl.id"><fa icon="hashtag"/> {{ tl.title }}</span>
|
2018-04-26 14:38:37 +09:00
|
|
|
</div>
|
2018-04-26 14:01:41 +09:00
|
|
|
</div>
|
2018-02-24 02:46:09 +09:00
|
|
|
</div>
|
2018-04-26 14:01:41 +09:00
|
|
|
|
|
|
|
<div class="tl">
|
2018-05-27 00:18:44 +09:00
|
|
|
<x-tl v-if="src == 'home'" ref="tl" key="home" src="home"/>
|
2018-04-26 14:01:41 +09:00
|
|
|
<x-tl v-if="src == 'local'" ref="tl" key="local" src="local"/>
|
2018-07-11 13:43:09 +09:00
|
|
|
<x-tl v-if="src == 'hybrid'" ref="tl" key="hybrid" src="hybrid"/>
|
2018-04-26 14:01:41 +09:00
|
|
|
<x-tl v-if="src == 'global'" ref="tl" key="global" src="global"/>
|
2018-09-16 22:48:57 +09:00
|
|
|
<x-tl v-if="src == 'mentions'" ref="tl" key="mentions" src="mentions"/>
|
2018-09-18 02:14:12 +09:00
|
|
|
<x-tl v-if="src == 'messages'" ref="tl" key="messages" src="messages"/>
|
2018-09-17 09:00:20 +09:00
|
|
|
<x-tl v-if="src == 'tag'" ref="tl" key="tag" src="tag" :tag-tl="tagTl"/>
|
2018-05-27 00:18:44 +09:00
|
|
|
<mk-user-list-timeline v-if="src == 'list'" ref="tl" :key="list.id" :list="list"/>
|
2018-02-24 02:46:09 +09:00
|
|
|
</div>
|
|
|
|
</main>
|
2018-02-15 17:50:19 +09:00
|
|
|
</mk-ui>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-15 17:50:19 +09:00
|
|
|
import Progress from '../../../common/scripts/loading';
|
2018-04-26 14:01:41 +09:00
|
|
|
import XTl from './home.timeline.vue';
|
2018-02-15 17:50:19 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-09 03:44:35 +09:00
|
|
|
i18n: i18n('mobile/views/pages/home.vue'),
|
|
|
|
|
2018-02-24 02:46:09 +09:00
|
|
|
components: {
|
2018-04-26 14:01:41 +09:00
|
|
|
XTl
|
2018-02-24 02:46:09 +09:00
|
|
|
},
|
2018-04-26 14:01:41 +09:00
|
|
|
|
2018-02-15 17:50:19 +09:00
|
|
|
data() {
|
|
|
|
return {
|
2018-04-26 14:01:41 +09:00
|
|
|
src: 'home',
|
|
|
|
list: null,
|
2018-04-26 14:38:37 +09:00
|
|
|
lists: null,
|
2018-09-17 09:00:20 +09:00
|
|
|
tagTl: null,
|
2018-09-12 02:48:19 +09:00
|
|
|
showNav: false,
|
|
|
|
enableLocalTimeline: false
|
2018-02-15 17:50:19 +09:00
|
|
|
};
|
|
|
|
},
|
2018-02-24 03:03:26 +09:00
|
|
|
|
2018-04-26 14:38:37 +09:00
|
|
|
watch: {
|
|
|
|
src() {
|
|
|
|
this.showNav = false;
|
2018-05-27 02:56:54 +09:00
|
|
|
this.saveSrc();
|
2018-05-27 00:18:44 +09:00
|
|
|
},
|
|
|
|
|
2018-09-17 09:00:20 +09:00
|
|
|
list(x) {
|
2018-05-27 00:18:44 +09:00
|
|
|
this.showNav = false;
|
2018-05-27 02:56:54 +09:00
|
|
|
this.saveSrc();
|
2018-09-17 09:00:20 +09:00
|
|
|
if (x != null) this.tagTl = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
tagTl(x) {
|
|
|
|
this.showNav = false;
|
|
|
|
this.saveSrc();
|
|
|
|
if (x != null) this.list = null;
|
2018-04-26 14:38:37 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
showNav(v) {
|
|
|
|
if (v && this.lists === null) {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('users/lists/list').then(lists => {
|
2018-04-26 14:38:37 +09:00
|
|
|
this.lists = lists;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-05-06 14:35:28 +09:00
|
|
|
created() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.getMeta().then(meta => {
|
2018-09-12 02:48:19 +09:00
|
|
|
this.enableLocalTimeline = !meta.disableLocalTimeline;
|
|
|
|
});
|
|
|
|
|
2018-05-27 00:18:44 +09:00
|
|
|
if (this.$store.state.device.tl) {
|
|
|
|
this.src = this.$store.state.device.tl.src;
|
|
|
|
if (this.src == 'list') {
|
|
|
|
this.list = this.$store.state.device.tl.arg;
|
2018-09-17 09:00:20 +09:00
|
|
|
} else if (this.src == 'tag') {
|
|
|
|
this.tagTl = this.$store.state.device.tl.arg;
|
2018-05-27 00:18:44 +09:00
|
|
|
}
|
2018-05-27 13:49:09 +09:00
|
|
|
} else if (this.$store.state.i.followingCount == 0) {
|
2018-07-14 11:58:21 +09:00
|
|
|
this.src = 'hybrid';
|
2018-05-06 14:35:28 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-02-15 17:50:19 +09:00
|
|
|
mounted() {
|
2018-11-09 08:13:34 +09:00
|
|
|
document.title = this.$root.os.instanceName;
|
2018-02-15 17:50:19 +09:00
|
|
|
|
|
|
|
Progress.start();
|
2018-05-27 00:18:44 +09:00
|
|
|
|
|
|
|
(this.$refs.tl as any).$once('loaded', () => {
|
|
|
|
Progress.done();
|
|
|
|
});
|
2018-02-15 17:50:19 +09:00
|
|
|
},
|
2018-04-26 14:01:41 +09:00
|
|
|
|
2018-02-15 17:50:19 +09:00
|
|
|
methods: {
|
|
|
|
fn() {
|
2018-09-01 20:47:49 +09:00
|
|
|
(this as any).apis.post();
|
2018-02-15 17:50:19 +09:00
|
|
|
},
|
2018-04-26 14:01:41 +09:00
|
|
|
|
2018-05-27 02:56:54 +09:00
|
|
|
saveSrc() {
|
|
|
|
this.$store.commit('device/setTl', {
|
|
|
|
src: this.src,
|
2018-09-17 09:00:20 +09:00
|
|
|
arg: this.src == 'list' ? this.list : this.tagTl
|
2018-05-27 02:56:54 +09:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-02-24 02:46:09 +09:00
|
|
|
warp() {
|
|
|
|
|
2018-02-15 17:50:19 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2018-02-24 02:46:09 +09:00
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-28 11:49:32 +09:00
|
|
|
main
|
2018-04-26 14:01:41 +09:00
|
|
|
> .nav
|
2018-09-18 02:14:12 +09:00
|
|
|
> .pointer
|
|
|
|
position fixed
|
|
|
|
z-index 10002
|
|
|
|
top 56px
|
|
|
|
left 0
|
|
|
|
right 0
|
|
|
|
|
|
|
|
$size = 16px
|
|
|
|
|
|
|
|
&:after
|
|
|
|
content ""
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
top -($size * 2)
|
|
|
|
left s('calc(50% - %s)', $size)
|
|
|
|
border-top solid $size transparent
|
|
|
|
border-left solid $size transparent
|
|
|
|
border-right solid $size transparent
|
2018-09-28 11:49:32 +09:00
|
|
|
border-bottom solid $size var(--popupBg)
|
2018-09-18 02:14:12 +09:00
|
|
|
|
2018-04-26 14:01:41 +09:00
|
|
|
> .bg
|
|
|
|
position fixed
|
|
|
|
z-index 10000
|
|
|
|
top 0
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
height 100%
|
|
|
|
background rgba(#000, 0.5)
|
|
|
|
|
|
|
|
> .body
|
|
|
|
position fixed
|
|
|
|
z-index 10001
|
2018-04-26 14:38:37 +09:00
|
|
|
top 56px
|
2018-04-26 14:01:41 +09:00
|
|
|
left 0
|
2018-04-26 14:38:37 +09:00
|
|
|
right 0
|
|
|
|
width 300px
|
2018-09-18 02:14:12 +09:00
|
|
|
max-height calc(100% - 70px)
|
2018-04-26 14:38:37 +09:00
|
|
|
margin 0 auto
|
2018-09-18 02:14:12 +09:00
|
|
|
overflow auto
|
|
|
|
-webkit-overflow-scrolling touch
|
2018-09-28 11:49:32 +09:00
|
|
|
background var(--popupBg)
|
2018-04-26 14:01:41 +09:00
|
|
|
border-radius 8px
|
2018-04-29 08:51:17 +09:00
|
|
|
box-shadow 0 0 16px rgba(#000, 0.1)
|
2018-04-26 14:38:37 +09:00
|
|
|
|
|
|
|
> div
|
|
|
|
padding 8px 0
|
|
|
|
|
2018-09-18 02:14:12 +09:00
|
|
|
> .hr
|
|
|
|
margin 8px 0
|
2018-09-28 11:49:32 +09:00
|
|
|
border-top solid 1px var(--faceDivider)
|
2018-09-18 02:14:12 +09:00
|
|
|
|
|
|
|
> *:not(.hr)
|
2018-04-26 14:38:37 +09:00
|
|
|
display block
|
|
|
|
padding 8px 16px
|
2018-09-28 11:49:32 +09:00
|
|
|
color var(--text)
|
2018-04-26 14:38:37 +09:00
|
|
|
|
|
|
|
&[data-active]
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primaryForeground)
|
|
|
|
background var(--primary)
|
2018-04-26 14:38:37 +09:00
|
|
|
|
|
|
|
&:not([data-active]):hover
|
2018-09-28 11:49:32 +09:00
|
|
|
background var(--mobileHomeTlItemHover)
|
2018-02-24 02:46:09 +09:00
|
|
|
|
2018-09-19 14:18:34 +09:00
|
|
|
> .badge
|
|
|
|
margin-left 6px
|
|
|
|
font-size 10px
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primary)
|
2018-09-19 14:18:34 +09:00
|
|
|
|
2018-02-24 02:46:09 +09:00
|
|
|
> .tl
|
2018-04-27 21:06:28 +09:00
|
|
|
max-width 680px
|
2018-02-24 02:46:09 +09:00
|
|
|
margin 0 auto
|
2018-04-26 14:01:41 +09:00
|
|
|
padding 8px
|
2018-02-24 02:46:09 +09:00
|
|
|
|
2018-02-24 03:30:13 +09:00
|
|
|
@media (min-width 500px)
|
2018-04-26 14:01:41 +09:00
|
|
|
padding 16px
|
2018-02-24 02:46:09 +09:00
|
|
|
|
2018-04-27 21:06:28 +09:00
|
|
|
@media (min-width 600px)
|
|
|
|
padding 32px
|
|
|
|
|
2018-02-24 02:46:09 +09:00
|
|
|
</style>
|
2018-09-19 14:18:34 +09:00
|
|
|
|
|
|
|
<style lang="stylus" module>
|
|
|
|
.title
|
2018-11-06 01:40:11 +09:00
|
|
|
[data-icon]
|
2018-09-19 14:18:34 +09:00
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
.badge
|
|
|
|
margin-left 6px
|
|
|
|
font-size 10px
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primary)
|
2018-09-19 14:18:34 +09:00
|
|
|
vertical-align middle
|
|
|
|
|
|
|
|
</style>
|