From 714b56c02ae143244ff69a37e37317a0f980fabb Mon Sep 17 00:00:00 2001 From: Ted Morin Date: Mon, 25 Apr 2016 21:28:07 -0400 Subject: [PATCH] Rewrite readme for Jekyll update --- .babelrc | 19 ------- .eslintrc | 35 ------------ .gitignore | 12 ---- README.md | 79 +++++++++++--------------- actions/index.js | 94 ------------------------------- bootstrap.config.js | 37 ------------ bootstrap.config.less | 83 --------------------------- bootstrap.prod.js | 3 - components/Dictionaries.js | 41 -------------- components/Dictionary.js | 79 -------------------------- components/DictionaryItem.js | 31 ---------- components/DownloadDictionary.js | 40 ------------- components/FilterWidget.js | 36 ------------ components/Markdown.js | 32 ----------- containers/App.js | 30 ---------- containers/DevTools.js | 11 ---- containers/DictionariesPage.js | 49 ---------------- containers/DictionaryPage.js | 61 -------------------- containers/Root.dev.js | 22 -------- containers/Root.js | 5 -- containers/Root.prod.js | 18 ------ favicon.png | Bin 2087 -> 0 bytes index.html | 49 ---------------- index.js | 15 ----- package.json | 66 ---------------------- reducers/details.js | 30 ---------- reducers/dictionaries.js | 37 ------------ reducers/filtered.js | 32 ----------- reducers/formats.js | 13 ----- reducers/index.js | 20 ------- reducers/tags.js | 56 ------------------ routes.js | 13 ----- server.js | 28 --------- store/configureStore.dev.js | 31 ---------- store/configureStore.js | 5 -- store/configureStore.prod.js | 15 ----- util/load.js | 22 -------- webpack.config.js | 17 ------ webpack.prod.js | 49 ---------------- 39 files changed, 32 insertions(+), 1283 deletions(-) delete mode 100644 .babelrc delete mode 100644 .eslintrc delete mode 100644 actions/index.js delete mode 100644 bootstrap.config.js delete mode 100644 bootstrap.config.less delete mode 100644 bootstrap.prod.js delete mode 100644 components/Dictionaries.js delete mode 100644 components/Dictionary.js delete mode 100644 components/DictionaryItem.js delete mode 100644 components/DownloadDictionary.js delete mode 100644 components/FilterWidget.js delete mode 100644 components/Markdown.js delete mode 100644 containers/App.js delete mode 100644 containers/DevTools.js delete mode 100644 containers/DictionariesPage.js delete mode 100644 containers/DictionaryPage.js delete mode 100644 containers/Root.dev.js delete mode 100644 containers/Root.js delete mode 100644 containers/Root.prod.js delete mode 100644 favicon.png delete mode 100644 index.html delete mode 100644 index.js delete mode 100644 package.json delete mode 100644 reducers/details.js delete mode 100644 reducers/dictionaries.js delete mode 100644 reducers/filtered.js delete mode 100644 reducers/formats.js delete mode 100644 reducers/index.js delete mode 100644 reducers/tags.js delete mode 100644 routes.js delete mode 100644 server.js delete mode 100644 store/configureStore.dev.js delete mode 100644 store/configureStore.js delete mode 100644 store/configureStore.prod.js delete mode 100644 util/load.js delete mode 100644 webpack.config.js delete mode 100644 webpack.prod.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index b110a8d..0000000 --- a/.babelrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "stage": 2, - "env": { - "development": { - "plugins": [ - "react-transform" - ], - "extra": { - "react-transform": { - "transforms": [{ - "transform": "react-transform-hmr", - "imports": ["react"], - "locals": ["module"] - }] - } - } - } - } -} diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 1e71640..0000000 --- a/.eslintrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "parser": "babel-eslint", - "ecmaFeatures": { - "forOf": true, - "jsx": true - }, - "rules": { - "strict": 0, - "indent": [2, 2], - "no-extra-parens": 0, - "no-fallthrough": 0, - "eqeqeq": 1, - "semi": [2, "never"], - "comma-style": [2, "first"] - }, - "env": { - "node": false, - "browser": true, - "es6": true, - }, - "extends": "eslint:recommended", - "globals": { - "require": false, - "window": false, - "module": false, - "__dirname": false, - "Buffer": false, - "describe": false, - "it": false, - "AWS": false - }, - "plugins": [ - "eslint-plugin-react" - ] -} diff --git a/.gitignore b/.gitignore index dbd6864..e11e532 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,7 @@ -dictionaries -dictionaries.json - .DS_Store .AppleDouble .LSOverride -# Icon must end with two \r -Icon - - # Thumbnails ._* @@ -28,8 +21,3 @@ Temporary Items .apdisk *.log -node_modules -dist -lib -coverage -_book diff --git a/README.md b/README.md index e76ce90..57b81a3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ There is much more to text now than there ever was, between new weird words, all the way to extended symbols such as emoji. We type cryptic nonsense in the form of programming languages. We use function keys and movement keys and modifiers and shortcuts. We have a whole set of problems -to deal with that the *writers of olde* never had to deal with. +to deal with that the *writers of olde* never had to. If stenography is ever really going to replace a keyboard for everyday use, people need to use shortcuts, commands, and preferably they shouldn't have to @@ -16,61 +16,46 @@ you with the task of evolving beyond a traditional keyboard. ## Adding a dictionary -To add a dictionary, you only need to add the dictionary file and edit the -dictionary list with information about your dictionary. +**To submit a dictionary, you can do one of the following:** -### What makes a dictionary +1. Send me an email with your dictionary: morinted@gmail.com +2. Submit a GitHub issue with the needed information +3. Make a GitHub pull request on the gh-pages branch with your `dictname.md` -The required bits that make up a dictionary are: +To submit a dictionary, you'll need: -- A dictionary file in either JSON or RTF/CE. JSON is preferable, as that's -what most Plover users are familiar with. -- An entry in the dictionary list with information about your dictionary: - + Name: title of the dictionary - + Filename: the filename of the dictionary that you added to the dictionary folder - + Description: - - What: short summary of what the dictionary is. Limit to one sentence where possible. - - Why: longer explanation of why you think people might use this dictionary and what its contents may be. Limit to one paragraph where possible. - - How: explain the theory behind your dictionary, you can use as much detail as you think is necessary. You can use multiple paragraphs: this is where the user is learning how to use your dictionary. - + Tags: the categories that your dictionary fits into. There are a few tags that are pre-defined, you are welcome to define new ones if you feel it is necessary. You can see dictionaries.json for a full list of tags, which, for example, are along the lines of briefs, words, symbols, commands, and shortcuts. +- A steno dictionary in JSON or RTF/CRE format, or both. +- To create a description file, formatted like this one, but with your dictionary information filled in, instead. Note: "dictname" below would need to match the name of your actual dictionary, like `dictname.json` or `dictname.rtf` -There are examples with the other dictionaries in the repository. Because dictionaries -are manually approved, you can assume that any dictionaries on the site are in a format -that you can copy for your own submission. +```md +--- +layout: dictionary +title: A Cool Title +version: 1 +date: 2016-01-01 +filename: dictname +author: My Name +tags: briefs captioning commands linux mac windows program-specific programming shortcuts symbols words +what: One-liner about my cool dictionary +formats: + - json + - rtf +--- -### Option 1. Submit a Pull Request +## Why -This is the preffered method, if you are familiar with GitHub. Just fork, on the `gh-pages` -branch add your dictionary to `dictionaries.json` and place your dictionary in the -`dictionaries` folder. +This is a really cool dictionary. I'll describe it in about one paragraph. It's really great because when you use it you can write more words with the steno machine and it makes you cooler. -The JSON format may look a little weird to you, it's just an alternative style called diffy that aims to make maintaining JSON a little bit easier for programmers. Please maintain this style when submitting a PR. If you don't want to style it manually, you can use the npm tool `format-json` which defaults to diffy format. +## How -### Option 2. Submit an Issue +Here you can extend on how to use the dictionary, offer tips and advice. -If you are not comfortable making a GitHub Pull Request, -you are welcome to just submit an issue with the required information -for a dictionary and we can make the code changes. +Feel free to spread out across multiple paragraphs... -### Option 3. Email - -If you for some reason -cannot create a GitHub account and still want to submit a dictionary, you -can always email [Ted](https://github.com/morinted) using the email on his GitHub profile. - -## Development - -The scripts for the website assume that you have both the `master` and the `gh-pages` branches pulled and available, side-by-side in a parent folder. I.e., you have `stenodict/master` and `stenodict/gh-pages`. To achieve this, you can run these commands wherever you want to store Stenodict for development: +- Use a bulleted list. +- Make your points. +- You can show raw steno: `STKPWHRAO*EUFRPBLGTSDZ` +- `STK`: "and" +And that's why you should use my dictionary! ``` -mkdir stenodict && cd stenodict -git clone https://GitHub.com/openstenoproject/stenodict master -git clone https://GitHub.com/openstenoproject/stenodict gh-pages && cd gh-pages -git checkout gh-pages && git branch -D master -cd .. && pwd && ls - -``` - -Now you will have a `stenodict` directory with folders `master` and `gh-pages` in it. - -In order to develop the JavaScript component of the website, in the master branch, run `npm install`. After grabbing the dependencies, you should be able to start a server locally with `npm start`. `npm run build` places your `index.html` and needed files in `../gh-pages`, so it's best to have the folder structure explained above. diff --git a/actions/index.js b/actions/index.js deleted file mode 100644 index a57c1c0..0000000 --- a/actions/index.js +++ /dev/null @@ -1,94 +0,0 @@ -import { fetchJSON } from '../util/load' - -export const LOAD_DICTIONARIES = 'LOAD_DICTIONARIES' -export const GET_DETAILS = 'GET_DETAILS' -export const FETCHING = 'FETCHING' -export const SUCCESS = 'SUCCESS' -export const FAILURE = 'FAILURE' -export const APPLY_FILTERS = 'APPLY_FILTERS' -export const CLEAR_FILTERS = 'CLEAR_FILTERS' -export const TOGGLE_FILTER = 'TOGGLE_FILTER' - -export function fetchDictionaries() { - return dispatch => { - dispatch({ type: LOAD_DICTIONARIES - , status: FETCHING - }) - fetchJSON(`dictionaries.json`) - .then(({ tags, dictionaries, formats }) => { - dispatch({ type: LOAD_DICTIONARIES - , status: SUCCESS - , tags - , formats - , dictionaries - }) - dispatch(applyFilters()) - }) - .catch(error => { - dispatch({ type: LOAD_DICTIONARIES - , status: FAILURE - , error - }) - }) - } -} - -export function toggleFilter({ tag = null, format = null }) { - return dispatch => { - dispatch( - { type: TOGGLE_FILTER - , tag - , format - } - ) - dispatch(applyFilters()) - } - } - -export function clearFilters() { - return (dispatch, getState) => { - const { tags, formats, dictionaries } = getState() - dispatch({ type: CLEAR_FILTERS - , tags - , formats - , dictionaries - }) - dispatch(applyFilters()) - }} - -export function applyFilters() { - return (dispatch, getState) => { - const { tags, formats, dictionaries } = getState() - dispatch({ type: APPLY_FILTERS - , tags - , formats - , dictionaries - }) - } -} - -export function fetchDetails(filename: string) { - return dispatch => { - dispatch({ type: GET_DETAILS - , status: FETCHING - , filename - }) - fetchJSON(`dictionaries/${filename}_info.json`) - .then(({ why, how, version }) => { - dispatch({ type: GET_DETAILS - , status: SUCCESS - , why - , how - , version - , filename - }) - }) - .catch(error => { - dispatch({ type: GET_DETAILS - , status: FAILURE - , error - , filename - }) - }) - } -} diff --git a/bootstrap.config.js b/bootstrap.config.js deleted file mode 100644 index 2e336b9..0000000 --- a/bootstrap.config.js +++ /dev/null @@ -1,37 +0,0 @@ -module.exports = { - scripts: { - // add every bootstrap script you need - "button": true, - "dropdown": true, - "modal": true, - "popover": true, - "tab": true, - "collapse": true, - "transition": true, - "tooltip": true - }, - styles: { - // add every bootstrap style you need - "mixins": true, - "forms": true, - "media": true, - "normalize": true, - "print": true, - "code": true, - "component-animations": true, - "buttons": true, - "labels": true, - "panels": true, - "wells": true, - "glyphicons": true, - "navs": true, - "navbar": true, - "scaffolding": true, - "type": true, - "tables": true, - "grid": true, - "utilities": true, - "responsive-utilities": true, - "dropdowns": true - } -} diff --git a/bootstrap.config.less b/bootstrap.config.less deleted file mode 100644 index 0230ca5..0000000 --- a/bootstrap.config.less +++ /dev/null @@ -1,83 +0,0 @@ -@brand-primary: #568078; -@brand-info: #C89D39; - -.filters > div.checkbox, .filters > .form-group { - margin: 0 !important; -} - -hr.dictionary-page { - margin-top: 10px; - margin-bottom: 5px; -} - -h1.dictionary-title { - margin-top: 0; -} - -h4.dictionary-name { - margin-top: 3px; - margin-bottom: 3px; -} - -html, body#body { - background-color: #eee !important; -} - -#root-parent { - max-width: 960px; - margin: auto; -} - -@media (max-width: 767px) { - #stenodict-menu.navbar-default .navbar-nav .open .dropdown-menu > li > a { - color: #fff; - } - #stenodict-menu.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover { - color: #ddd; - } -} - -#stenodict-menu.navbar-default .navbar-brand { - color: rgba(255, 255, 255, 1); - font-size: 36px; - font-family: 'Sofia', sans-serif; -} -#stenodict-menu.navbar-default { - font-size: 14px; - background-color: rgba(86, 128, 120, 1); - border-width: 0px; - border-radius: 0px; -} -#stenodict-menu.navbar-default .navbar-nav>li>a { - color: rgba(255, 255, 255, 1); - background-color: rgba(86, 128, 120, 1); -} -#stenodict-menu.navbar-default .navbar-nav>li>a:hover, -#stenodict-menu.navbar-default .navbar-nav>li>a:focus { - color: rgba(255, 255, 255, 1); - background-color: rgba(93, 145, 135, 1); -} -#stenodict-menu.navbar-default .navbar-nav>.active>a, -#stenodict-menu.navbar-default .navbar-nav>.active>a:hover, -#stenodict-menu.navbar-default .navbar-nav>.active>a:focus { - color: rgba(255, 255, 255, 1); - background-color: rgba(68, 107, 100, 1); -} -#stenodict-menu.navbar-default .navbar-toggle { - border-color: #eee; -} -#stenodict-menu.navbar-default .navbar-toggle:hover, -#stenodict-menu.navbar-default .navbar-toggle:focus { - background-color: #446b64; -} -#stenodict-menu.navbar-default .navbar-toggle .icon-bar { - background-color: #eee; -} -#stenodict-menu.navbar-default .navbar-toggle:hover .icon-bar, -#stenodict-menu.navbar-default .navbar-toggle:focus .icon-bar { - background-color: #eee; -} - -.author { - color: #555; -} diff --git a/bootstrap.prod.js b/bootstrap.prod.js deleted file mode 100644 index 4a5cf3d..0000000 --- a/bootstrap.prod.js +++ /dev/null @@ -1,3 +0,0 @@ -var config = require('./bootstrap.config.js') -config.styleLoader = require('extract-text-webpack-plugin').extract('style-loader', 'css-loader!less-loader') -module.exports = config diff --git a/components/Dictionaries.js b/components/Dictionaries.js deleted file mode 100644 index 68f4c2a..0000000 --- a/components/Dictionaries.js +++ /dev/null @@ -1,41 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import { Table } from 'react-bootstrap' -import DictionaryItem from './DictionaryItem' - -class Dictionaries extends Component { - render() { - const { dictionaries, filtered } = this.props - let tableContent - if (dictionaries.fetching) { - tableContent = (Loading dictionaries...) - } else if (filtered.length >= 1) { - let list = dictionaries.list - tableContent = filtered - .map(x => - () - ) - } else if (filtered.length === 0 && - Object.keys(dictionaries.list).length > 0) { - return (No dictionaries match all the selected filters.) - } else { - // This should not show up - // because dictionaries.list shouldn't - // be handed in empty. - return (No dictionaries found.) - } - - return ( - - - { tableContent } - -
- ) - } -} - -Dictionaries.propTypes = { dictionaries: PropTypes.object.isRequired - , filtered: PropTypes.array.isRequired - } - -export default Dictionaries diff --git a/components/Dictionary.js b/components/Dictionary.js deleted file mode 100644 index 861e3e3..0000000 --- a/components/Dictionary.js +++ /dev/null @@ -1,79 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import { Glyphicon, Button, Row, Col } from 'react-bootstrap' -import Markdown from './Markdown' -import DownloadDictionary from './DownloadDictionary' - -class Dictionary extends Component { - render() { - const { dictionary, details, formats, tags } = this.props - let dictDetails = (

Loading details...

) - let downloadButton = null - let versionTag = null - if (details && details.version) { - versionTag = ( - {`v${details.version}`} - ) - } - if (details && !details.isLoading) { - if (!details.why && !details.how) { - dictDetails = ( -

- Sorry, can't find details on this dictionary! -

- ) - } else { - downloadButton = () - dictDetails = ( -
-

Why

- {details.why} -

How

- -

Where

-

Get the dictionary file for {dictionary.name}:

- { downloadButton } -
- ) - } - } - return ( -
- - - - - - { downloadButton } - - - -
- -

- { dictionary.name + ' ' } - { versionTag } -

-

By { dictionary.author }

-

{ dictionary.what}

- { dictDetails } -
- ) - } -} - -Dictionary.propTypes = { dictionary: PropTypes.object - , details: PropTypes.object - , formats: PropTypes.object - , tags: PropTypes.object - } - -export default Dictionary diff --git a/components/DictionaryItem.js b/components/DictionaryItem.js deleted file mode 100644 index e2ac17d..0000000 --- a/components/DictionaryItem.js +++ /dev/null @@ -1,31 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import { Link } from 'react-router' -import { Col, Button, Glyphicon } from 'react-bootstrap' -import Markdown from './Markdown' -import { LinkContainer } from 'react-router-bootstrap' - -class DictionaryItem extends Component { - render() { - const { dictionary } = this.props - const dictUrl = `dictionary/${dictionary.filename}` - const dictName = dictionary.name - const dictAuthor = dictionary.author - return ( - - - -

{ dictName }

- by { dictAuthor }
- { dictionary.what } - - - -
- ) - } - } - -DictionaryItem.PropTypes = { dictionary: PropTypes.object } - -export default DictionaryItem diff --git a/components/DownloadDictionary.js b/components/DownloadDictionary.js deleted file mode 100644 index edd9a28..0000000 --- a/components/DownloadDictionary.js +++ /dev/null @@ -1,40 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import { Button, Label, Glyphicon } from 'react-bootstrap' -import Markdown from './Markdown' - -class DownloadDictionary extends Component { - render() { - const { dictFormats - , formats - , filename - , name - , version - } = this.props - const downloadGlyph = - - const links = dictFormats.map((x, i) => ( - - )) - return ( -
- { links } -
- ) - } -} - -DownloadDictionary.propTypes = { formats: PropTypes.object.isRequired - , dictFormats: PropTypes.array.isRequired - , name: PropTypes.string.isRequired - , filename: PropTypes.string.isRequired - , version: PropTypes.number.isRequired - } - -export default DownloadDictionary diff --git a/components/FilterWidget.js b/components/FilterWidget.js deleted file mode 100644 index ffc7187..0000000 --- a/components/FilterWidget.js +++ /dev/null @@ -1,36 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import { Button } from 'react-bootstrap' - -class FilterWidget extends Component { - toggleBy(x) { - return () => { - this.props.toggleFilter(x) - } - } - render() { - const { tags, dictionaries, toggleFilter, clearFilters } = this.props - return ( -
-
Tags
- - { Object.keys(tags) - .sort((a, b) => tags[a].label.localeCompare(tags[b].label)) - .map(x => - ( - ) - ) - } -
- ) - } - } - -FilterWidget.PropTypes = { tags: PropTypes.object - , formats: PropTypes.object - , toggleFilter: PropTypes.func.isRequired - , clearFilters: PropTypes.func.isRequired - } - -export default FilterWidget diff --git a/components/Markdown.js b/components/Markdown.js deleted file mode 100644 index 0411e8d..0000000 --- a/components/Markdown.js +++ /dev/null @@ -1,32 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import marked from 'marked' - -class Markdown extends Component { - - parseMarkdown(md: string) { - // marked is sanitized by default. - return { __html: marked(md) } - } - - render() { - let { paragraphs = null, children } = this.props - if (paragraphs) { - paragraphs = paragraphs.join('\n\n') - } - if (children) { - paragraphs = paragraphs ? children + '\n\n' + paragraphs : children - } - if (!paragraphs && !children) { - return null - } - return ( - - - ) - } -} - -Markdown.propTypes = { paragraphs: React.PropTypes.array - } - -export default Markdown diff --git a/containers/App.js b/containers/App.js deleted file mode 100644 index aec37f7..0000000 --- a/containers/App.js +++ /dev/null @@ -1,30 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import { Row } from 'react-bootstrap' -import { connect } from 'react-redux'; -import { pushState } from 'redux-router'; - -class App extends Component { - render() { - const { children, dictionaries } = this.props; - return ( -
- {children} -
- ); - } -} - -App.propTypes = { - // Injected by React Redux - pushState: PropTypes.func.isRequired, - // Injected by React Router - children: PropTypes.node -}; - -function mapStateToProps(state) { - return { dictionaries: state.dictionaries }; -} - -export default connect(mapStateToProps, { - pushState -})(App); diff --git a/containers/DevTools.js b/containers/DevTools.js deleted file mode 100644 index f5fbd3a..0000000 --- a/containers/DevTools.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import { createDevTools } from 'redux-devtools'; -import LogMonitor from 'redux-devtools-log-monitor'; -import DockMonitor from 'redux-devtools-dock-monitor'; - -export default createDevTools( - - - -); diff --git a/containers/DictionariesPage.js b/containers/DictionariesPage.js deleted file mode 100644 index dc3c8c2..0000000 --- a/containers/DictionariesPage.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import { Row, Col, Panel } from 'react-bootstrap' -import { connect } from 'react-redux'; -import Dictionaries from '../components/Dictionaries' -import FilterWidget from '../components/FilterWidget' -import { toggleFilter, clearFilters } from '../actions' - -class DictionariesPage extends Component { - render() { - const { children - , dictionaries - , tags - , toggleFilter - , filtered - , clearFilters - } = this.props; - return ( - - -

Filter

- - - -

Dictionaries

- - -
- ) - } -} - -function mapStateToProps(state) { - return { dictionaries: state.dictionaries - , tags: state.tags - , filtered: state.filtered - } -} - -function mapDispatchToProps(dispatch) { - return { toggleFilter: x => dispatch(toggleFilter(x)) - , clearFilters: () => dispatch(clearFilters()) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(DictionariesPage); diff --git a/containers/DictionaryPage.js b/containers/DictionaryPage.js deleted file mode 100644 index 9d4d1c9..0000000 --- a/containers/DictionaryPage.js +++ /dev/null @@ -1,61 +0,0 @@ -import React, { Component, PropTypes } from 'react' -import { connect } from 'react-redux' -import { Button, Glyphicon } from 'react-bootstrap' -import Dictionary from '../components/Dictionary' -import { fetchDetails } from '../actions' -import { goBack } from 'redux-router' - -class DictionaryPage extends Component { - constructor() { - super() - this.fname = null - } - componentWillMount() { - const { location } = this.context - this.fname = location.pathname.substring( - location.pathname.lastIndexOf('/') + 1 - ) - this.getDetailsBasedOnProps(this.props) - } - componentWillReceiveProps(p) { - this.getDetailsBasedOnProps(p) - } - getDetailsBasedOnProps(props) { - const dictionary = props.dictionaries.list[this.fname] - const details = props.details[this.fname] - if (dictionary && !details) { - this.props.fetchDetails(this.fname) - } - } - render() { - const { children, dictionaries, details, formats, tags } = this.props - - if (!dictionaries.list[this.fname]) { - return (

Dictionary not found

) - } - return ( -
- -
- ) - } -} - -DictionaryPage.contextTypes = { location: PropTypes.object.isRequired } - -function mapStateToProps(state) { - return { dictionaries: state.dictionaries - , details: state.details - , formats: state.formats - , tags: state.tags - } -} - -function mapDispatchToProps(dispatch) { - return { fetchDetails: x => dispatch(fetchDetails(x)) } -} - -export default connect(mapStateToProps, mapDispatchToProps)(DictionaryPage) diff --git a/containers/Root.dev.js b/containers/Root.dev.js deleted file mode 100644 index 0d0ad50..0000000 --- a/containers/Root.dev.js +++ /dev/null @@ -1,22 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import { Provider } from 'react-redux'; -import { ReduxRouter } from 'redux-router'; -import DevTools from './DevTools'; - -export default class Root extends Component { - render() { - const { store } = this.props; - return ( - -
- - -
-
- ); - } -} - -Root.propTypes = { - store: PropTypes.object.isRequired -}; diff --git a/containers/Root.js b/containers/Root.js deleted file mode 100644 index 9cea0b2..0000000 --- a/containers/Root.js +++ /dev/null @@ -1,5 +0,0 @@ -if (process.env.NODE_ENV === 'production') { - module.exports = require('./Root.prod'); -} else { - module.exports = require('./Root.dev'); -} diff --git a/containers/Root.prod.js b/containers/Root.prod.js deleted file mode 100644 index 4d40c6d..0000000 --- a/containers/Root.prod.js +++ /dev/null @@ -1,18 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import { Provider } from 'react-redux'; -import { ReduxRouter } from 'redux-router'; - -export default class Root extends Component { - render() { - const { store } = this.props; - return ( - - - - ); - } -} - -Root.propTypes = { - store: PropTypes.object.isRequired -}; diff --git a/favicon.png b/favicon.png deleted file mode 100644 index 6c4dba07550bc6192e26612611a8a7d2f5b93b1d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2087 zcmV+?2-x?DP)m>XFQJUR~h?^ zJ=f=)z4lsb?{h4$&g($it}`89>UyX1D+duxG>ym)y*EBe`gF-QnrTh{W?%v0H zJ@2BWWhY*H{S7oWHo~@T6bgl4q{qfFc=ZaFrbn?Y=0RH-c<mL^5VWLaj5<-roM}&d$!??eE%;6DMCr>+V*hhsKc0=P*4zjo#i~ z6pKZiJb4n|Jn{{ws)~uR$pGBc)D$jVx`c&=1$2M^2YBI?6m(s~bb1a((ZFbW3Bn#QZ2?Y61>S*eHeoDAV32_dj*?JKsHq=fD0Oyo!(Mi5bky&R}+S78fpDKwDcI z&YnGs*49>7mK6kLIe7H+^kDa{-8g;jG(O+i3TgV7P0u59FN2x6Io!N{1B(-*Xx2=U z3-CM@QrIDYuYUPSzq9LUyzsr3@OVc%^7jiU86~7|r*ZAtHITu;a-2AEB4CQ?HcAED z9;2+T4`ATNhd6TND1P|rtAQj8E^p*8Iduo=ku*_0j_AGju|p$|po1h4@IBN4?A!M_ zKN)F)u129N0!?}h3Vo@hU(qRJx|ku#8W4*nAyo}c(HI&%fxK42oSKJs&p=!>ArfmM z06u9ON7M(l*%j;*CK9@UCk1kzL{Yc|00cl;2B1BNkyej90X_K|p4xE`UF{Cu_)!G^ zyaD{=7Xv6y9s{<2g64y9?0Oz(*k|I-x1Yt#6%B|x|?0mV`aN{Mk8$v*)~ zkroo_oQBenhVdyM@n>{m$VKITxKUpBF_$kQpU)$kDBuf63^ea-!Gfuy0JphDn`3RGXfg%8JJ z?SaM^Z>B;qvv3U$WtXLtBriRuJsF2d#Ya365IvNj-UUSU-3y$`gC8m63zb%?j8@Zw z^3rlXlqDLPLX*7e`f8d=1b$(P9%pGi^#REqz}g+JCc*Lsg5Rk`m~!5ag0r*f8yW?U z5JQ?4K~v5lb|e-fdKG|QPl6agDGOg30f30gEQB-Gm7um*R2c|AieLkkHdIw&fp*bU z9Z@|F%~8lq7K(8fC6xgx;d~0izq_^tR|!GcluV6*O(dub;nGaW6ma%bj+}jz$}dJE z8VSqHmLvs>%jt#GRdF)_hdP~KWdIv8psb|}H8NOL2{et$N7oVILG)|n$ObB@7!3#& z_1x+SNOHd8N_t8j@WeU{Bty%r&YqbhkHPSXeyRXIP}D$2E%?kbBq;kRIbZtW0wL-a zQ;0dw_23eX0?Yu(M{=xWfchx`DSR40?d8#I$7+DA?4U&|?;67Ah@60}AWkc{B_tGT z624fr02H#2;F2RCazhU!*9H*e67gYY;_$~isP6vXB{ zMF@gPX9ICWGP6of5JAB8if|18jFMyz27;s|(dokVywI35%Bn~1_ku%Zbss@>&g$o% zNrL4S^d>1|&fa4Xt`m&1=E9`*tBCb8TZ`E(N$^no8h~1p6H3r6{1pjr9++g~mMz8B z83-8kw-z9r?+0TILEy+Rcdc3pTV`POWapq0Huz56#<1g4#2SK{2y*44K%zIRmw_<_5%>`;>7$;-Nr8$U4Byih`MA z$y{nsN_0B~Pxf6N7#8aTsG$z%4u7tuUseHZ)DGB9lFE<|w=##1>R2@Gx8ENa{#wA$ z<_!431%*2yOQ3q3dDs>G4GdVr#9i5;6Val^obzqdHLcW@!I8e&yfyCwCBBleS?S#7 zN?@~daK~|=IJAT=je!AIc%=5C6C8$3WogCeBxpv(%F+J=4yN78KR&oQl3E=vkiZ>& z3GUb)c#$ip_>;IXPFHCogJjE9x>L~Y#^pPr4U29%remRD$;Bh4M7%++KrYCj0@|-5nW;yg-qWkbw4c={-{{ix^JExs8 Rf<6EM002ovPDHLkV1m~m)_VW| diff --git a/index.html b/index.html deleted file mode 100644 index b737751..0000000 --- a/index.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - Stenodict - Share Stenographic Dictionaries - - - - - - - -
-
-
-
-
-
-
-
- - diff --git a/index.js b/index.js deleted file mode 100644 index 33ad284..0000000 --- a/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import 'babel-core/polyfill'; -import React from 'react'; -import { render } from 'react-dom'; -import Root from './containers/Root'; -import configureStore from './store/configureStore'; -import { fetchDictionaries, fetchDetails } from './actions' - -const store = configureStore(); - -render( - , - document.getElementById('root') -); - -store.dispatch(fetchDictionaries()) diff --git a/package.json b/package.json deleted file mode 100644 index c1f0b43..0000000 --- a/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "stenodict", - "version": "1.1.0", - "description": "Stenodict repository", - "scripts": { - "start": "node server.js", - "build": "NODE_ENV=production node node_modules/webpack/bin/webpack.js -p --colors --progress --config=./webpack.prod.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/rackt/redux.git" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/rackt/redux/issues" - }, - "homepage": "http://rackt.github.io/redux", - "dependencies": { - "bootstrap": "^3.3.5", - "bootstrap-webpack": "0.0.5", - "css-loader": "^0.21.0", - "exports-loader": "^0.6.2", - "extract-text-webpack-plugin": "^0.8.2", - "file-loader": "^0.8.4", - "history": "^1.9.0", - "humps": "^0.6.0", - "imports-loader": "^0.6.5", - "isomorphic-fetch": "^2.2.0", - "jquery": "^2.1.4", - "less": "^2.5.3", - "less-loader": "^2.2.1", - "lodash": "^3.10.1", - "marked": "^0.3.5", - "normalizr": "^1.0.0", - "react": "^0.14.0", - "react-bootstrap": "^0.27.3", - "react-dom": "^0.14.0", - "react-redux": "^2.1.2", - "react-router": "^1.0.0-rc1", - "react-router-bootstrap": "^0.19.3", - "redux": "^3.0.0", - "redux-logger": "^2.0.2", - "redux-router": "^1.0.0-beta3", - "redux-thunk": "^0.1.0", - "style-loader": "^0.13.0", - "url-loader": "^0.5.6" - }, - "devDependencies": { - "babel-core": "^5.6.18", - "babel-loader": "^5.1.4", - "babel-plugin-react-transform": "^1.1.0", - "concurrently": "^0.1.1", - "eslint": "^1.7.3", - "eslint-config-eslint": "^1.0.1", - "eslint-plugin-react": "^3.6.3", - "express": "^4.13.3", - "html-webpack-plugin": "^1.6.2", - "react-transform-hmr": "^1.0.0", - "redux-devtools": "^3.0.0-beta-3", - "redux-devtools-dock-monitor": "^1.0.0-beta-3", - "redux-devtools-log-monitor": "^1.0.0-beta-3", - "webpack": "^1.9.11", - "webpack-dev-middleware": "^1.2.0", - "webpack-hot-middleware": "^2.2.0" - } -} diff --git a/reducers/details.js b/reducers/details.js deleted file mode 100644 index 62ec97c..0000000 --- a/reducers/details.js +++ /dev/null @@ -1,30 +0,0 @@ -import { FETCHING - , SUCCESS - , FAILURE - , GET_DETAILS - } from '../actions' - -export default function details(state = {}, action) { - switch (action.type) { - case GET_DETAILS: - let { filename } = action - switch (action.status) { - case FETCHING: - return { ...state - , [filename]: { isLoading: true } - } - case SUCCESS: - let { why, how, version = 1 } = action - return { ...state - , [filename]: { why, how, version, isLoading: false } - } - case FAILURE: - let { error } = action - return { ...state - , [filename]: { isLoading: false, error } - } - } - default: - return state - } -} diff --git a/reducers/dictionaries.js b/reducers/dictionaries.js deleted file mode 100644 index ebf0f6f..0000000 --- a/reducers/dictionaries.js +++ /dev/null @@ -1,37 +0,0 @@ -import { LOAD_DICTIONARIES - , FETCHING - , SUCCESS - , FAILURE - , GET_DETAILS - } from '../actions' - -export default function dictionaries(state = { fetching: false - , list: {} - , error: null - , details: {} - } - , action - ) { - switch (action.type) { - case LOAD_DICTIONARIES: - switch (action.status) { - case FETCHING: - return { ...state - , fetching: true - , error: null - } - case SUCCESS: - return { ...state - , fetching: false - , list: action.dictionaries - } - case FAILURE: - return { ...state - , fetching: false - , error: action.error - } - } - default: - return state - } -} diff --git a/reducers/filtered.js b/reducers/filtered.js deleted file mode 100644 index c6707c8..0000000 --- a/reducers/filtered.js +++ /dev/null @@ -1,32 +0,0 @@ -import { APPLY_FILTERS - , TOGGLE_FILTER - , CLEAR_FILTERS - } from '../actions' - -export default function filtered(state = [] - , action - ) { - switch (action.type) { - case APPLY_FILTERS: - const { tags, formats, dictionaries } = action - const { list } = dictionaries - let selectedTags = Object.keys(tags) - .filter(x => tags[x].selected) - let filtered = Object.keys(list) - if (selectedTags.length !== 0) { - filtered = filtered - .filter(x => - selectedTags.every(y => - list[x].tags.includes(parseInt(y, 10)) - ) - ) - } - filtered = filtered.sort((a, b) => - list[a].name - .localeCompare(list[b].name) - ) - return filtered - default: - return state - } -} diff --git a/reducers/formats.js b/reducers/formats.js deleted file mode 100644 index 358258e..0000000 --- a/reducers/formats.js +++ /dev/null @@ -1,13 +0,0 @@ -import { LOAD_DICTIONARIES, SUCCESS } from '../actions'; - -export default function formats(state = {}, action) { - switch (action.type) { - case LOAD_DICTIONARIES: - switch (action.status) { - case SUCCESS: - return { ...action.formats } - } - default: - return state; - } -} diff --git a/reducers/index.js b/reducers/index.js deleted file mode 100644 index fce8889..0000000 --- a/reducers/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import * as ActionTypes from '../actions'; -import merge from 'lodash/object/merge'; -import tags from './tags'; -import dictionaries from './dictionaries'; -import details from './details'; -import formats from './formats'; -import filtered from './filtered'; -import { routerStateReducer as router } from 'redux-router'; -import { combineReducers } from 'redux'; - -const rootReducer = combineReducers({ - router, - tags, - formats, - details, - dictionaries, - filtered -}); - -export default rootReducer; diff --git a/reducers/tags.js b/reducers/tags.js deleted file mode 100644 index 2c4b61f..0000000 --- a/reducers/tags.js +++ /dev/null @@ -1,56 +0,0 @@ -import { LOAD_DICTIONARIES - , SUCCESS - , TOGGLE_FILTER - , CLEAR_FILTERS - } from '../actions'; - -export default function tags(state = {}, action) { - switch (action.type) { - case LOAD_DICTIONARIES: - switch (action.status) { - case SUCCESS: - const { tags, dictionaries } = action - const filtered = Object.keys(tags).map(key => { - // Count how many dictionaries have each tag - let count = Object.keys(dictionaries).reduce((prev, next) => { - let tags = dictionaries[next].tags - let nKey = parseInt(key, 10) - if (tags.includes(nKey)) { - return prev + 1 - } - return prev - }, 0) - return { key, count, label: tags[key], selected: false } - }) - // Forget about tags that aren't used - .filter(x => x.count > 0) - // Turn back into an object - .reduce((p, n) => { - p[n.key] = n - return p - }, {}) - return { ...filtered } - } - case TOGGLE_FILTER: - const { tag } = action - if (tag === null || tag === undefined) { - return state - } - return { ...state - , [tag]: { ...state[tag] - , selected: !state[tag].selected - } - } - case CLEAR_FILTERS: - let newState = { ...state } - newState = Object.keys(newState) - .reduce((p, n) => { - p[n] = newState[n] - p[n].selected = false - return p - }, {}) - return newState - default: - return state; - } -} diff --git a/routes.js b/routes.js deleted file mode 100644 index ad0ded1..0000000 --- a/routes.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import { Route, IndexRoute } from 'react-router'; -import App from './containers/App'; -import DictionaryPage from './containers/DictionaryPage' -import DictionariesPage from './containers/DictionariesPage' - -export default ( - - - - - -); diff --git a/server.js b/server.js deleted file mode 100644 index 37b99ae..0000000 --- a/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var webpack = require('webpack'); -var webpackDevMiddleware = require('webpack-dev-middleware'); -var webpackHotMiddleware = require('webpack-hot-middleware'); -var config = require('./webpack.config'); -var express = require('express'); -var app = new express(); -var port = 3000; - -var compiler = webpack(config); -app.use(webpackDevMiddleware(compiler - , { noInfo: true - , publicPath: config.output.publicPath - , historyApiFallback: true - } - )); -app.use(webpackHotMiddleware(compiler)); -app.use(express.static('../gh-pages')) -app.use(function(req, res) { - res.sendFile(__dirname + '/index.html'); -}); - -app.listen(port, function(error) { - if (error) { - console.error(error); - } else { - console.info("==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.", port, port); - } -}); diff --git a/store/configureStore.dev.js b/store/configureStore.dev.js deleted file mode 100644 index 097e737..0000000 --- a/store/configureStore.dev.js +++ /dev/null @@ -1,31 +0,0 @@ -import { createStore, applyMiddleware, compose } from 'redux'; -import { reduxReactRouter } from 'redux-router'; -import DevTools from '../containers/DevTools'; -import createHistory from 'history/lib/createHashHistory'; -import routes from '../routes'; -import thunk from 'redux-thunk'; -import createLogger from 'redux-logger'; -import rootReducer from '../reducers'; - -const finalCreateStore = compose( - applyMiddleware(thunk), - reduxReactRouter({ routes - , createHistory - }), - applyMiddleware(createLogger()), - DevTools.instrument() -)(createStore); - -export default function configureStore(initialState) { - const store = finalCreateStore(rootReducer, initialState); - - if (module.hot) { - // Enable Webpack hot module replacement for reducers - module.hot.accept('../reducers', () => { - const nextRootReducer = require('../reducers'); - store.replaceReducer(nextRootReducer); - }); - } - - return store; -} diff --git a/store/configureStore.js b/store/configureStore.js deleted file mode 100644 index 78c9ea1..0000000 --- a/store/configureStore.js +++ /dev/null @@ -1,5 +0,0 @@ -if (process.env.NODE_ENV === 'production') { - module.exports = require('./configureStore.prod'); -} else { - module.exports = require('./configureStore.dev'); -} diff --git a/store/configureStore.prod.js b/store/configureStore.prod.js deleted file mode 100644 index 9f514ba..0000000 --- a/store/configureStore.prod.js +++ /dev/null @@ -1,15 +0,0 @@ -import { createStore, applyMiddleware, compose } from 'redux'; -import { reduxReactRouter } from 'redux-router'; -import createHistory from 'history/lib/createHashHistory'; -import routes from '../routes'; -import thunk from 'redux-thunk'; -import rootReducer from '../reducers'; - -const finalCreateStore = compose( - applyMiddleware(thunk), - reduxReactRouter({ routes, createHistory }) -)(createStore); - -export default function configureStore(initialState) { - return finalCreateStore(rootReducer, initialState); -} diff --git a/util/load.js b/util/load.js deleted file mode 100644 index 5c7982d..0000000 --- a/util/load.js +++ /dev/null @@ -1,22 +0,0 @@ -import 'isomorphic-fetch' - -let readAsText = blob => { - let reader = new FileReader(); - return new Promise(resolve => { - reader.addEventListener("loadend", function() { - resolve(reader.result) - }) - reader.readAsText(blob) - }) -} - -export function fetchJSON(url) { - return fetch(url).then(response => { - if (response.status !== 200) { - throw new Error(`Unable to fetch ${url}`) - } - return response.blob() - }) - .then(blob => readAsText(blob)) - .then(jsonString => JSON.parse(jsonString)) -} diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index d1d0134..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -var webpack = require('webpack') -var config = require("./webpack.prod.js") -var HtmlWebpackPlugin = require('html-webpack-plugin') - -config.devtool = 'cheap-module-eval-source-map' -config.entry = - [ 'webpack-hot-middleware/client' - , 'bootstrap-webpack!./bootstrap.config.js' - , './index' - ] -config.plugins = [ - config.plugins[0], - new webpack.optimize.OccurenceOrderPlugin(), - new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin() - ] -module.exports = config diff --git a/webpack.prod.js b/webpack.prod.js deleted file mode 100644 index 6f2866f..0000000 --- a/webpack.prod.js +++ /dev/null @@ -1,49 +0,0 @@ -var path = require('path') -var webpack = require('webpack') -var jQuery = require('jQuery') -var HtmlWebpackPlugin = require('html-webpack-plugin') -var ExtractTextPlugin = require('extract-text-webpack-plugin') - -module.exports = { - entry: - [ 'bootstrap-webpack!./bootstrap.prod.js' - , './index' - ], - output: { - path: path.join(__dirname, '../gh-pages'), - filename: 'stenodict-[hash:4].js', - publicPath: '' - }, - plugins: [ - new HtmlWebpackPlugin( - { template: './index.html' - , inject: true - , favicon: './favicon.png' - } - ), - new webpack.optimize.DedupePlugin(), - new webpack.optimize.OccurenceOrderPlugin(), - new webpack.optimize.UglifyJsPlugin(), - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': '"production"' - } - }), - new ExtractTextPlugin("style-[contenthash:4].css") - ], - module: - { loaders: - [ { test: /\.js$/ - , loaders: ['babel'] - , exclude: /node_modules/ - , include: __dirname - } - , { test: /bootstrap\/js\// - , loader: 'imports?jQuery=jquery' - } - , { test: /\.woff.*|\.ttf|\.eot|\.svg$/ - , loader: "file?name=static/fnt-[hash:6].[ext]" - } - ] - } -};