Skip to content

Commit

Permalink
Merge pull request #43 from InteropIO/bugfix/G4E-7363-notifications-p…
Browse files Browse the repository at this point in the history
…anel-is-not-hiding-every-time-when-auto-hide-panel-is-on

Bugfix/G4E-7363 notifications panel is not hiding every time when auto hide panel is on
  • Loading branch information
gdavidkov authored May 10, 2024
2 parents c1b9910 + f485efe commit 9736181
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
37 changes: 31 additions & 6 deletions js/connect-related.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ gluePromise.then((glue) => {
trackConnection();
trackNotificationCount();
trackWindowZoom();
trackNotificationPanelVisibilityChange();
});

function trackWindowZoom() {
Expand Down Expand Up @@ -201,6 +202,31 @@ async function trackDisplayChange() {
});
}

async function trackNotificationPanelVisibilityChange() {
const notificationPanel = q('#notification-panel');
const isPanelVisible = await glue.notifications.panel.isVisible();

if (isPanelVisible) {
notificationPanel.classList.add('app-active');
}

if (typeof glue.notifications.panel.onVisibilityChanged !== 'function') {
return;
}

const unSubscribe = glue.notifications.panel.onVisibilityChanged(
(isVisible) => {
if (isVisible) {
notificationPanel.classList.add('app-active');
} else {
notificationPanel.classList.remove('app-active');
}
}
);

return () => unSubscribe();
}

function windowCenter() {
glue.windows.my().center();
}
Expand Down Expand Up @@ -391,13 +417,12 @@ async function trackNotificationsConfigurationChange() {

async function openNotificationPanel() {
const glue = await gluePromise;
const isPanelVisible = await glue.notifications.panel.isVisible();
const panelApp = glue.windows.find(
'io-connect-notifications-panel-application'
);

if (isPanelVisible) {
await glue.notifications.panel.hide();
} else {
await glue.notifications.panel.show();
}
await glue.notifications.panel.show();
await panelApp.focus();
}

async function openFeedbackForm() {
Expand Down
5 changes: 3 additions & 2 deletions js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,15 @@ function handleDropDownClicks() {

async function handleNotificationClick() {
const enableNotifications = getSetting('enableNotifications');
const notificationPanel = q('#notification-panel');

if (enableNotifications) {
notificationEnabledObs.subscribe((data) => {
q('#notification-panel').classList[data ? 'remove' : 'add']('d-none');
notificationPanel.classList[data ? 'remove' : 'add']('d-none');
});
}

q('#notification-panel').addEventListener('click', (e) => {
notificationPanel.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
Expand Down
2 changes: 1 addition & 1 deletion scss/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scss/app.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scss/mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

@mixin divider($theme) {
&::before {
&::after {
@if $theme == "dark" {
background-color: rgba(255, 255, 255, 0.075);
} @else {
Expand All @@ -23,7 +23,7 @@
}

&:hover {
&::before {
&::after {
background-color: transparent;
}
}
Expand Down

0 comments on commit 9736181

Please sign in to comment.