reformatted stream

This commit is contained in:
Morgan McMillian 2017-06-10 11:53:36 -07:00
parent 85f7155651
commit ac0974d41c
4 changed files with 126 additions and 77 deletions

View file

@ -1,68 +1,69 @@
{ {
"name": "Goober", "name": "Goober",
"version": "0.0.1", "version": "0.0.1",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "http://ionicframework.com/", "homepage": "http://ionicframework.com/",
"private": true, "private": true,
"scripts": { "scripts": {
"clean": "ionic-app-scripts clean", "clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build", "build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint", "lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve" "ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.1.2",
"@angular/compiler": "4.1.2",
"@angular/compiler-cli": "4.1.2",
"@angular/core": "4.1.2",
"@angular/forms": "4.1.2",
"@angular/http": "4.1.2",
"@angular/platform-browser": "4.1.2",
"@angular/platform-browser-dynamic": "4.1.2",
"@ionic-native/core": "3.10.2",
"@ionic-native/splash-screen": "3.10.2",
"@ionic-native/status-bar": "3.10.2",
"@ionic/storage": "2.0.1",
"cordova-android": "^6.2.3",
"cordova-blackberry10": "^3.8.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-windows": "^5.0.0",
"ionic-angular": "3.3.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"moment": "^2.18.1",
"ng2-cordova-oauth": "0.0.8",
"pnut-butter": "^0.8.1",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.7",
"@ionic/cli-plugin-cordova": "1.3.0",
"@ionic/cli-plugin-ionic-angular": "1.3.0",
"typescript": "2.3.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-inappbrowser": {}
}, },
"dependencies": { "platforms": [
"@angular/common": "4.1.2", "android",
"@angular/compiler": "4.1.2", "blackberry10",
"@angular/compiler-cli": "4.1.2", "windows"
"@angular/core": "4.1.2", ]
"@angular/forms": "4.1.2", }
"@angular/http": "4.1.2",
"@angular/platform-browser": "4.1.2",
"@angular/platform-browser-dynamic": "4.1.2",
"@ionic-native/core": "3.10.2",
"@ionic-native/splash-screen": "3.10.2",
"@ionic-native/status-bar": "3.10.2",
"@ionic/storage": "2.0.1",
"cordova-android": "^6.2.3",
"cordova-blackberry10": "^3.8.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-windows": "^5.0.0",
"ionic-angular": "3.3.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"ng2-cordova-oauth": "0.0.8",
"pnut-butter": "^0.8.1",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.7",
"@ionic/cli-plugin-cordova": "1.3.0",
"@ionic/cli-plugin-ionic-angular": "1.3.0",
"typescript": "2.3.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-inappbrowser": {}
},
"platforms": [
"android",
"blackberry10",
"windows"
]
}
} }

View file

@ -12,6 +12,7 @@ import { PostDetailsPage } from '../pages/post-details/post-details';
import { StatusBar } from '@ionic-native/status-bar'; import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen'; import { SplashScreen } from '@ionic-native/splash-screen';
import { IonicStorageModule } from '@ionic/storage'; import { IonicStorageModule } from '@ionic/storage';
import { TimeagoPipe } from '../pipes/timeago/timeago';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -20,7 +21,8 @@ import { IonicStorageModule } from '@ionic/storage';
ListPage, ListPage,
LoginPage, LoginPage,
StreamPage, StreamPage,
PostDetailsPage PostDetailsPage,
TimeagoPipe
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View file

@ -19,22 +19,46 @@
<ion-content> <ion-content>
<ion-list> <ion-list>
<ion-item *ngFor="let post of posts" (click)="showPostDetails(post)" text-wrap> <ion-card *ngFor="let post of posts">
<ion-avatar item-start> <ion-item>
<img src="{{ post.user.content.avatar_image.link }}"> <ion-avatar item-start>
</ion-avatar> <img src="{{ post.user.content.avatar_image.link }}">
<h1>{{ post.user.username }}</h1> </ion-avatar>
<p>{{ post.is_deleted ? '{post deleted}' : post.content.text }}</p> <h2>{{ post.user.name }}</h2>
<p>@{{ post.user.username }}</p>
<ion-note item-end>{{ post.created_at | timeago }}</ion-note>
</ion-item>
<ion-card-content>
<p>{{ post.is_deleted ? '{post deleted}' : post.content.text }}</p>
</ion-card-content>
<div *ngIf="post.raw"> <div *ngIf="post.raw">
<div *ngFor="let r of post.raw"> <div *ngFor="let r of post.raw">
<div *ngIf="r.type == 'io.pnut.core.oembed'"> <div *ngIf="r.type == 'io.pnut.core.oembed'">
<ion-thumbnail> <img src="{{ r.value.url }}">
<img src="{{ r.value.url }}">
</ion-thumbnail>
</div> </div>
</div> </div>
</div> </div>
</ion-item> <ion-row>
<ion-col>
<button ion-button icon-left clear small block>
<ion-icon name="star"></ion-icon>
<div *ngIf="post.counts.bookmarks > 0">{{ post.counts.bookmarks }}</div>
</button>
</ion-col>
<ion-col>
<button ion-button icon-left clear small block>
<ion-icon name="repeat"></ion-icon>
<div *ngIf="post.counts.reposts > 0">{{ post.counts.reposts }}</div>
</button>
</ion-col>
<ion-col>
<button ion-button icon-left clear small block>
<ion-icon name="text"></ion-icon>
<div *ngIf="post.counts.replies > 0">{{ post.counts.replies }}</div>
</button>
</ion-col>
</ion-row>
</ion-card>
</ion-list> </ion-list>
</ion-content> </ion-content>

View file

@ -0,0 +1,22 @@
import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';
/**
* Generated class for the TimeagoPipe pipe.
*
* See https://angular.io/docs/ts/latest/guide/pipes.html for more info on
* Angular Pipes.
*/
@Pipe({
name: 'timeago',
})
export class TimeagoPipe implements PipeTransform {
now: any;
/**
* Takes a value and makes it lowercase.
*/
transform(value: string, ...args) {
this.now = moment(value).fromNow(true);
return this.now;
}
}