1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-25 01:34:07 +02:00
Files
misskey/packages/frontend/src/pages/chat/room.info.vue
かっこかり 15a5bb17e3 fix(frontend): チャットのデザイン調整 (#15708)
* fix(frontend): チャットのデザイン調整

* remove unused locales

* 🎨

* Update XMessage.vue

* Update XMessage.vue

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2025-03-31 17:33:00 +09:00

101 lines
2.3 KiB
Vue

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div class="_gaps">
<MkInput v-model="name_" :disabled="!isOwner">
<template #label>{{ i18n.ts.name }}</template>
</MkInput>
<MkTextarea v-model="description_" :disabled="!isOwner">
<template #label>{{ i18n.ts.description }}</template>
</MkTextarea>
<MkButton v-if="isOwner" primary @click="save">{{ i18n.ts.save }}</MkButton>
<hr>
<MkButton v-if="isOwner || ($i.isAdmin || $i.isModerator)" danger @click="del">{{ i18n.ts._chat.deleteRoom }}</MkButton>
<MkSwitch v-if="!isOwner" v-model="isMuted">
<template #label>{{ i18n.ts._chat.muteThisRoom }}</template>
</MkSwitch>
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, ref, watch } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import * as os from '@/os.js';
import { ensureSignin } from '@/i.js';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import { useRouter } from '@/router.js';
const router = useRouter();
const $i = ensureSignin();
const props = defineProps<{
room: Misskey.entities.ChatRoom;
}>();
const isOwner = computed(() => {
return props.room.ownerId === $i.id;
});
const name_ = ref(props.room.name);
const description_ = ref(props.room.description);
function save() {
os.apiWithDialog('chat/rooms/update', {
roomId: props.room.id,
name: name_.value,
description: description_.value,
});
}
async function del() {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.tsx.deleteAreYouSure({ x: name_.value }),
});
if (canceled) return;
await os.apiWithDialog('chat/rooms/delete', {
roomId: props.room.id,
});
router.push('/chat');
}
const isMuted = ref(props.room.isMuted);
watch(isMuted, async () => {
await os.apiWithDialog('chat/rooms/mute', {
roomId: props.room.id,
mute: isMuted.value,
});
});
</script>
<style lang="scss" module>
.membership {
display: flex;
}
.membershipBody {
flex: 1;
min-width: 0;
margin-right: 8px;
&:hover {
text-decoration: none;
}
}
</style>