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>
|
2023-11-10 17:49:09 +09:00
|
|
|
<XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
|
2020-07-11 10:13:11 +09:00
|
|
|
<template #header>
|
2023-11-03 23:20:53 +01:00
|
|
|
<i class="ph-list ph-bold ph-lg"></i><span style="margin-left: 8px;">{{ column.name }}</span>
|
2020-07-11 10:13:11 +09:00
|
|
|
</template>
|
|
|
|
|
|
2024-05-31 13:24:00 +01:00
|
|
|
<MkTimeline v-if="column.listId" ref="timeline" src="list" :key="column.listId + column.withRenotes + column.onlyFiles" :list="column.listId" :withRenotes="withRenotes" :onlyFiles="onlyFiles" @note="onNote"/>
|
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>
|
2023-12-07 14:42:09 +09:00
|
|
|
import { watch, shallowRef, ref } from 'vue';
|
2020-07-11 10:13:11 +09:00
|
|
|
import XColumn from './column.vue';
|
2023-12-24 16:16:58 +09:00
|
|
|
import { updateColumn, Column } from './deck-store.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';
|
2024-01-04 18:32:46 +09:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { i18n } from '@/i18n.js';
|
2024-05-27 20:54:53 +09:00
|
|
|
import { MenuItem } from '@/types/menu.js';
|
|
|
|
|
import { SoundStore } from '@/store.js';
|
|
|
|
|
import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js';
|
|
|
|
|
import * as sound from '@/scripts/sound.js';
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
const props = defineProps<{
|
|
|
|
|
column: Column;
|
|
|
|
|
isStacked: boolean;
|
|
|
|
|
}>();
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
|
|
|
|
const withRenotes = ref(props.column.withRenotes ?? true);
|
2024-05-23 21:56:28 +00:00
|
|
|
const onlyFiles = ref(props.column.onlyFiles ?? false);
|
2024-05-27 20:54:53 +09:00
|
|
|
const soundSetting = ref<SoundStore>(props.column.soundSetting ?? { type: null, volume: 1 });
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
if (props.column.listId == null) {
|
|
|
|
|
setList();
|
|
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
watch(withRenotes, v => {
|
2023-10-03 20:38:34 +09:00
|
|
|
updateColumn(props.column.id, {
|
|
|
|
|
withRenotes: v,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2024-05-23 21:56:28 +00:00
|
|
|
watch(onlyFiles, v => {
|
|
|
|
|
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
|
|
|
async function setList() {
|
2024-01-04 18:32:46 +09:00
|
|
|
const lists = await misskeyApi('users/lists/list');
|
2022-03-21 03:11:14 +09:00
|
|
|
const { canceled, result: list } = await os.select({
|
|
|
|
|
title: i18n.ts.selectList,
|
|
|
|
|
items: lists.map(x => ({
|
2022-07-17 05:33:21 +09:00
|
|
|
value: x, text: x.name,
|
2022-03-21 03:11:14 +09:00
|
|
|
})),
|
2022-07-17 05:33:21 +09:00
|
|
|
default: props.column.listId,
|
2022-03-21 03:11:14 +09:00
|
|
|
});
|
|
|
|
|
if (canceled) return;
|
|
|
|
|
updateColumn(props.column.id, {
|
2022-07-17 05:33:21 +09:00
|
|
|
listId: list.id,
|
2022-03-21 03:11:14 +09:00
|
|
|
});
|
|
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2023-07-05 13:04:27 +09:00
|
|
|
function editList() {
|
|
|
|
|
os.pageWindow('my/lists/' + props.column.listId);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-27 20:54:53 +09:00
|
|
|
function onNote() {
|
|
|
|
|
sound.playMisskeySfxFile(soundSetting.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const menu: MenuItem[] = [
|
2023-07-05 13:04:27 +09:00
|
|
|
{
|
2024-02-05 06:39:15 -05:00
|
|
|
icon: 'ph-pencil-simple ph-bold ph-lg',
|
2023-07-05 13:04:27 +09:00
|
|
|
text: i18n.ts.selectList,
|
|
|
|
|
action: setList,
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-11-03 23:20:53 +01:00
|
|
|
icon: 'ph-gear ph-bold ph-lg',
|
2023-07-05 13:04:27 +09:00
|
|
|
text: i18n.ts.editList,
|
|
|
|
|
action: editList,
|
|
|
|
|
},
|
2023-10-03 20:38:34 +09:00
|
|
|
{
|
|
|
|
|
type: 'switch',
|
|
|
|
|
text: i18n.ts.showRenotes,
|
2023-12-07 14:42:09 +09:00
|
|
|
ref: withRenotes,
|
2023-10-03 20:38:34 +09:00
|
|
|
},
|
2024-05-23 21:56:28 +00:00
|
|
|
{
|
|
|
|
|
type: 'switch',
|
|
|
|
|
text: i18n.ts.fileAttachedOnly,
|
|
|
|
|
ref: onlyFiles,
|
|
|
|
|
},
|
2024-05-27 20:54:53 +09:00
|
|
|
{
|
2024-05-31 12:41:41 +01:00
|
|
|
icon: 'ph-bell-ringing ph-bold ph-lg',
|
2024-05-27 20:54:53 +09:00
|
|
|
text: i18n.ts._deck.newNoteNotificationSettings,
|
|
|
|
|
action: () => soundSettingsButton(soundSetting),
|
|
|
|
|
},
|
2023-07-05 13:04:27 +09:00
|
|
|
];
|
2020-07-11 10:13:11 +09:00
|
|
|
</script>
|