This commit is contained in:
FruitRiin 2023-12-16 19:39:12 +09:00
parent 20e4c6b01e
commit 86ac1f6492
1 changed files with 17 additions and 15 deletions

View File

@ -37,11 +37,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<span :class="$style.itemDescription">{{ i18n.ts._visibility.specifiedDescription }}</span> <span :class="$style.itemDescription">{{ i18n.ts._visibility.specifiedDescription }}</span>
</div> </div>
</button> </button>
<button v-for="channel in channels" :class="$style.item" class="_button" @click="chooseChannel(channel)" > <button v-for="channel in channels" :class="$style.item" class="_button" @click="chooseChannel(channel)">
<div :class="$style.body" :style="{borderLeft: `solid 2px ${channel.color}`}"> <div :class="$style.body" :style="{borderLeft: `solid 2px ${channel.color}`}">
<span :class="$style.itemTitle">{{ channel.name }}</span> <span :class="$style.itemTitle">{{ channel.name }}</span>
</div> </div>
</button> </button>
</div> </div>
</MkModal> </MkModal>
</template> </template>
@ -51,7 +51,7 @@ import { nextTick, shallowRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import * as os from "@/os.js"; import * as os from '@/os.js';
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = shallowRef<InstanceType<typeof MkModal>>();
@ -82,18 +82,20 @@ const v = ref(props.currentVisibility);
*/ */
const channels = ref([]); const channels = ref([]);
async function getChannel(){
const res = await os.api('channels/my-favorites', { async function getChannel() {
limit: 100, const res = await os.api('channels/my-favorites', {
}); limit: 100,
channels.value.splice(0, 0, ...res); });
channels.value.splice(0, 0, ...res);
} }
getChannel(); getChannel();
async function chooseChannel(channel: string ){ async function chooseChannel(channel: string ) {
emit("changeChannel", channel); emit('changeChannel', channel);
await nextTick(); await nextTick();
if (modal.value) modal.value.close(); if (modal.value) modal.value.close();
} }
function choose(visibility: typeof Misskey.noteVisibilities[number]): void { function choose(visibility: typeof Misskey.noteVisibilities[number]): void {