diff --git a/frontend/src/app/containers/region-details/region-details.component.scss b/frontend/src/app/containers/region-details/region-details.component.scss
index 177cc04..a499753 100644
--- a/frontend/src/app/containers/region-details/region-details.component.scss
+++ b/frontend/src/app/containers/region-details/region-details.component.scss
@@ -42,6 +42,7 @@
> .more-btn {
color: #8f8f8f;
+ cursor: pointer;
}
}
@@ -66,6 +67,27 @@
}
+.places-container {
+ display: flex;
+ flex-direction: column;
+
+ > .group-title {
+ font-size: 1.5rem;
+ margin-bottom: 1rem;
+ }
+
+ > .places {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: space-evenly;
+
+ app-place {
+ margin: 0.5rem;
+ }
+ }
+}
+
.spinner {
flex: 1 1 auto;
display: flex;
diff --git a/frontend/src/app/containers/region-details/region-details.component.ts b/frontend/src/app/containers/region-details/region-details.component.ts
index 3480f24..24a35f5 100644
--- a/frontend/src/app/containers/region-details/region-details.component.ts
+++ b/frontend/src/app/containers/region-details/region-details.component.ts
@@ -4,6 +4,7 @@ import {ActivatedRoute, ParamMap} from '@angular/router';
import {DataService} from '../../services/data.service';
import {switchMap} from 'rxjs/operators';
import {SearchParameter} from '../../interfaces/search-request.interface';
+import {Place} from '../../interfaces/places.interface';
@Component({
@@ -36,6 +37,8 @@ export class RegionDetailsComponent implements AfterViewInit {
/** Extend the description text */
isDescExtended = false;
+ places: Place[] = [];
+
constructor(private route: ActivatedRoute, private ds: DataService) {
}
@@ -45,6 +48,7 @@ export class RegionDetailsComponent implements AfterViewInit {
).subscribe((region: Region) => {
this.region = region;
this.uriRegionName = encodeURI(this.region.name.toLowerCase());
+ this.ds.getPlacesByRegion(this.region.region_id).then(places => this.places = places);
setTimeout(() => {
if (this.container) {
this.container.nativeElement.scrollIntoView();
diff --git a/frontend/src/app/interfaces/places.interface.ts b/frontend/src/app/interfaces/places.interface.ts
new file mode 100644
index 0000000..b26c93d
--- /dev/null
+++ b/frontend/src/app/interfaces/places.interface.ts
@@ -0,0 +1,20 @@
+export interface Place {
+ /** The place id */
+ place_id: number;
+ /** The id of the parent region */
+ region_id: number;
+ /** The name of the place in english */
+ place_name: string;
+ /** The longitude position */
+ lon: number;
+ /** The latitude position */
+ lat: number;
+ /** The user rating between 0 and 5 */
+ rating: number;
+ /** Nearby address */
+ vicinity: string;
+ /** Google photo reference */
+ photo_reference: string;
+ /** URL to the image */
+ img_url: string;
+}
diff --git a/frontend/src/app/services/data.service.ts b/frontend/src/app/services/data.service.ts
index b83c7ac..c71b429 100644
--- a/frontend/src/app/services/data.service.ts
+++ b/frontend/src/app/services/data.service.ts
@@ -3,7 +3,11 @@ import {HttpClient, HttpParams} from '@angular/common/http';
import {Preset} from '../interfaces/preset.interface';
import {Result} from '../interfaces/result.interface';
import {Region} from '../interfaces/region.interface';
+import {Place} from '../interfaces/places.interface';
+/**
+ * The data service handles all API interactions.
+ */
@Injectable({
providedIn: 'root'
})
@@ -16,16 +20,27 @@ export class DataService {
constructor(private http: HttpClient) {
}
+ /**
+ * Get results for specific search query.
+ * @param query The search query
+ */
public searchRegions(query: string): Promise
{
const params = new HttpParams().set('q', query);
return this.http.get(this.API_URL + '/search', {params}).toPromise();
}
+ /**
+ * Get all search presets.
+ */
public getAllPresets(): Promise {
return this.http.get(this.API_URL + '/search/presets').toPromise();
}
+ /**
+ * Gets all regions.
+ * @param max Limit the returned regions. Selected regions are random.
+ */
public async getAllRegions(max?: number): Promise {
let params = new HttpParams();
if (max) {
@@ -38,6 +53,10 @@ export class DataService {
return regions;
}
+ /**
+ * Gets one region by its id.
+ * @param id The region id
+ */
public async getRegion(id: number): Promise {
if (this.regionCache.has(id)) {
return this.regionCache.get(id);
@@ -48,8 +67,19 @@ export class DataService {
return region;
}
+
+ /**
+ * Returns POIs near the region.
+ * @param id The regions id
+ */
+ public getPlacesByRegion(id: number): Promise {
+ return this.http.get(`${this.API_URL}/regions/${id}/nearby`).toPromise();
+ }
}
+/**
+ * Defines meta data for all region parameters.
+ */
export const REGION_PARAM_VIS: RegionParamVisLookup = {
temperature_mean: {
icon: 'wb_sunny',