2020-07-11 01:13:11 +00:00
|
|
|
<template>
|
2023-01-10 01:30:38 +00:00
|
|
|
<XColumn :menu="menu" :column="column" :is-stacked="isStacked" @parent-focus="$event => emit('parent-focus', $event)">
|
2020-07-11 01:13:11 +00:00
|
|
|
<template #header>
|
2022-12-19 10:01:30 +00:00
|
|
|
<i v-if="column.tl === 'home'" class="ti ti-home"></i>
|
2022-12-31 11:40:47 +00:00
|
|
|
<i v-else-if="column.tl === 'local'" class="ti ti-planet"></i>
|
|
|
|
<i v-else-if="column.tl === 'social'" class="ti ti-rocket"></i>
|
|
|
|
<i v-else-if="column.tl === 'global'" class="ti ti-whirl"></i>
|
2020-07-11 01:13:11 +00:00
|
|
|
<span style="margin-left: 8px;">{{ column.name }}</span>
|
|
|
|
</template>
|
|
|
|
|
2023-03-12 01:20:33 +00:00
|
|
|
<div v-if="(((column.tl === 'local' || column.tl === 'social') && !isLocalTimelineAvailable) || (column.tl === 'global' && !isGlobalTimelineAvailable))" :class="$style.disabled">
|
2023-01-14 02:18:12 +00:00
|
|
|
<p :class="$style.disabledTitle">
|
2023-03-12 01:20:33 +00:00
|
|
|
<i class="ti ti-circle-minus"></i>
|
|
|
|
{{ i18n.ts._disabledTimeline.title }}
|
2020-07-11 01:13:11 +00:00
|
|
|
</p>
|
2023-03-12 01:20:33 +00:00
|
|
|
<p :class="$style.disabledDescription">{{ i18n.ts._disabledTimeline.description }}</p>
|
2020-07-11 01:13:11 +00:00
|
|
|
</div>
|
2023-02-22 02:00:34 +00:00
|
|
|
<MkTimeline v-else-if="column.tl" ref="timeline" :key="column.tl" :src="column.tl" @after="() => emit('loaded')"/>
|
2020-10-17 11:12:00 +00:00
|
|
|
</XColumn>
|
2020-07-11 01:13:11 +00:00
|
|
|
</template>
|
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted } from 'vue';
|
2020-07-11 01:13:11 +00:00
|
|
|
import XColumn from './column.vue';
|
2022-07-16 20:33:21 +00:00
|
|
|
import { removeColumn, updateColumn, Column } from './deck-store';
|
2023-02-22 02:00:34 +00:00
|
|
|
import MkTimeline from '@/components/MkTimeline.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import * as os from '@/os';
|
2022-03-20 18:11:14 +00:00
|
|
|
import { $i } from '@/account';
|
|
|
|
import { i18n } from '@/i18n';
|
2023-03-12 01:20:33 +00:00
|
|
|
import { instance } from '@/instance';
|
2022-03-20 18:11:14 +00:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2022-05-19 08:35:43 +00:00
|
|
|
(ev: 'loaded'): void;
|
|
|
|
(ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
|
2022-03-20 18:11:14 +00:00
|
|
|
}>();
|
|
|
|
|
|
|
|
let disabled = $ref(false);
|
|
|
|
|
2023-03-12 01:20:33 +00:00
|
|
|
const isLocalTimelineAvailable = (($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable));
|
|
|
|
const isGlobalTimelineAvailable = (($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable));
|
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.column.tl == null) {
|
|
|
|
setType();
|
|
|
|
} else if ($i) {
|
2023-03-12 01:20:33 +00:00
|
|
|
disabled = (
|
|
|
|
(!((instance.policies.ltlAvailable) || ($i.policies.ltlAvailable)) && ['local', 'social'].includes(props.column.tl)) ||
|
|
|
|
(!((instance.policies.gtlAvailable) || ($i.policies.gtlAvailable)) && ['global'].includes(props.column.tl)));
|
2022-03-20 18:11:14 +00:00
|
|
|
}
|
|
|
|
});
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
async function setType() {
|
|
|
|
const { canceled, result: src } = await os.select({
|
|
|
|
title: i18n.ts.timeline,
|
|
|
|
items: [{
|
2022-07-16 20:33:21 +00:00
|
|
|
value: 'home' as const, text: i18n.ts._timelines.home,
|
2022-03-20 18:11:14 +00:00
|
|
|
}, {
|
2022-07-16 20:33:21 +00:00
|
|
|
value: 'local' as const, text: i18n.ts._timelines.local,
|
2022-03-20 18:11:14 +00:00
|
|
|
}, {
|
2022-07-16 20:33:21 +00:00
|
|
|
value: 'social' as const, text: i18n.ts._timelines.social,
|
2022-03-20 18:11:14 +00:00
|
|
|
}, {
|
2022-07-16 20:33:21 +00:00
|
|
|
value: 'global' as const, text: i18n.ts._timelines.global,
|
2022-03-20 18:11:14 +00:00
|
|
|
}],
|
|
|
|
});
|
|
|
|
if (canceled) {
|
|
|
|
if (props.column.tl == null) {
|
|
|
|
removeColumn(props.column.id);
|
2020-07-11 01:13:11 +00:00
|
|
|
}
|
2022-03-20 18:11:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
updateColumn(props.column.id, {
|
2022-07-16 20:33:21 +00:00
|
|
|
tl: src,
|
2022-03-20 18:11:14 +00:00
|
|
|
});
|
|
|
|
}
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2022-07-16 20:33:21 +00:00
|
|
|
const menu = [{
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-pencil',
|
2022-07-16 20:33:21 +00:00
|
|
|
text: i18n.ts.timeline,
|
|
|
|
action: setType,
|
|
|
|
}];
|
2020-07-11 01:13:11 +00:00
|
|
|
</script>
|
|
|
|
|
2023-01-14 02:18:12 +00:00
|
|
|
<style lang="scss" module>
|
|
|
|
.disabled {
|
2020-07-11 01:13:11 +00:00
|
|
|
text-align: center;
|
2023-01-14 02:18:12 +00:00
|
|
|
}
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2023-01-14 02:18:12 +00:00
|
|
|
.disabledTitle {
|
|
|
|
margin: 16px;
|
|
|
|
}
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2023-01-14 02:18:12 +00:00
|
|
|
.disabledDescription {
|
|
|
|
font-size: 90%;
|
2020-07-11 01:13:11 +00:00
|
|
|
}
|
|
|
|
</style>
|