feat: add map module

This commit is contained in:
Jovan Krunić
2021-07-13 07:57:09 +00:00
parent d696215d08
commit c1c9a92ec9
44 changed files with 2138 additions and 93 deletions

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input, OnInit} from '@angular/core';
import {SCPlace, SCSearchFilter} from '@openstapps/core';
import {MapProvider} from '../../map.provider';
/**
* Modal showing a provided list of places
*/
@Component({
selector: 'map-list-modal',
templateUrl: 'map-list.html',
styleUrls: ['map-list.scss'],
})
export class MapListModalComponent implements OnInit {
/**
* Action when close is pressed
*/
@Input() dismissAction: () => void;
/**
* Used for creating the search for the shown list
*/
@Input() filterQuery?: SCSearchFilter;
/**
* Places to show in the list
*/
items: SCPlace[];
/**
* Used for creating the search for the shown list
*/
@Input() queryText?: string;
constructor(private mapProvider: MapProvider) {}
/**
* Populate the list with the results from the search
*/
ngOnInit() {
this.mapProvider
.searchPlaces(this.filterQuery, this.queryText)
.then(result => {
this.items = result.data as SCPlace[];
});
}
}