2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-07-11 01:13:11 +00:00
|
|
|
<template>
|
2023-11-10 08:49:09 +00:00
|
|
|
<XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
|
2020-07-11 01:13:11 +00:00
|
|
|
<template #header>
|
2023-11-03 22:20:53 +00:00
|
|
|
<i class="ph-list ph-bold ph-lg"></i><span style="margin-left: 8px;">{{ column.name }}</span>
|
2020-07-11 01:13:11 +00:00
|
|
|
</template>
|
|
|
|
|
2023-10-03 11:38:34 +00:00
|
|
|
<MkTimeline v-if="column.listId" ref="timeline" src="list" :list="column.listId" :withRenotes="withRenotes"/>
|
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>
|
2023-10-03 11:38:34 +00:00
|
|
|
import { watch } from 'vue';
|
2020-07-11 01:13:11 +00:00
|
|
|
import XColumn from './column.vue';
|
2022-07-16 20:33:21 +00:00
|
|
|
import { updateColumn, Column } from './deck-store';
|
2023-02-22 02:00:34 +00:00
|
|
|
import MkTimeline from '@/components/MkTimeline.vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2023-02-22 02:00:34 +00:00
|
|
|
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
|
2023-10-03 11:38:34 +00:00
|
|
|
const withRenotes = $ref(props.column.withRenotes ?? true);
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
if (props.column.listId == null) {
|
|
|
|
setList();
|
|
|
|
}
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2023-10-03 11:38:34 +00:00
|
|
|
watch($$(withRenotes), v => {
|
|
|
|
updateColumn(props.column.id, {
|
|
|
|
withRenotes: v,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
async function setList() {
|
|
|
|
const lists = await os.api('users/lists/list');
|
|
|
|
const { canceled, result: list } = await os.select({
|
|
|
|
title: i18n.ts.selectList,
|
|
|
|
items: lists.map(x => ({
|
2022-07-16 20:33:21 +00:00
|
|
|
value: x, text: x.name,
|
2022-03-20 18:11:14 +00:00
|
|
|
})),
|
2022-07-16 20:33:21 +00:00
|
|
|
default: props.column.listId,
|
2022-03-20 18:11:14 +00:00
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
updateColumn(props.column.id, {
|
2022-07-16 20:33:21 +00:00
|
|
|
listId: list.id,
|
2022-03-20 18:11:14 +00:00
|
|
|
});
|
|
|
|
}
|
2020-07-11 01:13:11 +00:00
|
|
|
|
2023-07-05 04:04:27 +00:00
|
|
|
function editList() {
|
|
|
|
os.pageWindow('my/lists/' + props.column.listId);
|
|
|
|
}
|
|
|
|
|
|
|
|
const menu = [
|
|
|
|
{
|
2023-09-30 19:53:52 +00:00
|
|
|
icon: 'ph-pencil ph-bold ph-lg',
|
2023-07-05 04:04:27 +00:00
|
|
|
text: i18n.ts.selectList,
|
|
|
|
action: setList,
|
|
|
|
},
|
|
|
|
{
|
2023-11-03 22:20:53 +00:00
|
|
|
icon: 'ph-gear ph-bold ph-lg',
|
2023-07-05 04:04:27 +00:00
|
|
|
text: i18n.ts.editList,
|
|
|
|
action: editList,
|
|
|
|
},
|
2023-10-03 11:38:34 +00:00
|
|
|
{
|
|
|
|
type: 'switch',
|
|
|
|
text: i18n.ts.showRenotes,
|
|
|
|
ref: $$(withRenotes),
|
|
|
|
},
|
2023-07-05 04:04:27 +00:00
|
|
|
];
|
2020-07-11 01:13:11 +00:00
|
|
|
</script>
|