<commit_before>import {Component, OnInit} from '@angular/core';
import {Observable} from 'rxjs/Rx';
import 'rxjs/add/operator/toPromise';
import {GeolocationService} from './geolocation.service';
import {GooglePlacesService} from './gplaces.service';

declare var google: any;

// TODO: refactorizar servicio maps.
@Component({
    selector: 'my-dashboard',
    template: `
        <div class="dashboard">
            <h3> Welcome {{profile.given_name}}!</h3>
            <p>Which places they are near me?</p>
            <button (click)="getPlaces()">Search</button>
            <ul>
                <li *ngFor="let restaurant of restaurants">
                <span class="badge">{{restaurant.name}}</span> {{restaurant.vicinity}}
                </li>
            </ul>
            <div id="results"></div>
        </div>
    `,
    providers:[
        GeolocationService,
        GooglePlacesService
    ]
})
// @CanActivate(() => this.tokenNotExpired())
export class DashboardComponent implements OnInit{
    profile: Object;
    restaurants: any[] = [];

    constructor (
        private geolocationService: GeolocationService,
        private googlePlacesService: GooglePlacesService
    ) {
        this.profile = JSON.parse(localStorage.getItem('profile'));
        console.log(this.profile)
    }

    ngOnInit() {
        //this.getPlaces();
    }

    getPlaces() {
        this.geolocationService.getLocation()
            .toPromise()
            .then(
                position => {
                    var latLng = new google.maps.LatLng(
                        position.coords.latitude,
                        position.coords.longitude);
                    var container = document.getElementById('results');
                    this.googlePlacesService.getPlaces(container, latLng)
                        .toPromise()
                        .then((list:any[]) => {
                            console.log(list);
                            this.restaurants = list;
                        });
                }
            );
    }
}
<commit_msg>Add first image to the list<commit_after>import {Component, OnInit} from '@angular/core';
import {Observable} from 'rxjs/Rx';
import 'rxjs/add/operator/toPromise';
import {GeolocationService} from './geolocation.service';
import {GooglePlacesService} from './gplaces.service';

declare var google: any;

// TODO: refactorizar servicio maps.
@Component({
    selector: 'my-dashboard',
    template: `
        <div class="dashboard">
            <h3> Welcome {{profile.given_name}}!</h3>
            <p>Which places they are near me?</p>
            <button (click)="getPlaces()">Search</button>
            <ul>
                <li *ngFor="let restaurant of restaurants">
                <span class="badge">{{restaurant.name}}</span> {{restaurant.vicinity}}
                <div *ngIf="restaurant.photos">
                    <img [src]="restaurant.photos[0].getUrl({'maxWidth': 300, 'maxHeight': 300})">
                </div>
                </li>
            </ul>
            <div id="results"></div>
        </div>
    `,
    providers:[
        GeolocationService,
        GooglePlacesService
    ]
})
// @CanActivate(() => this.tokenNotExpired())
export class DashboardComponent implements OnInit{
    profile: Object;
    restaurants: any[] = [];

    constructor (
        private geolocationService: GeolocationService,
        private googlePlacesService: GooglePlacesService
    ) {
        this.profile = JSON.parse(localStorage.getItem('profile'));
        console.log(this.profile)
    }

    ngOnInit() {
        //this.getPlaces();
    }

    getPlaces() {
        this.geolocationService.getLocation()
            .toPromise()
            .then(
                position => {
                    var latLng = new google.maps.LatLng(
                        position.coords.latitude,
                        position.coords.longitude);
                    var container = document.getElementById('results');
                    this.googlePlacesService.getPlaces(container, latLng)
                        .toPromise()
                        .then((list:any[]) => {
                            this.restaurants = list;
                        });
                }
            );
    }
}

{'fraction_non_alphanumeric': 0.128187134502924, 'fraction_numerical': 0.0025730994152046785, 'mean_word_length': 1.7658473479948253, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5300420', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1137, 'n_words': 222}