diff --git a/package.json b/package.json index e48ea43..8043b16 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "firebase": "^5.1.0", "firebase-tools": "^3.19.0", "hammerjs": "^2.0.8", + "ng-simple-slideshow": "^1.2.3", "ngx-electron": "^1.0.4", "rxjs": "^6.0.0", "webstorage-decorators": "^1.0.3", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index dd9f89f..cb3e736 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,6 +29,7 @@ import {NewComponentComponent} from './formulaManager/newComponent/newComponent. import {HttpModule} from '@angular/http'; import {NewFormulaComponent} from './formulaManager/newFormula/newFormula.component'; import {AppStore} from './app.store'; +import {SlideshowModule} from 'ng-simple-slideshow'; @NgModule({ declarations: [ @@ -71,7 +72,8 @@ import {AppStore} from './app.store'; {path: 'store', component: CategoriesComponent}, {path: '**', component: HomeComponent} ]), - ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production}) + ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production}), + SlideshowModule ], providers: [AppStore], entryComponents: [ diff --git a/src/app/app.store.ts b/src/app/app.store.ts index e29550a..090323e 100644 --- a/src/app/app.store.ts +++ b/src/app/app.store.ts @@ -73,6 +73,7 @@ export class AppStore { map(rows => rows.map((row: any) => { let temp = Object.assign({id: row.payload.doc.id, ref: row.payload.doc.ref}, row.payload.doc.data()); + temp.originalImage = temp.image; temp.image = this.domSanitizer.bypassSecurityTrustUrl(temp.image); temp.originalDescription = temp.description; temp.description = this.domSanitizer.bypassSecurityTrustHtml( diff --git a/src/app/store/product.ts b/src/app/store/product.ts index 301aa88..7670be6 100644 --- a/src/app/store/product.ts +++ b/src/app/store/product.ts @@ -5,10 +5,12 @@ export interface Product { category: string; currency: 'CAD' | 'USD'; description: SafeHtml; - files: {link: string; type: string}[]; + files: {name: string; link: string; type: string}[]; id: string; image: SafeUrl; name: string; + originalDescription: string; + originalImage: string; price: number; ref: DocumentReference; weight: number; diff --git a/src/app/store/products/products.component.html b/src/app/store/products/products.component.html index 9fcc3c6..edef859 100644 --- a/src/app/store/products/products.component.html +++ b/src/app/store/products/products.component.html @@ -2,12 +2,43 @@
- -

{{product.name}}

-
{{product.currency}} {{product.price | currency}}
-
Contact For Price
-
-

+
+
+ +
+
Links
+ + + {{l.name}} + + +
+
+
+

{{product.name}}

+
{{product.currency}} {{product.price | currency}}
+
Contact For Price
+ +

+ +
+
+ cloud_download Downloads +
+ + + insert_drive_file +
{{a.name}}
+
+ View + | + Download +
+
+
+
+
+
diff --git a/src/app/store/products/products.component.ts b/src/app/store/products/products.component.ts index 31f8feb..92096f9 100644 --- a/src/app/store/products/products.component.ts +++ b/src/app/store/products/products.component.ts @@ -3,20 +3,38 @@ import {ActivatedRoute} from '@angular/router'; import {AppComponent} from '../../app.component'; import {map} from 'rxjs/operators'; import {AppStore} from '../../app.store'; +import {Product} from '../product'; +import {SafeUrl, DomSanitizer} from '../../../../node_modules/@angular/platform-browser'; @Component({ selector: 'products', templateUrl: 'products.component.html' }) export class ProductsComponent { - product; + product: Product; + preview: SafeUrl[]; + links: {name: string; link: string; type: string}[]; + attachments: {name: string; link: string; type: string}[]; - constructor(private store: AppStore, private route: ActivatedRoute, public app: AppComponent) {} + constructor( + private store: AppStore, + private route: ActivatedRoute, + private domSanitizer: DomSanitizer, + public app: AppComponent + ) {} ngOnInit() { this.route.params.subscribe(params => { this.store.products.pipe(map(rows => rows.filter(row => row.name == params['product']))).subscribe(data => { this.product = data[0]; + + this.preview = [this.product.originalImage]; + this.preview = this.preview.concat( + this.product.files.filter(row => row.type == 'preview').map(row => row.link) + ); + + this.links = this.product.files.filter(row => row.type == 'link'); + this.attachments = this.product.files.filter(row => row.type == 'other'); }); }); } diff --git a/yarn.lock b/yarn.lock index 37f09f1..f42df5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5663,6 +5663,10 @@ next-tick@1: version "1.0.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" +ng-simple-slideshow@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/ng-simple-slideshow/-/ng-simple-slideshow-1.2.3.tgz#78938ce2ca936d2a96badd86214dc36cb9ca72bc" + ngx-electron@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/ngx-electron/-/ngx-electron-1.0.4.tgz#2d80b25d74ae4d6226ad8b3bc4ecfa611e48fdca"