Skip to content

Commit

Permalink
Add tooltip to screen source names (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
streamer45 committed Nov 11, 2024
1 parent fefebc6 commit f64e911
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
10 changes: 9 additions & 1 deletion e2e/tests/desktop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test.describe('desktop', () => {
message: [
{id: '1', name: 'source_1', thumbnailURL},
{id: '2', name: 'source_2', thumbnailURL},
{id: '3', name: 'source_3', thumbnailURL},
{id: '3', name: 'very very very very very long source name', thumbnailURL},
],
},
window.location.origin);
Expand All @@ -113,9 +113,17 @@ test.describe('desktop', () => {
await page.locator('#calls-widget-menu-screenshare').click();
await expect(page.locator('#calls-screen-source-modal')).toBeVisible();
expect(await page.locator('#calls-screen-source-modal').screenshot()).toMatchSnapshot('calls-screen-source-modal.png');

// Verify tooltip shows correctly
await page.getByText('very very').hover();
await expect(page.locator('#tooltip-screen-source-name')).toBeVisible();
await expect(page.locator('#tooltip-screen-source-name')).toContainText('very very very very very long source name');

await page.locator('#calls-screen-source-modal button:has-text("source_2")').click();

await page.locator('#calls-screen-source-modal button:has-text("Share")').click();
await expect(page.locator('#calls-screen-source-modal')).toBeHidden();

await devPage.leaveCall();
});

Expand Down
15 changes: 13 additions & 2 deletions webapp/src/components/screen_source_modal/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './component.scss';

import {DesktopCaptureSource} from '@mattermost/desktop-api';
import React, {CSSProperties} from 'react';
import {OverlayTrigger, Tooltip} from 'react-bootstrap';
import {IntlShape} from 'react-intl';
import CompassIcon from 'src/components/icons/compassIcon';
import {logDebug, logErr} from 'src/log';
Expand Down Expand Up @@ -30,7 +31,7 @@ export default class ScreenSourceModal extends React.PureComponent<Props, State>
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
zIndex: 10000,
zIndex: 1000,
background: 'rgba(0, 0, 0, 0.64)',
},
modal: {
Expand Down Expand Up @@ -133,7 +134,17 @@ export default class ScreenSourceModal extends React.PureComponent<Props, State>
src={source.thumbnailURL}
/>
</div>
<span style={this.style.sourceLabel as CSSProperties}>{source.name}</span>

<OverlayTrigger
placement='bottom'
overlay={
<Tooltip id='tooltip-screen-source-name'>
{source.name}
</Tooltip>
}
>
<span style={this.style.sourceLabel as CSSProperties}>{source.name}</span>
</OverlayTrigger>
</button>
);
});
Expand Down

0 comments on commit f64e911

Please sign in to comment.