2020-07-11 10:13:11 +09:00
|
|
|
<template>
|
2020-10-17 20:12:00 +09:00
|
|
|
<XColumn :menu="menu" :column="column" :is-stacked="isStacked" :indicated="indicated" @change-active-state="onChangeActiveState">
|
2020-07-11 10:13:11 +09:00
|
|
|
<template #header>
|
2020-10-17 20:12:00 +09:00
|
|
|
<Fa v-if="column.tl === 'home'" :icon="faHome"/>
|
|
|
|
<Fa v-else-if="column.tl === 'local'" :icon="faComments"/>
|
|
|
|
<Fa v-else-if="column.tl === 'social'" :icon="faShareAlt"/>
|
|
|
|
<Fa v-else-if="column.tl === 'global'" :icon="faGlobe"/>
|
2020-07-11 10:13:11 +09:00
|
|
|
<span style="margin-left: 8px;">{{ column.name }}</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div class="iwaalbte" v-if="disabled">
|
|
|
|
<p>
|
2020-10-17 20:12:00 +09:00
|
|
|
<Fa :icon="faMinusCircle"/>
|
2020-07-11 10:13:11 +09:00
|
|
|
{{ $t('disabled-timeline.title') }}
|
|
|
|
</p>
|
|
|
|
<p class="desc">{{ $t('disabled-timeline.description') }}</p>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<XTimeline v-else-if="column.tl" ref="timeline" :src="column.tl" @after="() => $emit('loaded')" @queue="queueUpdated" @note="onNote" :key="column.tl"/>
|
|
|
|
</XColumn>
|
2020-07-11 10:13:11 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent } from 'vue';
|
2020-07-11 10:13:11 +09:00
|
|
|
import { faMinusCircle, faHome, faComments, faShareAlt, faGlobe, faCog } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import XColumn from './column.vue';
|
2020-10-25 09:15:20 +09:00
|
|
|
import XTimeline from '@/components/timeline.vue';
|
2020-10-17 20:12:00 +09:00
|
|
|
import * as os from '@/os';
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-07-11 10:13:11 +09:00
|
|
|
components: {
|
|
|
|
XColumn,
|
|
|
|
XTimeline,
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
column: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
isStacked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
menu: null,
|
|
|
|
disabled: false,
|
|
|
|
indicated: false,
|
|
|
|
columnActive: true,
|
|
|
|
faMinusCircle, faHome, faComments, faShareAlt, faGlobe,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
mediaOnly() {
|
|
|
|
(this.$refs.timeline as any).reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
this.menu = [{
|
|
|
|
icon: faCog,
|
|
|
|
text: this.$t('timeline'),
|
|
|
|
action: this.setType
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
if (this.column.tl == null) {
|
|
|
|
this.setType();
|
|
|
|
} else {
|
|
|
|
this.disabled = !this.$store.state.i.isModerator && !this.$store.state.i.isAdmin && (
|
|
|
|
this.$store.state.instance.meta.disableLocalTimeline && ['local', 'social'].includes(this.column.tl) ||
|
|
|
|
this.$store.state.instance.meta.disableGlobalTimeline && ['global'].includes(this.column.tl));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async setType() {
|
2020-10-17 20:12:00 +09:00
|
|
|
const { canceled, result: src } = await os.dialog({
|
2020-07-11 10:13:11 +09:00
|
|
|
title: this.$t('timeline'),
|
|
|
|
type: null,
|
|
|
|
select: {
|
|
|
|
items: [{
|
|
|
|
value: 'home', text: this.$t('_timelines.home')
|
|
|
|
}, {
|
|
|
|
value: 'local', text: this.$t('_timelines.local')
|
|
|
|
}, {
|
|
|
|
value: 'social', text: this.$t('_timelines.social')
|
|
|
|
}, {
|
|
|
|
value: 'global', text: this.$t('_timelines.global')
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
});
|
2020-07-12 00:31:37 +09:00
|
|
|
if (canceled) {
|
|
|
|
if (this.column.tl == null) {
|
2020-07-12 15:33:04 +09:00
|
|
|
this.$store.commit('deviceUser/removeDeckColumn', this.column.id);
|
2020-07-12 00:31:37 +09:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
this.column.tl = src;
|
2020-07-11 10:13:11 +09:00
|
|
|
this.$store.commit('deviceUser/updateDeckColumn', this.column);
|
|
|
|
},
|
|
|
|
|
|
|
|
queueUpdated(q) {
|
|
|
|
if (this.columnActive) {
|
|
|
|
this.indicated = q !== 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onNote() {
|
|
|
|
if (!this.columnActive) {
|
|
|
|
this.indicated = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onChangeActiveState(state) {
|
|
|
|
this.columnActive = state;
|
|
|
|
|
|
|
|
if (this.columnActive) {
|
|
|
|
this.indicated = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
focus() {
|
|
|
|
(this.$refs.timeline as any).focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.iwaalbte {
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
> p {
|
|
|
|
margin: 16px;
|
|
|
|
|
|
|
|
&.desc {
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|