1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

refactoring

This commit is contained in:
Andrew Simachev 2025-04-11 13:22:19 +02:00
parent 1935e97820
commit 7c804d72bb
No known key found for this signature in database
GPG key ID: 1DFE44B21443F0EF
3 changed files with 8 additions and 13 deletions

View file

@ -657,18 +657,14 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
this.scrolledItems = [];
};
getMessageScrollOffset (id: string) {
getMessageScrollOffset (id: string): number {
const ref = this.messageRefs[id];
if (!ref) {
return;
return 0;
};
const node = $(ref.node);
if (!node.length) {
return;
};
return node.offset().top + node.outerHeight();
return node.length ? node.offset().top + node.outerHeight() : 0;
};
getMessagesInViewport () {

View file

@ -87,9 +87,8 @@ const ChatForm = observer(class ChatForm extends React.Component<Props, State> {
};
render () {
const { rootId, subId, readonly, getReplyContent, getMessagesInViewport } = this.props;
const { subId, readonly, getReplyContent } = this.props;
const { attachments, charCounter, isBottom } = this.state;
const { space } = S.Common;
const value = this.getTextValue();
const { messageCounter } = S.Chat.getState(subId);

View file

@ -30,7 +30,7 @@ const VaultItem: FC<Props> = observer(({
};
let icon = null;
let counterText = null;
let cnt = null;
if (!item.isButton) {
icon = <IconObject object={item} size={36} iconSize={36} />;
@ -39,10 +39,10 @@ const VaultItem: FC<Props> = observer(({
};
if (counters.mentionCounter) {
counterText = '@';
cnt = '@';
} else
if (counters.messageCounter) {
counterText = counters.messageCounter;
cnt = counters.messageCounter;
};
return (
@ -60,7 +60,7 @@ const VaultItem: FC<Props> = observer(({
>
<div className="iconWrap">
{icon}
{counterText ? <div className="cnt">{counterText}</div> : ''}
{cnt ? <div className="cnt">{cnt}</div> : ''}
</div>
</div>
);