diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a98a887..d0a5089 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,7 +7,7 @@ import { HomePage } from '../pages/home/home'; import { ListPage } from '../pages/list/list'; import { LoginPage } from '../pages/login/login'; import { StreamPage, NewPostModal } from '../pages/stream/stream'; -import { PostDetailsPage } from '../pages/post-details/post-details'; +import { ThreadPage } from '../pages/thread/thread'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic-native/splash-screen'; @@ -21,7 +21,7 @@ import { TimeagoPipe } from '../pipes/timeago/timeago'; ListPage, LoginPage, StreamPage, - PostDetailsPage, + ThreadPage, TimeagoPipe, NewPostModal ], @@ -37,7 +37,7 @@ import { TimeagoPipe } from '../pipes/timeago/timeago'; ListPage, LoginPage, StreamPage, - PostDetailsPage, + ThreadPage, NewPostModal ], providers: [ diff --git a/src/pages/stream/stream.html b/src/pages/stream/stream.html index 0ccb410..6ea09f0 100644 --- a/src/pages/stream/stream.html +++ b/src/pages/stream/stream.html @@ -69,7 +69,7 @@ - diff --git a/src/pages/stream/stream.ts b/src/pages/stream/stream.ts index 0bc44be..255cf9f 100644 --- a/src/pages/stream/stream.ts +++ b/src/pages/stream/stream.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; import { ViewController, NavController, NavParams, ModalController } from 'ionic-angular'; -import { PostDetailsPage } from '../post-details/post-details'; +import { ThreadPage } from '../thread/thread'; import * as pnut from 'pnut-butter'; @@ -79,8 +79,12 @@ export class StreamPage { }); } - showPostDetails(postData) { - this.navCtrl.push(PostDetailsPage, {post: postData}); + fetchThread(threadid) { + pnut.thread(threadid).then(res => { + this.navCtrl.push(ThreadPage, {posts: res.data}); + }).catch(err => { + console.log(err); + }); } bookmark(postid, bookmarked) { diff --git a/src/pages/thread/thread.html b/src/pages/thread/thread.html new file mode 100644 index 0000000..aa64ddf --- /dev/null +++ b/src/pages/thread/thread.html @@ -0,0 +1,82 @@ + + + + + + Conversation + + + + + + + + + + + + + +

{{ post.user.name }}

+

@{{ post.user.username }}

+ + {{ post.created_at | timeago }}
+ {{ post.source.name }} +
+
+ +

{{ post.is_deleted ? '{post deleted}' : post.content.text }}

+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + +
+
+ +
diff --git a/src/pages/thread/thread.scss b/src/pages/thread/thread.scss new file mode 100644 index 0000000..ab0d8a2 --- /dev/null +++ b/src/pages/thread/thread.scss @@ -0,0 +1,3 @@ +page-thread { + +} diff --git a/src/pages/thread/thread.ts b/src/pages/thread/thread.ts new file mode 100644 index 0000000..f3cb0f4 --- /dev/null +++ b/src/pages/thread/thread.ts @@ -0,0 +1,37 @@ +import { Component } from '@angular/core'; +import { NavController, NavParams, ModalController } from 'ionic-angular'; +import { NewPostModal } from '../stream/stream'; + +// import * as pnut from 'pnut-butter'; + +/** + * Generated class for the ThreadPage page. + * + * See http://ionicframework.com/docs/components/#navigation for more info + * on Ionic pages and navigation. + */ +@Component({ + selector: 'page-thread', + templateUrl: 'thread.html', +}) +export class ThreadPage { + + title: string; + posts: Array = []; + + constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController) { + this.posts = this.navParams.data.posts; + } + + showReplyPost(postData) { + let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'reply', post: postData}); + newPostModal.present(); + } + + showQuotedPost(postData) { + console.log(postData); + let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'quote', post: postData}); + newPostModal.present(); + } + +}