Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1x 2x 2x 2x 2x 2x 2x 3x 3x 2x 2x 3x 3x 3x 3x 4x 4x 4x 2x 2x 2x 4x 4x 4x 4x 4x | import {Component, OnInit} from '@angular/core'; import {MatDialog} from "@angular/material/dialog"; import {faAngleRight} from "@fortawesome/free-solid-svg-icons"; import {DateTime, Duration} from "luxon"; import {Subscription} from "rxjs"; import {ApiService} from '../../services/api.service'; import {Gym} from '../../models/gym.model'; import {MatSnackBar} from "@angular/material/snack-bar"; import {DataService} from "../../services/data.service"; import {SocialComponent} from "../../modals/social/social.component"; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.css'] }) export class HomeComponent implements OnInit { gyms: Gym[] = []; isLoading: boolean = true; gym_list_sorting = 'nearby'; gym_list_show_all: string | undefined = undefined; username: string | undefined; usernameSubscription: Subscription | undefined; constructor(private apiService: ApiService, private _snackBar: MatSnackBar, private data: DataService, public dialog: MatDialog) { } ngOnInit() { this.loadGyms() this.usernameSubscription = this.data.currentUsername.subscribe(d => this.username = d) } ngOnDestroy() { if (this.usernameSubscription !== undefined) { this.usernameSubscription.unsubscribe(); } } loadGyms() { this.isLoading = true; this.apiService.sendGetRequest().subscribe({ next: (data: any) => { // console.log("got gym data", data); this.gyms = data; this.isLoading = false; }, error: () => { // this.openSnackBar('Connection Error', 'Dismiss'); this.isLoading = false; } }); } openSnackBar(message: string, action: string) { this._snackBar.open(message, action, { duration: 3000 }); } get_firstname() { let s; if (this.username !== undefined) { s = this.username.split(" ") return s[0] }elseE{ return "" } } openNotifications(): void { const dialogRef = this.dialog.open(SocialComponent, { // data: {name: this.name, animal: this.animal}, }); } protected readonly DateTime = DateTime; protected readonly Duration = Duration; protected readonly faAngleRight = faAngleRight; get_greeting() { const h = DateTime.now().toObject().hour; Iif ( h < 5 || h > 22) { return "Good Night" }else Iif(h < 12) { return "Good Morning" }else if(h < 18) { return "Good Afternoon" }else E{ return "Good Evening" } } } |