Prettier.

This commit is contained in:
Jesse Brault 2026-01-26 13:14:55 -06:00
parent 13a282f71f
commit 6e6bf04541
12 changed files with 34 additions and 39 deletions

View File

@ -17,7 +17,7 @@ export const routes: Routes = [
{ {
path: 'recipe-upload', path: 'recipe-upload',
component: RecipeUploadPage, component: RecipeUploadPage,
canActivate: [authGuard] canActivate: [authGuard],
}, },
{ {
path: 'recipes/:username/:slug', path: 'recipes/:username/:slug',

View File

@ -5,7 +5,7 @@
'step-complete': step.completed, 'step-complete': step.completed,
'step-in-progress': step.inProgress, 'step-in-progress': step.inProgress,
'step-incomplete': !step.completed, 'step-incomplete': !step.completed,
'step-displayed': displayStep() === step.index 'step-displayed': displayStep() === step.index,
}" }"
> >
@if (step.completed || step.inProgress) { @if (step.completed || step.inProgress) {

View File

@ -5,7 +5,9 @@
<app-file-upload [files]="sourceFilesArray()" (fileChange)="onFileChange($event)"></app-file-upload> <app-file-upload [files]="sourceFilesArray()" (fileChange)="onFileChange($event)"></app-file-upload>
<div id="ai-or-manual-buttons"> <div id="ai-or-manual-buttons">
<button matButton="outlined" type="button" (click)="onFormSubmit('manual')">Enter Manually</button> <button matButton="outlined" type="button" (click)="onFormSubmit('manual')">Enter Manually</button>
<button matButton="filled" type="button" [disabled]="!sourceFile()" (click)="onFormSubmit('ai-assist')">Use AI Assist</button> <button matButton="filled" type="button" [disabled]="!sourceFile()" (click)="onFormSubmit('ai-assist')">
Use AI Assist
</button>
</div> </div>
</form> </form>
</section> </section>

View File

@ -2,11 +2,11 @@
<form [formGroup]="recipeFormGroup"> <form [formGroup]="recipeFormGroup">
<mat-form-field> <mat-form-field>
<mat-label>Title</mat-label> <mat-label>Title</mat-label>
<input matInput [formControl]="recipeFormGroup.controls.title"> <input matInput [formControl]="recipeFormGroup.controls.title" />
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-label>Slug</mat-label> <mat-label>Slug</mat-label>
<input matInput [formControl]="recipeFormGroup.controls.slug"> <input matInput [formControl]="recipeFormGroup.controls.slug" />
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-label>Recipe Text</mat-label> <mat-label>Recipe Text</mat-label>

View File

@ -3,7 +3,9 @@
<ul> <ul>
@for (link of links(); track link.relativeUrl) { @for (link of links(); track link.relativeUrl) {
@if (!link.disabled) { @if (!link.disabled) {
<li><a [routerLink]="link.relativeUrl">{{ link.title }}</a></li> <li>
<a [routerLink]="link.relativeUrl">{{ link.title }}</a>
</li>
} }
} }
</ul> </ul>

View File

@ -10,7 +10,6 @@ import { NavLinkConfig } from './NavLinkConfig';
styleUrl: './nav.css', styleUrl: './nav.css',
}) })
export class Nav { export class Nav {
private readonly authService = inject(AuthService); private readonly authService = inject(AuthService);
protected readonly links = computed<NavLinkConfig[]>(() => { protected readonly links = computed<NavLinkConfig[]>(() => {
@ -26,9 +25,8 @@ export class Nav {
{ {
relativeUrl: '/recipe-upload', relativeUrl: '/recipe-upload',
title: 'Upload Recipe', title: 'Upload Recipe',
disabled: this.authService.accessToken() === null disabled: this.authService.accessToken() === null,
} },
]; ];
}); });
} }

View File

@ -19,21 +19,16 @@ export class RecipeService {
public getRecipes(): Promise<Recipe[]> { public getRecipes(): Promise<Recipe[]> {
return firstValueFrom( return firstValueFrom(
this.http.get<RecipeInfoViews>(this.endpointService.getUrl('recipes')) this.http.get<RecipeInfoViews>(this.endpointService.getUrl('recipes')).pipe(map((res) => res.content)),
.pipe(map((res) => res.content))
); );
} }
public getRecipeView(username: string, slug: string): Promise<RecipeView> { public getRecipeView(username: string, slug: string): Promise<RecipeView> {
return firstValueFrom(this.http.get<RecipeView>( return firstValueFrom(this.http.get<RecipeView>(this.endpointService.getUrl('recipes', [username, slug])));
this.endpointService.getUrl('recipes', [username, slug])
));
} }
private getRecipeBaseUrl(recipeView: RecipeView): string { private getRecipeBaseUrl(recipeView: RecipeView): string {
return this.endpointService.getUrl( return this.endpointService.getUrl('recipes', [recipeView.recipe.owner.username, recipeView.recipe.slug]);
'recipes', [recipeView.recipe.owner.username, recipeView.recipe.slug]
);
} }
public async toggleStar(recipeView: RecipeView): Promise<void> { public async toggleStar(recipeView: RecipeView): Promise<void> {
@ -61,10 +56,9 @@ export class RecipeService {
public async addComment(username: string, slug: string, commentText: string): Promise<RecipeComment> { public async addComment(username: string, slug: string, commentText: string): Promise<RecipeComment> {
const comment = await firstValueFrom( const comment = await firstValueFrom(
this.http.post<RecipeComment>( this.http.post<RecipeComment>(this.endpointService.getUrl('recipes', [username, slug, 'comments']), {
this.endpointService.getUrl('recipes', [username, slug, 'comments']), text: commentText,
{ text: commentText } }),
)
); );
await this.queryClient.invalidateQueries({ await this.queryClient.invalidateQueries({
queryKey: ['recipeComments', username, slug], queryKey: ['recipeComments', username, slug],

View File

@ -13,7 +13,7 @@ export class RecipeUploadService {
public getRecipeUploadModel(draftId: number): Observable<RecipeUploadModel> { public getRecipeUploadModel(draftId: number): Observable<RecipeUploadModel> {
return of({ return of({
inProgressStep: RecipeUploadStep.ENTER_DATA, inProgressStep: RecipeUploadStep.ENTER_DATA,
id: 42 id: 42,
}); });
} }
@ -24,8 +24,7 @@ export class RecipeUploadService {
inferredTitle: 'Some recipe', inferredTitle: 'Some recipe',
inferredSlug: 'some-recipe', inferredSlug: 'some-recipe',
inferredText: 'Some text.', inferredText: 'Some text.',
inferredIngredients: [] inferredIngredients: [],
}).pipe(delay(5_000)); }).pipe(delay(5_000));
} }
} }

View File

@ -1,3 +1,3 @@
export const environment = { export const environment = {
apiBaseUrl: 'http://localhost:8080' apiBaseUrl: 'http://localhost:8080',
}; };

View File

@ -1,3 +1,3 @@
export const environment = { export const environment = {
apiBaseUrl: 'http://localhost:8080' apiBaseUrl: 'http://localhost:8080',
}; };