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