@@ -318,6 +329,7 @@
diff --git a/client/src/app/features/dashboard/recipe-details/recipe-details.component.ts b/client/src/app/features/recipes/recipe-details/recipe-details.component.ts
similarity index 84%
rename from client/src/app/features/dashboard/recipe-details/recipe-details.component.ts
rename to client/src/app/features/recipes/recipe-details/recipe-details.component.ts
index 787e634..e5401dd 100644
--- a/client/src/app/features/dashboard/recipe-details/recipe-details.component.ts
+++ b/client/src/app/features/recipes/recipe-details/recipe-details.component.ts
@@ -6,6 +6,8 @@ import { isEqual } from 'lodash';
import { delay } from 'rxjs';
import { RecipeService } from 'src/app/core/services/recipe.service';
import { ConfirmModal } from 'src/app/shared/modal/confirm/confirm-modal.component';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { animate, style, transition, trigger } from '@angular/animations';
interface RecipeDetail {
productCode: string;
@@ -33,6 +35,14 @@ interface RecipeMetaData {
templateUrl: './recipe-details.component.html',
standalone: true,
imports: [NgIf, RouterLink, ReactiveFormsModule, ConfirmModal],
+ animations: [
+ trigger('inOutAnimation', [
+ transition(':enter', [
+ style({ opacity: 0 }),
+ animate('1s ease-out', style({ opacity: 1 })),
+ ]),
+ ]),
+ ],
})
export class RecipeDetailsComponent implements OnInit {
title: string = 'Recipe Detail';
@@ -100,7 +110,7 @@ export class RecipeDetailsComponent implements OnInit {
message: 'Do you want to save changes?',
confirmCallBack: () => {
console.log('confirm save');
- this._router.navigate(['..']);
+ this._router.navigate(['/recipes']);
},
};
@@ -109,23 +119,27 @@ export class RecipeDetailsComponent implements OnInit {
message: 'Do you want to close without saving?',
confirmCallBack: () => {
console.log('confirm close');
- this._router.navigate(['..']);
+ this._router.navigate(['/recipes']);
},
};
onPressConfirmSave() {
- if (!isEqual(this.recipeDetail.value, this.originalRecipeDetail)) {
+ if (this.isValueChanged) {
this.showConfirmSaveModal.emit(true);
} else {
- this._router.navigate(['..']);
+ this._router.navigate(['/recipes']);
}
}
onPressConfirmClose() {
- if (!isEqual(this.recipeDetail.value, this.originalRecipeDetail)) {
+ if (this.isValueChanged) {
this.showConfirmCloseModal.emit(true);
} else {
- this._router.navigate(['..']);
+ this._router.navigate(['/recipes']);
}
}
+
+ get isValueChanged() {
+ return !isEqual(this.recipeDetail.value, this.originalRecipeDetail);
+ }
}
diff --git a/client/src/app/features/dashboard/dashboard.component.html b/client/src/app/features/recipes/recipes.component.html
similarity index 100%
rename from client/src/app/features/dashboard/dashboard.component.html
rename to client/src/app/features/recipes/recipes.component.html
diff --git a/client/src/app/features/dashboard/dashboard.component.ts b/client/src/app/features/recipes/recipes.component.ts
similarity index 98%
rename from client/src/app/features/dashboard/dashboard.component.ts
rename to client/src/app/features/recipes/recipes.component.ts
index 11d9345..9f75134 100644
--- a/client/src/app/features/dashboard/dashboard.component.ts
+++ b/client/src/app/features/recipes/recipes.component.ts
@@ -11,10 +11,10 @@ import * as lodash from 'lodash';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
@Component({
- selector: 'app-dashboard',
+ selector: 'app-recipes',
standalone: true,
imports: [RouterLink, NgIf, NgFor, DatePipe, RecipeModalComponent],
- templateUrl: './dashboard.component.html',
+ templateUrl: './recipes.component.html',
})
export class DashboardComponent implements OnInit {
recipes: Recipe | null = null;
diff --git a/client/src/assets/icons/dashboard.svg b/client/src/assets/icons/recipes.svg
similarity index 100%
rename from client/src/assets/icons/dashboard.svg
rename to client/src/assets/icons/recipes.svg