Skip to content

Commit

Permalink
Merge pull request #19 from rotirk20/development
Browse files Browse the repository at this point in the history
Updates of homepage, locations UI and mockup data
  • Loading branch information
rotirk20 authored Sep 28, 2024
2 parents 7b35f69 + 02020d7 commit 13751ab
Show file tree
Hide file tree
Showing 22 changed files with 319 additions and 91 deletions.
28 changes: 24 additions & 4 deletions frontend/src/app/components/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
<div class="bg-white shadow-lg py-4 border-t-[1px] border-gray-100">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
Copyright 2024 Smetovi.ba
<footer class="w-full py-14">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div class="max-w-3xl mx-auto">
<ul
class="text-lg flex items-center justify-center flex-col gap-7 md:flex-row md:gap-12 transition-all duration-500 py-8 mb-8 border-b border-gray-200">
<li><a routerLink="/" class="text-gray-800 hover:text-gray-900">Početna</a></li>
<li><a routerLink="/lokacije" class=" text-gray-800 hover:text-gray-900">Lokacije</a></li>
<li><a routerLink="/kontakt" class=" text-gray-800 hover:text-gray-900">Kontakt</a></li>
</ul>
<div class="flex space-x-10 justify-center items-center mb-8">
<a href="#" class="block text-gray-900 transition-all duration-500 hover:text-indigo-600 ">
<svg class="w-[0.938rem] h-[1.625rem]" viewBox="0 0 15 26" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M13.7926 14.4697L14.5174 9.86889H10.0528V6.87836C10.0528 5.62033 10.6761 4.39105 12.6692 4.39105H14.7275V0.473179C13.5289 0.282204 12.3177 0.178886 11.1037 0.164062C7.42917 0.164062 5.0302 2.37101 5.0302 6.36077V9.86889H0.957031V14.4697H5.0302V25.5979H10.0528V14.4697H13.7926Z"
fill="currentColor" />
</svg>

</a>
</div>
<span class="text-lg text-gray-500 text-center block">©<a href="https://smetovi.ba/">smetovi.ba</a> 2024,
All rights reserved.</span>
</div>
</div>
</div>
</footer>
3 changes: 2 additions & 1 deletion frontend/src/app/components/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';

@Component({
selector: 'app-footer',
standalone: true,
imports: [],
imports: [RouterLink],
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss']
})
Expand Down
29 changes: 29 additions & 0 deletions frontend/src/app/components/item-list/item-list.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div class="bg-white py-12">
<div class="container mx-auto px-4 mt-24">
<h2
class="text-4xl mb-8 font-bold uppercase text-left relative inline-block after:content-[''] after:block after:w-32 after:h-1 after:bg-blue-500 after:mt-4">
{{title}}
</h2>

<div *ngIf="data.length > 0; else noData"
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8">
<article *ngFor="let item of data"
class="relative isolate flex flex-col justify-end overflow-hidden rounded-2xl px-8 pb-8 pt-40 w-full mx-auto cursor-pointer shadow-lg">
<img src="{{item.image}}" alt="{{item.name}}" class="absolute inset-0 h-full w-full object-cover">
<div class="absolute inset-0 bg-gradient-to-t from-gray-900 via-gray-900/40"></div>
<h3 class="z-10 mt-3 text-2xl font-bold text-white">{{item.name}}</h3>
</article>
</div>

<!-- Template for no data -->
<ng-template #noData>
<div class="mt-8">
<p class="bg-zinc-50 text-gray-700 p-4 rounded-lg text-center font-semibold">
Nema podataka.
</p>
</div>
</ng-template>


</div>
</div>
Empty file.
23 changes: 23 additions & 0 deletions frontend/src/app/components/item-list/item-list.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ItemListComponent } from './item-list.component';

describe('ItemListComponent', () => {
let component: ItemListComponent;
let fixture: ComponentFixture<ItemListComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ItemListComponent]
})
.compileComponents();

fixture = TestBed.createComponent(ItemListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
19 changes: 19 additions & 0 deletions frontend/src/app/components/item-list/item-list.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgFor, NgIf } from '@angular/common';
import { Component, Input, OnInit } from '@angular/core';
import { Location } from 'src/app/shared/models/location.model';

type ItemType = Location; // Union type for flexibility

@Component({
selector: 'item-list',
standalone: true,
imports: [NgFor, NgIf],
templateUrl: './item-list.component.html',
styleUrls: ['./item-list.component.scss']
})
export class ItemListComponent {
@Input() data!: ItemType[]; // decorate the property with @Input()
@Input() title!: string;
constructor() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<p class="text-gray-500 text-sm text-slate-500 truncate">
{{ location.address }}
</p>
<p class="text-gray-600 text-sm text-slate-500 truncate">
<!-- <p class="text-gray-600 text-sm text-slate-500 truncate">
Kategorija: {{ location.type }}
</p>
</p> -->
</div>
</div>
</div>
1 change: 1 addition & 0 deletions frontend/src/app/components/weather/weather.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>weather works!</p>
Empty file.
23 changes: 23 additions & 0 deletions frontend/src/app/components/weather/weather.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { WeatherComponent } from './weather.component';

describe('WeatherComponent', () => {
let component: WeatherComponent;
let fixture: ComponentFixture<WeatherComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [WeatherComponent]
})
.compileComponents();

fixture = TestBed.createComponent(WeatherComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
36 changes: 36 additions & 0 deletions frontend/src/app/components/weather/weather.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Component, OnInit } from '@angular/core';
import { WeatherService } from 'src/app/shared/services/weather.service';

@Component({
selector: 'app-weather',
standalone: true,
imports: [],
templateUrl: './weather.component.html',
styleUrls: ['./weather.component.scss']
})
export class WeatherComponent implements OnInit {
weatherData: any;
city: string = 'Zenica'; // Default city, you can make this dynamic

constructor(private weatherService: WeatherService) {}

ngOnInit() {
this.getWeather(this.city);
}

getWeather(city: string) {
this.weatherService.getWeather(city).subscribe({
next: (data) => {
this.weatherData = data;
console.log(this.weatherData)
},
error: (error) => {
console.error('Error fetching weather data:', error);
},
complete: () => {
console.log('Weather data fetching complete');
}
});
}

}
2 changes: 1 addition & 1 deletion frontend/src/app/pages/contact/contact.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<main class="flex h-screen items-center justify-center bg-gray-100">
<div class="bg-white shadow-lg rounded-lg p-4 flex items-center space-x-4">
<div class="bg-white shadow-lg rounded-lg p-8 flex items-center space-x-4">
<!-- Mail Icon -->
<svg viewBox="0 0 8 6" class="h-6 w-6 text-blue-500"xmlns="http://www.w3.org/2000/svg">
<path d="m0 0h8v6h-8zm.75 .75v4.5h6.5v-4.5zM0 0l4 3 4-3v1l-4 3-4-3z"/>
Expand Down
91 changes: 33 additions & 58 deletions frontend/src/app/pages/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,43 @@
<div class="absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center backdrop-blur-md">
<h1 class="text-white text-3xl md:text-5xl font-bold text-center uppercase">Dobro došli na Smetovi.ba</h1>
</div>
<div class="svg-container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 0 450 48" preserveAspectRatio="none" class="absolute bottom-0 left-0 w-full">
<path d="M0,50 L20,30 L40,50 Z" fill="white"></path>
<path d="M20,50 L40,20 L60,50 Z" fill="white"></path>
<path d="M40,50 L70,35 L90,50 Z" fill="white"></path>
<g transform="translate(10, 34) scale(0.29)">
<path d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z" fill="#228B22"></path>
</g>
<g transform="translate(32, 25) scale(0.3)">
<path d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z" fill="#228B22"></path>
</g>
<g transform="translate(44, 35) scale(0.3)">
<path d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z" fill="#228B22"></path>
</g>
<g transform="translate(72, 36) scale(0.25)">
<path d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z" fill="#228B22"></path>
</g>
<div class="svg-container container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 0 450 48" preserveAspectRatio="none"
class="absolute bottom-0 left-0 w-full">
<path d="M0,50 L20,30 L40,50 Z" fill="white"></path>
<path d="M20,50 L40,20 L60,50 Z" fill="white"></path>
<path d="M40,50 L70,35 L90,50 Z" fill="white"></path>
<g transform="translate(10, 34) scale(0.29)">
<path
d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z"
fill="#228B22"></path>
</g>
<g transform="translate(32, 25) scale(0.3)">
<path
d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z"
fill="#228B22"></path>
</g>
<g transform="translate(44, 35) scale(0.3)">
<path
d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z"
fill="#228B22"></path>
</g>
<g transform="translate(72, 36) scale(0.25)">
<path
d="M14.779,12.18 L11.795,8.501 C11.795,8.501 13.396,8.937 13.57,8.937 C14.035,8.937 13.765,8.42 13.57,8.223 L11.185,5.192 C11.185,5.192 12.333,4.918 12.75,4.918 C13.168,4.918 12.947,4.401 12.75,4.204 L9.4,0.061 C9.203,-0.136 8.883,-0.136 8.686,0.061 L5.291,4.161 C5.093,4.358 4.805,4.876 5.291,4.876 C5.777,4.876 6.913,5.192 6.913,5.192 L4.325,8.079 C4.127,8.276 3.768,8.793 4.325,8.793 C4.644,8.793 6.275,8.502 6.275,8.502 L3.317,12.189 C3.12,12.385 2.76,12.903 3.317,12.903 C3.874,12.903 8.008,11.896 8.008,11.896 L8.008,14.941 C8.008,15.478 8.444,15.914 8.983,15.914 C9.52,15.914 9.998,15.478 9.998,14.941 L9.998,11.896 C9.998,11.896 14.373,12.895 14.778,12.895 C15.183,12.895 14.976,12.376 14.779,12.18 Z"
fill="#228B22"></path>
</g>
</svg>
</div>
</div>

</div>

<!-- Location Section -->
<div class="bg-white py-12">
<div class="container mx-auto px-4">
<h2 class="text-4xl mb-8 font-semibold text-center uppercase">Lokacije</h2>

<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8 mt-7">
<!-- Location 1 -->
<div class="bg-white-100">
<img class="w-48 h-48 object-cover rounded-full mx-auto drop-shadow-xl" src="/assets/images/smet.jpg">
<div class="p-6">
<h3 class="text-lg font-medium mb-2 text-center uppercase">Konjički klub "Smet"</h3>
</div>
</div>
<item-list [data]="locations" [title]="'Lokacije'"></item-list>

<!-- Location 2 -->
<div class="bg-white-100">
<img class="w-48 h-48 object-cover rounded-full mx-auto drop-shadow-xl" src="/assets/images/spomenik.jpg">
<div class="p-6">
<h3 class="text-lg font-medium mb-2 text-center uppercase">Spomen obilježje</h3>
</div>
</div>

<!-- Location 3 -->
<div class="bg-white-100">
<img class="w-48 h-48 object-cover rounded-full mx-auto drop-shadow-xl" src="/assets/images/restoran_960.jpg">
<div class="p-6">
<h3 class="text-lg font-medium mb-2 text-center uppercase">Restoran 360</h3>
</div>
</div>

<!-- Location 4 -->
<div class="bg-white-100">
<img class="w-48 h-48 object-cover rounded-full mx-auto drop-shadow-xl"
src="/assets/images/dom_saveza_izvidaca_i_radioamatera.jpg">
<div class="p-6">
<h3 class="text-lg font-medium mb-2 text-center uppercase">Dom Saveza Izviđača i Radioamatera</h3>
</div>
</div>
</div>
</div>
</div>
<!-- Tour section -->
<item-list [data]="[]" [title]="'Planinske ture'"></item-list>

<!-- Event section -->
<item-list [data]="[]" [title]="'Događaji'"></item-list>
</div>
18 changes: 15 additions & 3 deletions frontend/src/app/pages/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { Component } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { RouterLink } from '@angular/router';
import { ItemListComponent } from 'src/app/components/item-list/item-list.component';
import { WeatherComponent } from 'src/app/components/weather/weather.component';
import { Location } from 'src/app/shared/models/location.model';
import { LocationService } from 'src/app/shared/services/location.service';

@Component({
selector: 'app-home',
standalone: true,
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
imports: [RouterLink]
imports: [RouterLink, HttpClientModule, ItemListComponent, WeatherComponent]
})
export class HomeComponent {
export class HomeComponent implements OnInit {
locations: Location[] = [];
constructor(private locationService: LocationService) {}

ngOnInit() {
this.locationService.getLocations().subscribe(data => {
this.locations = data.locations; // Assuming 'locations' is the key in your JSON
});
}
}
1 change: 1 addition & 0 deletions frontend/src/app/pages/location/location.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.marker-info {
max-width: 300px;
img {
max-width: 300px;
max-height: 200px;
Expand Down
31 changes: 11 additions & 20 deletions frontend/src/app/pages/location/location.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,8 @@ import { Location } from 'src/app/shared/models/location.model';
import { GoogleMapsModule, MapMarker, MapInfoWindow } from '@angular/google-maps';
import { InfoWindowContent } from 'src/app/shared/models/info-window.model';
import { Marker } from 'src/app/shared/models/marker.model';
import { LocationService } from 'src/app/shared/services/location.service';

const DUMMY_LOCATIONS: Location[] = [
{
id: 1,
name: 'Konjički klub "Smet"',
address: 'Smetovi bb',
type: 'Zooloski vrt',
image: '/assets/images/smet.jpg',
coordinates: { lat: 44.241592, lng: 17.969323 },
},
{
id: 2,
name: 'Restoran "960"',
address: 'Smetovi bb',
type: 'Restoran',
image: '/assets/images/restoran_960.jpg',
coordinates: { lat: 44.242418, lng: 17.97361 },
},
];

@Component({
selector: 'app-location',
Expand Down Expand Up @@ -67,14 +50,22 @@ export class LocationComponent implements OnInit {
},
],
};
locations: Location[] = DUMMY_LOCATIONS;
locations: Location[] = [];
selectedLocationIndex!: number; // Tracks the selected location index
infoWindowContent: InfoWindowContent = {
name: '',
image: ''
};
constructor(private locationService: LocationService) {}

ngOnInit() {
this.locationService.getLocations().subscribe(data => {
this.locations = data.locations; // Assuming 'locations' is the key in your JSON
this.loadMarkers();
})
}

loadMarkers() {
this.locations.forEach(location => {
this.markers.push(
{
Expand All @@ -96,7 +87,7 @@ export class LocationComponent implements OnInit {
// Handle card click and open corresponding marker infoWindow
openInfoWindowFromCard(index: number) {
const markerRef = this.markerElements.get(index); // Get the marker reference by index
if (markerRef) {
if (markerRef && this.markers[index].position) {
this.center = this.markers[index].position; // Center map on the marker's position
this.selectedLocationIndex = index; // Set the selected location index
this.openInfoWindow(this.markers[index], markerRef, index);
Expand Down
Loading

0 comments on commit 13751ab

Please sign in to comment.