view group chat profile (#260)

This commit is contained in:
Bullish Bear 2023-10-24 17:03:12 +08:00 committed by GitHub
parent b3cee30602
commit 732d8ca303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 6 deletions

View File

@ -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);

View File

@ -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(
<button
class={tw`w-8 h-8 ${CenterClass}`}
onClick={() => {
props.bus.emit({
type: "ViewUserDetail",
pubkey: currentEditor.pubkey,
});
}}
>
<UserIcon
class={tw`w-6 h-6 text-[${PrimaryTextColor}] stroke-current`}
style={{ fill: "none" }}
/>
</button>,
);
const canEditGroupProfile = props.groupChatController.getGroupAdminCtx(currentEditor.pubkey);
if (canEditGroupProfile) {
buttons.push(

View File

@ -274,7 +274,7 @@ export class MessageList extends Component<MessageListProps, MessageListState> {
/>
</button>
<ul
class={tw`w-full h-full overflow-y-auto overflow-x-hidden py-8 px-2 flex flex-col-reverse`}
class={tw`w-full h-full overflow-y-auto overflow-x-hidden py-9 px-2 flex flex-col-reverse`}
ref={this.messagesULElement}
onScroll={this.onScroll}
>