feat(spa): scaffold Angular app shell with host/player routes
This commit is contained in:
3
frontend/angular/.gitignore
vendored
Normal file
3
frontend/angular/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
dist/
|
||||
.angular/
|
||||
36
frontend/angular/angular.json
Normal file
36
frontend/angular/angular.json
Normal 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
7185
frontend/angular/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
frontend/angular/package.json
Normal file
25
frontend/angular/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
4
frontend/angular/src/app/app.component.css
Normal file
4
frontend/angular/src/app/app.component.css
Normal 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; }
|
||||
13
frontend/angular/src/app/app.component.html
Normal file
13
frontend/angular/src/app/app.component.html
Normal 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>
|
||||
20
frontend/angular/src/app/app.component.ts
Normal file
20
frontend/angular/src/app/app.component.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
7
frontend/angular/src/app/app.config.ts
Normal file
7
frontend/angular/src/app/app.config.ts
Normal 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())],
|
||||
};
|
||||
14
frontend/angular/src/app/app.routes.ts
Normal file
14
frontend/angular/src/app/app.routes.ts
Normal 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' },
|
||||
];
|
||||
@@ -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 {}
|
||||
@@ -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 {}
|
||||
12
frontend/angular/src/index.html
Normal file
12
frontend/angular/src/index.html
Normal 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>
|
||||
7
frontend/angular/src/main.ts
Normal file
7
frontend/angular/src/main.ts
Normal 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);
|
||||
});
|
||||
4
frontend/angular/src/styles.css
Normal file
4
frontend/angular/src/styles.css
Normal file
@@ -0,0 +1,4 @@
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
9
frontend/angular/tsconfig.app.json
Normal file
9
frontend/angular/tsconfig.app.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
},
|
||||
"files": ["src/main.ts"],
|
||||
"include": ["src/**/*.d.ts"]
|
||||
}
|
||||
22
frontend/angular/tsconfig.json
Normal file
22
frontend/angular/tsconfig.json
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user