feat(front-end): ssr implementation #41

Merged
JoeKung merged 4 commits from feat/ssr into dev 2026-03-11 16:59:22 +01:00
Showing only changes of commit c47a7e28c7 - Show all commits

View File

@@ -4,9 +4,10 @@ import {
signal, signal,
ViewChild, ViewChild,
ElementRef, ElementRef,
Inject,
OnInit, OnInit,
Optional,
PLATFORM_ID, PLATFORM_ID,
inject,
} from '@angular/core'; } from '@angular/core';
import { CommonModule, isPlatformBrowser } from '@angular/common'; import { CommonModule, isPlatformBrowser } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
@@ -55,7 +56,7 @@ type TrackedPrintSettings = {
styleUrl: './calculator-page.component.scss', styleUrl: './calculator-page.component.scss',
}) })
export class CalculatorPageComponent implements OnInit { export class CalculatorPageComponent implements OnInit {
private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID)); private readonly isBrowser: boolean;
mode = signal<'easy' | 'advanced'>('easy'); mode = signal<'easy' | 'advanced'>('easy');
step = signal<'upload' | 'quote' | 'details' | 'success'>('upload'); step = signal<'upload' | 'quote' | 'details' | 'success'>('upload');
@@ -88,7 +89,10 @@ export class CalculatorPageComponent implements OnInit {
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private languageService: LanguageService, private languageService: LanguageService,
) {} @Optional() @Inject(PLATFORM_ID) platformId?: Object,
) {
this.isBrowser = isPlatformBrowser(platformId ?? 'browser');
}
ngOnInit() { ngOnInit() {
this.route.data.subscribe((data) => { this.route.data.subscribe((data) => {