From 37ce1aed50ba2c63f33b9c5ef2784abaf1b9120a Mon Sep 17 00:00:00 2001 From: Last2014 Date: Sat, 6 Jun 2026 00:17:55 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20undefined=E5=8F=82=E7=85=A7=20/=20Chg:?= =?UTF-8?q?=20=E3=82=B3=E3=83=9F=E3=83=A5=E3=83=8B=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=92=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3=E3=83=88=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/src/components/CommunityMenu.vue | 115 ++++++++++++++++++ .../frontend/src/routes/community/channel.vue | 3 +- .../frontend/src/routes/community/index.vue | 96 ++------------- 3 files changed, 125 insertions(+), 89 deletions(-) create mode 100644 packages/frontend/src/components/CommunityMenu.vue diff --git a/packages/frontend/src/components/CommunityMenu.vue b/packages/frontend/src/components/CommunityMenu.vue new file mode 100644 index 0000000..04a1ca6 --- /dev/null +++ b/packages/frontend/src/components/CommunityMenu.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/packages/frontend/src/routes/community/channel.vue b/packages/frontend/src/routes/community/channel.vue index 96cc535..9a849e7 100644 --- a/packages/frontend/src/routes/community/channel.vue +++ b/packages/frontend/src/routes/community/channel.vue @@ -334,7 +334,8 @@ const send = async (e: Event) => { await new Promise(resolve => setTimeout(resolve, 0)); const messagesElem = document.querySelector(".messages")!; - messagesElem.scrollTop = messagesElem.scrollHeight; + if (messagesElem) + messagesElem.scrollTop = messagesElem.scrollHeight; } const deleteMessage = (data: { id: string }) => { diff --git a/packages/frontend/src/routes/community/index.vue b/packages/frontend/src/routes/community/index.vue index ee693ff..c23639e 100644 --- a/packages/frontend/src/routes/community/index.vue +++ b/packages/frontend/src/routes/community/index.vue @@ -27,19 +27,12 @@ /> - + />
div { - display: flex; - cursor: pointer; - width: 100%; - height: calc(1rlh + calc(0.75rem * 2)); - box-sizing: border-box; - padding: 0.75rem 1rem; - gap: 0.25rem; -} - -.menu > div:hover { - background-color: var(--bg-color); -} - -.menu > div > svg { - width: 1rlh; - height: 1rlh; - margin: auto 0; -} - .community { height: 100%; display: flex; @@ -262,14 +218,14 @@ import Progress from "@/components/Progress.vue"; import { title } from "@/lib/router"; import type ApiMap from "lynqchat-js/1.0.0-alpha.0/map"; import { Icon } from "@iconify/vue"; -import CreateChannel from "@/components/Modal/CreateChannel.vue"; +import CommunityMenu from "@/components/CommunityMenu.vue"; const route = useRoute(); const router = useRouter(); const isProcessing = ref(false); const isMenuOpen = ref(false); -const menuElem = ref(null); +const menuElem = ref | null>(null); const isChannelsLoading = ref(false); const channels = ref["channels"]>(); @@ -293,7 +249,7 @@ if (!account.value?.success) { } const handleOutsideClick = (event: any) => { - if (menuElem.value && !menuElem.value.contains(event.target)) { + if (menuElem.value?.menuElem && !menuElem.value.menuElem.contains(event.target)) { isMenuOpen.value = false; } } @@ -311,42 +267,6 @@ onBeforeUnmount(() => { window.removeEventListener("click", handleOutsideClick); }); -const createChannel = () => { - isMenuOpen.value = false; - - const communityId = route.params.communityId; - if (typeof communityId !== "string") { - isProcessing.value = false; - createModal({ - component: GoHomeError, - onClose: async () => await router.push("/"), - props: { - error: "不正なアクセスです。", - }, - }); - return; - } - - createModal({ - component: CreateChannel, - onClose: (result: "success" | "cancel") => { - if (result === "success") { - loadChannels(communityId); - } - }, - props: { - community: communityId, - }, - }); -} - -const menuContents = [ - { - name: "チャンネルを作成", - icon: "add-2-rounded", - onClick: createChannel, - }, -]; const changeMenu = () => { isMenuOpen.value = !isMenuOpen.value; }