do not render typing animation at all if not typing

pull/1839/head
audric 4 years ago
parent 01ff290f85
commit c58312e853

@ -49,7 +49,6 @@ window.isBehindProxy = () => Boolean(config.proxyUrl);
window.getStoragePubKey = key => (window.isDev() ? key.substring(2) : key); window.getStoragePubKey = key => (window.isDev() ? key.substring(2) : key);
window.getDefaultFileServer = () => config.defaultFileServer; window.getDefaultFileServer = () => config.defaultFileServer;
window.initialisedAPI = false;
window.lokiFeatureFlags = { window.lokiFeatureFlags = {
useOnionRequests: true, useOnionRequests: true,

@ -1,40 +1,29 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
interface Props { export const TypingAnimation = () => {
color?: string; return (
} <div className="module-typing-animation" title={window.i18n('typingAlt')}>
<div
export class TypingAnimation extends React.Component<Props> { className={classNames(
public render() { 'module-typing-animation__dot',
const { color } = this.props; 'module-typing-animation__dot--first'
)}
return ( />
<div className="module-typing-animation" title={window.i18n('typingAlt')}> <div className="module-typing-animation__spacer" />
<div <div
className={classNames( className={classNames(
'module-typing-animation__dot', 'module-typing-animation__dot',
'module-typing-animation__dot--first', 'module-typing-animation__dot--second'
color ? `module-typing-animation__dot--${color}` : null )}
)} />
/> <div className="module-typing-animation__spacer" />
<div className="module-typing-animation__spacer" /> <div
<div className={classNames(
className={classNames( 'module-typing-animation__dot',
'module-typing-animation__dot', 'module-typing-animation__dot--third'
'module-typing-animation__dot--second', )}
color ? `module-typing-animation__dot--${color}` : null />
)} </div>
/> );
<div className="module-typing-animation__spacer" /> };
<div
className={classNames(
'module-typing-animation__dot',
'module-typing-animation__dot--third',
color ? `module-typing-animation__dot--${color}` : null
)}
/>
</div>
);
}
}

@ -29,6 +29,10 @@ export const TypingBubble = (props: TypingBubbleProps) => {
return <></>; return <></>;
} }
if (!props.isTyping) {
return null;
}
return ( return (
<TypingBubbleContainer {...props}> <TypingBubbleContainer {...props}>
<TypingAnimation /> <TypingAnimation />

@ -3,6 +3,7 @@ import classNames from 'classnames';
import { SessionIcon, SessionIconProps } from '../icon'; import { SessionIcon, SessionIconProps } from '../icon';
import { SessionNotificationCount } from '../SessionNotificationCount'; import { SessionNotificationCount } from '../SessionNotificationCount';
import { DefaultTheme, useTheme } from 'styled-components'; import { DefaultTheme, useTheme } from 'styled-components';
import _ from 'lodash';
interface SProps extends SessionIconProps { interface SProps extends SessionIconProps {
onClick?: any; onClick?: any;
@ -12,7 +13,7 @@ interface SProps extends SessionIconProps {
isHidden?: boolean; isHidden?: boolean;
} }
export const SessionIconButton = (props: SProps) => { const SessionIconButtonInner = (props: SProps) => {
const { const {
iconType, iconType,
iconSize, iconSize,
@ -56,3 +57,5 @@ export const SessionIconButton = (props: SProps) => {
</div> </div>
); );
}; };
export const SessionIconButton = React.memo(SessionIconButtonInner, _.isEqual);

Loading…
Cancel
Save