[HIMA-84] Added mock entry to dashboard at last position and product results at 4-th position

This commit is contained in:
Eraldo Hasanaj
2019-02-12 16:36:20 +01:00
parent 1a4ce519dc
commit b7f7c5ddc4
3 changed files with 34 additions and 3 deletions

View File

@@ -18,6 +18,9 @@ export const procuctsMock: Product[] = <Product[]> [
slogan: 'Silberfischchen gehen mit frechen Goldfischchen eine Runde im nahegelegenen See schwimmen',
icon: 'ResultBook1.png',
recommandation: false,
err: null,
location: null,
ean: null
},
<Product> {
id: 2,
@@ -36,6 +39,9 @@ export const procuctsMock: Product[] = <Product[]> [
slogan: 'Archipel',
icon: 'ResultBook2.png',
recommandation: false,
err: null,
location: null,
ean: null
},
<Product> {
id: 3,
@@ -54,13 +60,16 @@ export const procuctsMock: Product[] = <Product[]> [
slogan: 'Wie Ihr wollt',
icon: 'ResultBook3.png',
recommandation: false,
err: null,
location: 'Abenteuerroman A-Z',
ean: '3'
},
<Product> {
id: 4,
author: 'Ann Christin Artel',
title: 'Eine Reise um die Welt',
type: 'Kalender',
typeIcon: 'TypeCalendarWhite.svg',
typeIcon: 'KA',
category: 'Kalender A-Z',
serial: 'EAN 9783423267886',
price: 9.99,
@@ -72,6 +81,9 @@ export const procuctsMock: Product[] = <Product[]> [
slogan: 'Eine Reise um die Welt',
icon: 'ResultBook4.png',
recommandation: true,
err: null,
location: 'Abenteuerroman A-Z',
ean: '3'
},
<Product> {
id: 5,
@@ -90,6 +102,9 @@ export const procuctsMock: Product[] = <Product[]> [
slogan: 'Rechnung offen',
icon: 'ResultBook5.png',
recommandation: false,
err: null,
location: null,
ean: null
},
<Product> {
id: 6,
@@ -108,5 +123,8 @@ export const procuctsMock: Product[] = <Product[]> [
slogan: 'Wie Ihr wollt',
icon: 'ResultBook6.png',
recommandation: false,
err: null,
location: null,
ean: null
}
];

View File

@@ -54,7 +54,14 @@ export class ProductCardComponent implements OnInit {
private store: Store
) {
this.imageUrl$ = this.eanChangedSub.pipe(
flatMap(ean => this.catImageService.getImageUrl(ean)),
flatMap(ean => {
// TODO: remove mock data
if (ean === '3') {
console.log('ean 3');
return of('../../../assets/images/ResultBook4.png');
}
return this.catImageService.getImageUrl(ean);
}),
catchError(() => of(''))
);
}

View File

@@ -28,6 +28,7 @@ import {
import { ProductMapping } from 'src/app/core/mappings/product.mapping';
import { staggerAnimation } from './stagger.animation';
import { DataSource, CollectionViewer } from '@angular/cdk/collections';
import { procuctsMock } from 'mocks/products.mock';
@Component({
selector: 'app-search-results',
@@ -201,7 +202,12 @@ export class SearchDataSource extends DataSource<Product | undefined> {
this.cachedData.splice(
page * this.pageSize,
this.pageSize,
...data.result.map(item => this.productMapping.fromItemDTO(item))
...data.result.map((item, i) => {
if (i === 3) {
return procuctsMock[3];
}
return this.productMapping.fromItemDTO(item);
})
);
this.dataStream.next(this.cachedData);
this.dataStreamDTO.next(this.cachedItemsDTO);