diff --git a/src/app/pages/recipe-page/recipe-page-content/recipe-page-content.ts b/src/app/pages/recipe-page/recipe-page-content/recipe-page-content.ts index fdbd9f3..d672f59 100644 --- a/src/app/pages/recipe-page/recipe-page-content/recipe-page-content.ts +++ b/src/app/pages/recipe-page/recipe-page-content/recipe-page-content.ts @@ -28,7 +28,7 @@ export class RecipePageContent { const recipe = this.recipeView().recipe; return { queryKey: ['recipe-main-images', recipe.owner.username, recipe.slug], - queryFn: () => this.imageService.getImage(recipe.mainImage?.url) + queryFn: () => this.imageService.getImage(recipe.mainImage?.url), }; }); diff --git a/src/app/pages/recipe-upload-page/recipe-upload-page.ts b/src/app/pages/recipe-upload-page/recipe-upload-page.ts index ddea9e0..87d7255 100644 --- a/src/app/pages/recipe-upload-page/recipe-upload-page.ts +++ b/src/app/pages/recipe-upload-page/recipe-upload-page.ts @@ -76,7 +76,10 @@ export class RecipeUploadPage implements OnInit { .subscribe(); } - private async switchModel(model: RecipeUploadClientModel, switchStep: boolean | RecipeUploadStep = false): Promise { + private async switchModel( + model: RecipeUploadClientModel, + switchStep: boolean | RecipeUploadStep = false, + ): Promise { this.model.set(model); this.includeInfer.set(!!model.draft?.lastInference); if (switchStep === true) { @@ -140,7 +143,7 @@ export class RecipeUploadPage implements OnInit { const model = await this.recipeDraftService.updateDraft(this.model().draft!.id, { title, slug, - rawText + rawText, }); await this.switchModel(model, RecipeUploadStep.REVIEW); } diff --git a/src/app/pages/recipe-upload-page/steps/enter-recipe-data/EnterRecipeDataEvent.ts b/src/app/pages/recipe-upload-page/steps/enter-recipe-data/EnterRecipeDataEvent.ts index d6f175c..baa8b75 100644 --- a/src/app/pages/recipe-upload-page/steps/enter-recipe-data/EnterRecipeDataEvent.ts +++ b/src/app/pages/recipe-upload-page/steps/enter-recipe-data/EnterRecipeDataEvent.ts @@ -1,4 +1,4 @@ -export type EnterRecipeDataEvent = EnterRecipeDataSubmitEvent +export type EnterRecipeDataEvent = EnterRecipeDataSubmitEvent; export interface EnterRecipeDataSubmitEvent { _type: 'submit'; @@ -6,5 +6,5 @@ export interface EnterRecipeDataSubmitEvent { title: string; slug: string; rawText: string; - } + }; } diff --git a/src/app/pages/recipe-upload-page/steps/enter-recipe-data/enter-recipe-data.ts b/src/app/pages/recipe-upload-page/steps/enter-recipe-data/enter-recipe-data.ts index 1a28296..806a53b 100644 --- a/src/app/pages/recipe-upload-page/steps/enter-recipe-data/enter-recipe-data.ts +++ b/src/app/pages/recipe-upload-page/steps/enter-recipe-data/enter-recipe-data.ts @@ -5,7 +5,8 @@ import { inject, Injector, input, - OnInit, output, + OnInit, + output, runInInjectionContext, viewChild, } from '@angular/core'; @@ -73,8 +74,8 @@ export class EnterRecipeData implements OnInit { data: { title: title!, slug: slug!, - rawText: text! - } - }) + rawText: text!, + }, + }); } } diff --git a/src/app/pages/recipe-upload-page/steps/review/review.spec.ts b/src/app/pages/recipe-upload-page/steps/review/review.spec.ts index 7928052..76d4214 100644 --- a/src/app/pages/recipe-upload-page/steps/review/review.spec.ts +++ b/src/app/pages/recipe-upload-page/steps/review/review.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Review } from './review'; describe('Review', () => { - let component: Review; - let fixture: ComponentFixture; + let component: Review; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [Review] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Review], + }).compileComponents(); - fixture = TestBed.createComponent(Review); - component = fixture.componentInstance; - await fixture.whenStable(); - }); + fixture = TestBed.createComponent(Review); + component = fixture.componentInstance; + await fixture.whenStable(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/recipe-upload-page/steps/review/review.ts b/src/app/pages/recipe-upload-page/steps/review/review.ts index 299af8e..51a82d0 100644 --- a/src/app/pages/recipe-upload-page/steps/review/review.ts +++ b/src/app/pages/recipe-upload-page/steps/review/review.ts @@ -3,20 +3,16 @@ import { RecipeDraftViewModel } from '../../../../shared/models/RecipeDraftView. import { MatButton } from '@angular/material/button'; @Component({ - selector: 'app-review', - imports: [ - MatButton - ], - templateUrl: './review.html', - styleUrl: './review.css', + selector: 'app-review', + imports: [MatButton], + templateUrl: './review.html', + styleUrl: './review.css', }) export class Review { - public readonly draft = input.required(); public readonly publish = output(); protected onPublish(): void { this.publish.emit(); } - } diff --git a/src/app/shared/client-models/RecipeUploadStep.ts b/src/app/shared/client-models/RecipeUploadStep.ts index 2f3df52..ccf42df 100644 --- a/src/app/shared/client-models/RecipeUploadStep.ts +++ b/src/app/shared/client-models/RecipeUploadStep.ts @@ -2,5 +2,5 @@ export enum RecipeUploadStep { START, INFER, ENTER_DATA, - REVIEW + REVIEW, } diff --git a/src/app/shared/components/recipe-card-grid/recipe-card/recipe-card.ts b/src/app/shared/components/recipe-card-grid/recipe-card/recipe-card.ts index 948758e..29ae26a 100644 --- a/src/app/shared/components/recipe-card-grid/recipe-card/recipe-card.ts +++ b/src/app/shared/components/recipe-card-grid/recipe-card/recipe-card.ts @@ -31,7 +31,7 @@ export class RecipeCard { const recipe = this.recipe(); return { queryKey: ['recipe-main-images', recipe.owner.username, recipe.slug], - queryFn: () => this.imageService.getImage(recipe.mainImage?.url) + queryFn: () => this.imageService.getImage(recipe.mainImage?.url), }; }); } diff --git a/src/app/shared/services/RecipeDraftService.ts b/src/app/shared/services/RecipeDraftService.ts index 7fab0f5..467b9ff 100644 --- a/src/app/shared/services/RecipeDraftService.ts +++ b/src/app/shared/services/RecipeDraftService.ts @@ -72,32 +72,30 @@ export class RecipeDraftService { ); } - public updateDraft(id: string, data: { - title?: string | null; - slug?: string | null; - rawText?: string | null; - }): Promise { + public updateDraft( + id: string, + data: { + title?: string | null; + slug?: string | null; + rawText?: string | null; + }, + ): Promise { return firstValueFrom( - this.http.put>( - this.endpointService.getUrl('recipeDrafts', [id]), - data - ) + this.http + .put>(this.endpointService.getUrl('recipeDrafts', [id]), data) .pipe( - map(rawView => this.hydrateView(rawView)), - map(draft => ({ + map((rawView) => this.hydrateView(rawView)), + map((draft) => ({ draft, inProgressStep: RecipeUploadStep.ENTER_DATA, - })) - ) + })), + ), ); } public publish(id: string): Promise { return firstValueFrom( - this.http.post( - this.endpointService.getUrl('recipeDrafts', [id, 'publish']), - null - ) + this.http.post(this.endpointService.getUrl('recipeDrafts', [id, 'publish']), null), ); }