2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
2024-02-13 15:59:27 +00:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-07-11 10:13:11 +09:00
|
|
|
<template>
|
2024-07-30 13:11:06 +09:00
|
|
|
<XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="async () => { await timeline?.reloadTimeline() }">
|
2020-07-11 10:13:11 +09:00
|
|
|
<template #header>
|
2024-07-30 20:13:00 +09:00
|
|
|
<i v-if="column.tl != null" :class="basicTimelineIconClass(column.tl)"/>
|
2020-07-11 10:13:11 +09:00
|
|
|
<span style="margin-left: 8px;">{{ column.name }}</span>
|
|
|
|
</template>
|
|
|
|
|
2024-07-30 20:13:00 +09:00
|
|
|
<div v-if="!isAvailableBasicTimeline(column.tl)" :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-09-28 15:32:47 +09:00
|
|
|
<MkTimeline
|
|
|
|
v-else-if="column.tl"
|
|
|
|
ref="timeline"
|
2023-10-11 10:15:44 +09:00
|
|
|
:key="column.tl + withRenotes + withReplies + onlyFiles"
|
2023-09-28 15:32:47 +09:00
|
|
|
:src="column.tl"
|
|
|
|
:withRenotes="withRenotes"
|
2023-10-11 10:15:44 +09:00
|
|
|
:withReplies="withReplies"
|
2024-10-21 13:22:21 +09:00
|
|
|
:withSensitive="withSensitive"
|
2023-09-29 16:56:17 +09:00
|
|
|
:onlyFiles="onlyFiles"
|
2024-05-27 20:54:53 +09:00
|
|
|
@note="onNote"
|
2023-09-28 15:32:47 +09:00
|
|
|
/>
|
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>
|
2024-07-30 20:13:00 +09:00
|
|
|
import { onMounted, watch, ref, shallowRef, computed } from 'vue';
|
2020-07-11 10:13:11 +09:00
|
|
|
import XColumn from './column.vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { removeColumn, updateColumn, Column } from './deck-store.js';
|
2024-07-30 20:13:00 +09:00
|
|
|
import type { MenuItem } from '@/types/menu.js';
|
2023-02-22 11:00:34 +09:00
|
|
|
import MkTimeline from '@/components/MkTimeline.vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2024-07-30 20:13:00 +09:00
|
|
|
import { hasWithReplies, isAvailableBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { instance } from '@/instance.js';
|
2024-05-27 20:54:53 +09:00
|
|
|
import { SoundStore } from '@/store.js';
|
|
|
|
import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js';
|
|
|
|
import * as sound from '@/scripts/sound.js';
|
2022-03-21 03:11:14 +09:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
2022-03-21 03:11:14 +09:00
|
|
|
|
2024-05-27 20:54:53 +09:00
|
|
|
const soundSetting = ref<SoundStore>(props.column.soundSetting ?? { type: null, volume: 1 });
|
2023-12-07 14:42:09 +09:00
|
|
|
const withRenotes = ref(props.column.withRenotes ?? true);
|
|
|
|
const withReplies = ref(props.column.withReplies ?? false);
|
2024-10-21 13:22:21 +09:00
|
|
|
const withSensitive = ref(props.column.withSensitive ?? true);
|
2023-12-07 14:42:09 +09:00
|
|
|
const onlyFiles = ref(props.column.onlyFiles ?? false);
|
2023-09-28 15:32:47 +09:00
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
watch(withRenotes, v => {
|
2023-09-28 15:32:47 +09:00
|
|
|
updateColumn(props.column.id, {
|
|
|
|
withRenotes: v,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
watch(withReplies, v => {
|
2023-11-03 17:18:30 +09:00
|
|
|
updateColumn(props.column.id, {
|
|
|
|
withReplies: v,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-10-21 13:22:21 +09:00
|
|
|
watch(withSensitive, v => {
|
|
|
|
updateColumn(props.column.id, {
|
|
|
|
withSensitive: v,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
watch(onlyFiles, v => {
|
2023-09-29 17:05:35 +09:00
|
|
|
updateColumn(props.column.id, {
|
|
|
|
onlyFiles: v,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-05-27 20:54:53 +09:00
|
|
|
watch(soundSetting, v => {
|
|
|
|
updateColumn(props.column.id, { soundSetting: v });
|
|
|
|
});
|
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.column.tl == null) {
|
|
|
|
setType();
|
|
|
|
}
|
|
|
|
});
|
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;
|
|
|
|
}
|
2024-07-30 13:11:06 +09:00
|
|
|
if (src == null) return;
|
2022-03-21 03:11:14 +09:00
|
|
|
updateColumn(props.column.id, {
|
2024-07-30 20:13:00 +09:00
|
|
|
tl: src ?? undefined,
|
2022-03-21 03:11:14 +09:00
|
|
|
});
|
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2024-05-27 20:54:53 +09:00
|
|
|
function onNote() {
|
|
|
|
sound.playMisskeySfxFile(soundSetting.value);
|
|
|
|
}
|
|
|
|
|
2024-09-23 21:50:30 +09:00
|
|
|
const menu = computed<MenuItem[]>(() => {
|
|
|
|
const menuItems: MenuItem[] = [];
|
|
|
|
|
|
|
|
menuItems.push({
|
|
|
|
icon: 'ti ti-pencil',
|
|
|
|
text: i18n.ts.timeline,
|
|
|
|
action: setType,
|
|
|
|
}, {
|
|
|
|
icon: 'ti ti-bell',
|
|
|
|
text: i18n.ts._deck.newNoteNotificationSettings,
|
|
|
|
action: () => soundSettingsButton(soundSetting),
|
|
|
|
}, {
|
|
|
|
type: 'switch',
|
|
|
|
text: i18n.ts.showRenotes,
|
|
|
|
ref: withRenotes,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (hasWithReplies(props.column.tl)) {
|
|
|
|
menuItems.push({
|
|
|
|
type: 'switch',
|
|
|
|
text: i18n.ts.showRepliesToOthersInTimeline,
|
|
|
|
ref: withReplies,
|
|
|
|
disabled: onlyFiles,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
menuItems.push({
|
|
|
|
type: 'switch',
|
|
|
|
text: i18n.ts.fileAttachedOnly,
|
|
|
|
ref: onlyFiles,
|
|
|
|
disabled: hasWithReplies(props.column.tl) ? withReplies : false,
|
2024-10-21 13:22:21 +09:00
|
|
|
}, {
|
|
|
|
type: 'switch',
|
|
|
|
text: i18n.ts.withSensitive,
|
|
|
|
ref: withSensitive,
|
2024-09-23 21:50:30 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
return menuItems;
|
|
|
|
});
|
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>
|