Bot Info: Fix logic preventing it from showing up (#5828)
This commit is contained in:
parent
3167a36d84
commit
d21af3b5d7
@ -13,6 +13,7 @@
|
||||
flex-direction: column;
|
||||
|
||||
font-size: calc(var(--message-text-size, 1rem) - 0.0625rem);
|
||||
font-weight: var(--font-weight-normal);
|
||||
border-radius: var(--border-radius-messages);
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
|
||||
@ -3,7 +3,6 @@ import React, {
|
||||
memo,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
} from '../../lib/teact/teact';
|
||||
import { getActions, getGlobal, withGlobal } from '../../global';
|
||||
|
||||
@ -30,12 +29,10 @@ import { getCountryCodeByIso } from '../../util/phoneNumber';
|
||||
import stopEvent from '../../util/stopEvent';
|
||||
import renderText from '../common/helpers/renderText';
|
||||
|
||||
import useEffectOnce from '../../hooks/useEffectOnce';
|
||||
import useLang from '../../hooks/useLang';
|
||||
import useLastCallback from '../../hooks/useLastCallback';
|
||||
import useMedia from '../../hooks/useMedia';
|
||||
import useOldLang from '../../hooks/useOldLang';
|
||||
import useShowTransition from '../../hooks/useShowTransition';
|
||||
|
||||
import AvatarList from '../common/AvatarList';
|
||||
import Icon from '../common/icons/Icon';
|
||||
@ -65,7 +62,6 @@ const MessageListAccountInfo: FC<OwnProps & StateProps> = ({
|
||||
chatId,
|
||||
botInfo,
|
||||
isLoadingFullUser,
|
||||
isInMessageList,
|
||||
phoneCodeList,
|
||||
commonChats,
|
||||
userFullInfo,
|
||||
@ -168,25 +164,8 @@ const MessageListAccountInfo: FC<OwnProps & StateProps> = ({
|
||||
return entries;
|
||||
}, [lang, oldLang, country, registrationMonth, commonChats, userFullInfo]);
|
||||
|
||||
const isEmptyOrLoading = (isBotInfoEmpty && isChatInfoEmpty) || isLoadingFullUser;
|
||||
|
||||
const isFirstRenderRef = useRef(true);
|
||||
const {
|
||||
shouldRender,
|
||||
ref,
|
||||
} = useShowTransition({
|
||||
isOpen: !isEmptyOrLoading && isInMessageList,
|
||||
withShouldRender: true,
|
||||
});
|
||||
|
||||
useEffectOnce(() => {
|
||||
isFirstRenderRef.current = false;
|
||||
});
|
||||
|
||||
if (!shouldRender) return undefined;
|
||||
|
||||
return (
|
||||
<div ref={ref} className={buildClassName(styles.root, 'empty')}>
|
||||
<div className={buildClassName(styles.root, 'empty')}>
|
||||
{isLoadingFullUser && isChatInfoEmpty && <span>{oldLang('Loading')}</span>}
|
||||
{(isBotInfoEmpty && isChatInfoEmpty) && !isLoadingFullUser && <span>{oldLang('NoMessages')}</span>}
|
||||
{botInfo && (
|
||||
|
||||
@ -372,7 +372,7 @@ const MessageListContent: FC<OwnProps> = ({
|
||||
<div className="messages-container" teactFastList>
|
||||
{withHistoryTriggers && <div ref={backwardsTriggerRef} key="backwards-trigger" className="backwards-trigger" />}
|
||||
{shouldRenderAccountInfo
|
||||
&& <MessageListAccountInfo isInMessageList key={`account_info_${chatId}`} chatId={chatId} />}
|
||||
&& <MessageListAccountInfo key={`account_info_${chatId}`} chatId={chatId} />}
|
||||
{dateGroups.flat()}
|
||||
{withHistoryTriggers && (
|
||||
<div
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user