Upgraded dependencies

This commit is contained in:
Jori Lallo
2017-04-26 22:18:36 -07:00
parent c0a8d71bb9
commit b34d80717b
8 changed files with 825 additions and 798 deletions

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { browserHistory, Link } from 'react-router'; import { browserHistory, Link } from 'react-router';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';
import { observer } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { injectOffline } from 'components/Offline'; import { injectOffline } from 'components/Offline';
import keydown from 'react-keydown'; import keydown from 'react-keydown';
import _ from 'lodash'; import _ from 'lodash';
@ -16,7 +16,8 @@ import styles from './Layout.scss';
import classNames from 'classnames/bind'; import classNames from 'classnames/bind';
const cx = classNames.bind(styles); const cx = classNames.bind(styles);
@observer(['user']) @inject('user')
@observer
@injectOffline @injectOffline
class Layout extends React.Component { class Layout extends React.Component {
static propTypes = { static propTypes = {
@ -29,11 +30,11 @@ class Layout extends React.Component {
search: React.PropTypes.bool, search: React.PropTypes.bool,
offline: React.PropTypes.bool, offline: React.PropTypes.bool,
notifications: React.PropTypes.node, notifications: React.PropTypes.node,
} };
static defaultProps = { static defaultProps = {
search: true, search: true,
} };
@keydown(['/', 't']) @keydown(['/', 't'])
search() { search() {
@ -53,20 +54,17 @@ class Layout extends React.Component {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<Helmet <Helmet
title={ this.props.titleText title={
? `${this.props.titleText} - Atlas` this.props.titleText ? `${this.props.titleText} - Atlas` : 'Atlas'
: 'Atlas' } }
/> />
{ this.props.loading && ( {this.props.loading && <LoadingIndicator />}
<LoadingIndicator />
) }
{ this.props.offline && ( {this.props.offline &&
<Alert offline> <Alert offline>
It looks like you're offline. Reconnect to restore access to all of your documents 📚 It looks like you're offline. Reconnect to restore access to all of your documents 📚
</Alert> </Alert>}
) }
{this.props.notifications} {this.props.notifications}
@ -82,40 +80,39 @@ class Layout extends React.Component {
<Flex align="center" className={styles.actions}> <Flex align="center" className={styles.actions}>
{this.props.actions} {this.props.actions}
</Flex> </Flex>
{ user.user && ( {user.user &&
<Flex> <Flex>
{ this.props.search && ( {this.props.search &&
<Flex> <Flex>
<div <div
onClick={this.search} onClick={this.search}
className={styles.search} className={styles.search}
title="Search (/)" title="Search (/)"
> >
<img src={ require('assets/icons/search.svg') } alt="Search" /> <img
src={require('assets/icons/search.svg')}
alt="Search"
/>
</div> </div>
</Flex> </Flex>}
) }
<DropdownMenu <DropdownMenu
label={ <Avatar label={
circle <Avatar circle size={24} src={user.user.avatarUrl} />
size={ 24 } }
src={ user.user.avatarUrl }
/> }
> >
<MenuItem to="/settings">Settings</MenuItem> <MenuItem to="/settings">Settings</MenuItem>
<MenuItem to="/keyboard-shortcuts">Keyboard shortcuts</MenuItem> <MenuItem to="/keyboard-shortcuts">
Keyboard shortcuts
</MenuItem>
<MenuItem to="/developers">API</MenuItem> <MenuItem to="/developers">API</MenuItem>
<MenuItem onClick={user.logout}>Logout</MenuItem> <MenuItem onClick={user.logout}>Logout</MenuItem>
</DropdownMenu> </DropdownMenu>
</Flex> </Flex>}
) }
</Flex> </Flex>
</Flex> </Flex>
</div> </div>
<div <div className={cx(styles.content)}>
className={ cx(styles.content) }
>
{this.props.children} {this.props.children}
</div> </div>
</div> </div>

View File

@ -1,14 +1,15 @@
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer, inject } from 'mobx-react';
@observer(['user']) @inject('user')
@observer
class SlackAuthLink extends React.Component { class SlackAuthLink extends React.Component {
static propTypes = { static propTypes = {
children: React.PropTypes.node.isRequired, children: React.PropTypes.node.isRequired,
scopes: React.PropTypes.arrayOf(React.PropTypes.string), scopes: React.PropTypes.arrayOf(React.PropTypes.string),
user: React.PropTypes.object.isRequired, user: React.PropTypes.object.isRequired,
redirectUri: React.PropTypes.string, redirectUri: React.PropTypes.string,
} };
static defaultProps = { static defaultProps = {
scopes: [ scopes: [
@ -17,7 +18,7 @@ class SlackAuthLink extends React.Component {
'identity.avatar', 'identity.avatar',
'identity.team', 'identity.team',
], ],
} };
slackUrl = () => { slackUrl = () => {
const baseUrl = 'https://slack.com/oauth/authorize'; const baseUrl = 'https://slack.com/oauth/authorize';
@ -28,17 +29,17 @@ class SlackAuthLink extends React.Component {
state: this.props.user.getOauthState(), state: this.props.user.getOauthState(),
}; };
const urlParams = Object.keys(params).map((key) => { const urlParams = Object.keys(params)
.map(key => {
return `${key}=${encodeURIComponent(params[key])}`; return `${key}=${encodeURIComponent(params[key])}`;
}).join('&'); })
.join('&');
return `${baseUrl}?${urlParams}`; return `${baseUrl}?${urlParams}`;
} };
render() { render() {
return ( return <a href={this.slackUrl()}>{this.props.children}</a>;
<a href={ this.slackUrl() }>{ this.props.children }</a>
);
} }
} }

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import DashboardStore from './DashboardStore'; import DashboardStore from './DashboardStore';
@ -11,12 +11,13 @@ import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
import CenteredContent from 'components/CenteredContent'; import CenteredContent from 'components/CenteredContent';
@withRouter @withRouter
@observer(['user']) @inject('user')
@observer
class Dashboard extends React.Component { class Dashboard extends React.Component {
static propTypes = { static propTypes = {
user: React.PropTypes.object.isRequired, user: React.PropTypes.object.isRequired,
router: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired,
} };
constructor(props) { constructor(props) {
super(props); super(props);
@ -33,13 +34,14 @@ class Dashboard extends React.Component {
<Layout> <Layout>
<CenteredContent> <CenteredContent>
<Flex column auto> <Flex column auto>
{ this.store.isFetching ? ( {this.store.isFetching
<AtlasPreviewLoading /> ? <AtlasPreviewLoading />
) : ( : this.store.collections &&
this.store.collections && this.store.collections.map((collection) => { this.store.collections.map(collection => {
return (<AtlasPreview key={ collection.id } data={ collection } />); return (
}) <AtlasPreview key={collection.id} data={collection} />
) } );
})}
</Flex> </Flex>
</CenteredContent> </CenteredContent>
</Layout> </Layout>

View File

@ -1,13 +1,11 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Link, browserHistory } from 'react-router'; import { Link, browserHistory } from 'react-router';
import { observer } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { toJS } from 'mobx'; import { toJS } from 'mobx';
import keydown from 'react-keydown'; import keydown from 'react-keydown';
import _ from 'lodash'; import _ from 'lodash';
import DocumentSceneStore, { import DocumentSceneStore, { DOCUMENT_PREFERENCES } from './DocumentSceneStore';
DOCUMENT_PREFERENCES,
} from './DocumentSceneStore';
import Layout from 'components/Layout'; import Layout from 'components/Layout';
import AtlasPreviewLoading from 'components/AtlasPreviewLoading'; import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
@ -22,7 +20,8 @@ import styles from './DocumentScene.scss';
// const cx = classNames.bind(styles); // const cx = classNames.bind(styles);
@keydown(['cmd+/', 'ctrl+/', 'c', 'e']) @keydown(['cmd+/', 'ctrl+/', 'c', 'e'])
@observer(['ui', 'cache']) @inject('ui', 'cache')
@observer
class DocumentScene extends React.Component { class DocumentScene extends React.Component {
static propTypes = { static propTypes = {
ui: PropTypes.object.isRequired, ui: PropTypes.object.isRequired,
@ -30,7 +29,7 @@ class DocumentScene extends React.Component {
routeParams: PropTypes.object, routeParams: PropTypes.object,
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
location: PropTypes.object.isRequired, location: PropTypes.object.isRequired,
} };
constructor(props) { constructor(props) {
super(props); super(props);
@ -44,7 +43,7 @@ class DocumentScene extends React.Component {
state = { state = {
didScroll: false, didScroll: false,
} };
componentDidMount = async () => { componentDidMount = async () => {
const { id } = this.props.routeParams; const { id } = this.props.routeParams;
@ -52,9 +51,9 @@ class DocumentScene extends React.Component {
replaceUrl: !this.props.location.hash, replaceUrl: !this.props.location.hash,
}); });
this.scrollTohash(); this.scrollTohash();
} };
componentWillReceiveProps = async (nextProps) => { componentWillReceiveProps = async nextProps => {
const key = nextProps.keydown.event; const key = nextProps.keydown.event;
if (key) { if (key) {
if (key.key === '/' && (key.metaKey || key.ctrl.Key)) { if (key.key === '/' && (key.metaKey || key.ctrl.Key)) {
@ -81,25 +80,26 @@ class DocumentScene extends React.Component {
} }
this.scrollTohash(); this.scrollTohash();
} };
onEdit = () => { onEdit = () => {
const url = `${this.store.document.url}/edit`; const url = `${this.store.document.url}/edit`;
browserHistory.push(url); browserHistory.push(url);
} };
onCreateDocument = () => { onCreateDocument = () => {
browserHistory.push(`${this.store.collectionTree.url}/new`); browserHistory.push(`${this.store.collectionTree.url}/new`);
} };
onCreateChild = () => { onCreateChild = () => {
browserHistory.push(`${this.store.document.url}/new`); browserHistory.push(`${this.store.document.url}/new`);
} };
onDelete = () => { onDelete = () => {
let msg; let msg;
if (this.store.document.collection.type === 'atlas') { if (this.store.document.collection.type === 'atlas') {
msg = 'Are you sure you want to delete this document and all it\'s child documents (if any)?'; msg =
"Are you sure you want to delete this document and all it's child documents (if any)?";
} else { } else {
msg = 'Are you sure you want to delete this document?'; msg = 'Are you sure you want to delete this document?';
} }
@ -107,7 +107,7 @@ class DocumentScene extends React.Component {
if (confirm(msg)) { if (confirm(msg)) {
this.store.deleteDocument(); this.store.deleteDocument();
} }
} };
onExport = () => { onExport = () => {
const doc = this.store.document; const doc = this.store.document;
@ -116,7 +116,7 @@ class DocumentScene extends React.Component {
a.download = `${doc.title}.md`; a.download = `${doc.title}.md`;
a.href = `data:text/markdown;charset=UTF-8,${encodeURIComponent(doc.text)}`; a.href = `data:text/markdown;charset=UTF-8,${encodeURIComponent(doc.text)}`;
a.click(); a.click();
} };
scrollTohash = () => { scrollTohash = () => {
// Scroll to anchor after loading, and only once // Scroll to anchor after loading, and only once
@ -128,15 +128,15 @@ class DocumentScene extends React.Component {
const element = window.document.getElementsByName(name)[0]; const element = window.document.getElementsByName(name)[0];
if (element) element.scrollIntoView(); if (element) element.scrollIntoView();
} }
} };
render() { render() {
const { const { sidebar } = this.props.ui;
sidebar,
} = this.props.ui;
const doc = this.store.document; const doc = this.store.document;
const allowDelete = doc && doc.collection.type === 'atlas' && const allowDelete =
doc &&
doc.collection.type === 'atlas' &&
doc.id !== doc.collection.navigationTree.id; doc.id !== doc.collection.navigationTree.id;
let title; let title;
let titleText; let titleText;
@ -145,12 +145,13 @@ class DocumentScene extends React.Component {
actions = ( actions = (
<div className={styles.actions}> <div className={styles.actions}>
<DropdownMenu label={<MoreIcon />}> <DropdownMenu label={<MoreIcon />}>
{ this.store.isCollection && ( {this.store.isCollection &&
<div className={styles.menuGroup}> <div className={styles.menuGroup}>
<MenuItem onClick={ this.onCreateDocument }>New document</MenuItem> <MenuItem onClick={this.onCreateDocument}>
New document
</MenuItem>
<MenuItem onClick={this.onCreateChild}>New child</MenuItem> <MenuItem onClick={this.onCreateChild}>New child</MenuItem>
</div> </div>}
) }
<MenuItem onClick={this.onEdit}>Edit</MenuItem> <MenuItem onClick={this.onEdit}>Edit</MenuItem>
<MenuItem onClick={this.onExport}>Export</MenuItem> <MenuItem onClick={this.onExport}>Export</MenuItem>
{allowDelete && <MenuItem onClick={this.onDelete}>Delete</MenuItem>} {allowDelete && <MenuItem onClick={this.onDelete}>Delete</MenuItem>}
@ -174,28 +175,25 @@ class DocumentScene extends React.Component {
actions={doc && actions} actions={doc && actions}
loading={this.store.updatingStructure} loading={this.store.updatingStructure}
> >
{ this.store.isFetching ? ( {this.store.isFetching
<CenteredContent> ? <CenteredContent>
<AtlasPreviewLoading /> <AtlasPreviewLoading />
</CenteredContent> </CenteredContent>
) : ( : <Flex auto>
<Flex auto> {this.store.isCollection &&
{ this.store.isCollection && (
<Sidebar <Sidebar
open={sidebar} open={sidebar}
onToggle={this.props.ui.toggleSidebar} onToggle={this.props.ui.toggleSidebar}
navigationTree={toJS(this.store.collectionTree)} navigationTree={toJS(this.store.collectionTree)}
onNavigationUpdate={this.store.updateNavigationTree} onNavigationUpdate={this.store.updateNavigationTree}
onNodeCollapse={this.store.onNodeCollapse} onNodeCollapse={this.store.onNodeCollapse}
/> />}
) }
<Flex auto justify="center" className={styles.content}> <Flex auto justify="center" className={styles.content}>
<CenteredContent> <CenteredContent>
<Document document={doc} /> <Document document={doc} />
</CenteredContent> </CenteredContent>
</Flex> </Flex>
</Flex> </Flex>}
) }
</Layout> </Layout>
); );
} }

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { browserHistory } from 'react-router'; import { browserHistory } from 'react-router';
import { Flex } from 'reflexbox'; import { Flex } from 'reflexbox';
@ -10,18 +10,19 @@ import Alert from 'components/Alert';
import styles from './Home.scss'; import styles from './Home.scss';
@observer(['user']) @inject('user')
@observer
export default class Home extends React.Component { export default class Home extends React.Component {
static propTypes = { static propTypes = {
user: React.PropTypes.object.isRequired, user: React.PropTypes.object.isRequired,
location: React.PropTypes.object.isRequired, location: React.PropTypes.object.isRequired,
} };
componentDidMount = () => { componentDidMount = () => {
if (this.props.user.authenticated) { if (this.props.user.authenticated) {
browserHistory.replace('/dashboard'); browserHistory.replace('/dashboard');
} }
} };
get notifications() { get notifications() {
const notifications = []; const notifications = [];
@ -30,7 +31,9 @@ export default class Home extends React.Component {
if (state && state.nextPathname) { if (state && state.nextPathname) {
sessionStorage.removeItem('redirectTo'); sessionStorage.removeItem('redirectTo');
sessionStorage.setItem('redirectTo', state.nextPathname); sessionStorage.setItem('redirectTo', state.nextPathname);
notifications.push(<Alert key="login" info>Please login to continue</Alert>); notifications.push(
<Alert key="login" info>Please login to continue</Alert>
);
} }
return notifications; return notifications;
@ -41,16 +44,15 @@ export default class Home extends React.Component {
return ( return (
<Flex auto> <Flex auto>
<Layout <Layout notifications={this.notifications}>
notifications={ this.notifications }
>
<CenteredContent> <CenteredContent>
{ showLandingPageCopy && ( {showLandingPageCopy &&
<div className={styles.intro}> <div className={styles.intro}>
<h1 className={styles.title}>Simple, fast, markdown.</h1> <h1 className={styles.title}>Simple, fast, markdown.</h1>
<p className={ styles.copy }>We're building a modern wiki for engineering teams.</p> <p className={styles.copy}>
</div> We're building a modern wiki for engineering teams.
) } </p>
</div>}
<div className={styles.action}> <div className={styles.action}>
<SlackAuthLink redirectUri={`${URL}/auth/slack`}> <SlackAuthLink redirectUri={`${URL}/auth/slack`}>
<img <img

View File

@ -1,22 +1,19 @@
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { browserHistory } from 'react-router'; import { browserHistory } from 'react-router';
import { client } from 'utils/ApiClient'; import { client } from 'utils/ApiClient';
@observer(['user']) @inject('user')
@observer
class SlackAuth extends React.Component { class SlackAuth extends React.Component {
static propTypes = { static propTypes = {
user: React.PropTypes.object.isRequired, user: React.PropTypes.object.isRequired,
location: React.PropTypes.object.isRequired, location: React.PropTypes.object.isRequired,
route: React.PropTypes.object.isRequired, route: React.PropTypes.object.isRequired,
} };
componentDidMount = async () => { componentDidMount = async () => {
const { const { error, code, state } = this.props.location.query;
error,
code,
state,
} = this.props.location.query;
if (error) { if (error) {
if (error === 'access_denied') { if (error === 'access_denied') {
@ -43,12 +40,10 @@ class SlackAuth extends React.Component {
this.props.user.authWithSlack(code, state, redirectTo); this.props.user.authWithSlack(code, state, redirectTo);
} }
} };
render() { render() {
return ( return <div />;
<div></div>
);
} }
} }

View File

@ -58,32 +58,32 @@
"url": "git+ssh://git@github.com/jorilallo/atlas.git" "url": "git+ssh://git@github.com/jorilallo/atlas.git"
}, },
"dependencies": { "dependencies": {
"babel-core": "6.13.2", "babel-core": "^6.24.1",
"babel-eslint": "6.1.2", "babel-eslint": "^7.2.3",
"babel-loader": "6.2.5", "babel-loader": "6.2.5",
"babel-plugin-lodash": "^3.2.6", "babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-decorators-legacy": "1.3.4", "babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-polyfill": "^6.13.0", "babel-polyfill": "^6.13.0",
"babel-preset-es2015": "6.13.2", "babel-preset-es2015": "^6.24.1",
"babel-preset-react": "6.11.1", "babel-preset-react": "6.11.1",
"babel-preset-react-hmre": "1.1.1", "babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-0": "6.5.0", "babel-preset-stage-0": "^6.24.1",
"babel-regenerator-runtime": "6.5.0", "babel-regenerator-runtime": "6.5.0",
"bcrypt": "^0.8.7", "bcrypt": "^0.8.7",
"bugsnag": "^1.7.0", "bugsnag": "^1.7.0",
"classnames": "2.2.3", "classnames": "2.2.3",
"codemirror": "5.16.0", "codemirror": "^5.25.2",
"cross-env": "1.0.7", "cross-env": "1.0.7",
"css-loader": "0.23.1", "css-loader": "0.23.1",
"debug": "2.2.0", "debug": "2.2.0",
"dotenv": "2.0.0", "dotenv": "^4.0.0",
"emoji-name-map": "1.1.2", "emoji-name-map": "1.1.2",
"eslint": "2.13.1", "eslint": "^3.19.0",
"eslint-config-airbnb": "9.0.1", "eslint-config-airbnb": "^14.1.0",
"eslint-import-resolver-webpack": "^0.3.1", "eslint-import-resolver-webpack": "^0.3.1",
"eslint-plugin-import": "^1.9.2", "eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^1.5.3", "eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "5.2.2", "eslint-plugin-react": "^6.10.3",
"exports-loader": "0.6.3", "exports-loader": "0.6.3",
"extract-text-webpack-plugin": "1.0.1", "extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0", "file-loader": "0.9.0",
@ -110,22 +110,22 @@
"koa-webpack-dev-middleware": "1.2.0", "koa-webpack-dev-middleware": "1.2.0",
"koa-webpack-hot-middleware": "1.0.3", "koa-webpack-hot-middleware": "1.0.3",
"localenv": "0.2.2", "localenv": "0.2.2",
"lodash": "4.13.1", "lodash": "^4.17.4",
"lodash.orderby": "4.4.0", "lodash.orderby": "4.4.0",
"marked": "0.3.6", "marked": "0.3.6",
"marked-sanitized": "^0.1.1", "marked-sanitized": "^0.1.1",
"mobx": "2.5.1", "mobx": "^3.1.9",
"mobx-react": "3.5.5", "mobx-react": "^4.1.8",
"mobx-react-devtools": "4.2.4", "mobx-react-devtools": "^4.2.11",
"moment": "2.13.0", "moment": "2.13.0",
"node-dev": "3.1.0", "node-dev": "3.1.0",
"node-sass": "3.8.0", "node-sass": "3.8.0",
"nodemon": "1.9.1", "nodemon": "^1.11.0",
"normalize.css": "4.1.1", "normalize.css": "4.1.1",
"normalizr": "2.0.1", "normalizr": "2.0.1",
"pg": "6.1.0", "pg": "^6.1.5",
"pg-hstore": "2.3.2", "pg-hstore": "2.3.2",
"query-string": "^4.2.2", "query-string": "^4.3.4",
"randomstring": "1.1.5", "randomstring": "1.1.5",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"react": "15.3.2", "react": "15.3.2",
@ -136,10 +136,10 @@
"react-helmet": "3.1.0", "react-helmet": "3.1.0",
"react-keydown": "^1.6.1", "react-keydown": "^1.6.1",
"react-router": "2.8.0", "react-router": "2.8.0",
"rebass": "0.3.3", "rebass": "^0.3.4",
"redis": "^2.6.2", "redis": "^2.6.2",
"redis-lock": "^0.1.0", "redis-lock": "^0.1.0",
"reflexbox": "^2.0.0", "reflexbox": "^2.2.3",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"safestart": "0.8.0", "safestart": "0.8.0",
"sass-loader": "4.0.0", "sass-loader": "4.0.0",

1282
yarn.lock

File diff suppressed because it is too large Load Diff