Prettier.

This commit is contained in:
Jesse Brault 2026-01-28 18:17:50 -06:00
parent b42971703f
commit 14acdc3e83
9 changed files with 47 additions and 50 deletions

View File

@ -28,7 +28,7 @@ export class RecipePageContent {
const recipe = this.recipeView().recipe; const recipe = this.recipeView().recipe;
return { return {
queryKey: ['recipe-main-images', recipe.owner.username, recipe.slug], queryKey: ['recipe-main-images', recipe.owner.username, recipe.slug],
queryFn: () => this.imageService.getImage(recipe.mainImage?.url) queryFn: () => this.imageService.getImage(recipe.mainImage?.url),
}; };
}); });

View File

@ -76,7 +76,10 @@ export class RecipeUploadPage implements OnInit {
.subscribe(); .subscribe();
} }
private async switchModel(model: RecipeUploadClientModel, switchStep: boolean | RecipeUploadStep = false): Promise<void> { private async switchModel(
model: RecipeUploadClientModel,
switchStep: boolean | RecipeUploadStep = false,
): Promise<void> {
this.model.set(model); this.model.set(model);
this.includeInfer.set(!!model.draft?.lastInference); this.includeInfer.set(!!model.draft?.lastInference);
if (switchStep === true) { if (switchStep === true) {
@ -140,7 +143,7 @@ export class RecipeUploadPage implements OnInit {
const model = await this.recipeDraftService.updateDraft(this.model().draft!.id, { const model = await this.recipeDraftService.updateDraft(this.model().draft!.id, {
title, title,
slug, slug,
rawText rawText,
}); });
await this.switchModel(model, RecipeUploadStep.REVIEW); await this.switchModel(model, RecipeUploadStep.REVIEW);
} }

View File

@ -1,4 +1,4 @@
export type EnterRecipeDataEvent = EnterRecipeDataSubmitEvent export type EnterRecipeDataEvent = EnterRecipeDataSubmitEvent;
export interface EnterRecipeDataSubmitEvent { export interface EnterRecipeDataSubmitEvent {
_type: 'submit'; _type: 'submit';
@ -6,5 +6,5 @@ export interface EnterRecipeDataSubmitEvent {
title: string; title: string;
slug: string; slug: string;
rawText: string; rawText: string;
} };
} }

View File

@ -5,7 +5,8 @@ import {
inject, inject,
Injector, Injector,
input, input,
OnInit, output, OnInit,
output,
runInInjectionContext, runInInjectionContext,
viewChild, viewChild,
} from '@angular/core'; } from '@angular/core';
@ -73,8 +74,8 @@ export class EnterRecipeData implements OnInit {
data: { data: {
title: title!, title: title!,
slug: slug!, slug: slug!,
rawText: text! rawText: text!,
} },
}) });
} }
} }

View File

@ -8,9 +8,8 @@ describe('Review', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [Review] imports: [Review],
}) }).compileComponents();
.compileComponents();
fixture = TestBed.createComponent(Review); fixture = TestBed.createComponent(Review);
component = fixture.componentInstance; component = fixture.componentInstance;

View File

@ -4,19 +4,15 @@ import { MatButton } from '@angular/material/button';
@Component({ @Component({
selector: 'app-review', selector: 'app-review',
imports: [ imports: [MatButton],
MatButton
],
templateUrl: './review.html', templateUrl: './review.html',
styleUrl: './review.css', styleUrl: './review.css',
}) })
export class Review { export class Review {
public readonly draft = input.required<RecipeDraftViewModel>(); public readonly draft = input.required<RecipeDraftViewModel>();
public readonly publish = output<void>(); public readonly publish = output<void>();
protected onPublish(): void { protected onPublish(): void {
this.publish.emit(); this.publish.emit();
} }
} }

View File

@ -2,5 +2,5 @@ export enum RecipeUploadStep {
START, START,
INFER, INFER,
ENTER_DATA, ENTER_DATA,
REVIEW REVIEW,
} }

View File

@ -31,7 +31,7 @@ export class RecipeCard {
const recipe = this.recipe(); const recipe = this.recipe();
return { return {
queryKey: ['recipe-main-images', recipe.owner.username, recipe.slug], queryKey: ['recipe-main-images', recipe.owner.username, recipe.slug],
queryFn: () => this.imageService.getImage(recipe.mainImage?.url) queryFn: () => this.imageService.getImage(recipe.mainImage?.url),
}; };
}); });
} }

View File

@ -72,32 +72,30 @@ export class RecipeDraftService {
); );
} }
public updateDraft(id: string, data: { public updateDraft(
id: string,
data: {
title?: string | null; title?: string | null;
slug?: string | null; slug?: string | null;
rawText?: string | null; rawText?: string | null;
}): Promise<RecipeUploadClientModel> { },
): Promise<RecipeUploadClientModel> {
return firstValueFrom( return firstValueFrom(
this.http.put<WithStringDates<RecipeDraftViewModel>>( this.http
this.endpointService.getUrl('recipeDrafts', [id]), .put<WithStringDates<RecipeDraftViewModel>>(this.endpointService.getUrl('recipeDrafts', [id]), data)
data
)
.pipe( .pipe(
map(rawView => this.hydrateView(rawView)), map((rawView) => this.hydrateView(rawView)),
map(draft => ({ map((draft) => ({
draft, draft,
inProgressStep: RecipeUploadStep.ENTER_DATA, inProgressStep: RecipeUploadStep.ENTER_DATA,
})) })),
) ),
); );
} }
public publish(id: string): Promise<Recipe> { public publish(id: string): Promise<Recipe> {
return firstValueFrom( return firstValueFrom(
this.http.post<Recipe>( this.http.post<Recipe>(this.endpointService.getUrl('recipeDrafts', [id, 'publish']), null),
this.endpointService.getUrl('recipeDrafts', [id, 'publish']),
null
)
); );
} }