(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;
}