mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-21 16:38:41 -06:00
Add new layout of screen sharing indicator + update test
This commit is contained in:
parent
4dab0d66d5
commit
0d97cf2890
@ -4,24 +4,20 @@ exports[`screen sharing indicator should render correctly 1`] = `
|
||||
<div
|
||||
className="ScreenSharingIndicator mac"
|
||||
>
|
||||
<span
|
||||
className="drag-area"
|
||||
/>
|
||||
<span
|
||||
className="text-label"
|
||||
>
|
||||
You are sharing your screen on Symphony
|
||||
You are sharing your screen on
|
||||
<span
|
||||
className="text-label2"
|
||||
>
|
||||
|
||||
Symphony
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
className="buttons"
|
||||
>
|
||||
<a
|
||||
className="hide-button"
|
||||
href="#"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Hide
|
||||
</a>
|
||||
<button
|
||||
className="stop-sharing-button"
|
||||
onClick={[Function]}
|
||||
|
@ -16,7 +16,6 @@ describe('screen sharing indicator', () => {
|
||||
const onEventLabel = 'on';
|
||||
const removeListenerEventLabel = 'removeListener';
|
||||
const sendEventLabel = 'send';
|
||||
const symphonyAPIEventLabel = 'symphony-api';
|
||||
const screenSharingIndicatorDataEventLabel = 'screen-sharing-indicator-data';
|
||||
// state moked
|
||||
const screenSharingIndicatorStateMock = { id: 10 };
|
||||
@ -26,20 +25,6 @@ describe('screen sharing indicator', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should call `close` correctly', () => {
|
||||
const customSelector = 'a.hide-button';
|
||||
const closeIpcRendererMock = {
|
||||
cmd: 'close-window',
|
||||
windowType: 'screen-sharing-indicator',
|
||||
winKey: 'id-123',
|
||||
};
|
||||
const spy = jest.spyOn(ipcRenderer, sendEventLabel);
|
||||
const wrapper = shallow(React.createElement(ScreenSharingIndicator));
|
||||
wrapper.setState({ streamId: 'id-123' });
|
||||
wrapper.find(customSelector).simulate('click');
|
||||
expect(spy).lastCalledWith(symphonyAPIEventLabel, closeIpcRendererMock);
|
||||
});
|
||||
|
||||
it('should call `stopScreenShare` correctly', () => {
|
||||
const customSelector = 'button.stop-sharing-button';
|
||||
const stopScreenSharingEventLabel = 'stop-screen-sharing';
|
||||
|
@ -670,7 +670,7 @@ export class WindowHandler {
|
||||
// Set stream id as winKey to link stream to the window
|
||||
let opts = {
|
||||
...this.getWindowOpts({
|
||||
width: 620,
|
||||
width: 592,
|
||||
height: 48,
|
||||
show: false,
|
||||
modal: true,
|
||||
@ -681,6 +681,9 @@ export class WindowHandler {
|
||||
resizable: false,
|
||||
alwaysOnTop: true,
|
||||
fullscreenable: false,
|
||||
titleBarStyle: 'customButtonsOnHover',
|
||||
minimizable: false,
|
||||
maximizable: false,
|
||||
}, {
|
||||
devTools: false,
|
||||
}), ...{winKey: streamId},
|
||||
@ -688,9 +691,10 @@ export class WindowHandler {
|
||||
if (opts.width && opts.height) {
|
||||
opts = Object.assign({}, opts, {
|
||||
x: screenRect.x + Math.round((screenRect.width - opts.width) / 2),
|
||||
y: screenRect.y + screenRect.height - opts.height,
|
||||
y: screenRect.y + 16,
|
||||
});
|
||||
}
|
||||
|
||||
this.screenSharingIndicatorWindow = createComponentWindow('screen-sharing-indicator', opts);
|
||||
this.screenSharingIndicatorWindow.setVisibleOnAllWorkspaces(true);
|
||||
this.screenSharingIndicatorWindow.webContents.once('did-finish-load', () => {
|
||||
|
@ -37,12 +37,13 @@ export default class ScreenSharingIndicator extends React.Component<{}, IState>
|
||||
public render(): JSX.Element {
|
||||
const { id } = this.state;
|
||||
const namespace = 'ScreenSharingIndicator';
|
||||
|
||||
return (
|
||||
<div className={classNames('ScreenSharingIndicator', { mac: isMac })}>
|
||||
<span className='drag-area'/>
|
||||
<span className='text-label'>{i18n.t(`You are sharing your screen on {appName}`, namespace)({ appName: remote.app.getName() })}</span>
|
||||
<span className='text-label'>{(i18n.t(`You are sharing your screen on {appName}`, namespace)({ appName: remote.app.getName()})).replace(remote.app.getName(), '')}
|
||||
<span className='text-label2'> {remote.app.getName()}</span>
|
||||
</span>
|
||||
<span className='buttons'>
|
||||
<a className='hide-button' href='#' onClick={this.eventHandlers.onClose}>{i18n.t('Hide', namespace)()}</a>
|
||||
<button className='stop-sharing-button' onClick={this.eventHandlers.onStopScreenSharing(id)}>
|
||||
{i18n.t('Stop sharing', namespace)()}
|
||||
</button>
|
||||
|
@ -1,7 +1,7 @@
|
||||
@white: rgba(255,255,255, 1);
|
||||
@background: #6b717c;
|
||||
@button-color: #303237;
|
||||
@stop-sharing-background: #107ccc;
|
||||
@stop-sharing-background:#EE3D3D;
|
||||
@font: "system";
|
||||
|
||||
@font-face {
|
||||
@ -14,62 +14,56 @@ body {
|
||||
font-family: @font;
|
||||
font-size: 13px;
|
||||
padding: 0;
|
||||
margin: 10px;
|
||||
margin: 0px;
|
||||
user-select: none;
|
||||
-webkit-app-region: drag;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ScreenSharingIndicator {
|
||||
|
||||
.window-border {
|
||||
border: 2px solid rgba(68, 68, 68, 1);
|
||||
}
|
||||
|
||||
.buttons {
|
||||
float: right;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
background: #FFFFFF;
|
||||
width: 584px;
|
||||
height: 40px;
|
||||
border-radius: 24px;
|
||||
border: 4px solid @stop-sharing-background;
|
||||
|
||||
.stop-sharing-button {
|
||||
text-transform: uppercase;
|
||||
background: @stop-sharing-background;
|
||||
color: @white;
|
||||
border: none;
|
||||
font-size: inherit;
|
||||
border-radius: 14px;
|
||||
height: 28px;
|
||||
width: 152px;
|
||||
height: 32px;
|
||||
border-radius: 16px;
|
||||
position: absolute;
|
||||
left: 432px;
|
||||
top: 8px;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
text-align: center;
|
||||
|
||||
padding: 6px 14px;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.hide-button {
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
color: @background;
|
||||
margin-right: 29px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.text-label {
|
||||
position: relative;
|
||||
top: -2px;
|
||||
left: 16px;
|
||||
position: absolute;
|
||||
width: 281px;
|
||||
height: 17px;
|
||||
left: 24px;
|
||||
top: 16px;
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.drag-area {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 22px;
|
||||
position: relative;
|
||||
cursor: move;
|
||||
top: 3px;
|
||||
text-transform: uppercase;
|
||||
background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 1px, rgba(0, 0, 0, 0.12) 1px, rgba(0, 0, 0, 0.12) 2px);
|
||||
.text-label2 {
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
.mac {
|
||||
|
Loading…
Reference in New Issue
Block a user