Skip to content

Commit

Permalink
chore: Reinstate more old prettier rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Wiraszka committed Jul 3, 2024
1 parent 7347b38 commit 1937b1b
Show file tree
Hide file tree
Showing 84 changed files with 383 additions and 481 deletions.
17 changes: 10 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 90,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"bracketSameLine": true,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"overrides": [
{
Expand All @@ -13,5 +10,11 @@
"parser": "angular"
}
}
]
],
"printWidth": 90,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
32 changes: 14 additions & 18 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,83 +8,79 @@ const routes: Routes = [
{
path: NavPathTypes.HOME,
loadChildren: () =>
import('./screens/home/home-screen.module').then((m) => m.HomeScreenModule),
import('./screens/home/home-screen.module').then(m => m.HomeScreenModule),
pathMatch: 'full',
},
{
path: NavPathTypes.ABOUT,
loadChildren: () =>
import('./screens/about/about-screen.module').then((m) => m.AboutScreenModule),
import('./screens/about/about-screen.module').then(m => m.AboutScreenModule),
},
{
path: NavPathTypes.MEMBERS,
loadChildren: () =>
import('./screens/members/members-screen.module').then(
(m) => m.MembersScreenModule,
),
import('./screens/members/members-screen.module').then(m => m.MembersScreenModule),
},
{
path: NavPathTypes.MEMBER,
loadChildren: () =>
import('./screens/member/member-screen.module').then((m) => m.MemberScreenModule),
import('./screens/member/member-screen.module').then(m => m.MemberScreenModule),
},
{
path: NavPathTypes.SCHEDULE,
loadChildren: () =>
import('./screens/schedule/schedule-screen.module').then(
(m) => m.ScheduleScreenModule,
m => m.ScheduleScreenModule,
),
},
{
path: NavPathTypes.EVENT,
loadChildren: () =>
import('./screens/event/event-screen.module').then((m) => m.EventScreenModule),
import('./screens/event/event-screen.module').then(m => m.EventScreenModule),
canActivate: [AuthGuard],
},
{
path: NavPathTypes.NEWS,
loadChildren: () =>
import('./screens/news/news-screen.module').then((m) => m.NewsScreenModule),
import('./screens/news/news-screen.module').then(m => m.NewsScreenModule),
},
{
path: NavPathTypes.ARTICLE,
loadChildren: () =>
import('./screens/article/article-screen.module').then(
(m) => m.ArticleScreenModule,
),
import('./screens/article/article-screen.module').then(m => m.ArticleScreenModule),
},
{
path: NavPathTypes.CITY_CHAMPION,
loadChildren: () =>
import('./screens/champion/champion-screen.module').then(
(m) => m.ChampionScreenModule,
m => m.ChampionScreenModule,
),
},
{
path: NavPathTypes.PHOTO_GALLERY,
loadChildren: () =>
import('./screens/photo-gallery/photo-gallery-screen.module').then(
(m) => m.PhotoGalleryScreenModule,
m => m.PhotoGalleryScreenModule,
),
},
{
path: NavPathTypes.GAME_ARCHIVES,
loadChildren: () =>
import('./screens/game-archives/game-archives-screen.module').then(
(m) => m.GameArchivesScreenModule,
m => m.GameArchivesScreenModule,
),
},
{
path: NavPathTypes.DOCUMENTS,
loadChildren: () =>
import('./screens/documents/documents-screen.module').then(
(m) => m.DocumentsScreenModule,
m => m.DocumentsScreenModule,
),
},
{
path: NavPathTypes.LOGIN,
loadChildren: () =>
import('./screens/login/login-screen.module').then((m) => m.LoginScreenModule),
import('./screens/login/login-screen.module').then(m => m.LoginScreenModule),
},
{
path: NavPathTypes.LOGOUT,
Expand All @@ -94,7 +90,7 @@ const routes: Routes = [
path: NavPathTypes.CHANGE_PASSWORD,
loadChildren: () =>
import('./screens/change-password/change-password-screen.module').then(
(m) => m.ChangePasswordScreenModule,
m => m.ChangePasswordScreenModule,
),
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export class AppFacade {
@Inject(DOCUMENT) private document: Document,
private readonly store: Store,
) {
this.isDarkMode$.pipe(untilDestroyed(this)).subscribe((isDarkMode) => {
this.isDarkMode$.pipe(untilDestroyed(this)).subscribe(isDarkMode => {
this.document.body.setAttribute('data-theme', isDarkMode ? 'dark' : 'light');
});

this.bannerLastCleared$
.pipe(first(), filter(isDefined))
.subscribe((lastClearedTime) => {
.subscribe(lastClearedTime => {
const currentTime = new Date().getTime();
if (currentTime - lastClearedTime > this.ONE_DAY_MS) {
this.store.dispatch(UserSettingsActions.reinstateUpcomingEventBanner());
Expand Down
12 changes: 4 additions & 8 deletions src/app/components/admin-controls/admin-controls.component.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<a
class="admin-control-button edit-button"
[tooltip]="'Edit ' + itemName"
[routerLink]="editPath"
>
[routerLink]="editPath">
<i-feather
name="edit"
class="edit-icon"
[style.height.px]="height - 10"
[style.width.px]="height - 10"
>
[style.width.px]="height - 10">
</i-feather>
</a>

<button
class="admin-control-button delete-button"
[tooltip]="'Delete ' + itemName"
(click)="onDelete($event)"
>
(click)="onDelete($event)">
<i-feather
name="trash-2"
class="delete-icon"
[style.height.px]="height - 10"
[style.width.px]="height - 10"
>
[style.width.px]="height - 10">
</i-feather>
</button>
27 changes: 9 additions & 18 deletions src/app/components/article-form/article-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
class="banner-image"
[src]="form.controls['imageUrl'].value"
default="assets/image-placeholder.png"
alt="Article banner image"
/>
alt="Article banner image" />
} @placeholder {
<div class="lcc-content-placeholder-wrapper loading-placeholder-image">
<div class="lcc-content-placeholder"></div>
Expand All @@ -25,14 +24,12 @@
type="file"
name="imageFile"
accept="image/*"
(change)="onChooseImage($event)"
/>
(change)="onChooseImage($event)" />
<button
class="lcc-secondary-button image-revert-button"
tooltip="Revert to original image"
[disabled]="!(facade.hasNewImage$ | async)"
(click)="onRevert()"
>
(click)="onRevert()">
<i-feather class="revert-icon" name="rotate-ccw"> </i-feather>
</button>
</div>
Expand All @@ -42,8 +39,7 @@
<i-feather
name="alert-triangle"
class="lcc-form-error-icon validation-alert-icon"
[tooltip]="getErrorMessage(form.controls['imageFile'])"
>
[tooltip]="getErrorMessage(form.controls['imageFile'])">
</i-feather>
}
</div>
Expand All @@ -54,15 +50,13 @@
type="text"
name="title"
formControlName="title"
maxlength="120"
/>
maxlength="120" />
<div class="lcc-form-error-container">
@if (hasError(form.controls['title'])) {
<i-feather
name="alert-triangle"
class="lcc-form-error-icon validation-alert-icon"
[tooltip]="getErrorMessage(form.controls['title'])"
>
[tooltip]="getErrorMessage(form.controls['title'])">
</i-feather>
}
</div>
Expand All @@ -75,8 +69,7 @@
<i-feather
name="alert-triangle"
class="lcc-form-error-icon validation-alert-icon"
[tooltip]="getErrorMessage(form.controls['body'])"
>
[tooltip]="getErrorMessage(form.controls['body'])">
</i-feather>
}
</div>
Expand All @@ -86,8 +79,7 @@
id="is-sticky-input"
type="checkbox"
name="is-sticky"
formControlName="isSticky"
/>
formControlName="isSticky" />
</div>

<aside class="lcc-required-fields-legend">Required fields</aside>
Expand All @@ -114,8 +106,7 @@ <h4>Preview</h4>
<button
class="lcc-primary-button"
type="submit"
[disabled]="form.invalid || !(facade.hasUnsavedChanges$ | async)"
>
[disabled]="form.invalid || !(facade.hasUnsavedChanges$ | async)">
@if (facade.isEditMode$ | async) {
Update article
} @else {
Expand Down
14 changes: 6 additions & 8 deletions src/app/components/article-form/article-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ export class ArticleFormComponent implements OnInit {
) {}

ngOnInit(): void {
this.facade.articleCurrently$
.pipe(filter(isDefined), first())
.subscribe((article) => {
this.initForm(article);
this.initValueChangesListener();
this.initArticleImageRehydration();
});
this.facade.articleCurrently$.pipe(filter(isDefined), first()).subscribe(article => {
this.initForm(article);
this.initValueChangesListener();
this.initArticleImageRehydration();
});
}

hasError(control: AbstractControl): boolean {
Expand Down Expand Up @@ -108,7 +106,7 @@ export class ArticleFormComponent implements OnInit {
}

private initArticleImageRehydration(): void {
this.facade.articleImageCurrently$.pipe(untilDestroyed(this)).subscribe((article) => {
this.facade.articleImageCurrently$.pipe(untilDestroyed(this)).subscribe(article => {
this.form.patchValue(
{
imageFile: article.imageFile,
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/article-form/article-form.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ArticleFormFacade {
onSubmit(article: Article): void {
this.isEditMode$
.pipe(
map((isEditMode) =>
map(isEditMode =>
isEditMode
? this.store.dispatch(
ArticlesActions.updateArticleSelected({
Expand Down
13 changes: 6 additions & 7 deletions src/app/components/article-grid/article-grid.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
class="lcc-admin-controls-container article"
[routerLink]="
'/' + NavPathTypes.ARTICLE + '/' + NavPathTypes.VIEW + '/' + article.id
"
>
">
@if (facade.isAdmin$ | async) {
<lcc-admin-controls
[editPath]="
'/' + NavPathTypes.ARTICLE + '/' + NavPathTypes.EDIT + '/' + article.id
"
[itemName]="article.title"
(delete)="facade.onDeleteArticle(article)"
>
(delete)="facade.onDeleteArticle(article)">
</lcc-admin-controls>
}

Expand All @@ -30,8 +28,7 @@
class="article-thumbnail-image"
[src]="article.thumbnailImageUrl"
default="assets/image-placeholder.png"
alt="Article banner image"
/>
alt="Article banner image" />
} @placeholder {
<div class="lcc-content-placeholder-wrapper loading-placeholder-image">
<div class="lcc-content-placeholder"></div>
Expand All @@ -41,7 +38,9 @@
<div class="article-summary-container">
<h3 class="lcc-truncate-max-2-lines">{{ article.title }}</h3>
<hr />
<p class="lcc-truncate-max-5-lines">{{ article.body | stripMarkdown }}</p>
<p class="lcc-truncate-max-5-lines">
{{ article.body | stripMarkdown }}
</p>
<div class="article-dates-container">
<span class="date-created">
{{ article?.modificationInfo?.dateCreated | formatDate: 'short no-time' }}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/article-grid/article-grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ArticleGridComponent implements OnInit {
ngOnInit(): void {
this.facade.fetchArticles();

this.facade.articles$.pipe(untilDestroyed(this)).subscribe((articles) => {
this.facade.articles$.pipe(untilDestroyed(this)).subscribe(articles => {
this.articles = articles.slice(0, this.maxArticles ?? articles.length);
});
}
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/article/article.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<img
[src]="article.imageUrl"
default="assets/image-placeholder.png"
alt="Article image banner"
/>
alt="Article image banner" />
} @placeholder {
<div class="lcc-content-placeholder-wrapper loading-placeholder-image">
<div class="lcc-content-placeholder"></div>
Expand Down
Loading

0 comments on commit 1937b1b

Please sign in to comment.