when the screen is not wide to show details and activity tab, it won't scroll to unread notification

pull/9621/head
bsatarnejad 3 years ago
parent 6d9ae488b7
commit 851622f004
  1. 5
      frontend/src/app/core/browser/device.service.ts
  2. 4
      frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts

@ -3,8 +3,13 @@ import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class DeviceService {
public mobileWidthTreshold = 680;
public tabletWidthTreshold = 1249;
public get isMobile():boolean {
return (window.innerWidth < this.mobileWidthTreshold);
}
public get isTablet():boolean {
return (window.innerWidth < this.tabletWidthTreshold);
}
}

@ -39,6 +39,7 @@ import { InAppNotification } from 'core-app/features/in-app-notifications/store/
import { InAppNotificationsService } from 'core-app/features/in-app-notifications/store/in-app-notifications.service';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { DeviceService } from 'core-app/core/browser/device.service';
@Directive()
export class ActivityPanelBaseController extends UntilDestroyedMixin implements OnInit {
@ -74,6 +75,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
readonly $transition:Transition,
readonly wpActivity:WorkPackagesActivityService,
readonly ianService:InAppNotificationsService,
readonly deviceService:DeviceService,
) {
super();
@ -145,7 +147,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
protected scrollToUnreadNotification():void {
// scroll to the unread notification only if there is no deep link
if (window.location.href.indexOf('activity#') > -1) {
if (window.location.href.indexOf('activity#') > -1 || this.deviceService.isTablet) {
return;
}
const unreadNotifications = document.querySelectorAll('.comments-number--bubble');

Loading…
Cancel
Save