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