frontend timeline fixes & improvements (#13727)
* fix: withRepliesがオフのときにwithFilesのとぐるをいじれない問題 * fix: type errors in tl-column * fix: deck uiでタイムラインを切り替えた際にTLの設定項目が更新されない * refactor: タイムラインの各種知識を一つのファイルに統合 fix: ウィジェットのタイムライン選択欄に表示できないタイムラインが表示される * docs(changelog): timeline improvements * fix: missing license header * chore: timeline > basic timeline * use BasicTimelineType in deck-store * Update CHANGELOG.md --------- Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { throttle } from 'throttle-debounce';
|
||||
import { markRaw } from 'vue';
|
||||
import { notificationTypes } from 'misskey-js';
|
||||
import type { BasicTimelineType } from '@/timelines.js';
|
||||
import { Storage } from '@/pizzax.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { deepClone } from '@/scripts/clone.js';
|
||||
@@ -45,7 +46,7 @@ export type Column = {
|
||||
channelId?: string;
|
||||
roleId?: string;
|
||||
excludeTypes?: typeof notificationTypes[number][];
|
||||
tl?: 'home' | 'local' | 'social' | 'global';
|
||||
tl?: BasicTimelineType;
|
||||
withRenotes?: boolean;
|
||||
withReplies?: boolean;
|
||||
onlyFiles?: boolean;
|
||||
|
@@ -6,14 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template>
|
||||
<XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="async () => { await timeline?.reloadTimeline() }">
|
||||
<template #header>
|
||||
<i v-if="column.tl === 'home'" class="ti ti-home"></i>
|
||||
<i v-else-if="column.tl === 'local'" class="ti ti-planet"></i>
|
||||
<i v-else-if="column.tl === 'social'" class="ti ti-universe"></i>
|
||||
<i v-else-if="column.tl === 'global'" class="ti ti-whirl"></i>
|
||||
<i v-if="column.tl != null" :class="basicTimelineIconClass(column.tl)"/>
|
||||
<span style="margin-left: 8px;">{{ column.name }}</span>
|
||||
</template>
|
||||
|
||||
<div v-if="(((column.tl === 'local' || column.tl === 'social') && !isLocalTimelineAvailable) || (column.tl === 'global' && !isGlobalTimelineAvailable))" :class="$style.disabled">
|
||||
<div v-if="!isAvailableBasicTimeline(column.tl)" :class="$style.disabled">
|
||||
<p :class="$style.disabledTitle">
|
||||
<i class="ti ti-circle-minus"></i>
|
||||
{{ i18n.ts._disabledTimeline.title }}
|
||||
@@ -34,15 +31,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, watch, ref, shallowRef } from 'vue';
|
||||
import { onMounted, watch, ref, shallowRef, computed } from 'vue';
|
||||
import XColumn from './column.vue';
|
||||
import { removeColumn, updateColumn, Column } from './deck-store.js';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
import MkTimeline from '@/components/MkTimeline.vue';
|
||||
import * as os from '@/os.js';
|
||||
import { $i } from '@/account.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { hasWithReplies, isAvailableBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
||||
import { instance } from '@/instance.js';
|
||||
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';
|
||||
@@ -52,11 +49,8 @@ const props = defineProps<{
|
||||
isStacked: boolean;
|
||||
}>();
|
||||
|
||||
const disabled = ref(false);
|
||||
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
|
||||
|
||||
const isLocalTimelineAvailable = (($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable));
|
||||
const isGlobalTimelineAvailable = (($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable));
|
||||
const soundSetting = ref<SoundStore>(props.column.soundSetting ?? { type: null, volume: 1 });
|
||||
const withRenotes = ref(props.column.withRenotes ?? true);
|
||||
const withReplies = ref(props.column.withReplies ?? false);
|
||||
@@ -87,10 +81,6 @@ watch(soundSetting, v => {
|
||||
onMounted(() => {
|
||||
if (props.column.tl == null) {
|
||||
setType();
|
||||
} else if ($i) {
|
||||
disabled.value = (
|
||||
(!((instance.policies.ltlAvailable) || ($i.policies.ltlAvailable)) && ['local', 'social'].includes(props.column.tl)) ||
|
||||
(!((instance.policies.gtlAvailable) || ($i.policies.gtlAvailable)) && ['global'].includes(props.column.tl)));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,7 +105,7 @@ async function setType() {
|
||||
}
|
||||
if (src == null) return;
|
||||
updateColumn(props.column.id, {
|
||||
tl: src,
|
||||
tl: src ?? undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -123,7 +113,7 @@ function onNote() {
|
||||
sound.playMisskeySfxFile(soundSetting.value);
|
||||
}
|
||||
|
||||
const menu: MenuItem[] = [{
|
||||
const menu = computed<MenuItem[]>(() => [{
|
||||
icon: 'ti ti-pencil',
|
||||
text: i18n.ts.timeline,
|
||||
action: setType,
|
||||
@@ -135,7 +125,7 @@ const menu: MenuItem[] = [{
|
||||
type: 'switch',
|
||||
text: i18n.ts.showRenotes,
|
||||
ref: withRenotes,
|
||||
}, props.column.tl === 'local' || props.column.tl === 'social' ? {
|
||||
}, hasWithReplies(props.column.tl) ? {
|
||||
type: 'switch',
|
||||
text: i18n.ts.showRepliesToOthersInTimeline,
|
||||
ref: withReplies,
|
||||
@@ -144,8 +134,8 @@ const menu: MenuItem[] = [{
|
||||
type: 'switch',
|
||||
text: i18n.ts.fileAttachedOnly,
|
||||
ref: onlyFiles,
|
||||
disabled: props.column.tl === 'local' || props.column.tl === 'social' ? withReplies : false,
|
||||
}];
|
||||
disabled: hasWithReplies(props.column.tl) ? withReplies : false,
|
||||
}]);
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
Reference in New Issue
Block a user