diff --git a/browser/main/HomePage.js b/browser/main/HomePage.js index 2f6f2983..57094068 100644 --- a/browser/main/HomePage.js +++ b/browser/main/HomePage.js @@ -1,6 +1,6 @@ import React, { PropTypes} from 'react' import { connect } from 'react-redux' -import { CREATE_MODE, EDIT_MODE, IDLE_MODE, NEW } from 'boost/actions' +import { CREATE_MODE, EDIT_MODE, IDLE_MODE, NEW, toggleTutorial } from 'boost/actions' // import UserNavigator from './HomePage/UserNavigator' import ArticleNavigator from './HomePage/ArticleNavigator' import ArticleTopBar from './HomePage/ArticleTopBar' @@ -32,9 +32,15 @@ class HomePage extends React.Component { return } - let { status } = this.props + let { status, dispatch } = this.props let { nav, top, list, detail } = this.refs + if (status.isTutorialOpen) { + dispatch(toggleTutorial()) + e.preventDefault() + return + } + // Search inputがfocusされていたら大体のキー入力は無視される。 if (top.isInputFocused() && !e.metaKey) { if (e.keyCode === 13 || e.keyCode === 27) top.escape() diff --git a/browser/main/HomePage/ArticleDetail.js b/browser/main/HomePage/ArticleDetail.js index cf861ff9..10c702c5 100644 --- a/browser/main/HomePage/ArticleDetail.js +++ b/browser/main/HomePage/ArticleDetail.js @@ -13,6 +13,65 @@ import TagSelect from 'boost/components/TagSelect' import ModeSelect from 'boost/components/ModeSelect' import activityRecord from 'boost/activityRecord' +const BRAND_COLOR = '#18AF90' + +const editDeleteTutorialElement = ( + + Edit / Delete a post + press `e`/`d` + + + + + + + +) + +const tagSelectTutorialElement = ( + + Attach some tags here! + + + + + + + + +) + +const modeSelectTutorialElement = ( + + Select code syntax!! + + + + + + + +) + function makeInstantArticle (article) { return Object.assign({}, article) } @@ -95,7 +154,7 @@ export default class ArticleDetail extends React.Component { } renderIdle () { - let { activeArticle, folders } = this.props + let { status, activeArticle, folders } = this.props let tags = activeArticle.tags != null ? activeArticle.tags.length > 0 ? activeArticle.tags.map(tag => { @@ -140,6 +199,9 @@ export default class ArticleDetail extends React.Component { Delete (d) + + {status.isTutorialOpen ? editDeleteTutorialElement : null} + ) } @@ -234,15 +296,14 @@ export default class ArticleDetail extends React.Component { } handleTitleKeyDown (e) { - console.log(e.keyCode) - if (e.keyCode === 9) { + if (e.keyCode === 9 && !e.shiftKey) { e.preventDefault() this.refs.mode.handleIdleSelectClick() } } renderEdit () { - let { folders } = this.props + let { folders, status } = this.props let folderOptions = folders.map(folder => { return ( @@ -266,7 +327,11 @@ export default class ArticleDetail extends React.Component { tags={this.state.article.tags} onChange={(tags, tag) => this.handleTagsChange(tags, tag)} /> + + {status.isTutorialOpen ? tagSelectTutorialElement : null} + +
{ this.state.article.mode === 'markdown' @@ -290,6 +355,8 @@ export default class ArticleDetail extends React.Component { className='mode' onBlur={() => this.handleModeSelectBlur()} /> + + {status.isTutorialOpen ? modeSelectTutorialElement : null}
{this.state.previewMode diff --git a/browser/main/HomePage/ArticleNavigator.js b/browser/main/HomePage/ArticleNavigator.js index 5f353e4a..8a5abd7e 100644 --- a/browser/main/HomePage/ArticleNavigator.js +++ b/browser/main/HomePage/ArticleNavigator.js @@ -9,6 +9,56 @@ import CreateNewFolder from 'boost/components/modal/CreateNewFolder' import remote from 'remote' let userName = remote.getGlobal('process').env.USER +const BRAND_COLOR = '#18AF90' + +const preferenceTutorialElement = ( + + Preference + + + + +) + +const newPostTutorialElement = ( + + Create a new post!! + press `⌘ + Enter` or `a` + + + + + + + +) + +const newFolderTutorialElement = ( + + Create a new folder!! + + + + + +) + export default class ArticleNavigator extends React.Component { handlePreferencesButtonClick (e) { openModal(Preferences) @@ -61,6 +111,9 @@ export default class ArticleNavigator extends React.Component { Preferences + + {status.isTutorialOpen ? preferenceTutorialElement : null} +
@@ -68,6 +121,9 @@ export default class ArticleNavigator extends React.Component { New Post Create a new Post (⌘ + Enter or a) + + {status.isTutorialOpen ? newPostTutorialElement : null} +
@@ -77,6 +133,9 @@ export default class ArticleNavigator extends React.Component { Create a new folder + + {status.isTutorialOpen ? newFolderTutorialElement : null} +
diff --git a/browser/main/HomePage/ArticleTopBar.js b/browser/main/HomePage/ArticleTopBar.js index a7391d20..24cda08e 100644 --- a/browser/main/HomePage/ArticleTopBar.js +++ b/browser/main/HomePage/ArticleTopBar.js @@ -1,9 +1,32 @@ import React, { PropTypes } from 'react' import ReactDOM from 'react-dom' import ExternalLink from 'boost/components/ExternalLink' -import { setSearchFilter, clearSearch } from 'boost/actions' -import { openModal } from 'boost/modal' -import Tutorial from 'boost/components/modal/Tutorial' +import { setSearchFilter, clearSearch, toggleTutorial } from 'boost/actions' + +const BRAND_COLOR = '#18AF90' + +const searchTutorialElement = ( + + Search some posts!! + {'- Search by tag : #{string}'} + + {'- Search by folder : in:{folder_name}\n'} + + + + + + +) export default class ArticleTopBar extends React.Component { constructor (props) { @@ -66,10 +89,13 @@ export default class ArticleTopBar extends React.Component { } handleTutorialButtonClick (e) { - openModal(Tutorial) + let { dispatch } = this.props + + dispatch(toggleTutorial()) } render () { + let { status } = this.props return (
@@ -94,14 +120,34 @@ export default class ArticleTopBar extends React.Component { - Search by folder : in:{'{folder_name}'}
+ + {status.isTutorialOpen ? searchTutorialElement : null} +
- + Boost official page
+ + {status.isTutorialOpen ? ( +
+
this.handleTutorialButtonClick(e)} className='clickJammer'/> + + Also, you can open Finder + with pressing `Control` + `shift` + `tab` + + + Hope you to enjoy our app :D + Press any key or click to escape tutorial mode + +
+
+ ) : null} +
) } diff --git a/browser/styles/main/HomeContainer/components/ArticleDetail.styl b/browser/styles/main/HomeContainer/components/ArticleDetail.styl index 2596e4fb..0a3182f4 100644 --- a/browser/styles/main/HomeContainer/components/ArticleDetail.styl +++ b/browser/styles/main/HomeContainer/components/ArticleDetail.styl @@ -85,6 +85,10 @@ iptFocusBorderColor = #369DCD &.edit .detailInfo .left + &>.tutorial + position fixed + z-index 35 + font-style italic .folder border none width 150px @@ -99,6 +103,8 @@ iptFocusBorderColor = #369DCD position relative margin-top 5px noSelect() + z-index 30 + background-color #E6E6E6 .tagItem background-color brandColor border-radius 2px @@ -155,7 +161,13 @@ iptFocusBorderColor = #369DCD .detailBody .detailPanel &>.header + &>.tutorial + fixed right + z-index 35 + font-style italic .mode + position relative + z-index 30 absolute top bottom right display block height 33px @@ -226,6 +238,10 @@ iptFocusBorderColor = #369DCD outline none &.idle .detailInfo + &>.tutorial + fixed top right + z-index 35 + font-style italic .left right 99px .info @@ -248,14 +264,17 @@ iptFocusBorderColor = #369DCD span.noTags color noTagsColor .right + z-index 30 button + border-radius 16.5px cursor pointer height 33px width 33px border none + margin-right 5px font-size 18px color inactiveTextColor - background-color transparent + background-color darken(white, 5%) padding 0 .tooltip tooltip() @@ -266,7 +285,7 @@ iptFocusBorderColor = #369DCD margin-top 25px margin-left -73px &:hover - color inherit + color textColor .tooltip opacity 1 .detailBody diff --git a/browser/styles/main/HomeContainer/components/ArticleNavigator.styl b/browser/styles/main/HomeContainer/components/ArticleNavigator.styl index 91b25fa7..77b19b03 100644 --- a/browser/styles/main/HomeContainer/components/ArticleNavigator.styl +++ b/browser/styles/main/HomeContainer/components/ArticleNavigator.styl @@ -21,6 +21,16 @@ articleNavBgColor = #353535 color white padding-left 20px margin-top 3px + .tutorial + position fixed + z-index 35 + top 0 + left 0 + pointer-event none + font-style italic + transition 0.1s + &.hide + opacity 0 .settingBtn width 22px height 22px @@ -33,6 +43,7 @@ articleNavBgColor = #353535 padding 0 background-color transparent border 1px solid white + z-index 31 .tooltip tooltip() margin-top -5px @@ -47,7 +58,16 @@ articleNavBgColor = #353535 height 88px padding 22px 15px margin-bottom 44px + .tutorial + fixed top left + z-index 35 + pointer-event none + font-style italic + transition 0.1s + &.hide + opacity 0 .newPostBtn + position relative border none background-color brandColor color white @@ -56,6 +76,7 @@ articleNavBgColor = #353535 border-radius 5px font-size 20px transition 0.1s + z-index 30 .tooltip tooltip() margin-left 48px @@ -70,6 +91,8 @@ articleNavBgColor = #353535 padding-bottom 5px margin-bottom 10px clearfix() + position relative + z-index 30 .title float left padding-left 10px @@ -103,6 +126,12 @@ articleNavBgColor = #353535 absolute bottom top 200px width 100% + .header + .tutorial + position fixed + z-index 35px + top 200px + font-style italic .folderList absolute bottom top 38px diff --git a/browser/styles/main/HomeContainer/components/ArticleTopBar.styl b/browser/styles/main/HomeContainer/components/ArticleTopBar.styl index 56e21827..742a17d7 100644 --- a/browser/styles/main/HomeContainer/components/ArticleTopBar.styl +++ b/browser/styles/main/HomeContainer/components/ArticleTopBar.styl @@ -15,8 +15,32 @@ infoBtnActiveBgColor = #3A3A3A left 200px height 60px background-color bgColor + &>.tutorial + .clickJammer + fixed top left bottom right + z-index 40 + background transparent + .global + fixed bottom right + height 100px + z-index 35 + .finder + fixed bottom right + height 250px + left 50% + margin-left -250px + z-index 35 + .back + fixed top left bottom right + z-index 20 + background-color transparentify(black, 80%) &>.left float left + &>.tutorial + fixed top + left 200px + z-index 36 + font-style italic &>.search position relative float left @@ -28,6 +52,7 @@ infoBtnActiveBgColor = #3A3A3A transition 0.1s font-size 16px border 1px solid transparent + z-index 30 .tooltip tooltip() margin-left -24px diff --git a/lib/ace-modes.js b/lib/ace-modes.js deleted file mode 100644 index 98cc119d..00000000 --- a/lib/ace-modes.js +++ /dev/null @@ -1,16 +0,0 @@ -var fs = require('fs') -var path = require('path') - -var rootUrl = process.cwd() -if (rootUrl === '/') rootUrl = require('remote').require('app').getAppPath() -var url = path.resolve(rootUrl, './submodules/ace/src-min') -console.log(url) - -module.exports = fs.readdirSync(url) - .filter(function (file) { - return file.match(/^mode-/) - }) - .map(function (file) { - var match = file.match(/^mode-([a-z0-9\_]+).js$/) - return match[1] - }) diff --git a/lib/actions.js b/lib/actions.js index ba0f668e..d99aa2e4 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -11,6 +11,7 @@ export const SWITCH_ARTICLE = 'SWITCH_ARTICLE' export const SET_SEARCH_FILTER = 'SET_SEARCH_FILTER' export const SET_TAG_FILTER = 'SET_TAG_FILTER' export const CLEAR_SEARCH = 'CLEAR_SEARCH' +export const TOGGLE_TUTORIAL = 'TOGGLE_TUTORIAL' // Status - mode export const IDLE_MODE = 'IDLE_MODE' @@ -96,3 +97,9 @@ export function clearSearch () { type: CLEAR_SEARCH } } + +export function toggleTutorial() { + return { + type: TOGGLE_TUTORIAL + } +} diff --git a/lib/api.js b/lib/api.js index e7156ce5..6a5f9f91 100644 --- a/lib/api.js +++ b/lib/api.js @@ -3,8 +3,8 @@ import superagentPromise from 'superagent-promise' import auth from 'boost/auth' export const API_URL = 'http://boost-api4.elasticbeanstalk.com/' -// export const WEB_URL = 'http://b00st.io/' -export const WEB_URL = 'http://localhost:3333/' +export const WEB_URL = 'https://b00st.io/' +// export const WEB_URL = 'http://localhost:3333/' export const request = superagentPromise(superagent, Promise) diff --git a/lib/reducer.js b/lib/reducer.js index 78c8ec3b..52cd5916 100644 --- a/lib/reducer.js +++ b/lib/reducer.js @@ -1,13 +1,14 @@ import { combineReducers } from 'redux' import _ from 'lodash' -import { SWITCH_FOLDER, SWITCH_MODE, SWITCH_ARTICLE, SET_SEARCH_FILTER, SET_TAG_FILTER, CLEAR_SEARCH, ARTICLE_UPDATE, ARTICLE_DESTROY, FOLDER_CREATE, FOLDER_UPDATE, FOLDER_DESTROY, IDLE_MODE, CREATE_MODE } from './actions' +import { SWITCH_FOLDER, SWITCH_MODE, SWITCH_ARTICLE, SET_SEARCH_FILTER, SET_TAG_FILTER, CLEAR_SEARCH, TOGGLE_TUTORIAL, ARTICLE_UPDATE, ARTICLE_DESTROY, FOLDER_CREATE, FOLDER_UPDATE, FOLDER_DESTROY, IDLE_MODE, CREATE_MODE } from './actions' import dataStore from 'boost/dataStore' import keygen from 'boost/keygen' import activityRecord from 'boost/activityRecord' const initialStatus = { mode: IDLE_MODE, - search: '' + search: '', + isTutorialOpen: false } let data = dataStore.getData() @@ -125,6 +126,9 @@ function articles (state = initialArticles, action) { function status (state = initialStatus, action) { state = Object.assign({}, state) switch (action.type) { + case TOGGLE_TUTORIAL: + state.isTutorialOpen = !state.isTutorialOpen + return state case SWITCH_FOLDER: state.mode = IDLE_MODE state.search = `in:${action.data} `