From baf882e84a8e41606e87ed91a4c30cc189e71e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 6 Feb 2019 16:56:17 -0300 Subject: [PATCH 01/10] Removes chat state --- webchat/app.js | 10 ---------- webchat/chat/chat.html | 0 webchat/chat/chatController.js | 11 ----------- webchat/index.html | 1 - 4 files changed, 22 deletions(-) delete mode 100644 webchat/chat/chat.html delete mode 100644 webchat/chat/chatController.js diff --git a/webchat/app.js b/webchat/app.js index 30a8ec0c0..d64051c79 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -12,7 +12,6 @@ app.constant('STATES', { abstract: 'webchat', home: `${rootName}.home`, - chat: `${rootName}.chat`, login: 'login', error: 'error', }); @@ -53,15 +52,6 @@ }, }, }) - .state(STATES.chat, { - url: "/chat", - views: { - content: { - templateUrl: "app/chat/chat.html", - controller: "ChatController as controller", - }, - }, - }) .state(STATES.login, { url: "/login", views: { diff --git a/webchat/chat/chat.html b/webchat/chat/chat.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/webchat/chat/chatController.js b/webchat/chat/chatController.js deleted file mode 100644 index 466f5592f..000000000 --- a/webchat/chat/chatController.js +++ /dev/null @@ -1,11 +0,0 @@ -(function () { - 'use strict'; - - const webchat = angular.module('webchat'); - - webchat.controller('ChatController', function ChatController () { - const chatController = this; - - }); - -})(); \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index f37100b09..72536717a 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -110,7 +110,6 @@ - From 5ccee9d2a6509c3c9c3da32ef11cdf3d007359fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:01:31 -0300 Subject: [PATCH 02/10] Add close ws on logout --- webchat/auth/authService.js | 1 + webchat/utils/chatClient.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index 76eaa06b9..9f91d5d0b 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -152,6 +152,7 @@ delete $window.localStorage.userInfo; userInfo = undefined; clearInterval(refreshInterval); + chatClient.closeClient(); executeLogoutListeners(); diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index 4112fcecf..1770a30f8 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -88,6 +88,11 @@ } } + closeClient() { + this.ws.onclose = () => {}; + this.ws.close(); + } + /** * Mimics node's on/emit event handlers. * Raises an event. From 22131cbc6ddc8ca1738731f36a738104261bd10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:09:45 -0300 Subject: [PATCH 03/10] Extracts general input class from specific class --- .../expansive-search-bar/expansive-search-bar.html | 2 +- webchat/index.html | 1 + webchat/styles/custom/custom.css | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 webchat/styles/custom/custom.css diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.html b/webchat/components/expansive-search-bar/expansive-search-bar.html index a92cdaf2f..53272bbb1 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.html +++ b/webchat/components/expansive-search-bar/expansive-search-bar.html @@ -1,6 +1,6 @@
+ diff --git a/webchat/styles/custom/custom.css b/webchat/styles/custom/custom.css new file mode 100644 index 000000000..4da3533e0 --- /dev/null +++ b/webchat/styles/custom/custom.css @@ -0,0 +1,8 @@ +.custom-input { + width: 100%; + border-radius: 50px; + padding: 0 20px; + background-color: #EEEEEE; + border: none; + outline: none; +} \ No newline at end of file From 6c7e2b0cacce8a6078d05ce9e9ac54dabadf5010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:11:06 -0300 Subject: [PATCH 04/10] Add toggle icon button --- .../toggle-button/toggle-button.component.js | 32 +++++++++++++++++++ .../toggle-button/toggle-button.css | 0 .../toggle-button/toggle-button.html | 15 +++++++++ webchat/index.html | 1 + 4 files changed, 48 insertions(+) create mode 100644 webchat/components/toggle-button/toggle-button.component.js create mode 100644 webchat/components/toggle-button/toggle-button.css create mode 100644 webchat/components/toggle-button/toggle-button.html diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js new file mode 100644 index 000000000..afdcfbcd0 --- /dev/null +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -0,0 +1,32 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("toggleButton", { + templateUrl: "app/components/toggle-button/toggle-button.html", + controller: toggleButtonController, + controllerAs: "toggleButtonCtrl", + bindings: { + iconOn: '@', + iconOff: '@', + iconColorOn: '@', + iconColorOff: '@', + action: '<', + }, + }); + + function toggleButtonController() { + const toggleButtonCtrl = this; + + toggleButtonCtrl.$onInit = () => { + toggleButtonCtrl.active = true; + toggleButtonCtrl.iconColorOff = toggleButtonCtrl.iconColorOff || '#EEE'; + toggleButtonCtrl.iconColorOn = toggleButtonCtrl.iconColorOn || '#EEE'; + }; + + toggleButtonCtrl.toggle = () => { + toggleButtonCtrl.active = !toggleButtonCtrl.active; + toggleButtonCtrl.action(); + }; + } + +})(); \ No newline at end of file diff --git a/webchat/components/toggle-button/toggle-button.css b/webchat/components/toggle-button/toggle-button.css new file mode 100644 index 000000000..e69de29bb diff --git a/webchat/components/toggle-button/toggle-button.html b/webchat/components/toggle-button/toggle-button.html new file mode 100644 index 000000000..a8fdfe341 --- /dev/null +++ b/webchat/components/toggle-button/toggle-button.html @@ -0,0 +1,15 @@ + + + {{ toggleButtonCtrl.iconOn }} + + + {{ toggleButtonCtrl.iconOff }} + + \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index f06a90a0e..1fd34be0a 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -117,6 +117,7 @@ + From 9ba78f27f96bebdd629d6dbca382cf5c59221229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:12:51 -0300 Subject: [PATCH 05/10] Modify contacts list to receive open chat function and show user email --- webchat/components/contacts/contacts-sidenav.component.js | 1 + webchat/components/contacts/contacts-sidenav.html | 1 + webchat/components/contacts/list/contacts-list.component.js | 3 ++- webchat/components/contacts/list/contacts-list.html | 6 +++--- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/webchat/components/contacts/contacts-sidenav.component.js b/webchat/components/contacts/contacts-sidenav.component.js index 655095397..f2346246e 100644 --- a/webchat/components/contacts/contacts-sidenav.component.js +++ b/webchat/components/contacts/contacts-sidenav.component.js @@ -15,6 +15,7 @@ controllerAs: "contactsSidenavCtrl", bindings: { contacts: "<", + openChat: "<", }, }); diff --git a/webchat/components/contacts/contacts-sidenav.html b/webchat/components/contacts/contacts-sidenav.html index ee2d7c0cd..12a3af319 100644 --- a/webchat/components/contacts/contacts-sidenav.html +++ b/webchat/components/contacts/contacts-sidenav.html @@ -11,5 +11,6 @@ \ No newline at end of file diff --git a/webchat/components/contacts/list/contacts-list.component.js b/webchat/components/contacts/list/contacts-list.component.js index 89e7ff213..69e5952f9 100644 --- a/webchat/components/contacts/list/contacts-list.component.js +++ b/webchat/components/contacts/list/contacts-list.component.js @@ -14,7 +14,8 @@ controllerAs: "contactsListCtrl", bindings: { searchQuery: "<", - contacts: "<" + contacts: "<", + openChat: "<", }, }); diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 5538537ef..5355da2eb 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,16 +1,16 @@ + text="{{user.email[0]}}"> -

Não há contatos online no momento.

+

Não há contatos online no momento.

\ No newline at end of file From 2f4099170f874f26c4bff1cc0b4c3ca81ffee0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:13:42 -0300 Subject: [PATCH 06/10] Add icon button disabled state --- webchat/components/icon-button/icon-button.component.js | 3 +++ webchat/components/icon-button/icon-button.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webchat/components/icon-button/icon-button.component.js b/webchat/components/icon-button/icon-button.component.js index fa34060bd..243f3cdbc 100644 --- a/webchat/components/icon-button/icon-button.component.js +++ b/webchat/components/icon-button/icon-button.component.js @@ -18,6 +18,7 @@ icon: "@", iconColor: "@", action: '<', + disabled: '<', }, }); @@ -26,7 +27,9 @@ iconButtonCtrl.$onInit = () => { iconButtonCtrl.iconColor = iconButtonCtrl.iconColor || "#EEE"; + iconButtonCtrl.disabled = iconButtonCtrl.disabled || false; }; + } })(); \ No newline at end of file diff --git a/webchat/components/icon-button/icon-button.html b/webchat/components/icon-button/icon-button.html index de63ad5d2..70dd0dbc1 100644 --- a/webchat/components/icon-button/icon-button.html +++ b/webchat/components/icon-button/icon-button.html @@ -1,5 +1,5 @@ - - + + {{iconButtonCtrl.icon}} \ No newline at end of file From 39db1ffedad3a7fb45fb3d978790acff47030a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Feb 2019 12:47:11 -0300 Subject: [PATCH 07/10] Add lodash defaults to toggle button and icon button --- .../components/icon-button/icon-button.component.js | 7 +++++-- .../toggle-button/toggle-button.component.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/webchat/components/icon-button/icon-button.component.js b/webchat/components/icon-button/icon-button.component.js index 243f3cdbc..ec2b275a0 100644 --- a/webchat/components/icon-button/icon-button.component.js +++ b/webchat/components/icon-button/icon-button.component.js @@ -26,8 +26,11 @@ const iconButtonCtrl = this; iconButtonCtrl.$onInit = () => { - iconButtonCtrl.iconColor = iconButtonCtrl.iconColor || "#EEE"; - iconButtonCtrl.disabled = iconButtonCtrl.disabled || false; + _.defaults(iconButtonCtrl, { + iconColor: "#EEE", + action: () => {}, + disabled: false, + }); }; } diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index afdcfbcd0..537e8dc5d 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -18,9 +18,14 @@ const toggleButtonCtrl = this; toggleButtonCtrl.$onInit = () => { - toggleButtonCtrl.active = true; - toggleButtonCtrl.iconColorOff = toggleButtonCtrl.iconColorOff || '#EEE'; - toggleButtonCtrl.iconColorOn = toggleButtonCtrl.iconColorOn || '#EEE'; + console.log(toggleButtonCtrl); + _.defaults(toggleButtonCtrl, { + active: true, + iconColorOn: "#EEE", + iconColorOff: "#EEE", + action: () => {} + }); + console.log(toggleButtonCtrl); }; toggleButtonCtrl.toggle = () => { From c52787326a0b82e2df0af066d219e3b912a96dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Feb 2019 13:00:55 -0300 Subject: [PATCH 08/10] Add toggle-button jsdoc --- .../toggle-button/toggle-button.component.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index 537e8dc5d..02ce563c5 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -1,6 +1,24 @@ (function () { 'use strict'; + /** + * Button that calls an action and changes its icon on click. + * It receives as a binding an icon to shown when on and an + * icon to show when off. Also it receives an action to be + * called on click and the icons color when on and off. If + * the icon color is not passed, its color will be a default + * one (#EEE). + * @class toggleButton + * @example + * + * + * + */ angular.module("webchat").component("toggleButton", { templateUrl: "app/components/toggle-button/toggle-button.html", controller: toggleButtonController, From 7905a45353241074ce25026522221c7ec969dc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 14 Feb 2019 13:51:02 -0300 Subject: [PATCH 09/10] Refacts toggle-button component --- .../toggle-button/toggle-button.component.js | 12 +++++++++++ .../toggle-button/toggle-button.html | 20 +++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index 02ce563c5..c3575f400 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -50,6 +50,18 @@ toggleButtonCtrl.active = !toggleButtonCtrl.active; toggleButtonCtrl.action(); }; + + Object.defineProperty(toggleButtonCtrl, 'activeIcon', { + get: () => { + return toggleButtonCtrl.active ? toggleButtonCtrl.iconOn : toggleButtonCtrl.iconOff; + }, + }); + + Object.defineProperty(toggleButtonCtrl, 'activeIconColor', { + get: () => { + return toggleButtonCtrl.active ? toggleButtonCtrl.iconColorOn : toggleButtonCtrl.iconColorOff; + }, + }); } })(); \ No newline at end of file diff --git a/webchat/components/toggle-button/toggle-button.html b/webchat/components/toggle-button/toggle-button.html index a8fdfe341..b066812bf 100644 --- a/webchat/components/toggle-button/toggle-button.html +++ b/webchat/components/toggle-button/toggle-button.html @@ -1,15 +1,5 @@ - - - {{ toggleButtonCtrl.iconOn }} - - - {{ toggleButtonCtrl.iconOff }} - - \ No newline at end of file + + \ No newline at end of file From b75a113853c9a0e6cc47690b432f3dc7d93ecf2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 12:51:51 -0300 Subject: [PATCH 10/10] Change webchat folder and files to be referenced as main --- webchat/app.js | 10 +++++----- webchat/ecis.css | 7 +------ webchat/index.html | 6 +++--- webchat/{webchat/webchat.css => main/main.css} | 6 +++--- webchat/main/main.html | 4 ++++ webchat/main/mainController.js | 12 ++++++++++++ webchat/webchat/webchat.html | 4 ---- webchat/webchat/webchatController.js | 12 ------------ 8 files changed, 28 insertions(+), 33 deletions(-) rename webchat/{webchat/webchat.css => main/main.css} (83%) create mode 100644 webchat/main/main.html create mode 100644 webchat/main/mainController.js delete mode 100644 webchat/webchat/webchat.html delete mode 100644 webchat/webchat/webchatController.js diff --git a/webchat/app.js b/webchat/app.js index d64051c79..11431b295 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -8,9 +8,9 @@ 'firebase', ]); - const rootName = 'webchat'; + const rootName = 'main'; app.constant('STATES', { - abstract: 'webchat', + abstract: rootName, home: `${rootName}.home`, login: 'login', error: 'error', @@ -36,9 +36,9 @@ abstract: true, views: { main: { - templateUrl: "app/webchat/webchat.html", - controller: "WebchatController", - controllerAs: "webchatCtrl", + templateUrl: "app/main/main.html", + controller: "mainController", + controllerAs: "mainCtrl", }, }, }) diff --git a/webchat/ecis.css b/webchat/ecis.css index b10ce0758..5cb6d8aaf 100644 --- a/webchat/ecis.css +++ b/webchat/ecis.css @@ -1,9 +1,4 @@ -html, body { - height: 100%; - max-height: 100%; -} - -#webchat { +html, body, #main { height: 100%; max-height: 100%; } diff --git a/webchat/index.html b/webchat/index.html index 1fd34be0a..5d91c4f0e 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -44,7 +44,7 @@ - + @@ -62,7 +62,7 @@ -
+
- + diff --git a/webchat/webchat/webchat.css b/webchat/main/main.css similarity index 83% rename from webchat/webchat/webchat.css rename to webchat/main/main.css index 3dde1b912..f59069010 100644 --- a/webchat/webchat/webchat.css +++ b/webchat/main/main.css @@ -1,4 +1,4 @@ -.webchat__container { +.main__container { height: 100%; display: grid; grid-template-columns: 100%; @@ -10,10 +10,10 @@ animation-duration: 0.5s; } -.webchat__header { +.main__header { grid-area: header; } -.webchat__content { +.main__content { grid-area: content; } \ No newline at end of file diff --git a/webchat/main/main.html b/webchat/main/main.html new file mode 100644 index 000000000..8f21e5aa6 --- /dev/null +++ b/webchat/main/main.html @@ -0,0 +1,4 @@ +
+ +
+
diff --git a/webchat/main/mainController.js b/webchat/main/mainController.js new file mode 100644 index 000000000..70f58a270 --- /dev/null +++ b/webchat/main/mainController.js @@ -0,0 +1,12 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('mainController', ['AuthService', function mainController (AuthService) { + const mainCtrl = this; + + mainCtrl.user = AuthService.getCurrentUser(); + }]); + +})(); \ No newline at end of file diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html deleted file mode 100644 index d615c7bb5..000000000 --- a/webchat/webchat/webchat.html +++ /dev/null @@ -1,4 +0,0 @@ -
- -
-
diff --git a/webchat/webchat/webchatController.js b/webchat/webchat/webchatController.js deleted file mode 100644 index 338dcd989..000000000 --- a/webchat/webchat/webchatController.js +++ /dev/null @@ -1,12 +0,0 @@ -(function () { - 'use strict'; - - const webchat = angular.module('webchat'); - - webchat.controller('WebchatController', ['AuthService', function WebchatController (AuthService) { - const webchatCtrl = this; - - webchatCtrl.user = AuthService.getCurrentUser(); - }]); - -})(); \ No newline at end of file