8000 Feature/JS-6534: More button logic by mhlv · Pull Request #1353 · anyproto/anytype-ts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feature/JS-6534: More button logic #1353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions src/ts/component/block/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,29 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
<Label text={date} />
</div>

{(item.list || []).map(item => (
<Message
ref={ref => this.messageRefs[item.id] = ref}
key={item.id}
{...this.props}
id={item.id}
rootId={rootId}
blockId={blockId}
subId={subId}
isNew={item.orderId == this.firstUnreadOrderId}
scrollToBottom={this.scrollToBottomCheck}
=> this.onContextMenu(e, item)}
=> this.onContextMenu(e, item, true)}
=> this.onReplyEdit(e, item)}
=> this.onReplyClick(e, item)}
getReplyContent={this.getReplyContent}
/>
))}
{(item.list || []).map(item => {
const hasMore = !!this.getMessageMenuOptions(item, true).length;

return (
<Message
ref={ref => this.messageRefs[item.id] = ref}
key={item.id}
{...this.props}
id={item.id}
rootId={rootId}
blockId={blockId}
subId={subId}
isNew={item.orderId == this.firstUnreadOrderId}
hasMore={hasMore}
scrollToBottom={this.scrollToBottomCheck}
=> this.onContextMenu(e, item)}
=> this.onContextMenu(e, item, true)}
=> this.onReplyEdit(e, item)}
=> this.onReplyClick(e, item)}
getReplyContent={this.getReplyContent}
/>
);
})}
</div>
);
};
Expand Down Expand Up @@ -714,8 +719,8 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
options = ([
{ id: 'reaction',icon: 'reaction', name: translate('blockChatReactionAdd') },
{ id: 'reply',icon: 'reply', name: translate('blockChatReply') },
{ isDiv: true },
]).concat(options);
options.length ? { isDiv: true } : null,
].filter(it => it)).concat(options);
};

if (S.Common.config.experimental) {
Expand Down
4 changes: 2 additions & 2 deletions src/ts/component/block/chat/message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ChatMessage = observer(class ChatMessage extends React.Component<I.ChatMes
};

render () {
const { rootId, id, isNew, readonly, subId, scrollToBottom, onContextMenu, onMore, onReplyEdit } = this.props;
const { rootId, id, isNew, readonly, subId, hasMore, scrollToBottom, onContextMenu, onMore, onReplyEdit } = this.props;
const { space } = S.Common;
const { account } = S.Auth;
const message = S.Chat.getMessage(subId, id);
Expand Down Expand Up @@ -205,7 +205,7 @@ const ChatMessage = observer(class ChatMessage extends React.Component<I.ChatMes
<div className="controls">
{!hasReactions && canAddReaction ? <Icon id="reaction-add" className="reactionAdd" tooltipParam={{ text: translate('blockChatReactionAdd') }} /> : ''}
<Icon id="message-reply" className="messageReply" tooltipParam={{ text: translate('blockChatReply') }} />
<Icon className="more" />
{hasMore ? <Icon className="more" /> : '' }
</div>
) : ''}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/ts/interface/block/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface ChatMessageComponent extends I.BlockComponent {
blockId: string;
id: string;
isNew: boolean;
hasMore: boolean;
subId: string
scrollToBottom?: () => void;
onContextMenu: (e: any) => void;
Expand All @@ -71,4 +72,4 @@ export interface ChatMessageComponent extends I.BlockComponent {
getReplyContent: (message: any) => any;
};

export interface BlockChat extends I.Block {};
export interface BlockChat extends I.Block {};
0