diff --git a/src/pages/stream/stream.html b/src/pages/stream/stream.html index a38f5de..3af6ff2 100644 --- a/src/pages/stream/stream.html +++ b/src/pages/stream/stream.html @@ -16,7 +16,7 @@ - + @@ -64,24 +64,29 @@ - - - - 0">{{ post.counts.bookmarks }} - - 0">{{ post.counts.reposts }} + + + + 0">{{ post.counts.bookmarks }} + + 0">{{ post.counts.replies }} + + + + + diff --git a/src/pages/stream/stream.ts b/src/pages/stream/stream.ts index 094c752..dde3426 100644 --- a/src/pages/stream/stream.ts +++ b/src/pages/stream/stream.ts @@ -1,5 +1,5 @@ import { Component, ViewChild, ChangeDetectorRef } from '@angular/core'; -import { ViewController, NavController, NavParams, ModalController, Content } from 'ionic-angular'; +import { ViewController, NavController, NavParams, ModalController, Content, ToastController } from 'ionic-angular'; import { ThreadPage } from '../thread/thread'; import * as pnut from 'pnut-butter'; @@ -28,7 +28,7 @@ export class StreamPage { showScrollBtn: boolean = false; constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, - private changeDetectorRef: ChangeDetectorRef) { + private changeDetectorRef: ChangeDetectorRef, public toastCtrl: ToastController) { // console.log(JSON.stringify(navParams)); switch (navParams.data.stream) { @@ -190,6 +190,7 @@ export class StreamPage { pnut.deleteBookmark(postid).then(res => { console.log(res); this.updatePost(res.data.id); + this.presentToast("Bookmark updated."); }).catch(err => { console.log(err); }); @@ -197,6 +198,7 @@ export class StreamPage { pnut.bookmark(postid).then(res => { console.log(res); this.updatePost(res.data.id); + this.presentToast("Bookmark updated."); }).catch(err => { console.log(err); }); @@ -208,6 +210,7 @@ export class StreamPage { pnut.deleteRepost(postid).then(res => { console.log(res); this.updatePost(res.data.id); + this.presentToast("Repost updated."); }).catch(err => { console.log(err); }); @@ -215,6 +218,7 @@ export class StreamPage { pnut.repost(postid).then(res => { console.log(res); this.updatePost(res.data.id); + this.presentToast("Repost updated."); }).catch(err => { console.log(err); }); @@ -250,6 +254,15 @@ export class StreamPage { newPostModal.present(); } + presentToast(text) { + let toast = this.toastCtrl.create({ + position: 'middle', + message: text, + duration: 2000 + }); + toast.present(); + } + scrollToTop() { this.content.scrollToTop(); } @@ -300,7 +313,7 @@ export class NewPostModal { options: Object; myUsername: string; - constructor(public navParams: NavParams, public viewCtrl: ViewController) { + constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController) { console.log(this.navParams); this.myUsername = navParams.data.me; if (navParams.data.type === 'reply') { @@ -329,12 +342,22 @@ export class NewPostModal { console.log(this.ptext); pnut.createPost(this.ptext, this.options).then(res => { console.log(res); + this.presentToast("Status posted."); }).catch(err => { console.log(err); }); this.viewCtrl.dismiss(); } + presentToast(text) { + let toast = this.toastCtrl.create({ + position: 'middle', + message: text, + duration: 2000 + }); + toast.present(); + } + parseMentions(mentions) { let mtext = "" for(var i = 0; i < mentions.length; i++) {