fix: app start password window crash

pull/3071/head
Audric Ackermann 1 year ago
parent 9505407fc4
commit f304a5239f

@ -30,8 +30,9 @@ export const SessionScrollButton = (props: { onClickScrollBottom: () => void })
isHidden={!show} isHidden={!show}
onClick={props.onClickScrollBottom} onClick={props.onClickScrollBottom}
dataTestId="scroll-to-bottom-button" dataTestId="scroll-to-bottom-button"
unreadCount={unreadCount} >
/> {Boolean(unreadCount) && <SessionUnreadCount count={unreadCount} />}
</SessionIconButton>
</SessionScrollButtonDiv> </SessionScrollButtonDiv>
); );
}; };

@ -2,12 +2,10 @@ import classNames from 'classnames';
import _ from 'lodash'; import _ from 'lodash';
import React, { KeyboardEvent } from 'react'; import React, { KeyboardEvent } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { SessionIcon, SessionIconProps } from '.'; import { SessionIcon, SessionIconProps } from './SessionIcon';
import { SessionNotificationCount, SessionUnreadCount } from './SessionNotificationCount';
interface SProps extends SessionIconProps { interface SProps extends SessionIconProps {
onClick?: (e?: React.MouseEvent<HTMLButtonElement>) => void; onClick?: (e?: React.MouseEvent<HTMLButtonElement>) => void;
notificationCount?: number;
isSelected?: boolean; isSelected?: boolean;
isHidden?: boolean; isHidden?: boolean;
margin?: string; margin?: string;
@ -16,6 +14,7 @@ interface SProps extends SessionIconProps {
id?: string; id?: string;
style?: object; style?: object;
tabIndex?: number; tabIndex?: number;
children?: React.ReactNode;
} }
const StyledSessionIconButton = styled.button<{ color?: string; isSelected?: boolean }>` const StyledSessionIconButton = styled.button<{ color?: string; isSelected?: boolean }>`
@ -46,7 +45,6 @@ const SessionIconButtonInner = React.forwardRef<HTMLButtonElement, SProps>((prop
iconColor, iconColor,
iconRotation, iconRotation,
isSelected, isSelected,
notificationCount,
glowDuration, glowDuration,
glowStartDelay, glowStartDelay,
noScale, noScale,
@ -60,7 +58,7 @@ const SessionIconButtonInner = React.forwardRef<HTMLButtonElement, SProps>((prop
dataTestIdIcon, dataTestIdIcon,
style, style,
tabIndex, tabIndex,
unreadCount, children,
} = props; } = props;
const clickHandler = (e: React.MouseEvent<HTMLButtonElement>) => { const clickHandler = (e: React.MouseEvent<HTMLButtonElement>) => {
if (props.onClick) { if (props.onClick) {
@ -101,8 +99,7 @@ const SessionIconButtonInner = React.forwardRef<HTMLButtonElement, SProps>((prop
iconPadding={iconPadding} iconPadding={iconPadding}
dataTestId={dataTestIdIcon} dataTestId={dataTestIdIcon}
/> />
{Boolean(notificationCount) && <SessionNotificationCount count={notificationCount} />} {children}
{Boolean(unreadCount) && <SessionUnreadCount count={unreadCount} />}
</StyledSessionIconButton> </StyledSessionIconButton>
); );
}); });

@ -33,7 +33,7 @@ import { getSwarmPollingInstance } from '../../session/apis/snode_api';
import { UserUtils } from '../../session/utils'; import { UserUtils } from '../../session/utils';
import { Avatar, AvatarSize } from '../avatar/Avatar'; import { Avatar, AvatarSize } from '../avatar/Avatar';
import { ActionPanelOnionStatusLight } from '../dialog/OnionStatusPathDialog'; import { ActionPanelOnionStatusLight } from '../dialog/OnionStatusPathDialog';
import { SessionIconButton } from '../icon'; import { SessionIconButton } from '../icon/SessionIconButton';
import { LeftPaneSectionContainer } from './LeftPaneSectionContainer'; import { LeftPaneSectionContainer } from './LeftPaneSectionContainer';
import { SettingsKey } from '../../data/settings-key'; import { SettingsKey } from '../../data/settings-key';
@ -48,6 +48,7 @@ import { ensureThemeConsistency } from '../../themes/SessionTheme';
import { switchThemeTo } from '../../themes/switchTheme'; import { switchThemeTo } from '../../themes/switchTheme';
import { ReleasedFeatures } from '../../util/releaseFeature'; import { ReleasedFeatures } from '../../util/releaseFeature';
import { getOppositeTheme } from '../../util/theme'; import { getOppositeTheme } from '../../util/theme';
import { SessionNotificationCount } from '../icon/SessionNotificationCount';
const Section = (props: { type: SectionType }) => { const Section = (props: { type: SectionType }) => {
const ourNumber = useSelector(getOurNumber); const ourNumber = useSelector(getOurNumber);
@ -103,10 +104,11 @@ const Section = (props: { type: SectionType }) => {
iconSize="medium" iconSize="medium"
dataTestId="message-section" dataTestId="message-section"
iconType={'chatBubble'} iconType={'chatBubble'}
notificationCount={unreadToShow}
onClick={handleClick} onClick={handleClick}
isSelected={isSelected} isSelected={isSelected}
/> >
{Boolean(unreadToShow) && <SessionNotificationCount count={unreadToShow} />}
</SessionIconButton>
); );
case SectionType.Settings: case SectionType.Settings:
return ( return (

Loading…
Cancel
Save