feat(spa): scaffold Angular app shell with host/player routes

This commit is contained in:
2026-03-01 11:06:33 +00:00
parent 37b86d7065
commit 7180cc9b0d
16 changed files with 7383 additions and 0 deletions

3
frontend/angular/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules/
dist/
.angular/

View File

@@ -0,0 +1,36 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"projects": {
"wpp-angular-shell": {
"projectType": "application",
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": "dist/wpp-angular-shell",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": [],
"styles": ["src/styles.css"],
"outputHashing": "none"
}
},
"serve": {
"builder": "@angular/build:dev-server",
"options": {
"buildTarget": "wpp-angular-shell:build"
}
}
}
}
},
"cli": {
"analytics": false
}
}

7185
frontend/angular/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
{
"name": "wpp-angular-shell",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "ng serve",
"build": "ng build"
},
"dependencies": {
"@angular/common": "^19.2.0",
"@angular/compiler": "^19.2.0",
"@angular/core": "^19.2.0",
"@angular/platform-browser": "^19.2.0",
"@angular/router": "^19.2.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular/build": "^19.2.0",
"@angular/cli": "^19.2.0",
"@angular/compiler-cli": "^19.2.0",
"typescript": "~5.7.2"
}
}

View File

@@ -0,0 +1,4 @@
.shell { font-family: Arial, sans-serif; margin: 1rem; }
.shell__header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd; padding-bottom: 0.75rem; }
.shell__header nav { display: flex; gap: 0.75rem; }
.shell__content { margin-top: 1rem; }

View File

@@ -0,0 +1,13 @@
<main class="shell">
<header class="shell__header">
<h1>WPP Angular Shell</h1>
<nav>
<a routerLink="/host">Host</a>
<a routerLink="/player">Player</a>
</nav>
</header>
<section class="shell__content">
<router-outlet></router-outlet>
</section>
</main>

View File

@@ -0,0 +1,20 @@
import { Component, inject } from '@angular/core';
import { Router, RouterLink, RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, RouterLink],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
})
export class AppComponent {
private readonly router = inject(Router);
constructor() {
const shellRoute = document.body.dataset['wppShellRoute'];
if (shellRoute === '/host' || shellRoute === '/player') {
void this.router.navigateByUrl(shellRoute);
}
}
}

View File

@@ -0,0 +1,7 @@
import { ApplicationConfig } from '@angular/core';
import { provideRouter, withHashLocation } from '@angular/router';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideRouter(routes, withHashLocation())],
};

View File

@@ -0,0 +1,14 @@
import { Routes } from '@angular/router';
export const routes: Routes = [
{
path: 'host',
loadComponent: () => import('./features/host/host-shell.component').then((m) => m.HostShellComponent),
},
{
path: 'player',
loadComponent: () => import('./features/player/player-shell.component').then((m) => m.PlayerShellComponent),
},
{ path: '', pathMatch: 'full', redirectTo: 'player' },
{ path: '**', redirectTo: 'player' },
];

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-host-shell',
standalone: true,
template: `
<h2>Host route placeholder</h2>
<p>Host flow flyttes hertil i kommende SPA-issues.</p>
`,
})
export class HostShellComponent {}

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-player-shell',
standalone: true,
template: `
<h2>Player route placeholder</h2>
<p>Player flow flyttes hertil i kommende SPA-issues.</p>
`,
})
export class PlayerShellComponent {}

View File

@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>WPP Angular Shell</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<app-root></app-root>
</body>
</html>

View File

@@ -0,0 +1,7 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';
bootstrapApplication(AppComponent, appConfig).catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,4 @@
html, body {
margin: 0;
padding: 0;
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"]
}

View File

@@ -0,0 +1,22 @@
{
"compileOnSave": false,
"compilerOptions": {
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": false,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"lib": ["ES2022", "dom"]
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}