[MM-53491] Fix rendering of active call icon in sidebar's channel link (#27172)

Automatic Merge
Этот коммит содержится в:
Claudio Costa
2024-06-14 18:41:30 +02:00
коммит произвёл GitHub
родитель 1fd346f28e
Коммит 958a403537
3 изменённых файлов: 14 добавлений и 28 удалений

Просмотреть файл

@@ -198,16 +198,12 @@ exports[`components/sidebar/sidebar_channel/sidebar_channel_link should match sn
"focus", "focus",
] ]
} }
>
<div
className="truncated"
> >
<span <span
className="SidebarChannelLinkLabel" className="SidebarChannelLinkLabel"
> >
channel_label channel_label
</span> </span>
</div>
</OverlayTrigger> </OverlayTrigger>
<Connect(Pluggable) <Connect(Pluggable)
channel={ channel={

Просмотреть файл

@@ -80,13 +80,11 @@ type State = {
export default class SidebarChannelLink extends React.PureComponent<Props, State> { export default class SidebarChannelLink extends React.PureComponent<Props, State> {
labelRef: React.RefObject<HTMLDivElement>; labelRef: React.RefObject<HTMLDivElement>;
gmItemRef: React.RefObject<HTMLDivElement>;
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
this.labelRef = React.createRef(); this.labelRef = React.createRef();
this.gmItemRef = React.createRef();
this.state = { this.state = {
isMenuOpen: false, isMenuOpen: false,
@@ -105,7 +103,7 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
} }
enableToolTipIfNeeded = (): void => { enableToolTipIfNeeded = (): void => {
const element = this.gmItemRef.current || this.labelRef.current; const element = this.labelRef.current;
const showTooltip = element && element.offsetWidth < element.scrollWidth; const showTooltip = element && element.offsetWidth < element.scrollWidth;
this.setState({showTooltip: Boolean(showTooltip)}); this.setState({showTooltip: Boolean(showTooltip)});
}; };
@@ -133,7 +131,7 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
}; };
// Bootstrap adds the attr dynamically, removing it to prevent a11y readout // Bootstrap adds the attr dynamically, removing it to prevent a11y readout
removeTooltipLink = (): void => this.gmItemRef.current?.removeAttribute?.('aria-describedby'); removeTooltipLink = (): void => this.labelRef.current?.removeAttribute?.('aria-describedby');
handleChannelClick = (event: React.MouseEvent<HTMLAnchorElement>): void => { handleChannelClick = (event: React.MouseEvent<HTMLAnchorElement>): void => {
mark(Mark.ChannelLinkClicked); mark(Mark.ChannelLinkClicked);
@@ -195,7 +193,10 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
} }
let labelElement: JSX.Element = ( let labelElement: JSX.Element = (
<span className='SidebarChannelLinkLabel'> <span
ref={this.labelRef}
className='SidebarChannelLinkLabel'
>
{wrapEmojis(label)} {wrapEmojis(label)}
</span> </span>
); );
@@ -211,13 +212,8 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
placement='top' placement='top'
overlay={displayNameToolTip} overlay={displayNameToolTip}
onEntering={this.removeTooltipLink} onEntering={this.removeTooltipLink}
>
<div
className='truncated'
ref={this.gmItemRef}
> >
{labelElement} {labelElement}
</div>
</OverlayTrigger> </OverlayTrigger>
); );
} }
@@ -231,7 +227,6 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
}} }}
emojiStyle={{ emojiStyle={{
marginTop: -4, marginTop: -4,
marginLeft: 6,
marginBottom: 0, marginBottom: 0,
opacity: 0.8, opacity: 0.8,
}} }}
@@ -246,7 +241,6 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
/> />
<div <div
className='SidebarChannelLinkLabel_wrapper' className='SidebarChannelLinkLabel_wrapper'
ref={this.labelRef}
> >
{labelElement} {labelElement}
{customStatus} {customStatus}

Просмотреть файл

@@ -1132,10 +1132,12 @@ $sidebarOpacityAnimationDuration: 0.15s;
} }
& span.SidebarChannelLinkLabel { & span.SidebarChannelLinkLabel {
overflow: hidden;
max-width: 100%; max-width: 100%;
height: 18px; height: 18px;
line-height: 18px; line-height: 18px;
text-align: justify; text-align: justify;
text-overflow: ellipsis;
user-select: none; user-select: none;
white-space: nowrap; white-space: nowrap;
} }
@@ -1298,13 +1300,7 @@ $sidebarOpacityAnimationDuration: 0.15s;
display: flex; display: flex;
overflow: hidden; overflow: hidden;
flex-grow: 1; flex-grow: 1;
} gap: 8px;
.SidebarChannelLinkLabel_wrapper > div.truncated {
display: block;
overflow: hidden;
width: 100%;
text-overflow: ellipsis;
} }
.DirectChannel__profile-picture { .DirectChannel__profile-picture {