Lots of technical improvements
Build, Test & Push Frontend / quality-check (pull_request) Failing after 41s
Build, Test & Push Frontend / docker (pull_request) Has been skipped

This commit is contained in:
Andreas Dahm committed 2026-06-02 15:48:31 +02:00
1 parent 102cdfcb52
commit a26443af8f
26 files changed
+1864 -430

No files matched your search

@@ -1,4 +1,5 @@
import {AfterViewInit, Component, ElementRef, HostListener, inject, NgZone, OnDestroy, ViewChild} from '@angular/core';
import {AfterViewInit, Component, ElementRef, HostListener, inject, NgZone, OnDestroy, PLATFORM_ID, ViewChild} from '@angular/core';
import {isPlatformBrowser} from '@angular/common';
@Component({
selector: 'app-particles-background',
@@ -10,6 +11,7 @@ export class ParticleBackgroundComponent implements AfterViewInit, OnDestroy {
@ViewChild('canvas', { static: true }) canvasRef!: ElementRef<HTMLCanvasElement>;
private readonly ngZone = inject(NgZone);
private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
private ctx!: CanvasRenderingContext2D;
private particles: any[] = [];
@@ -21,6 +23,11 @@ export class ParticleBackgroundComponent implements AfterViewInit, OnDestroy {
private readonly particleSpeed = 0.8;
ngAfterViewInit(): void {
// Canvas animation relies on browser-only APIs; skip it during SSR/prerender.
if (!this.isBrowser) {
return;
}
const canvas = this.canvasRef.nativeElement;
this.ctx = canvas.getContext('2d')!;
@@ -38,6 +45,10 @@ export class ParticleBackgroundComponent implements AfterViewInit, OnDestroy {
@HostListener('window:resize')
resizeCanvas(): void {
if (!this.isBrowser) {
return;
}
const canvas = this.canvasRef.nativeElement;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;