mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
feat: add map module
This commit is contained in:
60
src/app/modules/map/page/modals/map-list-modal.component.ts
Normal file
60
src/app/modules/map/page/modals/map-list-modal.component.ts
Normal 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[];
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user