fix: channel timeline post form

This commit is contained in:
mattyatea 2024-03-12 23:18:11 +09:00
parent c2aba3886a
commit 51af59dfc5
2 changed files with 6 additions and 4 deletions

View File

@ -29,7 +29,7 @@ import { defaultStore } from '@/store.js';
import { Paging } from '@/components/MkPagination.vue'; import { Paging } from '@/components/MkPagination.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
src: 'home' | 'local' | 'social' | 'global' | 'mentions' | 'directs' | 'list' | 'antenna' | 'channel' | 'role'; src: 'home' | 'local' | 'social' | 'global' | 'mentions' | 'directs' | 'list' | 'antenna' | 'channel' | 'role' | 'media';
list?: string; list?: string;
antenna?: string; antenna?: string;
channel?: string; channel?: string;

View File

@ -7,6 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :displayMyAvatar="true"/></template> <template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :displayMyAvatar="true"/></template>
<MkSpacer :contentMax="800"> <MkSpacer :contentMax="800">
{{ channelInfo ? channelInfo.name : '' }}
<MkHorizontalSwipe v-model:tab="src" :tabs="$i ? headerTabs : headerTabsWhenNotLogin"> <MkHorizontalSwipe v-model:tab="src" :tabs="$i ? headerTabs : headerTabsWhenNotLogin">
<div :key="src" ref="rootEl" v-hotkey.global="keymap"> <div :key="src" ref="rootEl" v-hotkey.global="keymap">
<MkInfo v-if="['home', 'local', 'social', 'global'].includes(src) && !defaultStore.reactiveState.timelineTutorials.value[src]" style="margin-bottom: var(--margin);" closable @close="closeTutorial()"> <MkInfo v-if="['home', 'local', 'social', 'global'].includes(src) && !defaultStore.reactiveState.timelineTutorials.value[src]" style="margin-bottom: var(--margin);" closable @close="closeTutorial()">
@ -68,7 +69,7 @@ const rootEl = shallowRef<HTMLElement>();
const queue = ref(0); const queue = ref(0);
const srcWhenNotSignin = ref<'local' | 'global'>(isLocalTimelineAvailable ? 'local' : 'global'); const srcWhenNotSignin = ref<'local' | 'global'>(isLocalTimelineAvailable ? 'local' : 'global');
const src = computed<'home' | 'local' | 'social' | 'global' | `list:${string}`>({ const src = computed<'home' | 'local' | 'social' | 'global' | `list:${string}`| `channel:${string}`>({
get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin.value), get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin.value),
set: (x) => saveSrc(x), set: (x) => saveSrc(x),
}); });
@ -127,13 +128,14 @@ const showSocialTimeline = ref(defaultStore.state.showSocialTimeline);
const channelInfo = ref(); const channelInfo = ref();
if (src.value.split(':')[0] === 'channel') { if (src.value.split(':')[0] === 'channel') {
const channelId = src.value.split(':')[1]; const channelId = src.value.split(':')[1];
channelInfo.value = misskeyApi('channels/show', { channelId }); channelInfo.value = await misskeyApi('channels/show', { channelId });
} }
watch(src, async () => { watch(src, async () => {
queue.value = 0; queue.value = 0;
if (src.value.split(':')[0] === 'channel') { if (src.value.split(':')[0] === 'channel') {
const channelId = src.value.split(':')[1]; const channelId = src.value.split(':')[1];
channelInfo.value = misskeyApi('channels/show', { channelId }); channelInfo.value = await misskeyApi('channels/show', { channelId });
} else { } else {
channelInfo.value = null; channelInfo.value = null;
} }