From 43bdc421637f73951ab58a838da4458e88ac07bb Mon Sep 17 00:00:00 2001 From: kj1352 Date: Tue, 12 Jan 2021 12:22:15 +0530 Subject: [PATCH] Show cat button if party started --- src/app/app.component.ts | 36 ++++++++++++----------- src/app/booking/booking.page.html | 8 +++++ src/app/booking/booking.page.ts | 24 ++++++++++++--- src/app/chat/chat.page.ts | 2 +- src/app/collections/collections.page.scss | 5 ++-- src/app/home/home.page.html | 7 +++++ src/app/home/home.page.ts | 20 +++++++++++-- src/app/live/live.page.html | 1 + src/app/live/live.page.scss | 5 ---- src/app/live/live.page.ts | 11 +++---- src/global.scss | 19 ++++++++++++ 11 files changed, 102 insertions(+), 36 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2a20cb6..e0795a3 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -5,26 +5,28 @@ import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx'; @Component({ - selector: 'app-root', - templateUrl: 'app.component.html', - styleUrls: ['app.component.scss'] + selector: 'app-root', + templateUrl: 'app.component.html', + styleUrls: ['app.component.scss'] }) export class AppComponent { - constructor( - private platform: Platform, - private splashScreen: SplashScreen, - private statusBar: StatusBar - ) { - this.initializeApp(); - } + showAddParty: boolean = false; - initializeApp() { - this.platform.ready().then(() => { - this.statusBar.styleDefault(); - this.splashScreen.hide(); + constructor( + private platform: Platform, + private splashScreen: SplashScreen, + private statusBar: StatusBar + ) { + this.initializeApp(); + } - localStorage.isPartyChatOn = 'no'; + initializeApp() { + this.platform.ready().then(() => { + this.statusBar.styleDefault(); + this.splashScreen.hide(); - }); - } + localStorage.isPartyChatOn = 'no'; + + }); + } } diff --git a/src/app/booking/booking.page.html b/src/app/booking/booking.page.html index e7266df..1cc8778 100644 --- a/src/app/booking/booking.page.html +++ b/src/app/booking/booking.page.html @@ -45,4 +45,12 @@ + + + + + + 10 + + diff --git a/src/app/booking/booking.page.ts b/src/app/booking/booking.page.ts index 85623a2..6400c32 100644 --- a/src/app/booking/booking.page.ts +++ b/src/app/booking/booking.page.ts @@ -1,8 +1,9 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { IonSlides } from '@ionic/angular'; +import { IonSlides, ModalController } from '@ionic/angular'; import * as faker from 'faker'; import * as moment from 'moment'; import { Router } from '@angular/router'; +import { ChatPage } from '../chat/chat.page'; @Component({ selector: 'app-booking', @@ -44,8 +45,8 @@ export class BookingPage implements OnInit { spaceBetween: 15, initialSlide: 0, centeredSlides: true, - simulateTouch: false, - followFinger: false, + // simulateTouch: false, + // followFinger: false, }; bookingSeatsData: Array<{ @@ -74,9 +75,11 @@ export class BookingPage implements OnInit { }> }> }> = []; + showChat: boolean; constructor( - private router: Router + private router: Router, + private modalController: ModalController ) { } getFormattedDateTime(dateTime: Date) { @@ -147,4 +150,17 @@ export class BookingPage implements OnInit { this.router.navigate(['/booking-details' , { matchData: JSON.stringify(matchData) }]); } + async presentChatModal() { + const modal = await this.modalController.create({ + component: ChatPage, + }); + return await modal.present(); + } + + ionViewDidEnter() { + if (localStorage.isPartyChatOn === 'yes') { + this.showChat = true; + } + } + } diff --git a/src/app/chat/chat.page.ts b/src/app/chat/chat.page.ts index 2a686cc..c509196 100644 --- a/src/app/chat/chat.page.ts +++ b/src/app/chat/chat.page.ts @@ -55,7 +55,7 @@ export class ChatPage implements OnInit { async copyLink() { const toast = await this.toastController.create({ message: 'Copied invitation link!', - color: 'medium', + color: 'success', mode: 'md', duration: 100000, position: 'top', diff --git a/src/app/collections/collections.page.scss b/src/app/collections/collections.page.scss index 3e8d0da..b3b9361 100644 --- a/src/app/collections/collections.page.scss +++ b/src/app/collections/collections.page.scss @@ -46,11 +46,12 @@ ion-slides { position: absolute; left: 25vw; width: 50vw; - background-color: rgba(white, 0.1); + background-color: rgba(white, 0.3); border-radius: 7px; overflow: hidden; padding: 15px; - top: 58vh; + top: 60vh; + box-shadow: 0px 0px 5px inset dimgray; h5 { margin: 0; diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index 6bd19b4..c8a934c 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -105,4 +105,11 @@ + + + + 10 + + + diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 3583c2e..c8ceb85 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -1,6 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { IonSlides } from '@ionic/angular'; +import { IonSlides, ModalController } from '@ionic/angular'; import { Router } from '@angular/router'; +import { ChatPage } from '../chat/chat.page'; export type INews = { id: string | number, @@ -42,9 +43,11 @@ export class HomePage implements OnInit { newsData: Array = []; popularData: Array = []; + showChat: boolean = false; constructor( - private router: Router + private router: Router, + private modalController: ModalController ) { } ngOnInit() { @@ -116,6 +119,19 @@ export class HomePage implements OnInit { }]; } + ionViewDidEnter() { + if (localStorage.isPartyChatOn === 'yes') { + this.showChat = true; + } + } + + async presentChatModal() { + const modal = await this.modalController.create({ + component: ChatPage, + }); + return await modal.present(); + } + getIndex(e: any) { console.log(this.slides); } diff --git a/src/app/live/live.page.html b/src/app/live/live.page.html index 04beb83..9fc7ad9 100644 --- a/src/app/live/live.page.html +++ b/src/app/live/live.page.html @@ -134,6 +134,7 @@ + 10 diff --git a/src/app/live/live.page.scss b/src/app/live/live.page.scss index bc35170..3d866b5 100644 --- a/src/app/live/live.page.scss +++ b/src/app/live/live.page.scss @@ -237,11 +237,6 @@ ion-content { } } - -.chat-button { - --background: #d73e53; -} - ion-slides { padding: 30px 0 20px 0; position: relative; diff --git a/src/app/live/live.page.ts b/src/app/live/live.page.ts index c8ca35c..e42031f 100644 --- a/src/app/live/live.page.ts +++ b/src/app/live/live.page.ts @@ -49,8 +49,8 @@ export class LivePage implements OnInit { spaceBetween: 15, initialSlide: 0, centeredSlides: true, - simulateTouch: false, - followFinger: false, + // simulateTouch: false, + // followFinger: false, }; matchStats: { @@ -275,12 +275,12 @@ export class LivePage implements OnInit { totalWickets: 1, } } + } - - if (localStorage.isPartyChatOn = 'no') { + ionViewDidEnter() { + if (localStorage.isPartyChatOn === 'no') { this.showAddParty = true; } - } async presentChatModal() { @@ -298,6 +298,7 @@ export class LivePage implements OnInit { modal.onDidDismiss().then((data) => { if(data.data.createParty) { this.showAddParty = false; + localStorage.isPartyChatOn = 'yes'; } }); diff --git a/src/global.scss b/src/global.scss index ce411dc..bf35d06 100644 --- a/src/global.scss +++ b/src/global.scss @@ -52,4 +52,23 @@ figure { transform: translateY(0vh); } } +} + +.chat-button { + --background: #d73e53; + position: relative; + overflow: visible; + width: 60px; + height: 60px; + + ion-icon { + font-size: 25px; + } + + ion-badge { + position: absolute; + right: 10px; + top: 10px; + font-size: 10px; + } } \ No newline at end of file