From 732d8ca303e67ad4c54e4134866140f692a624f6 Mon Sep 17 00:00:00 2001 From: Bullish Bear <136302410+foodstr@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:03:12 +0800 Subject: [PATCH] view group chat profile (#260) --- UI/app_update.tsx | 16 +++++++++++----- UI/dm.tsx | 18 ++++++++++++++++++ UI/message-panel.tsx | 2 +- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/UI/app_update.tsx b/UI/app_update.tsx index 38663cf..b133159 100644 --- a/UI/app_update.tsx +++ b/UI/app_update.tsx @@ -292,17 +292,23 @@ export async function* UI_Interaction_Update(args: { } model.rightPanelModel.show = true; } else if (event.type == "ViewUserDetail") { - if ( - model.navigationModel.activeNav == "DM" - ) { - if (model.dm.currentEditor) { + if (model.dm.currentEditor) { + const currentFocus = model.dm.focusedContent.get(model.dm.currentEditor.pubkey.hex); + if ( + model.rightPanelModel.show == true && + currentFocus instanceof PublicKey && + currentFocus.hex == event.pubkey.hex && + currentFocus.hex == model.dm.currentEditor.pubkey.hex + ) { + model.rightPanelModel.show = false; + } else { model.dm.focusedContent.set( model.dm.currentEditor.pubkey.hex, event.pubkey, ); + model.rightPanelModel.show = true; } } - model.rightPanelModel.show = true; } else if (event.type == "ViewNoteThread") { let root: NostrEvent = event.event; const tags = getTags(event.event); diff --git a/UI/dm.tsx b/UI/dm.tsx index 717c698..f0ea713 100644 --- a/UI/dm.tsx +++ b/UI/dm.tsx @@ -23,6 +23,7 @@ import { ChatMessage } from "./message.ts"; import { EditorModel } from "./editor.tsx"; import { InviteButton } from "./invite-button.tsx"; import { IS_BETA_VERSION } from "./config.js"; +import { UserIcon } from "./icons2/user-icon.tsx"; export type DM_Model = { currentEditor: EditorModel | undefined; @@ -86,6 +87,23 @@ export function DirectMessageContainer(props: DirectMessageContainerProps) { let buttons = []; if (currentEditor && IS_BETA_VERSION) { if (props.isGroupMessage) { + buttons.push( + , + ); + const canEditGroupProfile = props.groupChatController.getGroupAdminCtx(currentEditor.pubkey); if (canEditGroupProfile) { buttons.push( diff --git a/UI/message-panel.tsx b/UI/message-panel.tsx index 419eb82..32e0fe3 100644 --- a/UI/message-panel.tsx +++ b/UI/message-panel.tsx @@ -274,7 +274,7 @@ export class MessageList extends Component { />