diff --git a/web/src/components/ChatList.tsx b/web/src/components/ChatList.tsx index 506bed5..ba4d53e 100644 --- a/web/src/components/ChatList.tsx +++ b/web/src/components/ChatList.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from "react"; +import { createPortal } from "react-dom"; import { deleteChat } from "../api/chats"; import { updateMyProfile } from "../api/users"; import { useAuthStore } from "../store/authStore"; @@ -26,7 +27,7 @@ export function ChatList() { const [profileError, setProfileError] = useState(null); const [profileSaving, setProfileSaving] = useState(false); const deleteModalChat = chats.find((chat) => chat.id === deleteModalChatId) ?? null; - const canDeleteForEveryone = Boolean(deleteModalChat && !deleteModalChat.is_saved && deleteModalChat.type !== "private"); + const canDeleteForEveryone = Boolean(deleteModalChat && !deleteModalChat.is_saved && deleteModalChat.type === "group"); useEffect(() => { const timer = setTimeout(() => { @@ -115,7 +116,7 @@ export function ChatList() {
-

{chat.display_title || chat.title || `${chat.type} #${chat.id}`}

+

{chatLabel(chat)}

{messagesByChat[chat.id]?.length ? "now" : ""} @@ -128,26 +129,32 @@ export function ChatList() {
- {ctxChatId && ctxPos ? ( -
e.stopPropagation()}> - -
- ) : null} + {ctxChatId && ctxPos + ? createPortal( +
e.stopPropagation()}> + +
, + document.body + ) + : null} {deleteModalChatId ? (
-

Delete chat #{deleteModalChatId}

+

Delete chat: {deleteModalChat ? chatLabel(deleteModalChat) : "selected chat"}

+ {deleteModalChat?.type === "channel" ? ( +

Channels are removed for all subscribers.

+ ) : null} {canDeleteForEveryone ? (