diff --git a/webchat/app.js b/webchat/app.js index 30a8ec0c0..11431b295 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -8,11 +8,10 @@ 'firebase', ]); - const rootName = 'webchat'; + const rootName = 'main'; app.constant('STATES', { - abstract: 'webchat', + abstract: rootName, home: `${rootName}.home`, - chat: `${rootName}.chat`, login: 'login', error: 'error', }); @@ -37,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", }, }, }) @@ -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/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/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/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 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 @@
{ - iconButtonCtrl.iconColor = iconButtonCtrl.iconColor || "#EEE"; + _.defaults(iconButtonCtrl, { + iconColor: "#EEE", + action: () => {}, + 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 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..c3575f400 --- /dev/null +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -0,0 +1,67 @@ +(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, + controllerAs: "toggleButtonCtrl", + bindings: { + iconOn: '@', + iconOff: '@', + iconColorOn: '@', + iconColorOff: '@', + action: '<', + }, + }); + + function toggleButtonController() { + const toggleButtonCtrl = this; + + toggleButtonCtrl.$onInit = () => { + console.log(toggleButtonCtrl); + _.defaults(toggleButtonCtrl, { + active: true, + iconColorOn: "#EEE", + iconColorOff: "#EEE", + action: () => {} + }); + console.log(toggleButtonCtrl); + }; + + toggleButtonCtrl.toggle = () => { + 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/chat/chat.html b/webchat/components/toggle-button/toggle-button.css similarity index 100% rename from webchat/chat/chat.html rename to webchat/components/toggle-button/toggle-button.css diff --git a/webchat/components/toggle-button/toggle-button.html b/webchat/components/toggle-button/toggle-button.html new file mode 100644 index 000000000..b066812bf --- /dev/null +++ b/webchat/components/toggle-button/toggle-button.html @@ -0,0 +1,5 @@ + + \ No newline at end of file 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 f37100b09..5d91c4f0e 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -29,6 +29,7 @@ + @@ -43,7 +44,7 @@ - + @@ -61,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/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 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. 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