diff --git a/client/less/chat.less b/client/less/chat.less deleted file mode 100644 index 17ec64258d..0000000000 --- a/client/less/chat.less +++ /dev/null @@ -1,25 +0,0 @@ -.chat-embed-help-title, -.chat-embed-main-title { - display: flex; - flex-grow: 1; - padding-left: 31px; - padding-top: 7px; -} - -.gitter-chat-embed { - z-index: 100; - position: fixed; - - top: 0; - left: 60%; - bottom: 0; - right: 0; - - display: flex; - flex-direction: row; - transition: transform 0.3s cubic-bezier(0.16, 0.22, 0.22, 1.7); -} - -.gitter-chat-embed.is-collapsed:not(.is-loading) { - transform: translateX(110%); -} diff --git a/client/less/drawers.less b/client/less/drawers.less deleted file mode 100644 index cff0fa04ad..0000000000 --- a/client/less/drawers.less +++ /dev/null @@ -1,137 +0,0 @@ -/* - * based off of https://github.com/gitterHQ/sidecar - * license: MIT - */ -.drawer { - width:500px; - - z-index: 20000; - position: fixed; - top: 0; - bottom: 0; - right: 0; - - display: -webkit-flex; - display: flex; - -webkit-flex-direction: row; - flex-direction: row; - background-color: @body-bg; - border-left: 1px solid #ddd; - box-shadow: -12px 0 18px 0 rgba(50, 50, 50, 0.1); - - transition: transform 0.3s cubic-bezier(0.16, 0.22, 0.22, 1.7); - - &.is-collapsed:not(.is-loading) { - -webkit-transform: translateX(110%); - transform: translateX(110%); - } - - /* Add some "extension" so that there isn't a gap - * when we translate(via animation) more than 100% */ - &:after { - content: ''; - - z-index: -1; - position: absolute; - top: 0; - left: 100%; - bottom: 0; - right: -100%; - - background-color: @body-bg; - } - iframe { - width: 100%; - height: 100%; - } - - h2 > a { - font-size: 20px; - } - a > h3 { - font-size: 18px; - font-weight: bold; - } - p { - font-size: 16px; - margin-left: 32px !important; - } - > .challenge-block-time { - width: 100%; - padding-top: 5px; - } - @media (max-width: 720px) { - width: 100%; - } -} - -.drawer-action-bar { - position: absolute; - top: 0; - right: 0; - - display: -webkit-flex; - display: flex; - justify-content: flex-end; - - padding-bottom: 5px; - padding-right:10px; - padding-top:5px; - z-index: 100; -} - -.drawer-action-item { - display: -webkit-flex; - display: flex; - /* main axis */ - justify-content: center; - /* cross axis */ - align-items: center; - - width: 40px; - height: 40px; - - padding-left: 0; - padding-right: 0; - - opacity: 0.65; - background: none; - background-position: center center; - background-repeat: no-repeat; - background-size: 22px 22px; - border: 0; - outline: none; - - cursor: pointer; - cursor: hand; - - transition: all 0.2s ease; - - &:hover, - &:focus { - opacity: 1; - } - - &:active { - filter: hue-rotate(80deg) saturate(150); - } -} - -.drawer-action-pop-out { - margin-right: -4px; - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMDAgMTcxLjQyOSIgZmlsbD0iIzNhMzEzMyI+PHBhdGggZD0iTTE1Ny4xNDMsMTAzLjU3MXYzNS43MTRjMCw4Ljg1NC0zLjE0NCwxNi40MjYtOS40MzEsMjIuNzEzcy0xMy44NTgsOS40MzEtMjIuNzEyLDkuNDMxSDMyLjE0MyBjLTguODU0LDAtMTYuNDI1LTMuMTQ0LTIyLjcxMi05LjQzMVMwLDE0OC4xNCwwLDEzOS4yODVWNDYuNDI5YzAtOC44NTQsMy4xNDQtMTYuNDI1LDkuNDMxLTIyLjcxMiBjNi4yODctNi4yODcsMTMuODU4LTkuNDMxLDIyLjcxMi05LjQzMWg3OC41NzJjMS4wNDEsMCwxLjg5NiwwLjMzNSwyLjU2NiwxLjAwNGMwLjY3LDAuNjcsMS4wMDQsMS41MjUsMS4wMDQsMi41NjdWMjUgYzAsMS4wNDItMC4zMzQsMS44OTctMS4wMDQsMi41NjdjLTAuNjcsMC42Ny0xLjUyNSwxLjAwNC0yLjU2NiwxLjAwNEgzMi4xNDNjLTQuOTExLDAtOS4xMTUsMS43NDktMTIuNjEyLDUuMjQ2IHMtNS4yNDYsNy43MDEtNS4yNDYsMTIuNjEydjkyLjg1NmMwLDQuOTExLDEuNzQ5LDkuMTE1LDUuMjQ2LDEyLjYxMnM3LjcwMSw1LjI0N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=) -} - -.night { - .drawer { - background-color: @night-body-bg; - } - .drawer-action-item{ - filter: brightness(4) saturate(0); - -webkit-filter: brightness(4) saturate(0); - } -} diff --git a/client/less/main.less b/client/less/main.less index f6f9c33043..6b370ce09e 100644 --- a/client/less/main.less +++ b/client/less/main.less @@ -1195,11 +1195,9 @@ and (max-width : 400px) { } -@import "chat.less"; -@import 'code-mirror.less'; +@import "code-mirror.less"; @import "challenge.less"; @import "toastr.less"; @import "map.less"; -@import "drawers.less"; @import "sk-wave.less"; @import "classic-modal.less"; diff --git a/client/less/map.less b/client/less/map.less index 0c9d43ca51..a4b07d3b68 100644 --- a/client/less/map.less +++ b/client/less/map.less @@ -224,57 +224,10 @@ } -.map-aside-body { - .map-fixed-header { - p { - margin-top: 0; - font-size: 16px; - } - .row.map-buttons { - float: none; - width: 100%; - text-align: center; - button { - width: 300px; - } - .input-group { - width: 300px; - padding-top: 5px; - } - } - } - .map-buttons:first-of-type { - float: none; - padding-left: 0; - } - .map-accordion { - top: 160px; - h2 { - margin: 15px 0; - a { - padding: 10px 0; - padding-left: 50px; - padding-right: 20px; - font-size: 20px; - } - } - h3 > a { - font-size: 20px; - } - } -} - .night { .map-fixed-header { background-color: @night-body-bg; } - .map-aside { - border-left-color:#222; - &-action-item { - filter: brightness(2) saturate(0); - -webkit-filter: brightness(2) saturate(0); - } - } #map-filter, .input-group-addon { border-color: #292929; background-color: #666; diff --git a/client/main.js b/client/main.js index 3670e120dd..d808af594e 100644 --- a/client/main.js +++ b/client/main.js @@ -2,136 +2,6 @@ var main = window.main || {}; main.ga = window.ga || function() {}; -main = (function(main, global) { - const { Mousetrap } = global; - - // should be set before gitter script loads - ((window.gitter = {}).chat = {}).options = { - disableDefaultChat: true - }; - // wait for sidecar to load - - main.chat = {}; - main.chat.isOpen = false; - main.chat.createHelpChat = function createHelpChat() { - throw new Error('Sidecar chat has not initialized'); - }; - - document.addEventListener('gitter-sidecar-ready', function(e) { - main.chat.GitterChat = e.detail.Chat; - - main.chat.createHelpChat = function(room, helpChatBtnClass, roomTitle) { - // room is always in PascalCase - roomTitle = room - .replace(/([A-Z])/g, ' $1') - .replace('Java Script', 'JavaScript'); - - $('body').append( - '' - ); - - main.chat.helpChat = new main.chat.GitterChat({ - room: `freecodecamp/${room}`, - activationElement: false, - targetElement: $('#chat-embed-help') - }); - - $(helpChatBtnClass).on('click', function() { - // is button already pressed? - // no? open chat - // yes? close chat - var shouldChatBeOpen = !$(this).hasClass('active'); - main.chat.helpChat.toggleChat(shouldChatBeOpen); - if (shouldChatBeOpen) { - $(helpChatBtnClass).addClass('active'); - } - }); - - var helpTitleAdd = false; - $('#chat-embed-help').on('gitter-chat-toggle', function(e) { - var shouldButtonBePressed = !!e.originalEvent.detail.state; - - if (!helpTitleAdd) { - helpTitleAdd = true; - $('#chat-embed-help > .gitter-chat-embed-action-bar').prepend( - '
' - ); - } - - if (shouldButtonBePressed) { - return $(helpChatBtnClass).addClass('active'); - } - return $(helpChatBtnClass).removeClass('active'); - }); - }; - - $('body').append( - '' - ); - - main.chat.mainChat = new main.chat.GitterChat({ - room: 'freecodecamp/freecodecamp', - activationElement: false, - targetElement: $('#chat-embed-main') - }); - - var mainChatTitleAdded = false; - $('#chat-embed-main').on('gitter-chat-toggle', function() { - if (mainChatTitleAdded) { - return null; - } - mainChatTitleAdded = true; - if ($('body').hasClass('night')) { - $('#chat-embed-main').addClass('night'); - } - $('#chat-embed-main > .gitter-chat-embed-action-bar').prepend( - ' ' - ); - return null; - }); - - - $('#nav-chat-btn').on('click', function(event) { - if (!(event.ctrlKey || event.metaKey)) { - toggleMainChat(); - } - window.ga('send', 'event', 'Nav', 'clicked', 'Nav chat opened'); - }); - - function showMainChat() { - if (!main.chat.isOpen) { - main.chat.mainChat.toggleChat(true); - } - } - - function collapseMainChat() { - $('#chat-embed-main').addClass('is-collapsed'); - document.activeElement.blur(); - } - - function toggleMainChat() { - var isCollapsed = $('#chat-embed-main').hasClass('is-collapsed'); - - if (isCollapsed) { - showMainChat(); - } else { - collapseMainChat(); - } - } - - // keyboard shortcuts: open main chat - Mousetrap.bind('g c', toggleMainChat); - }); - - return main; -}(main, window)); - $(document).ready(function() { const { Observable } = window.Rx; diff --git a/client/sagas/gitter-saga.js b/client/sagas/gitter-saga.js deleted file mode 100644 index aa8873a6a5..0000000000 --- a/client/sagas/gitter-saga.js +++ /dev/null @@ -1,178 +0,0 @@ -import { Subject, Observable } from 'rx'; -import Chat from 'gitter-sidecar'; -import types from '../../common/app/redux/types'; -import { - openHelpChat, - closeHelpChat, - toggleMainChat -} from '../../common/app/redux/actions'; - -export function createHeader(room, title, document) { - const type = room === 'freecodecamp' ? 'main' : 'help'; - const div = document.createElement('div'); - const span = document.createElement('span'); - const actionBar = document.querySelector( - `#chat-embed-${type}> .gitter-chat-embed-action-bar` - ); - span.appendChild(document.createTextNode(title)); - div.className = `chat-embed-${type}-title`; - div.appendChild(span); - actionBar.insertBefore(div, actionBar.firstChild); -} - -export function createHelpContainer(document) { - const container = document.createElement('aside'); - container.id = 'chat-embed-help'; - container.className = 'gitter-chat-embed is-collapsed'; - document.body.appendChild(container); - return container; -} - -export function createMainChat(getState, document) { - let mainChatTitleAdded = false; - const mainChatContainer = document.createElement('aside'); - mainChatContainer.id = 'chat-embed-main'; - mainChatContainer.className = 'gitter-chat-embed is-collapsed'; - document.body.appendChild(mainChatContainer); - const mainChat = new Chat({ - room: 'freecodecamp/freecodecamp', - activationElement: false, - targetElement: mainChatContainer - }); - - const toggle$ = Observable.fromEventPattern( - h => mainChatContainer.addEventListener('gitter-chat-toggle', h), - h => mainChatContainer.removeEventListener('gitter-chat-toggle', h) - ) - .map(e => { - const { isMainChatOpen } = getState().app; - if (!mainChatTitleAdded) { - mainChatTitleAdded = true; - createHeader('freecodecamp', 'Free Code Camp\'s Main Chat', document); - } - if (isMainChatOpen === e.detail.state) { - return null; - } - return toggleMainChat(); - }); - return { - mainChat, - toggle$ - }; -} - -// only one help room may be alive at once -export function createHelpChat(room, container, proxy, document) { - const title = room.replace(/([A-Z])/g, ' $1'); - let isTitleAdded = false; - const chat = new Chat({ - room: `freecodecamp/${room}`, - activationElement: false, - targetElement: container - }); - // return subscription to toggle stream - // dispose when rooms switch - const subscription = Observable.fromEventPattern( - h => container.addEventListener('gitter-chat-toggle', h), - h => container.removeEventListener('gitter-chat-toggle', h) - ) - .map(e => { - if (!isTitleAdded) { - isTitleAdded = true; - createHeader(room, title, document); - } - const gitterState = e.detail.state; - return gitterState ? openHelpChat() : closeHelpChat(); - }) - // use subject proxy to dispatch actions - .subscribe(proxy); - return { chat, subscription }; -} - -export const cache = {}; -export function toggleHelpChat(isOpen, room, proxy, document) { - // check is container is already created - if (!cache['container']) { - cache['container'] = createHelpContainer(document); - } - const { container } = cache; - if (!cache['chat']) { - const { - chat, - subscription - } = createHelpChat(room, container, proxy, document); - cache.chat = chat; - // make sure we clear out old subscription - if (cache.subscription && cache.subscription.dispose) { - cache.subscription.dispose(); - } - cache.subscription = subscription; - cache.currentRoom = room; - } - // have we switched rooms? - if (!cache.currentRoom === room) { - // room has changed, if chat object exist, destroy it - // and end subscription to toggle - try { - cache.chat.destroy(); - cache.subscription.dispose(); - // chat and subscription may not exist at first so we catch errors here - } catch (err) { - console.error(err); - } - // create new chat room and cache - const { - chat, - subscription - } = createHelpChat(room, container, proxy, document); - cache.chat = chat; - cache.subscription = subscription; - cache.currentRoom = room; - } - // all goes well pull chat object from cache - const { chat } = cache; - chat.toggleChat(isOpen); -} - -export default function gitterSaga(actions$, getState, { document }) { - const helpToggleProxy = new Subject(); - const { - mainChat, - toggle$: mainChatToggle$ - } = createMainChat(getState, document); - return Observable.merge( - mainChatToggle$, - helpToggleProxy, - actions$ - .filter(({ type }) => ( - type === types.openMainChat || - type === types.closeMainChat || - type === types.toggleMainChat || - type === types.toggleHelpChat - )) - .map(({ type }) => { - const state = getState(); - let shouldBlur = false; - if (type === types.toggleHelpChat) { - const { - app: { isHelpChatOpen }, - challengesApp: { helpChatRoom } - } = state; - shouldBlur = !isHelpChatOpen; - toggleHelpChat( - isHelpChatOpen, - helpChatRoom, - helpToggleProxy, - document - ); - } - const { isMainChatOpen } = state.app; - mainChat.toggleChat(isMainChatOpen); - shouldBlur = !isMainChatOpen; - if (!shouldBlur) { - document.activeElement.blur(); - } - return null; - }) - ); -} diff --git a/client/sagas/index.js b/client/sagas/index.js index 13e755f9fa..b94b7cfb59 100644 --- a/client/sagas/index.js +++ b/client/sagas/index.js @@ -5,7 +5,6 @@ import windowSaga from './window-saga'; import executeChallengeSaga from './execute-challenge-saga'; import frameSaga from './frame-saga'; import codeStorageSaga from './code-storage-saga'; -import gitterSaga from './gitter-saga'; import mouseTrapSaga from './mouse-trap-saga'; import analyticsSaga from './analytics-saga'; import nightModeSaga from './night-mode-saga'; @@ -18,7 +17,6 @@ export default [ executeChallengeSaga, frameSaga, codeStorageSaga, - gitterSaga, mouseTrapSaga, analyticsSaga, nightModeSaga diff --git a/client/sagas/mouse-trap-saga.js b/client/sagas/mouse-trap-saga.js index a9a7fb8297..b463f83ebf 100644 --- a/client/sagas/mouse-trap-saga.js +++ b/client/sagas/mouse-trap-saga.js @@ -3,12 +3,10 @@ import MouseTrap from 'mousetrap'; import { push } from 'react-router-redux'; import { toggleNightMode, - toggleMapDrawer, - toggleMainChat, hardGoTo } from '../../common/app/redux/actions'; -function bindKey$(key, actionCreator) { +function bindKey(key, actionCreator) { return Observable.fromEventPattern( h => MouseTrap.bind(key, h), h => MouseTrap.unbind(key, h) @@ -27,18 +25,16 @@ const softRedirects = { export default function mouseTrapSaga(actions$) { const traps$ = [ ...Object.keys(softRedirects) - .map(key => bindKey$(key, () => push(softRedirects[key]))), - bindKey$( + .map(key => bindKey(key, () => push(softRedirects[key]))), + bindKey( 'g n r', () => hardGoTo('https://github.com/freecodecamp/freecodecamp') ), - bindKey$( + bindKey( 'g n w', () => hardGoTo('http://forum.freecodecamp.com') ), - bindKey$('g m', toggleMapDrawer), - bindKey$('g t n', toggleNightMode), - bindKey$('g c', toggleMainChat) + bindKey('g t n', toggleNightMode) ]; return Observable.merge(traps$).takeUntil(actions$.last()); } diff --git a/common/app/App.jsx b/common/app/App.jsx index 1f566ea8e7..be56b9687c 100644 --- a/common/app/App.jsx +++ b/common/app/App.jsx @@ -3,13 +3,10 @@ import { Button, Row } from 'react-bootstrap'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; -import MapDrawer from './components/Map-Drawer.jsx'; import { fetchUser, initWindowHeight, updateNavHeight, - toggleMapDrawer, - toggleMainChat, updateAppLang, trackEvent, loadCurrentChallenge @@ -26,8 +23,6 @@ const mapDispatchToProps = { updateNavHeight, fetchUser, submitChallenge, - toggleMapDrawer, - toggleMainChat, updateAppLang, trackEvent, loadCurrentChallenge @@ -37,23 +32,17 @@ const mapStateToProps = createSelector( userSelector, state => state.app.isSignInAttempted, state => state.app.toast, - state => state.app.isMapDrawerOpen, - state => state.app.isMapAlreadyLoaded, state => state.challengesApp.toast, ( { user: { username, points, picture } }, isSignInAttempted, toast, - isMapDrawerOpen, - isMapAlreadyLoaded, ) => ({ username, points, picture, toast, showLoading: !isSignInAttempted, - isMapDrawerOpen, - isMapAlreadyLoaded, isSignedIn: !!username }) ); @@ -68,10 +57,6 @@ const propTypes = { updateNavHeight: PropTypes.func, initWindowHeight: PropTypes.func, submitChallenge: PropTypes.func, - isMapDrawerOpen: PropTypes.bool, - isMapAlreadyLoaded: PropTypes.bool, - toggleMapDrawer: PropTypes.func, - toggleMainChat: PropTypes.func, fetchUser: PropTypes.func, showLoading: PropTypes.bool, params: PropTypes.object, @@ -79,7 +64,6 @@ const propTypes = { trackEvent: PropTypes.func.isRequired, loadCurrentChallenge: PropTypes.func.isRequired }; -const contextTypes = { router: PropTypes.object }; // export plain class for testing export class FreeCodeCamp extends React.Component { @@ -112,30 +96,19 @@ export class FreeCodeCamp extends React.Component { } render() { - const { router } = this.context; const { username, points, picture, updateNavHeight, - isMapDrawerOpen, - isMapAlreadyLoaded, - toggleMapDrawer, - toggleMainChat, - showLoading, - params: { lang }, trackEvent, loadCurrentChallenge } = this.props; const navProps = { - isOnMap: router.isActive(`/${lang}/map`), username, points, picture, updateNavHeight, - toggleMapDrawer, - toggleMainChat, - showLoading, trackEvent, loadCurrentChallenge }; @@ -146,11 +119,6 @@ export class FreeCodeCamp extends React.Component {