1
0
Fork 0
This commit is contained in:
syuilo 2018-07-11 13:43:09 +09:00
parent eb392b1251
commit 555501d534
7 changed files with 58 additions and 36 deletions
src/client/app

View file

@ -43,19 +43,21 @@ export default Vue.extend({
}, },
stream(): any { stream(): any {
return this.src == 'home' switch (this.src) {
? (this as any).os.stream case 'home': return (this as any).os.stream;
: this.src == 'local' case 'local': return (this as any).os.streams.localTimelineStream;
? (this as any).os.streams.localTimelineStream case 'hybrid': return (this as any).os.streams.hybridTimelineStream;
: (this as any).os.streams.globalTimelineStream; case 'global': return (this as any).os.streams.globalTimelineStream;
}
}, },
endpoint(): string { endpoint(): string {
return this.src == 'home' switch (this.src) {
? 'notes/timeline' case 'home': return 'notes/timeline';
: this.src == 'local' case 'local': return 'notes/local-timeline';
? 'notes/local-timeline' case 'hybrid': return 'notes/hybrid-timeline';
: 'notes/global-timeline'; case 'global': return 'notes/global-timeline';
}
}, },
canFetchMore(): boolean { canFetchMore(): boolean {

View file

@ -3,12 +3,14 @@
<header> <header>
<span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span> <span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span>
<span :data-active="src == 'local'" @click="src = 'local'">%fa:R comments% %i18n:@local%</span> <span :data-active="src == 'local'" @click="src = 'local'">%fa:R comments% %i18n:@local%</span>
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'">%fa:share-alt% %i18n:@hybrid%</span>
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span> <span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list">%fa:list% {{ list.title }}</span> <span :data-active="src == 'list'" @click="src = 'list'" v-if="list">%fa:list% {{ list.title }}</span>
<button @click="chooseList" title="%i18n:@list%">%fa:list%</button> <button @click="chooseList" title="%i18n:@list%">%fa:list%</button>
</header> </header>
<x-core v-if="src == 'home'" ref="tl" key="home" src="home"/> <x-core v-if="src == 'home'" ref="tl" key="home" src="home"/>
<x-core v-if="src == 'local'" ref="tl" key="local" src="local"/> <x-core v-if="src == 'local'" ref="tl" key="local" src="local"/>
<x-core v-if="src == 'hybrid'" ref="tl" key="hybrid" src="hybrid"/>
<x-core v-if="src == 'global'" ref="tl" key="global" src="global"/> <x-core v-if="src == 'global'" ref="tl" key="global" src="global"/>
<mk-user-list-timeline v-if="src == 'list'" ref="tl" :key="list.id" :list="list"/> <mk-user-list-timeline v-if="src == 'list'" ref="tl" :key="list.id" :list="list"/>
</div> </div>

View file

@ -3,6 +3,7 @@
<span slot="header"> <span slot="header">
<template v-if="column.type == 'home'">%fa:home%</template> <template v-if="column.type == 'home'">%fa:home%</template>
<template v-if="column.type == 'local'">%fa:R comments%</template> <template v-if="column.type == 'local'">%fa:R comments%</template>
<template v-if="column.type == 'hybrid'">%fa:share-alt%</template>
<template v-if="column.type == 'global'">%fa:globe%</template> <template v-if="column.type == 'global'">%fa:globe%</template>
<template v-if="column.type == 'list'">%fa:list%</template> <template v-if="column.type == 'list'">%fa:list%</template>
<span>{{ name }}</span> <span>{{ name }}</span>
@ -61,6 +62,7 @@ export default Vue.extend({
switch (this.column.type) { switch (this.column.type) {
case 'home': return '%i18n:common.deck.home%'; case 'home': return '%i18n:common.deck.home%';
case 'local': return '%i18n:common.deck.local%'; case 'local': return '%i18n:common.deck.local%';
case 'hybrid': return '%i18n:common.deck.hybrid%';
case 'global': return '%i18n:common.deck.global%'; case 'global': return '%i18n:common.deck.global%';
case 'list': return this.column.list.title; case 'list': return this.column.list.title;
} }

View file

@ -41,27 +41,29 @@ export default Vue.extend({
}; };
}, },
watch: { computed: {
mediaOnly() { stream(): any {
this.fetch(); switch (this.src) {
case 'home': return (this as any).os.stream;
case 'local': return (this as any).os.streams.localTimelineStream;
case 'hybrid': return (this as any).os.streams.hybridTimelineStream;
case 'global': return (this as any).os.streams.globalTimelineStream;
} }
}, },
computed: { endpoint(): string {
stream(): any { switch (this.src) {
return this.src == 'home' case 'home': return 'notes/timeline';
? (this as any).os.stream case 'local': return 'notes/local-timeline';
: this.src == 'local' case 'hybrid': return 'notes/hybrid-timeline';
? (this as any).os.streams.localTimelineStream case 'global': return 'notes/global-timeline';
: (this as any).os.streams.globalTimelineStream; }
},
}, },
endpoint(): string { watch: {
return this.src == 'home' mediaOnly() {
? 'notes/timeline' this.fetch();
: this.src == 'local'
? 'notes/local-timeline'
: 'notes/global-timeline';
} }
}, },

View file

@ -119,6 +119,15 @@ export default Vue.extend({
type: 'local' type: 'local'
}); });
} }
}, {
icon: '%fa:share-alt%',
text: '%i18n:common.deck.hybrid%',
action: () => {
this.$store.dispatch('settings/addDeckColumn', {
id: uuid(),
type: 'hybrid'
});
}
}, { }, {
icon: '%fa:globe%', icon: '%fa:globe%',
text: '%i18n:common.deck.global%', text: '%i18n:common.deck.global%',

View file

@ -42,19 +42,21 @@ export default Vue.extend({
}, },
stream(): any { stream(): any {
return this.src == 'home' switch (this.src) {
? (this as any).os.stream case 'home': return (this as any).os.stream;
: this.src == 'local' case 'local': return (this as any).os.streams.localTimelineStream;
? (this as any).os.streams.localTimelineStream case 'hybrid': return (this as any).os.streams.hybridTimelineStream;
: (this as any).os.streams.globalTimelineStream; case 'global': return (this as any).os.streams.globalTimelineStream;
}
}, },
endpoint(): string { endpoint(): string {
return this.src == 'home' switch (this.src) {
? 'notes/timeline' case 'home': return 'notes/timeline';
: this.src == 'local' case 'local': return 'notes/local-timeline';
? 'notes/local-timeline' case 'hybrid': return 'notes/hybrid-timeline';
: 'notes/global-timeline'; case 'global': return 'notes/global-timeline';
}
}, },
canFetchMore(): boolean { canFetchMore(): boolean {

View file

@ -4,6 +4,7 @@
<span> <span>
<span v-if="src == 'home'">%fa:home%%i18n:@home%</span> <span v-if="src == 'home'">%fa:home%%i18n:@home%</span>
<span v-if="src == 'local'">%fa:R comments%%i18n:@local%</span> <span v-if="src == 'local'">%fa:R comments%%i18n:@local%</span>
<span v-if="src == 'hybrid'">%fa:share-alt%%i18n:@hybrid%</span>
<span v-if="src == 'global'">%fa:globe%%i18n:@global%</span> <span v-if="src == 'global'">%fa:globe%%i18n:@global%</span>
<span v-if="src == 'list'">%fa:list%{{ list.title }}</span> <span v-if="src == 'list'">%fa:list%{{ list.title }}</span>
</span> </span>
@ -24,6 +25,7 @@
<div> <div>
<span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span> <span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span>
<span :data-active="src == 'local'" @click="src = 'local'">%fa:R comments% %i18n:@local%</span> <span :data-active="src == 'local'" @click="src = 'local'">%fa:R comments% %i18n:@local%</span>
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'">%fa:share-alt% %i18n:@hybrid%</span>
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span> <span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
<template v-if="lists"> <template v-if="lists">
<span v-for="l in lists" :data-active="src == 'list' && list == l" @click="src = 'list'; list = l" :key="l.id">%fa:list% {{ l.title }}</span> <span v-for="l in lists" :data-active="src == 'list' && list == l" @click="src = 'list'; list = l" :key="l.id">%fa:list% {{ l.title }}</span>
@ -35,6 +37,7 @@
<div class="tl"> <div class="tl">
<x-tl v-if="src == 'home'" ref="tl" key="home" src="home"/> <x-tl v-if="src == 'home'" ref="tl" key="home" src="home"/>
<x-tl v-if="src == 'local'" ref="tl" key="local" src="local"/> <x-tl v-if="src == 'local'" ref="tl" key="local" src="local"/>
<x-tl v-if="src == 'hybrid'" ref="tl" key="hybrid" src="hybrid"/>
<x-tl v-if="src == 'global'" ref="tl" key="global" src="global"/> <x-tl v-if="src == 'global'" ref="tl" key="global" src="global"/>
<mk-user-list-timeline v-if="src == 'list'" ref="tl" :key="list.id" :list="list"/> <mk-user-list-timeline v-if="src == 'list'" ref="tl" :key="list.id" :list="list"/>
</div> </div>