Skip to content

Commit

Permalink
build: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaSch0212 committed Jun 22, 2024
1 parent efadfda commit cbda2e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 12 additions & 2 deletions src/client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,24 @@
"inject": false
}
],
"scripts": []
"scripts": [],
"externalDependencies": ["http", "https", "url", "util", "net"],
"allowedCommonJsDependencies": [
"copy-to-clipboard",
"tough-cookie",
"node-fetch",
"fetch-cookie",
"abort-controller",
"ws",
"eventsource"
]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "600kb",
"maximumWarning": "800kb",
"maximumError": "1mb"
},
{
Expand Down
14 changes: 8 additions & 6 deletions src/client/src/app/components/app/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ButtonModule } from 'primeng/button';
import { MenuModule } from 'primeng/menu';
import { MenubarModule } from 'primeng/menubar';
import { TooltipModule } from 'primeng/tooltip';
import { fromEvent, merge, startWith } from 'rxjs';
import { filter, fromEvent, map, merge } from 'rxjs';

import { selectAppTitle } from '../../../+state/app';
import { AuthService } from '../../../services/auth.service';
Expand Down Expand Up @@ -39,8 +39,6 @@ export class MenuComponent {
private readonly _swUpdate = inject(SwUpdate);
private readonly _realtimeEventsService = inject(RealtimeEventsService);

private readonly _versionInfo = toSignal(this._swUpdate.versionUpdates);

protected readonly translations = this._translateService.translations;
protected readonly title = chainSignals(this._store.selectSignal(selectAppTitle), title =>
computed(() =>
Expand All @@ -51,8 +49,12 @@ export class MenuComponent {
protected readonly isAdmin = computed(
() => this._authService.user()?.roles.includes('admin') ?? false
);
protected readonly newVersionAvailable = computed(
() => this._versionInfo()?.type === 'VERSION_READY'
protected readonly newVersionAvailable = toSignal(
this._swUpdate.versionUpdates.pipe(
filter(x => x.type === 'VERSION_READY'),
map(() => true)
),
{ initialValue: false }
);

protected readonly menuItems = computed<MenuItem[]>(() => [
Expand Down Expand Up @@ -99,7 +101,7 @@ export class MenuComponent {
constructor() {
if (this._swUpdate.isEnabled) {
merge(fromEvent(document, 'visibilitychange'), this._realtimeEventsService.onReconnected$)
.pipe(startWith(null), takeUntilDestroyed())
.pipe(takeUntilDestroyed())
.subscribe(() => {
if (!document.hidden) {
console.info('Checking for updates...');
Expand Down

0 comments on commit cbda2e5

Please sign in to comment.