浏览代码

message bar added

Nicholas Maidanos 6 年前
父节点
当前提交
d61461579e

+ 1
- 1
.sourcemaps/main.js.map
文件差异内容过多而无法显示
查看文件


+ 2
- 10
src/app/app.html 查看文件

@@ -1,10 +1,5 @@
1
-
2
-
3
-
4
-
5
-
6
-
7 1
 <ion-menu [content]="content">
2
+
8 3
   <ion-header>
9 4
     <ion-toolbar>
10 5
       <ion-title>Zip-Slack</ion-title>
@@ -22,7 +17,4 @@
22 17
 </ion-menu>
23 18
 
24 19
 <!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
25
-<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>
26
-
27
-
28
-
20
+<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

+ 15
- 5
src/pages/channel/channel.html 查看文件

@@ -21,9 +21,9 @@
21 21
         <button ion-button icon-only menuToggle>
22 22
           <ion-icon name="menu"></ion-icon>
23 23
         </button>
24
-        <button ion-button (click)="sendMessage()">
24
+        <!-- <button ion-button (click)="sendMessage()">
25 25
           <ion-icon name="add"></ion-icon>
26
-        </button>
26
+        </button> -->
27 27
         <button ion-button (click)="getMessages()">
28 28
           <ion-icon name="refresh"></ion-icon>
29 29
         </button>
@@ -74,10 +74,20 @@
74 74
    
75 75
         </ion-item-options>
76 76
       </ion-item-sliding>
77
-      
78
-      <!-- <ion-item>Todo 2</ion-item>
79
-      <ion-item>Todo 3</ion-item> -->
80 77
     </ion-list>
78
+
79
+
80
+    <ion-footer>
81
+        <textarea #chat_input
82
+        placeholder="Text Input"
83
+        [(ngModel)]="message"
84
+        (keyup.enter)="sendMessage()"
85
+        >
86
+</textarea>
87
+<button ion-button clear icon-only item-right (click)="sendMessage()">
88
+<ion-icon name="ios-send" ios="ios-send" md="md-send"></ion-icon>
89
+</button>
90
+    </ion-footer>
81 91
    
82 92
    </ion-content>
83 93
 

+ 5
- 0
src/pages/channel/channel.scss 查看文件

@@ -1,3 +1,8 @@
1 1
 page-channel {
2 2
 
3 3
 }
4
+ion-footer {
5
+    box-shadow: 0 0 4px rgba(0, 0, 0, 0.11);
6
+    background-color: #fff;
7
+  }
8
+

+ 41
- 31
src/pages/channel/channel.ts 查看文件

@@ -21,6 +21,8 @@ export class ChannelPage {
21 21
   public messages=[];
22 22
   public channels=[];
23 23
 
24
+  public message: any;
25
+
24 26
   private timerToken: number;
25 27
 
26 28
   private currentChannel = {"id":1};
@@ -49,7 +51,7 @@ export class ChannelPage {
49 51
 
50 52
 
51 53
   start() {
52
-    this.timerToken = setInterval( ()=> this.runningLoopOfMessages(this.channelProvider), 500);
54
+    this.timerToken = setInterval( ()=> this.runningLoopOfMessages(this.channelProvider), 5000);
53 55
   }
54 56
 
55 57
   getMessages(){
@@ -71,41 +73,49 @@ export class ChannelPage {
71 73
   }
72 74
   deleteMessage(messageId: number){
73 75
     this.messageProvider.delete(messageId, after =>{
74
-      //this.getMessages();
76
+      this.getMessages();
75 77
     });
76 78
   }
77 79
 
78
-  sendMessage(){
79
-    let addTodoAlert = this.alertController.create({
80
-      title: "Send Message",
81
-      message: "Enter a message:",
82
-      inputs: [
83
-        {
84
-          type: "text",
85
-          name: "addTodoInput"
86
-        }
87
-      ],
88
-      buttons: [
89
-          {
90
-            text: "Cancel"
91
-          },
92
-          {
93
-            text: "Send",
94
-            handler: (inputData) => {
95
-              let todoText;
96
-              todoText = inputData.addTodoInput;
97
-              //this.messageProider.getAll();
98
-              this.messageProvider.post(1, todoText, after => {
99
-                this.getMessages();
100
-              });
80
+  // sendMessage(){
81
+  //   let addTodoAlert = this.alertController.create({
82
+  //     title: "Send Message",
83
+  //     message: "Enter a message:",
84
+  //     inputs: [
85
+  //       {
86
+  //         type: "text",
87
+  //         name: "addTodoInput"
88
+  //       }
89
+  //     ],
90
+  //     buttons: [
91
+  //         {
92
+  //           text: "Cancel"
93
+  //         },
94
+  //         {
95
+  //           text: "Send",
96
+  //           handler: (inputData) => {
97
+  //             let todoText;
98
+  //             todoText = inputData.addTodoInput;
99
+  //             //this.messageProider.getAll();
100
+  //             this.messageProvider.post(1, todoText, after => {
101
+  //               this.getMessages();
102
+  //             });
101 103
               
102
-              //this.todos.push(todoText);
103
-              //this.todoProvider.addTodo(todoText);
104
-            }
105
-          }
106
-      ]
104
+  //             //this.todos.push(todoText);
105
+  //             //this.todoProvider.addTodo(todoText);
106
+  //           }
107
+  //         }
108
+  //     ]
109
+  //   });
110
+  //   addTodoAlert.present();
111
+  // }
112
+
113
+  sendMessage(){
114
+    if (!this.message.trim()) return;
115
+    this.messageProvider.post(1, this.message, after => {
116
+      this.message = '';
117
+      this.getMessages();
107 118
     });
108
-    addTodoAlert.present();
109 119
   }
110 120
 
111 121
 

+ 6
- 0
www/build/main.css 查看文件

@@ -25678,6 +25678,12 @@ ion-navbar.toolbar {
25678 25678
   min-height: calc(46px + env(safe-area-inset-bottom));
25679 25679
 }
25680 25680
 
25681
+ion-footer {
25682
+  -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.11);
25683
+  box-shadow: 0 0 4px rgba(0, 0, 0, 0.11);
25684
+  background-color: #fff;
25685
+}
25686
+
25681 25687
 page-home .login {
25682 25688
   background: url("../assets/imgs/background.jpg");
25683 25689
   background-repeat: no-repeat;

+ 43
- 34
www/build/main.js 查看文件

@@ -240,10 +240,10 @@ var ChannelProvider = /** @class */ (function () {
240 240
     };
241 241
     ChannelProvider = __decorate([
242 242
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])(),
243
-        __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["b" /* Http */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["b" /* Http */]) === "function" && _a || Object, typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1__user_user__["a" /* UserProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1__user_user__["a" /* UserProvider */]) === "function" && _b || Object])
243
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["b" /* Http */],
244
+            __WEBPACK_IMPORTED_MODULE_1__user_user__["a" /* UserProvider */]])
244 245
     ], ChannelProvider);
245 246
     return ChannelProvider;
246
-    var _a, _b;
247 247
 }());
248 248
 
249 249
 //# sourceMappingURL=channel.js.map
@@ -546,7 +546,7 @@ var MyApp = /** @class */ (function () {
546 546
         __metadata("design:type", __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* Nav */])
547 547
     ], MyApp.prototype, "nav", void 0);
548 548
     MyApp = __decorate([
549
-        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/app/app.html"*/'\n\n\n\n\n\n<ion-menu [content]="content">\n  <ion-header>\n    <ion-toolbar>\n      <ion-title>Zip-Slack</ion-title>\n    </ion-toolbar>\n  </ion-header>\n\n  <ion-content>\n    <ion-list>\n      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">\n        {{p.title}}\n      </button>\n    </ion-list>\n  </ion-content>\n\n</ion-menu>\n\n<!-- Disable swipe-to-go-back because it\'s poor UX to combine STGB with side menus -->\n<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>\n\n\n\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/app/app.html"*/
549
+        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/app/app.html"*/'<ion-menu [content]="content">\n\n  <ion-header>\n    <ion-toolbar>\n      <ion-title>Zip-Slack</ion-title>\n    </ion-toolbar>\n  </ion-header>\n\n  <ion-content>\n    <ion-list>\n      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">\n        {{p.title}}\n      </button>\n    </ion-list>\n  </ion-content>\n\n</ion-menu>\n\n<!-- Disable swipe-to-go-back because it\'s poor UX to combine STGB with side menus -->\n<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/app/app.html"*/
550 550
         }),
551 551
         __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["i" /* Platform */], __WEBPACK_IMPORTED_MODULE_2__ionic_native_status_bar__["a" /* StatusBar */], __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__["a" /* SplashScreen */]])
552 552
     ], MyApp);
@@ -671,7 +671,7 @@ var ChannelPage = /** @class */ (function () {
671 671
     };
672 672
     ChannelPage.prototype.start = function () {
673 673
         var _this = this;
674
-        this.timerToken = setInterval(function () { return _this.runningLoopOfMessages(_this.channelProvider); }, 500);
674
+        this.timerToken = setInterval(function () { return _this.runningLoopOfMessages(_this.channelProvider); }, 5000);
675 675
     };
676 676
     ChannelPage.prototype.getMessages = function () {
677 677
         var _this = this;
@@ -692,45 +692,54 @@ var ChannelPage = /** @class */ (function () {
692 692
         });
693 693
     };
694 694
     ChannelPage.prototype.deleteMessage = function (messageId) {
695
+        var _this = this;
695 696
         this.messageProvider.delete(messageId, function (after) {
696
-            //this.getMessages();
697
+            _this.getMessages();
697 698
         });
698 699
     };
700
+    // sendMessage(){
701
+    //   let addTodoAlert = this.alertController.create({
702
+    //     title: "Send Message",
703
+    //     message: "Enter a message:",
704
+    //     inputs: [
705
+    //       {
706
+    //         type: "text",
707
+    //         name: "addTodoInput"
708
+    //       }
709
+    //     ],
710
+    //     buttons: [
711
+    //         {
712
+    //           text: "Cancel"
713
+    //         },
714
+    //         {
715
+    //           text: "Send",
716
+    //           handler: (inputData) => {
717
+    //             let todoText;
718
+    //             todoText = inputData.addTodoInput;
719
+    //             //this.messageProider.getAll();
720
+    //             this.messageProvider.post(1, todoText, after => {
721
+    //               this.getMessages();
722
+    //             });
723
+    //             //this.todos.push(todoText);
724
+    //             //this.todoProvider.addTodo(todoText);
725
+    //           }
726
+    //         }
727
+    //     ]
728
+    //   });
729
+    //   addTodoAlert.present();
730
+    // }
699 731
     ChannelPage.prototype.sendMessage = function () {
700 732
         var _this = this;
701
-        var addTodoAlert = this.alertController.create({
702
-            title: "Send Message",
703
-            message: "Enter a message:",
704
-            inputs: [
705
-                {
706
-                    type: "text",
707
-                    name: "addTodoInput"
708
-                }
709
-            ],
710
-            buttons: [
711
-                {
712
-                    text: "Cancel"
713
-                },
714
-                {
715
-                    text: "Send",
716
-                    handler: function (inputData) {
717
-                        var todoText;
718
-                        todoText = inputData.addTodoInput;
719
-                        //this.messageProider.getAll();
720
-                        _this.messageProvider.post(1, todoText, function (after) {
721
-                            _this.getMessages();
722
-                        });
723
-                        //this.todos.push(todoText);
724
-                        //this.todoProvider.addTodo(todoText);
725
-                    }
726
-                }
727
-            ]
733
+        if (!this.message.trim())
734
+            return;
735
+        this.messageProvider.post(1, this.message, function (after) {
736
+            _this.message = '';
737
+            _this.getMessages();
728 738
         });
729
-        addTodoAlert.present();
730 739
     };
731 740
     ChannelPage = __decorate([
732 741
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
733
-            selector: 'page-channel',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/'\n\n\n<!-- <ion-buttons start>\n\n  <button ion-button icon-only menuToggle>\n\n    <ion-icon name="menu"></ion-icon>\n\n  </button>\n\n</ion-buttons> -->\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>Channel</ion-title>\n\n    <ion-buttons start>\n\n        <button ion-button icon-only menuToggle>\n          <ion-icon name="menu"></ion-icon>\n        </button>\n        <button ion-button (click)="sendMessage()">\n          <ion-icon name="add"></ion-icon>\n        </button>\n        <button ion-button (click)="getMessages()">\n          <ion-icon name="refresh"></ion-icon>\n        </button>\n      \n      </ion-buttons>\n  </ion-navbar>\n\n</ion-header>\n\n\n\n<ion-content padding>\n\n\n    <!-- <ion-list padding>\n        <h1>Channels</h1>\n        <ion-item-sliding *ngFor="let channel of channels">\n            <ion-item>{{channel.name}}</ion-item>\n\n          <ion-item-options side="right">\n              <button ion-button>\n                  <ion-icon name="settings"></ion-icon>\n                </button>\n              <button color="danger" ion-button (click)="deleteMessage(message.id)">\n                <ion-icon name="trash"></ion-icon>\n              </button>\n     \n          </ion-item-options>\n        </ion-item-sliding>\n\n        <button>Create new Channel</button>\n        \n        <ion-item>Todo 2</ion-item>\n        <ion-item>Todo 3</ion-item>\n      </ion-list> -->\n\n    <ion-list padding>\n      <ion-item-sliding *ngFor="let message of messages">\n          <ion-item>{{message.user.username}} - {{message.message}}</ion-item>\n    \n        <ion-item-options side="right">\n            <button ion-button>\n                <ion-icon name="settings"></ion-icon>\n              </button>\n            <button color="danger" ion-button (click)="deleteMessage(message.id)">\n              <ion-icon name="trash"></ion-icon>\n            </button>\n   \n        </ion-item-options>\n      </ion-item-sliding>\n      \n      <!-- <ion-item>Todo 2</ion-item>\n      <ion-item>Todo 3</ion-item> -->\n    </ion-list>\n   \n   </ion-content>\n\n\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/,
742
+            selector: 'page-channel',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/'\n\n\n<!-- <ion-buttons start>\n\n  <button ion-button icon-only menuToggle>\n\n    <ion-icon name="menu"></ion-icon>\n\n  </button>\n\n</ion-buttons> -->\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>Channel</ion-title>\n\n    <ion-buttons start>\n\n        <button ion-button icon-only menuToggle>\n          <ion-icon name="menu"></ion-icon>\n        </button>\n        <!-- <button ion-button (click)="sendMessage()">\n          <ion-icon name="add"></ion-icon>\n        </button> -->\n        <button ion-button (click)="getMessages()">\n          <ion-icon name="refresh"></ion-icon>\n        </button>\n      \n      </ion-buttons>\n  </ion-navbar>\n\n</ion-header>\n\n\n\n<ion-content padding>\n\n\n    <!-- <ion-list padding>\n        <h1>Channels</h1>\n        <ion-item-sliding *ngFor="let channel of channels">\n            <ion-item>{{channel.name}}</ion-item>\n\n          <ion-item-options side="right">\n              <button ion-button>\n                  <ion-icon name="settings"></ion-icon>\n                </button>\n              <button color="danger" ion-button (click)="deleteMessage(message.id)">\n                <ion-icon name="trash"></ion-icon>\n              </button>\n     \n          </ion-item-options>\n        </ion-item-sliding>\n\n        <button>Create new Channel</button>\n        \n        <ion-item>Todo 2</ion-item>\n        <ion-item>Todo 3</ion-item>\n      </ion-list> -->\n\n    <ion-list padding>\n      <ion-item-sliding *ngFor="let message of messages">\n          <ion-item>{{message.user.username}} - {{message.message}}</ion-item>\n    \n        <ion-item-options side="right">\n            <button ion-button>\n                <ion-icon name="settings"></ion-icon>\n              </button>\n            <button color="danger" ion-button (click)="deleteMessage(message.id)">\n              <ion-icon name="trash"></ion-icon>\n            </button>\n   \n        </ion-item-options>\n      </ion-item-sliding>\n    </ion-list>\n\n\n    <ion-footer>\n        <textarea #chat_input\n        placeholder="Text Input"\n        [(ngModel)]="message"\n        (keyup.enter)="sendMessage()"\n        >\n</textarea>\n<button ion-button clear icon-only item-right (click)="sendMessage()">\n<ion-icon name="ios-send" ios="ios-send" md="md-send"></ion-icon>\n</button>\n    </ion-footer>\n   \n   </ion-content>\n\n\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/,
734 743
         }),
735 744
         __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */]) === "function" && _a || Object, typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */]) === "function" && _b || Object, typeof (_c = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["a" /* AlertController */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["a" /* AlertController */]) === "function" && _c || Object, typeof (_d = typeof __WEBPACK_IMPORTED_MODULE_2__providers_message_message__["a" /* MessageProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_2__providers_message_message__["a" /* MessageProvider */]) === "function" && _d || Object, typeof (_e = typeof __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__["a" /* ChannelProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__["a" /* ChannelProvider */]) === "function" && _e || Object])
736 745
     ], ChannelPage);

+ 1
- 1
www/build/main.js.map
文件差异内容过多而无法显示
查看文件


+ 1
- 1
www/build/vendor.js.map
文件差异内容过多而无法显示
查看文件