From 58ad2037839ab1700936a9f8ee98dbc4a0d09569 Mon Sep 17 00:00:00 2001 From: panabonic Date: Mon, 11 Dec 2023 18:24:35 +0300 Subject: [PATCH] minor fixes and cleanup --- .../basic/images/images-section.component.ts | 54 ------------------- src/app/_services/gallery.service.ts | 4 +- 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/src/app/_modules/pages/sections/types/basic/images/images-section.component.ts b/src/app/_modules/pages/sections/types/basic/images/images-section.component.ts index a54155c..8402e25 100644 --- a/src/app/_modules/pages/sections/types/basic/images/images-section.component.ts +++ b/src/app/_modules/pages/sections/types/basic/images/images-section.component.ts @@ -1,8 +1,6 @@ import {Component, Input} from '@angular/core'; import {ObjectsService} from "@app/_services"; -import SwiperCore, {Navigation, Pagination, SwiperOptions} from 'swiper'; import {GalleryService} from "@app/_services/gallery.service"; -SwiperCore.use([Navigation, Pagination]); @Component({ selector: 'images-section', @@ -12,32 +10,11 @@ SwiperCore.use([Navigation, Pagination]); export class ImagesSectionComponent { @Input() section: any; - public config: SwiperOptions = { - slidesPerView: 1, - spaceBetween: 50 - }; - - public parsedPhotos: any[] = [] - public activePhoto: string = '' - public nextId:string; - public backId:string; - public showId: string = '' - public showFullscreen = false; - public activeIndex: number = 0 - public tmpNumber: number = 0 - constructor(private objectsService: ObjectsService, private galleryService: GalleryService) { } ngOnInit() { - this.config.navigation = { - prevEl: `#section-${this.section?.id} .prev`, nextEl: `#section-${this.section?.id} .next` - } - - setTimeout(()=>{ - this.parsed(); - }, 300) } get items() { @@ -48,37 +25,6 @@ export class ImagesSectionComponent { return type.name; } - set photo(activePhoto: string) { - this.activePhoto = activePhoto - } - get photo(): string { - return this.activePhoto - } - - - - - parsed(): void { - this.tmpNumber = 0 - this.parsedPhotos = this.items || [] - this.parsedPhotos.map((photo: any) => { - if (this.tmpNumber===0) { - photo.active = true - this.photo = photo.links.full - this.showId = photo.id - } else { - photo.active = false - if (this.tmpNumber===1) { - this.nextId = photo.id - } - } - this.tmpNumber++ - if (this.items.length > 1 && this.items.length == this.tmpNumber) { - this.backId = photo.id - } - return photo - }) - } show(i:number): void { this.galleryService.show(this.items, i); diff --git a/src/app/_services/gallery.service.ts b/src/app/_services/gallery.service.ts index afa3a6e..bf34026 100644 --- a/src/app/_services/gallery.service.ts +++ b/src/app/_services/gallery.service.ts @@ -3,8 +3,8 @@ import {BehaviorSubject} from 'rxjs'; @Injectable({providedIn: 'root'}) export class GalleryService { - public imagesSubject = new BehaviorSubject(null); - public positionSubject = new BehaviorSubject(null); + public imagesSubject = new BehaviorSubject(null); + public positionSubject = new BehaviorSubject(null); constructor() { }