mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge pull request #1247 from sbenmoussati/SDA-3237-v3
Backward compatibility fix with SDA 9.2.0 and client 1.5
This commit is contained in:
commit
1386abcf62
@ -70,7 +70,8 @@ export default class NotificationComp extends React.Component<
|
|||||||
INotificationState
|
INotificationState
|
||||||
> {
|
> {
|
||||||
private readonly eventHandlers = {
|
private readonly eventHandlers = {
|
||||||
onClose: (winKey) => (_event: mouseEventButton) => this.close(winKey),
|
onClose: (winKey) => (_event: mouseEventButton) =>
|
||||||
|
this.close(_event, winKey),
|
||||||
onClick: (data) => (_event: mouseEventButton) => this.click(data),
|
onClick: (data) => (_event: mouseEventButton) => this.click(data),
|
||||||
onContextMenu: (event) => this.contextMenu(event),
|
onContextMenu: (event) => this.contextMenu(event),
|
||||||
onMouseEnter: (winKey) => (_event: mouseEventButton) =>
|
onMouseEnter: (winKey) => (_event: mouseEventButton) =>
|
||||||
@ -167,9 +168,13 @@ export default class NotificationComp extends React.Component<
|
|||||||
<div
|
<div
|
||||||
className={`close-button ${themeClassName}`}
|
className={`close-button ${themeClassName}`}
|
||||||
title={i18n.t('Close')()}
|
title={i18n.t('Close')()}
|
||||||
onClick={this.eventHandlers.onClose(id)}
|
|
||||||
>
|
>
|
||||||
<img src={closeImgFilePath} alt='close' />
|
<img
|
||||||
|
src={closeImgFilePath}
|
||||||
|
title={i18n.t('Close')()}
|
||||||
|
alt='close'
|
||||||
|
onClick={this.eventHandlers.onClose(id)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className='main-container'
|
className='main-container'
|
||||||
@ -308,7 +313,8 @@ export default class NotificationComp extends React.Component<
|
|||||||
*
|
*
|
||||||
* @param id {number}
|
* @param id {number}
|
||||||
*/
|
*/
|
||||||
private close(id: number): void {
|
private close(event: any, id: number): void {
|
||||||
|
event.stopPropagation();
|
||||||
ipcRenderer.send('close-notification', id);
|
ipcRenderer.send('close-notification', id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,10 +435,24 @@ export default class NotificationComp extends React.Component<
|
|||||||
*/
|
*/
|
||||||
private updateState(_event, data): void {
|
private updateState(_event, data): void {
|
||||||
const { color } = data;
|
const { color } = data;
|
||||||
data.color = this.isValidColor(color) ? color : '';
|
// FYI: 1.5 sends hex color but without '#', reason why we check and add prefix if necessary.
|
||||||
|
// Goal is to keep backward compatibility with 1.5 colors (SDA v. 9.2.0)
|
||||||
|
const isOldColor = /^([A-Fa-f0-9]{6})/.test(color);
|
||||||
|
data.color = isOldColor
|
||||||
|
? `#${color}`
|
||||||
|
: this.isValidColor(color)
|
||||||
|
? color
|
||||||
|
: '';
|
||||||
data.isInputHidden = true;
|
data.isInputHidden = true;
|
||||||
data.containerHeight = CONTAINER_HEIGHT;
|
data.containerHeight = CONTAINER_HEIGHT;
|
||||||
data.theme = data.theme ? data.theme : Themes.LIGHT;
|
// FYI: 1.5 doesn't send current theme. We need to deduce it from the color that is sent.
|
||||||
|
// Goal is to keep backward compatibility with 1.5 themes (SDA v. 9.2.0)
|
||||||
|
data.theme =
|
||||||
|
isOldColor && darkTheme.includes(data.color)
|
||||||
|
? Themes.DARK
|
||||||
|
: data.theme
|
||||||
|
? data.theme
|
||||||
|
: Themes.LIGHT;
|
||||||
this.resetNotificationData();
|
this.resetNotificationData();
|
||||||
this.setState(data as INotificationState);
|
this.setState(data as INotificationState);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
--notification-border-color: #717681;
|
--notification-border-color: #717681;
|
||||||
--button-color: #b0b3ba;
|
--button-color: #b0b3ba;
|
||||||
--button-border-color: #b0b3ba;
|
--button-border-color: #b0b3ba;
|
||||||
--button-border-color: #717681;
|
|
||||||
--button-hover-color: #cdcfd4;
|
--button-hover-color: #cdcfd4;
|
||||||
--button-hover-border-color: #cdcfd4;
|
--button-hover-border-color: #cdcfd4;
|
||||||
--button-hover-bg-color: #3a3d43;
|
--button-hover-bg-color: #3a3d43;
|
||||||
@ -62,6 +61,7 @@ body {
|
|||||||
line-height: 15px;
|
line-height: 15px;
|
||||||
&:hover > .close-button {
|
&:hover > .close-button {
|
||||||
display: block;
|
display: block;
|
||||||
|
z-index: 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-container {
|
.main-container {
|
||||||
|
Loading…
Reference in New Issue
Block a user