Allison Ziegler 6 anni fa
parent
commit
4033eddf34

+ 3
- 0
.vscode/settings.json Vedi File

@@ -0,0 +1,3 @@
1
+{
2
+    "git.ignoreLimitWarning": true
3
+}

+ 3
- 4
zlg/ionic.config.json Vedi File

@@ -1,8 +1,7 @@
1 1
 {
2 2
   "name": "zlg",
3
-  "app_id": "",
4
-  "type": "ionic-angular",
5 3
   "integrations": {
6 4
     "cordova": {}
7
-  }
8
-}
5
+  },
6
+  "type": "ionic-angular"
7
+}

+ 3339
- 371
zlg/package-lock.json
File diff suppressed because it is too large
Vedi File


+ 4
- 1
zlg/package.json Vedi File

@@ -15,7 +15,7 @@
15 15
     "@angular/common": "5.2.11",
16 16
     "@angular/compiler": "5.2.11",
17 17
     "@angular/compiler-cli": "5.2.11",
18
-    "@angular/core": "5.2.11",
18
+    "@angular/core": "^5.2.11",
19 19
     "@angular/forms": "5.2.11",
20 20
     "@angular/http": "5.2.11",
21 21
     "@angular/platform-browser": "5.2.11",
@@ -23,7 +23,10 @@
23 23
     "@ionic-native/core": "~4.10.0",
24 24
     "@ionic-native/splash-screen": "~4.10.0",
25 25
     "@ionic-native/status-bar": "~4.10.0",
26
+    "@ionic/lab": "^1.0.0",
26 27
     "@ionic/storage": "2.1.3",
28
+    "cordova": "^8.0.0",
29
+    "ionic": "^4.0.0",
27 30
     "ionic-angular": "3.9.2",
28 31
     "ionicons": "3.0.0",
29 32
     "ng-socket-io": "^0.2.4",

+ 3
- 4
zlg/src/pages/home/home.html Vedi File

@@ -1,9 +1,8 @@
1 1
 <ion-header>
2 2
   <ion-navbar>
3
-    <button ion-button menuToggle>
4
-      <ion-icon name="menu"></ion-icon>
5
-    </button>
6
-    <ion-title>The Vault</ion-title>
3
+        <br>
4
+        <button ion-button menuToggle><ion-icon name="menu"></ion-icon></button>
5
+    <ion-title align="middle">The Vault</ion-title>
7 6
   </ion-navbar>
8 7
 </ion-header>
9 8
 

+ 8
- 12
zlg/src/pages/home/home.ts Vedi File

@@ -1,10 +1,8 @@
1 1
 import { Component, OnInit} from '@angular/core';
2
+import { MenuController } from 'ionic-angular';
2 3
 import Stomp from 'stompjs';
3 4
 import SockJS from 'sockjs-client';
4 5
 
5
-// import { Socket } from 'ng-socket-io';
6
-
7
-
8 6
 import { NavController } from 'ionic-angular';
9 7
 
10 8
 @Component({
@@ -13,8 +11,8 @@ import { NavController } from 'ionic-angular';
13 11
 })
14 12
 export class HomePage implements OnInit{
15 13
 
16
-  constructor(public navCtrl: NavController) {
17
-
14
+  constructor(public navCtrl: NavController, public menu: MenuController) {
15
+    this.menu.enable(true);
18 16
   }
19 17
 
20 18
   private stompClient ;
@@ -30,21 +28,19 @@ export class HomePage implements OnInit{
30 28
     const socket = new SockJS('https://fast-headland-39537.herokuapp.com/vault-socket');
31 29
     this.stompClient = Stomp.over(socket);
32 30
 
33
-    const _this = this; //i hope i am not expected to understand this
34
-    this.stompClient.connect({}, function (frame) {
31
+    this.stompClient.connect({}, (frame) => {
35 32
       console.log('Connected: ' + frame);
36
-      _this.stompClient.subscribe('/topic/posts', (post) => {
37
-        _this.posts.push(JSON.parse(post.body));
33
+      this.stompClient.subscribe('/topic/posts', (post) => {
34
+        this.posts.unshift(JSON.parse(post.body));
38 35
      });
39 36
     });
40 37
   }
41 38
 
42 39
   sendPost() {
43 40
     this.stompClient.send(this.userPostUrl, {}, JSON.stringify({'id': '','message': this.postInput, 'userId': this.userId}))
41
+    this.postInput = "";
44 42
   }
45 43
 
46
-  //  showPost(message, userName) {
47
-  //   //("#messages").append("<tr><td>" + userName + ": " + message + "</td></tr>");
48
-  // }
44
+
49 45
 
50 46
 }

+ 38
- 0
zlg/src/pages/menu/menu.html Vedi File

@@ -0,0 +1,38 @@
1
+<!-- 
2
+  Generated template for the MenuPage page.
3
+
4
+  See http://ionicframework.com/docs/components/#navigation for more info on
5
+  Ionic pages and navigation.
6
+-->
7
+<!-- <ion-menu [content]="content">
8
+
9
+  <ion-header>
10
+    <ion-toolbar>
11
+      <ion-title>Menu</ion-title>
12
+    </ion-toolbar>
13
+  </ion-header>
14
+
15
+    <ion-content>
16
+      <ion-list>
17
+        <button ion-item menuClose *ngFor="let p of pages" (click)="openPage(p)">
18
+          <ion-icon item-start [start]=p.icon" [color]="isActive(p)"></ion-icon>
19
+          {{p.title}}
20
+        </button>
21
+      </ion-list>
22
+    </ion-content>
23
+
24
+</ion-menu>
25
+
26
+<ion-nav [root]="rootPage" #content swipBackEnabled="false"></ion-nav> -->
27
+
28
+<ion-menu [content]="content">
29
+  <ion-content>
30
+    <ion-list>
31
+      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
32
+        {{p.title}}
33
+      </button>
34
+    </ion-list>
35
+  </ion-content>
36
+</ion-menu>
37
+
38
+<ion-nav #content [root]="rootPage"></ion-nav>

+ 13
- 0
zlg/src/pages/menu/menu.module.ts Vedi File

@@ -0,0 +1,13 @@
1
+import { NgModule } from '@angular/core';
2
+import { IonicPageModule } from 'ionic-angular';
3
+import { MenuPage } from './menu';
4
+
5
+@NgModule({
6
+  declarations: [
7
+    MenuPage,
8
+  ],
9
+  imports: [
10
+    IonicPageModule.forChild(MenuPage),
11
+  ],
12
+})
13
+export class MenuPageModule {}

+ 3
- 0
zlg/src/pages/menu/menu.scss Vedi File

@@ -0,0 +1,3 @@
1
+page-menu {
2
+
3
+}

+ 101
- 0
zlg/src/pages/menu/menu.ts Vedi File

@@ -0,0 +1,101 @@
1
+// import { Component, ViewChild } from '@angular/core';
2
+// import { IonicPage, NavController, NavParams, Nav } from 'ionic-angular';
3
+// import { HomePage } from '../home/home';
4
+
5
+// /**
6
+//  * Generated class for the MenuPage page.
7
+//  *
8
+//  * See https://ionicframework.com/docs/components/#navigation for more info on
9
+//  * Ionic pages and navigation.
10
+//  */
11
+
12
+// export interface PageInterface {
13
+//   title: string;
14
+//   pageName: string;
15
+//   tabComponent?: any;
16
+//   index?: number;
17
+//   icon: string;
18
+// }
19
+
20
+// @IonicPage()
21
+// @Component({
22
+//   selector: 'page-menu',
23
+//   templateUrl: 'menu.html',
24
+// })
25
+// export class MenuPage {
26
+//   //basic root for our 
27
+//   rootPage = 'HomePage';
28
+
29
+//   @ViewChild(Nav) nav: Nav;
30
+
31
+//   pages: PageInterface[] = [
32
+//     { title: 'My Vault', pageName: 'HomePage', index: 0, icon: 'home'  }
33
+//   ];
34
+
35
+//   constructor(public navCtrl: NavController, public navParams: NavParams) {
36
+//   }
37
+
38
+//   openPage(page: PageInterface) {
39
+//     let params = {};
40
+
41
+//     if (this.nav.getActiveChildNav() && page.index != undefined) {
42
+//       this.nav.getActiveChildNav().select(page.index);
43
+//     }
44
+//     else {
45
+//       this.nav.setRoot(page.pageName, params);
46
+//     }
47
+//   }
48
+
49
+//   isActive(page: PageInterface) {
50
+//     if (this.nav.getActive() && this.nav.getActive().name === page.pageName) {
51
+//       return 'primary';
52
+//     }
53
+//     return;
54
+//   }
55
+
56
+//   ionViewDidLoad() {
57
+//     console.log('ionViewDidLoad MenuPage');
58
+//   }
59
+
60
+// }
61
+
62
+import { Component, ViewChild } from '@angular/core';
63
+import { IonicPage, Nav, NavController } from 'ionic-angular';
64
+
65
+interface PageItem {
66
+  title: string
67
+  component: any
68
+}
69
+type PageList = PageItem[]
70
+
71
+@IonicPage()
72
+@Component({
73
+  selector: 'page-menu',
74
+  templateUrl: 'menu.html'
75
+})
76
+export class MenuPage {
77
+  // A reference to the ion-nav in our component
78
+  @ViewChild(Nav) nav: Nav;
79
+
80
+  rootPage: any = 'ContentPage';
81
+
82
+  pages: PageList;
83
+
84
+  constructor(public navCtrl: NavController) {
85
+    // used for an example of ngFor and navigation
86
+    this.pages = [
87
+      { title: 'Sign in', component: 'LoginPage' },
88
+      { title: 'Signup', component: 'SignupPage' }
89
+    ];
90
+  }
91
+
92
+  ionViewDidLoad() {
93
+    console.log('Hello MenuPage Page');
94
+  }
95
+
96
+  openPage(page: PageItem) {
97
+    // Reset the content nav to have just this page
98
+    // we wouldn't want the back button to show in this scenario
99
+    this.nav.setRoot(page.component);
100
+  }
101
+}