forked from mirrors/misskey
fix(frontend): add antenna handling in antenna-column component (#17553)
fix: add antenna handling in antenna-column component
This commit is contained in:
parent
a0889acb2a
commit
2aa6d4fc7f
1 changed files with 14 additions and 4 deletions
|
|
@ -14,8 +14,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, useTemplateRef, watch, defineAsyncComponent } from 'vue';
|
||||
import { onMounted, ref, useTemplateRef, watch, defineAsyncComponent, provide } from 'vue';
|
||||
import XColumn from './column.vue';
|
||||
import type * as Misskey from 'misskey-js';
|
||||
import type { entities as MisskeyEntities } from 'misskey-js';
|
||||
import type { Column } from '@/deck.js';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
|
|
@ -35,6 +36,14 @@ const props = defineProps<{
|
|||
|
||||
const timeline = useTemplateRef('timeline');
|
||||
const soundSetting = ref<SoundStore>(props.column.soundSetting ?? { type: null, volume: 1 });
|
||||
const antenna = ref<Misskey.entities.Antenna | null>(null);
|
||||
|
||||
provide('currentAntenna', antenna);
|
||||
|
||||
watch(() => props.column.antennaId, async (antennaId) => {
|
||||
if (antennaId == null) return;
|
||||
antenna.value = await misskeyApi('antennas/show', { antennaId });
|
||||
}, { immediate: true });
|
||||
|
||||
onMounted(() => {
|
||||
if (props.column.antennaId == null) {
|
||||
|
|
@ -84,11 +93,12 @@ async function setAntenna() {
|
|||
return;
|
||||
}
|
||||
|
||||
const antenna = antennas.find(x => x.id === antennaIdOrOperation)!;
|
||||
const selectedAntenna = antennas.find(x => x.id === antennaIdOrOperation);
|
||||
if (selectedAntenna == null) return;
|
||||
|
||||
updateColumn(props.column.id, {
|
||||
antennaId: antenna.id,
|
||||
timelineNameCache: antenna.name,
|
||||
antennaId: selectedAntenna.id,
|
||||
timelineNameCache: selectedAntenna.name,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue