2020-07-10 20:13:11 -05:00
|
|
|
<template>
|
2020-12-27 20:56:42 -06:00
|
|
|
<XColumn :func="{ handler: setType, title: $ts.timeline }" :column="column" :is-stacked="isStacked" :indicated="indicated" @change-active-state="onChangeActiveState">
|
2020-07-10 20:13:11 -05:00
|
|
|
<template #header>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i v-if="column.tl === 'home'" class="fas fa-home"></i>
|
|
|
|
<i v-else-if="column.tl === 'local'" class="fas fa-comments"></i>
|
|
|
|
<i v-else-if="column.tl === 'social'" class="fas fa-share-alt"></i>
|
|
|
|
<i v-else-if="column.tl === 'global'" class="fas fa-globe"></i>
|
2020-07-10 20:13:11 -05:00
|
|
|
<span style="margin-left: 8px;">{{ column.name }}</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div class="iwaalbte" v-if="disabled">
|
|
|
|
<p>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fas fa-minus-circle"></i>
|
2020-07-10 20:13:11 -05:00
|
|
|
{{ $t('disabled-timeline.title') }}
|
|
|
|
</p>
|
|
|
|
<p class="desc">{{ $t('disabled-timeline.description') }}</p>
|
|
|
|
</div>
|
2020-10-17 06:12:00 -05: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-10 20:13:11 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 06:12:00 -05:00
|
|
|
import { defineComponent } from 'vue';
|
2020-07-10 20:13:11 -05:00
|
|
|
import XColumn from './column.vue';
|
2021-03-23 03:30:14 -05:00
|
|
|
import XTimeline from '@client/components/timeline.vue';
|
|
|
|
import * as os from '@client/os';
|
2020-12-18 19:55:52 -06:00
|
|
|
import { removeColumn, updateColumn } from './deck-store';
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2020-07-10 20:13:11 -05:00
|
|
|
components: {
|
|
|
|
XColumn,
|
|
|
|
XTimeline,
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
column: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
isStacked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
disabled: false,
|
|
|
|
indicated: false,
|
|
|
|
columnActive: true,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
mediaOnly() {
|
|
|
|
(this.$refs.timeline as any).reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
if (this.column.tl == null) {
|
|
|
|
this.setType();
|
|
|
|
} else {
|
2020-12-18 19:55:52 -06:00
|
|
|
this.disabled = !this.$i.isModerator && !this.$i.isAdmin && (
|
|
|
|
this.$instance.disableLocalTimeline && ['local', 'social'].includes(this.column.tl) ||
|
|
|
|
this.$instance.disableGlobalTimeline && ['global'].includes(this.column.tl));
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async setType() {
|
2020-10-17 06:12:00 -05:00
|
|
|
const { canceled, result: src } = await os.dialog({
|
2020-12-25 19:47:36 -06:00
|
|
|
title: this.$ts.timeline,
|
2020-07-10 20:13:11 -05:00
|
|
|
type: null,
|
|
|
|
select: {
|
|
|
|
items: [{
|
2020-12-25 19:47:36 -06:00
|
|
|
value: 'home', text: this.$ts._timelines.home
|
2020-07-10 20:13:11 -05:00
|
|
|
}, {
|
2020-12-25 19:47:36 -06:00
|
|
|
value: 'local', text: this.$ts._timelines.local
|
2020-07-10 20:13:11 -05:00
|
|
|
}, {
|
2020-12-25 19:47:36 -06:00
|
|
|
value: 'social', text: this.$ts._timelines.social
|
2020-07-10 20:13:11 -05:00
|
|
|
}, {
|
2020-12-25 19:47:36 -06:00
|
|
|
value: 'global', text: this.$ts._timelines.global
|
2020-07-10 20:13:11 -05:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
});
|
2020-07-11 10:31:37 -05:00
|
|
|
if (canceled) {
|
|
|
|
if (this.column.tl == null) {
|
2020-12-18 19:55:52 -06:00
|
|
|
removeColumn(this.column.id);
|
2020-07-11 10:31:37 -05:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-12-18 19:55:52 -06:00
|
|
|
updateColumn(this.column.id, {
|
|
|
|
tl: src
|
|
|
|
});
|
2020-07-10 20:13:11 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
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>
|