Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 7x 7x 7x 7x 2x 2x 7x 7x 7x 7x 4x 4x 7x | import { NgOptimizedImage, NgStyle } from '@angular/common';
import { Component, Input, OnInit, inject, output } from '@angular/core';
import { blog } from '@classes/blog';
import { UrlService } from '@services/url.service';
@Component({
selector: 'grt-blog-card',
imports: [NgStyle, NgOptimizedImage],
templateUrl: './blog-card.component.html',
styleUrl: './blog-card.component.scss'
})
export class BlogCardComponent implements OnInit {
urlService = inject(UrlService);
@Input() blog!: blog;
@Input() mainPage!: boolean;
readonly showMap = output<any>();
countries = '';
cities: any = [];
hover = false;
showMoreCountries = false;
showMoreDestinations = false;
destinations = '';
ngOnInit() {
this.cities = this.blog?.cities
? this.blog.cities.includes(',')
? this.blog.cities.split(',')
: [this.blog.cities]
: [];
this.countries = this.cities
.filter(
(city: any, index: number, self: any[]) =>
index === self.findIndex((c) => c['country-name'] === city['country-name']),
)
.map((city: any) => city['country-name'])
.join(', ');
this.showMoreCountries = this.countries.length > 25;
const destinationNames = Array.isArray(this.cities) ? this.cities.map((city: any) => city?.name) : [];
this.destinations = destinationNames.join(', ');
this.showMoreDestinations = this.destinations.length > 25;
if (this.blog?.['image']) {
this.blog['image'] = this.urlService.getNewUrl(this.blog['image']);
}
}
replaceUrl(url: string) {
if (!url) return '';
return url.replace(/https:\/\/res-(?:[1-5]\.|)\bcloudinary.com\/gorealtravel\/image\/upload\//g, '');
}
details() {
this.showMap.emit(this.blog);
}
openModal() {}
setHover(bool: boolean) {
this.hover = bool;
}
}
|