fix: run prettier on all file to avoid prettier issue inside PR

This commit is contained in:
thomas
2024-01-07 21:41:36 +01:00
parent 3bc793f6b3
commit c8b7c5d4a6
195 changed files with 575 additions and 452 deletions

View File

@@ -5,6 +5,8 @@ import { RouterOutlet } from '@angular/router';
standalone: true,
imports: [RouterOutlet],
selector: 'app-root',
template: ` <router-outlet></router-outlet> `,
template: `
<router-outlet></router-outlet>
`,
})
export class AppComponent {}

View File

@@ -7,7 +7,7 @@ import { NavButtonComponent } from './nav-button.component';
selector: 'app-foo',
template: `
Welcome to foo page
<nav-button href="home" class="fixed top-3 left-1/2">Home Page</nav-button>
<nav-button href="home" class="fixed left-1/2 top-3">Home Page</nav-button>
<div class="h-screen bg-blue-200">section 1</div>
<div class="h-screen bg-red-200">section 2</div>
`,

View File

@@ -6,7 +6,7 @@ import { NavButtonComponent } from './nav-button.component';
imports: [NavButtonComponent],
selector: 'app-home',
template: `
<nav-button href="/foo" class="fixed top-3 left-1/2">Foo Page</nav-button>
<nav-button href="/foo" class="fixed left-1/2 top-3">Foo Page</nav-button>
<div id="top" class="h-screen bg-gray-500">
Empty
<nav-button href="#bottom">Scroll Bottom</nav-button>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

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

View File

@@ -6,7 +6,7 @@ import { RouterOutlet } from '@angular/router';
imports: [RouterOutlet],
selector: 'app-root',
template: `
<h1 class="text-xl px-4 py-2">My Application</h1>
<h1 class="px-4 py-2 text-xl">My Application</h1>
<section class="flex">
<router-outlet name="side" />
<div class="border p-4">

View File

@@ -2,6 +2,8 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-bar',
standalone: true,
template: ` BarComponent `,
template: `
BarComponent
`,
})
export class BarComponent {}

View File

@@ -2,6 +2,8 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-foo',
standalone: true,
template: `Foo Component `,
template: `
Foo Component
`,
})
export class FooComponent {}

View File

@@ -15,7 +15,7 @@ interface MenuItem {
template: `
<ng-container *ngFor="let menu of menus">
<a
class="border px-4 py-2 rounded-md"
class="rounded-md border px-4 py-2"
[routerLink]="menu.path"
routerLinkActive="isSelected">
{{ menu.name }}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

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

View File

@@ -17,11 +17,10 @@ import {
*ngTemplateOutlet="
listTemplateRef || emptyRef;
context: { $implicit: item, appList: item, index: i }
">
</ng-container>
"></ng-container>
</div>
<ng-template #emptyRef> No Template </ng-template>
<ng-template #emptyRef>No Template</ng-template>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})

View File

@@ -17,7 +17,7 @@ interface Person {
context: { $implicit: person.name, age: person.age }
"></ng-container>
<ng-template #emptyRef> No Template </ng-template>
<ng-template #emptyRef>No Template</ng-template>
`,
})
export class PersonComponent {

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -42,7 +42,7 @@ export class AppComponent implements OnInit {
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
}
},
)
.subscribe((todoUpdated: any) => {
this.todos[todoUpdated.id - 1] = todoUpdated;

View File

@@ -1,6 +1,5 @@
import { ApplicationConfig } from '@angular/core';
import { enableProdMode, importProvidersFrom } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
export const appConfig: ApplicationConfig = {
providers: [importProvidersFrom(HttpClientModule)],
};

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -4,5 +4,5 @@ import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig).catch((err) =>
console.error(err)
console.error(err),
);

View File

@@ -6,6 +6,8 @@ import { Component } from '@angular/core';
standalone: true,
imports: [BtnDisabledDirective, BtnHelmetDirective],
selector: 'app-root',
template: ` <button btnDisabled hlm>Coucou</button> `,
template: `
<button btnDisabled hlm>Coucou</button>
`,
})
export class AppComponent {}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -16,7 +16,7 @@ interface ProductContext {
export class ProductDirective {
static ngTemplateContextGuard(
dir: ProductDirective,
ctx: unknown
ctx: unknown,
): ctx is ProductContext {
return true;
}

View File

@@ -11,7 +11,7 @@ export class CurrencyPipe implements PipeTransform {
transform(price: number) {
return this.currencyService.symbol$.pipe(
map((s) => `${String(price)}${s}`)
map((s) => `${String(price)}${s}`),
);
}
}

View File

@@ -20,7 +20,7 @@ export const currency: Currency[] = [
export class CurrencyService extends ComponentStore<{ code: string }> {
readonly code$ = this.select((state) => state.code);
readonly symbol$ = this.code$.pipe(
map((code) => currency.find((c) => c.code === code)?.symbol ?? code)
map((code) => currency.find((c) => c.code === code)?.symbol ?? code),
);
constructor() {

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -5,15 +5,17 @@ import { RouterLink, RouterOutlet } from '@angular/router';
standalone: true,
imports: [RouterOutlet, RouterLink],
selector: 'app-root',
template: ` <div class="flex gap-4 mb-5">
<button class="border rounded-md px-4 py-2" routerLink="video">
template: `
<div class="mb-5 flex gap-4">
<button class="rounded-md border px-4 py-2" routerLink="video">
Video
</button>
<button class="border rounded-md px-4 py-2" routerLink="phone">
<button class="rounded-md border px-4 py-2" routerLink="phone">
Phone
</button>
</div>
<router-outlet />`,
<router-outlet />
`,
host: {
class: 'p-10 flex flex-col',
},

View File

@@ -5,10 +5,12 @@ import { TimerContainerComponent } from './timer-container.component';
selector: 'app-phone',
standalone: true,
imports: [TimerContainerComponent],
template: `<div class="flex gap-2">
template: `
<div class="flex gap-2">
Phone Call Timer:
<p class="italic">(should be 2000s)</p>
</div>
<timer-container />`,
<timer-container />
`,
})
export default class PhoneComponent {}

View File

@@ -6,7 +6,9 @@ import { DEFAULT_TIMER } from './data';
@Component({
selector: 'timer',
standalone: true,
template: ` Timer running {{ timer() }} `,
template: `
Timer running {{ timer() }}
`,
})
export class TimerComponent {
timer = toSignal(interval(DEFAULT_TIMER));

View File

@@ -5,10 +5,12 @@ import { TimerContainerComponent } from './timer-container.component';
selector: 'app-video',
standalone: true,
imports: [TimerContainerComponent],
template: `<div class="flex gap-2">
template: `
<div class="flex gap-2">
Video Call Timer:
<p class="italic">(should be the default 1000s)</p>
</div>
<timer-container />`,
<timer-container />
`,
})
export default class VideoComponent {}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

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

View File

@@ -5,7 +5,9 @@ import { RouterOutlet } from '@angular/router';
standalone: true,
imports: [RouterOutlet],
selector: 'app-root',
template: `<router-outlet />`,
template: `
<router-outlet />
`,
styles: [''],
})
export class AppComponent {}

View File

@@ -23,7 +23,7 @@ export const appConfig: ApplicationConfig = {
redirectTo: '',
},
],
withComponentInputBinding()
withComponentInputBinding(),
),
],
};

View File

@@ -9,13 +9,25 @@ import { Photo } from '../photo.model';
imports: [DatePipe, RouterLink],
template: `
<img src="{{ photo.url_m }}" alt="{{ photo.title }}" class="image" />
<p><span class="font-bold">Title:</span> {{ photo.title }}</p>
<p><span class="font-bold">Owner:</span> {{ photo.ownername }}</p>
<p><span class="font-bold">Date:</span> {{ photo.datetaken | date }}</p>
<p><span class="font-bold">Tags:</span> {{ photo.tags }}</p>
<p>
<span class="font-bold">Title:</span>
{{ photo.title }}
</p>
<p>
<span class="font-bold">Owner:</span>
{{ photo.ownername }}
</p>
<p>
<span class="font-bold">Date:</span>
{{ photo.datetaken | date }}
</p>
<p>
<span class="font-bold">Tags:</span>
{{ photo.tags }}
</p>
<button
class="border border-black rounded-md px-4 py-2 mt-10"
class="mt-10 rounded-md border border-black px-4 py-2"
routerLink="">
Back
</button>

View File

@@ -47,7 +47,7 @@ export class PhotoStore
private readonly endOfPage$ = this.select(
this.page$,
this.pages$,
(page, pages) => page === pages
(page, pages) => page === pages,
);
readonly vm$ = this.select(
@@ -60,7 +60,7 @@ export class PhotoStore
loading: this.loading$,
error: this.error$,
},
{ debounce: true }
{ debounce: true },
);
ngrxOnStoreInit() {
@@ -82,7 +82,7 @@ export class PhotoStore
this.select({
search: this.search$,
page: this.page$,
})
}),
);
}
@@ -91,21 +91,21 @@ export class PhotoStore
...state,
search,
page: 1,
})
}),
);
readonly nextPage = this.updater(
(state): PhotoState => ({
...state,
page: state.page + 1,
})
}),
);
readonly previousPage = this.updater(
(state): PhotoState => ({
...state,
page: state.page - 1,
})
}),
);
readonly searchPhotos = this.effect<{ search: string; page: number }>(
@@ -123,13 +123,13 @@ export class PhotoStore
});
localStorage.setItem(
PHOTO_STATE_KEY,
JSON.stringify({ search, page })
JSON.stringify({ search, page }),
);
},
(error: unknown) => this.patchState({ error, loading: false })
)
)
)
)
(error: unknown) => this.patchState({ error, loading: false }),
),
),
),
),
);
}

View File

@@ -16,7 +16,7 @@ export class PhotoService {
public searchPublicPhotos(
searchTerm: string,
page: number
page: number,
): Observable<FlickrAPIResponse> {
return this.http.get<FlickrAPIResponse>(
'https://www.flickr.com/services/rest/',
@@ -33,7 +33,7 @@ export class PhotoService {
extras: 'tags,date_taken,owner_name,url_q,url_m',
api_key: 'c3050d39a5bb308d9921bef0e15c437d',
},
}
},
);
}
}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

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

View File

@@ -2,24 +2,26 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: ` <div class="flex gap-2">
template: `
<div class="flex gap-2">
<button
routerLink="home"
class="border px-4 py-2 border-blue-400 rounded-md">
class="rounded-md border border-blue-400 px-4 py-2">
Home
</button>
<button
routerLink="admin"
class="border px-4 py-2 border-blue-400 rounded-md">
class="rounded-md border border-blue-400 px-4 py-2">
Admin
</button>
<button
routerLink="user"
class="border px-4 py-2 border-blue-400 rounded-md">
class="rounded-md border border-blue-400 px-4 py-2">
User
</button>
</div>
<router-outlet></router-outlet>`,
<router-outlet></router-outlet>
`,
host: {
class: 'flex flex-col p-4 gap-3',
},

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -5,7 +5,9 @@ import { RouterOutlet } from '@angular/router';
standalone: true,
imports: [RouterOutlet],
selector: 'app-root',
template: ` <router-outlet></router-outlet> `,
template: `
<router-outlet></router-outlet>
`,
styles: [],
})
export class AppComponent {}

View File

@@ -4,7 +4,9 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
standalone: true,
selector: 'button[app-button]',
template: `<ng-content></ng-content>`,
template: `
<ng-content></ng-content>
`,
host: {
class: 'border border-blue-700 bg-blue-400 p-2 rounded-sm text-white',
},

View File

@@ -8,7 +8,7 @@ export const APP_ROUTES = [
path: 'enter',
loadComponent: () =>
import('./dashboard/admin.component').then(
(m) => m.AdminDashboardComponent
(m) => m.AdminDashboardComponent,
),
},
];

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -4,5 +4,5 @@ import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig).catch((err) =>
console.error(err)
console.error(err),
);

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -7,10 +7,12 @@ import { CardComponent } from '../../ui/card/card.component';
@Component({
selector: 'app-student-card',
template: `<app-card
[list]="students"
[type]="cardType"
customClass="bg-light-green"></app-card>`,
template: `
<app-card
[list]="students"
[type]="cardType"
customClass="bg-light-green"></app-card>
`,
standalone: true,
styles: [
`
@@ -25,7 +27,10 @@ export class StudentCardComponent implements OnInit {
students: Student[] = [];
cardType = CardType.STUDENT;
constructor(private http: FakeHttpService, private store: StudentStore) {}
constructor(
private http: FakeHttpService,
private store: StudentStore,
) {}
ngOnInit(): void {
this.http.fetchStudents$.subscribe((s) => this.store.addAll(s));

View File

@@ -7,10 +7,12 @@ import { CardComponent } from '../../ui/card/card.component';
@Component({
selector: 'app-teacher-card',
template: `<app-card
[list]="teachers"
[type]="cardType"
customClass="bg-light-red"></app-card>`,
template: `
<app-card
[list]="teachers"
[type]="cardType"
customClass="bg-light-red"></app-card>
`,
styles: [
`
::ng-deep .bg-light-red {
@@ -25,7 +27,10 @@ export class TeacherCardComponent implements OnInit {
teachers: Teacher[] = [];
cardType = CardType.TEACHER;
constructor(private http: FakeHttpService, private store: TeacherStore) {}
constructor(
private http: FakeHttpService,
private store: TeacherStore,
) {}
ngOnInit(): void {
this.http.fetchTeachers$.subscribe((t) => this.store.addAll(t));

View File

@@ -6,7 +6,7 @@ import { CardType } from '../../model/card.model';
@Component({
selector: 'app-list-item',
template: `
<div class="border border-grey-300 py-1 px-2 flex justify-between">
<div class="border-grey-300 flex justify-between border px-2 py-1">
{{ name }}
<button (click)="delete(id)">
<img class="h-5" src="assets/svg/trash.svg" />
@@ -22,7 +22,7 @@ export class ListItemComponent {
constructor(
private teacherStore: TeacherStore,
private studentStore: StudentStore
private studentStore: StudentStore,
) {}
delete(id: number) {

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@@ -6,7 +6,8 @@ import { RouterLink, RouterModule } from '@angular/router';
standalone: true,
imports: [RouterLink, RouterModule, ReactiveFormsModule],
selector: 'app-root',
template: ` <label for="userName">UserName</label>
template: `
<label for="userName">UserName</label>
<input id="userName" type="text" [formControl]="userName" />
<label for="testId">TestId</label>
<input id="testId" type="number" [formControl]="testId" />
@@ -16,7 +17,8 @@ import { RouterLink, RouterModule } from '@angular/router';
Test
</button>
<button routerLink="/">HOME</button>
<router-outlet></router-outlet>`,
<router-outlet></router-outlet>
`,
})
export class AppComponent {
userName = new FormControl();

View File

@@ -3,6 +3,8 @@ import { Component } from '@angular/core';
selector: 'app-home',
standalone: true,
imports: [],
template: `<div>Home</div>`,
template: `
<div>Home</div>
`,
})
export default class HomeComponent {}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

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

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />