diff --git a/client/src/app-components/are-you-sure.scss b/client/src/app-components/are-you-sure.scss index 921ed1c3..04f4c40e 100644 --- a/client/src/app-components/are-you-sure.scss +++ b/client/src/app-components/are-you-sure.scss @@ -18,7 +18,7 @@ margin-bottom: 50px; } - &__butttons { + &__buttons { margin: 0 auto; } diff --git a/client/src/app/App.js b/client/src/app/App.js index 1cbeaf90..23da32fe 100644 --- a/client/src/app/App.js +++ b/client/src/app/App.js @@ -59,6 +59,14 @@ class App extends React.Component { loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff, loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged }; + + if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) { + browserHistory.push('/maintenance'); + } + + if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) { + browserHistory.push('/'); + } if (validations.languageChanged) { browserHistory.push(props.location.pathname); diff --git a/client/src/app/Routes.js b/client/src/app/Routes.js index 970fc454..bd97b39b 100644 --- a/client/src/app/Routes.js +++ b/client/src/app/Routes.js @@ -11,6 +11,7 @@ import MainLayout from 'app/main/main-layout'; import MainHomePage from 'app/main/main-home/main-home-page'; import MainSignUpPage from 'app/main/main-signup/main-signup-page'; import MainRecoverPasswordPage from 'app/main/main-recover-password/main-recover-password-page'; +import MainMaintenancePage from 'app/main/main-maintenance-page'; import DashboardLayout from 'app/main/dashboard/dashboard-layout'; import DashboardListTicketsPage from 'app/main/dashboard/dashboard-list-tickets/dashboard-list-tickets-page'; @@ -59,6 +60,7 @@ export default ( + diff --git a/client/src/app/main/main-maintenance-page.js b/client/src/app/main/main-maintenance-page.js new file mode 100644 index 00000000..c9b4cee7 --- /dev/null +++ b/client/src/app/main/main-maintenance-page.js @@ -0,0 +1,24 @@ +import React from 'react'; + +import i18n from 'lib-app/i18n'; +import Icon from 'core-components/icon'; + +class MainMaintenancePage extends React.Component { + render() { + return ( +
+
+ +
+
+ {i18n('MAINTENANCE_MODE')} +
+
+ {i18n('MAINTENANCE_MODE_DESCRIPTION')} +
+
+ ); + } +} + +export default MainMaintenancePage; \ No newline at end of file diff --git a/client/src/app/main/main-maintenance-page.scss b/client/src/app/main/main-maintenance-page.scss new file mode 100644 index 00000000..002f49da --- /dev/null +++ b/client/src/app/main/main-maintenance-page.scss @@ -0,0 +1,39 @@ +@import "../../scss/vars"; + +.main-maintenance-page { + margin: auto; + width: 70%; + padding: 50px 100px; + border: 2px solid $dark-grey; + text-align: center; + background-color: white; + border-radius: 4px; + + &__icon { + color: $primary-yellow; + background-color: $light-grey; + display: inline-block; + padding: 10px 15px; + margin-bottom: 20px; + border-radius: 10px; + } + + &__title { + font-size: $font-size--xl; + margin-bottom: 30px; + color: $primary-yellow; + font-weight: bold; + } + + &__description { + font-size: $font-size--bg; + color: $primary-black; + } +} + +@media screen and (max-width: 500px) { + .main-maintenance-page { + padding-left: 0; + padding-right: 0; + } +} diff --git a/client/src/data/fixtures/system-fixtures.js b/client/src/data/fixtures/system-fixtures.js index 672e964e..ad471c8a 100644 --- a/client/src/data/fixtures/system-fixtures.js +++ b/client/src/data/fixtures/system-fixtures.js @@ -8,6 +8,7 @@ module.exports = [ data: { 'language': 'en', 'reCaptchaKey': '6LfM5CYTAAAAAGLz6ctpf-hchX2_l0Ge-Bn-n8wS', + 'maintenance-mode': false, 'departments': [ {id: 1, name: 'Sales Support', owners: 2}, {id: 2, name: 'Technical Issues', owners: 5}, diff --git a/client/src/data/languages/en.js b/client/src/data/languages/en.js index ae1a3ebf..b1472eee 100644 --- a/client/src/data/languages/en.js +++ b/client/src/data/languages/en.js @@ -117,6 +117,7 @@ export default { 'TRANSFER_TICKETS_TO': 'Transfer tickets to', 'COMMENTS': 'Comments', 'DELETE_STAFF_MEMBER': 'Delete staff member', + 'MAINTENANCE_MODE': 'Maintenance mode', //VIEW DESCRIPTIONS 'CREATE_TICKET_DESCRIPTION': 'This is a form for creating tickets. Fill the form and send us your issues/doubts/suggestions. Our support system will answer it as soon as possible.', @@ -145,6 +146,7 @@ export default { 'EDIT_STAFF_DESCRIPTION': 'Here you can edit information about a staff member.', 'MY_ACCOUNT_DESCRIPTION': 'Here you can edit information about you.', 'DEPARTMENTS_DESCRIPTION': 'A department is a group where the tickets can go. They are used to categorize the tickets. You can assign them to other staff members.', + 'MAINTENANCE_MODE_DESCRIPTION': 'The support system is in maintenance mode, thus unavailable at the moment. We will come back as soon as possible.', //ERRORS 'EMAIL_OR_PASSWORD': 'Email or password invalid', diff --git a/client/src/index.js b/client/src/index.js index 00c95300..2d96694c 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -33,7 +33,7 @@ store.dispatch(SessionActions.initSession()); let unsubscribe = store.subscribe(() => { console.log(store.getState()); - if (store.getState().session.initDone) { + if (store.getState().session.initDone && store.getState().config.initDone) { unsubscribe(); renderApplication(); } diff --git a/client/src/reducers/config-reducer.js b/client/src/reducers/config-reducer.js index 3526bedf..5aee8933 100644 --- a/client/src/reducers/config-reducer.js +++ b/client/src/reducers/config-reducer.js @@ -7,7 +7,8 @@ class ConfigReducer extends Reducer { getInitialState() { return { - language: sessionStore.getItem('language') + language: sessionStore.getItem('language'), + initDone: false }; } @@ -35,7 +36,8 @@ class ConfigReducer extends Reducer { })); return _.extend({}, state, payload.data, { - language: currentLanguage || payload.language + language: currentLanguage || payload.language, + initDone: true }); } } diff --git a/client/src/scss/_vars.scss b/client/src/scss/_vars.scss index cea6e370..61188e1a 100644 --- a/client/src/scss/_vars.scss +++ b/client/src/scss/_vars.scss @@ -5,6 +5,8 @@ $secondary-red: #FB6362; $primary-blue: #414A59; $secondary-blue: #20B8c5; +$primary-yellow: #E5D151; + $primary-green: #82CA9C; $very-light-grey: #F7F7F7;