-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add chapter new control flow (#65)
feat: begin defer chapter
- Loading branch information
Showing
188 changed files
with
6,620 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<section> | ||
@for (person of people$|async;track person.id) { | ||
<sfeir-card *ngFor="let person of people$ | async" [person]="person" /> | ||
<sfeir-card [person]="person" /> | ||
} | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { computed, inject, InjectionToken, makeEnvironmentProviders, signal } from '@angular/core'; | ||
import { PeopleService } from '../providers/people.service'; | ||
import { People, PeopleForm } from '../../shared/models/people.model'; | ||
import { switchMap, tap } from 'rxjs'; | ||
|
||
const filterPeople = (search: string) => (people: People) => | ||
people.lastname.toLowerCase().includes(search.toLowerCase()) || people.firstname.toLowerCase().includes(search.toLowerCase()); | ||
|
||
function appStore(peopleService = inject(PeopleService)) { | ||
const people = signal<People[]>([]); | ||
const search = signal<string>(''); | ||
|
||
return { | ||
people: computed(() => people().filter(filterPeople(search()))), | ||
search: search.asReadonly(), | ||
setSearch(value: string) { | ||
search.set(value); | ||
}, | ||
getPeople() { | ||
return peopleService.getPeople().pipe(tap(data => people.set(data))); | ||
}, | ||
deletePeople(id: string) { | ||
return peopleService.deletePeople(id).pipe(tap(data => people.set(data))); | ||
}, | ||
addNewPerson(person: PeopleForm) { | ||
return peopleService.addNewPerson(person).pipe(switchMap(() => this.getPeople())); | ||
}, | ||
}; | ||
} | ||
|
||
export const PEOPLE_STORE = new InjectionToken<Store>('StoreToken'); | ||
|
||
export type Store = ReturnType<typeof appStore>; | ||
|
||
export const provideAppStore = () => { | ||
return makeEnvironmentProviders([{ provide: PEOPLE_STORE, useFactory: appStore }]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"extends": [ | ||
"../../.eslintrc.json" | ||
], | ||
"ignorePatterns": [ | ||
"!**/*" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts" | ||
], | ||
"extends": [ | ||
"plugin:@nx/angular", | ||
"plugin:@angular-eslint/template/process-inline-templates" | ||
], | ||
"rules": { | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
"type": "attribute", | ||
"prefix": "sfeir", | ||
"style": "camelCase" | ||
} | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
"type": "element", | ||
"prefix": "sfeir", | ||
"style": "kebab-case" | ||
} | ||
], | ||
"@angular-eslint/no-input-rename": "off" | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"*.html" | ||
], | ||
"extends": [ | ||
"plugin:@nx/angular-template" | ||
], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'ngrx-store-solution', | ||
preset: '../../jest.preset.js', | ||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], | ||
globals: {}, | ||
coverageDirectory: '../../coverage/apps/ngrx-store-solution', | ||
transform: { | ||
'^.+\\.(ts|mjs|js|html)$': [ | ||
'jest-preset-angular', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
stringifyContentPathRegex: '\\.(html|svg)$', | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], | ||
snapshotSerializers: [ | ||
'jest-preset-angular/build/serializers/no-ng-attributes', | ||
'jest-preset-angular/build/serializers/ng-snapshot', | ||
'jest-preset-angular/build/serializers/html-comment', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"name": "35-deferred-views-solution", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"sourceRoot": "apps/35-deferred-views-solution/src", | ||
"prefix": "sfeir", | ||
"tags": [], | ||
"targets": { | ||
"build": { | ||
"executor": "@angular-devkit/build-angular:application", | ||
"outputs": [ | ||
"{options.outputPath}" | ||
], | ||
"options": { | ||
"outputPath": "dist/apps/35-deferred-views-solution", | ||
"index": "apps/35-deferred-views-solution/src/index.html", | ||
"browser": "apps/35-deferred-views-solution/src/main.ts", | ||
"polyfills": [ | ||
"apps/35-deferred-views-solution/src/polyfills.ts" | ||
], | ||
"tsConfig": "apps/35-deferred-views-solution/tsconfig.app.json", | ||
"inlineStyleLanguage": "scss", | ||
"assets": [ | ||
"apps/35-deferred-views-solution/src/favicon.ico", | ||
"apps/35-deferred-views-solution/src/assets" | ||
], | ||
"styles": [ | ||
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", | ||
"apps/35-deferred-views-solution/src/styles.scss" | ||
], | ||
"scripts": [] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"budgets": [ | ||
{ | ||
"type": "initial", | ||
"maximumWarning": "500kb", | ||
"maximumError": "1mb" | ||
}, | ||
{ | ||
"type": "anyComponentStyle", | ||
"maximumWarning": "2kb", | ||
"maximumError": "4kb" | ||
} | ||
], | ||
"fileReplacements": [ | ||
{ | ||
"replace": "apps/35-deferred-views-solution/src/environments/environment.ts", | ||
"with": "apps/35-deferred-views-solution/src/environments/environment.prod.ts" | ||
} | ||
], | ||
"outputHashing": "all" | ||
}, | ||
"development": { | ||
"optimization": false, | ||
"extractLicenses": false, | ||
"sourceMap": true, | ||
"namedChunks": true | ||
} | ||
}, | ||
"defaultConfiguration": "production" | ||
}, | ||
"serve": { | ||
"executor": "@angular-devkit/build-angular:dev-server", | ||
"configurations": { | ||
"production": { | ||
"buildTarget": "35-deferred-views-solution:build:production" | ||
}, | ||
"development": { | ||
"buildTarget": "35-deferred-views-solution:build:development" | ||
} | ||
}, | ||
"defaultConfiguration": "development" | ||
}, | ||
"extract-i18n": { | ||
"executor": "@angular-devkit/build-angular:extract-i18n", | ||
"options": { | ||
"buildTarget": "35-deferred-views-solution:build" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint" | ||
}, | ||
"test": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": [ | ||
"{workspaceRoot}/coverage/apps/35-deferred-views-solution" | ||
], | ||
"options": { | ||
"jestConfig": "apps/35-deferred-views-solution/jest.config.ts" | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/35-deferred-views-solution/src/app/app.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- This component is an Angular Material Component, this is not important for the formation, to have more details on this component, please take take a look: https://material.angular.io/ --> | ||
<ng-template #headerTemplate> | ||
<mat-toolbar class="extend-toolbar"> | ||
<span> | ||
<a [routerLink]="['home']"> <img src="assets/images/logo-sfeir.svg" aria-label="sfeir" alt="Sfeir" /> </a> | ||
</span> | ||
|
||
<span class="flex"></span> | ||
|
||
<span> <a href="/locator">Maps</a> <a [routerLink]="['people']">List</a> </span> | ||
</mat-toolbar> | ||
</ng-template> | ||
|
||
<sfeir-header [headerTemplate]="headerTemplate"></sfeir-header> | ||
|
||
<router-outlet></router-outlet> |
43 changes: 43 additions & 0 deletions
43
apps/35-deferred-views-solution/src/app/app.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
mat-toolbar { | ||
&.extend-toolbar { | ||
background-color: #0168ab; | ||
background-image: url('/assets/images/bg_right.png'); | ||
background-repeat: no-repeat; | ||
background-position: right; | ||
top: 0px; | ||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); | ||
width: 100%; | ||
z-index: 1; | ||
color: white; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.flex { | ||
flex: 1 1 auto; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
height: 100%; | ||
margin: 0px 10px 0px 10px; | ||
border-bottom: 2px solid transparent; | ||
font-size: 1.1em; | ||
font-weight: normal; | ||
font-family: 'Open Sans', sans-serif; | ||
|
||
&:not(.active):hover { | ||
border-bottom: 2px solid white; | ||
} | ||
|
||
img { | ||
height: 100%; | ||
margin-left: -60px; | ||
} | ||
} | ||
} | ||
|
||
/* TODO(mdc-migration): The following rule targets internal classes of card that may no longer apply for the MDC version. */ | ||
mat-card { | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
import { MatToolbarModule } from '@angular/material/toolbar'; | ||
import { RouterLink, RouterOutlet } from '@angular/router'; | ||
import { HeaderComponent } from './core/components/header/header.component'; | ||
|
||
@Component({ | ||
selector: 'sfeir-app', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
standalone: true, | ||
imports: [HeaderComponent, RouterLink, RouterOutlet, MatToolbarModule], | ||
}) | ||
export class AppComponent { | ||
name = 'SFEIR - LUXEMBOURG'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { provideHttpClient, withInterceptors } from '@angular/common/http'; | ||
import { ApplicationConfig, importProvidersFrom } from '@angular/core'; | ||
import { MatDialogModule } from '@angular/material/dialog'; | ||
import { provideAnimations } from '@angular/platform-browser/animations'; | ||
import { Routes, provideRouter, withComponentInputBinding } from '@angular/router'; | ||
import { AuthorizationInterceptor } from './core/interceptors/authorization.interceptor'; | ||
import { providePeopleStore } from './core/store/signal.store'; | ||
|
||
const APP_ROUTES: Routes = [ | ||
{ path: '', redirectTo: 'home', pathMatch: 'full' }, | ||
{ path: 'home', loadComponent: async () => (await import('./feature/home/home.component')).HomeComponent }, | ||
{ path: 'people', loadComponent: async () => (await import('./feature/people/people.component')).PeopleComponent }, | ||
{ | ||
path: 'people/:id', | ||
loadChildren: async () => await import('./feature/update-person/update-person.route'), | ||
}, | ||
]; | ||
|
||
export const appConfig: ApplicationConfig = { | ||
providers: [ | ||
provideRouter(APP_ROUTES, withComponentInputBinding()), | ||
provideAnimations(), | ||
provideHttpClient(withInterceptors([AuthorizationInterceptor])), | ||
providePeopleStore(), | ||
importProvidersFrom(MatDialogModule), | ||
], | ||
}; |
3 changes: 3 additions & 0 deletions
3
apps/35-deferred-views-solution/src/app/core/components/header/header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<section> | ||
<ng-container *ngTemplateOutlet="headerTemplate()"></ng-container> | ||
</section> |
Empty file.
Oops, something went wrong.