commit
e051713177
11
.babelrc
11
.babelrc
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"presets": ["react", "env"],
|
"presets": [
|
||||||
|
"react",
|
||||||
|
"env"
|
||||||
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"lodash",
|
"lodash",
|
||||||
"transform-decorators-legacy",
|
"transform-decorators-legacy",
|
||||||
|
@ -10,7 +13,9 @@
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"development": {
|
"development": {
|
||||||
"presets": ["react-hmre"]
|
"presets": [
|
||||||
|
"react-hmre"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
38
.eslintrc
38
.eslintrc
|
@ -1,6 +1,10 @@
|
||||||
{
|
{
|
||||||
"parser": "babel-eslint",
|
"parser": "babel-eslint",
|
||||||
"extends": ["react-app", "plugin:import/errors", "plugin:import/warnings"],
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"plugin:import/errors",
|
||||||
|
"plugin:import/warnings"
|
||||||
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"prettier"
|
"prettier"
|
||||||
],
|
],
|
||||||
|
@ -10,23 +14,25 @@
|
||||||
// does more harm than good.
|
// does more harm than good.
|
||||||
"no-mixed-operators": "off",
|
"no-mixed-operators": "off",
|
||||||
// Enforce that code is formatted with prettier.
|
// Enforce that code is formatted with prettier.
|
||||||
"prettier/prettier": ["error", {"trailingComma": "es5", "singleQuote": true}]
|
"prettier/prettier": [
|
||||||
},
|
"error",
|
||||||
"settings" : {
|
{
|
||||||
"import/resolver": {
|
"trailingComma": "es5",
|
||||||
"webpack": {
|
"singleQuote": true
|
||||||
"config": "webpack.config.js"
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"import/resolver": "webpack"
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"jest": true,
|
"jest": true
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
__DEV__: true,
|
"__DEV__": true,
|
||||||
SLACK_KEY: true,
|
"SLACK_KEY": true,
|
||||||
SLACK_REDIRECT_URI: true,
|
"SLACK_REDIRECT_URI": true,
|
||||||
DEPLOYMENT: true,
|
"DEPLOYMENT": true,
|
||||||
afterAll: true
|
"afterAll": true
|
||||||
},
|
}
|
||||||
}
|
}
|
13
.flowconfig
13
.flowconfig
|
@ -4,9 +4,18 @@
|
||||||
[libs]
|
[libs]
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
|
emoji=true
|
||||||
|
|
||||||
|
module.system.node.resolve_dirname=node_modules
|
||||||
|
module.system.node.resolve_dirname=frontend
|
||||||
|
|
||||||
|
module.name_mapper='^\(.*\)\.s?css$' -> 'empty/object'
|
||||||
|
module.file_ext=.scss
|
||||||
|
|
||||||
esproposal.decorators=ignore
|
esproposal.decorators=ignore
|
||||||
esproposal.class_static_fields=enable
|
esproposal.class_static_fields=enable
|
||||||
esproposal.class_instance_fields=enable
|
esproposal.class_instance_fields=enable
|
||||||
unsafe.enable_getters_and_setters=true
|
unsafe.enable_getters_and_setters=true
|
||||||
module.name_mapper='^\(.*\)\.s?css$' -> 'empty/object'
|
|
||||||
module.file_ext=.scss
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
|
||||||
|
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { toJS } from 'mobx';
|
import { toJS } from 'mobx';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import type { Document as DocumentType } from '../../../types';
|
import type { Document as DocumentType } from 'types';
|
||||||
import PublishingInfo from '../PublishingInfo';
|
import PublishingInfo from '../PublishingInfo';
|
||||||
import styles from './Document.scss';
|
import styles from './Document.scss';
|
||||||
import DocumentHtml from './components/DocumentHtml';
|
import DocumentHtml from './components/DocumentHtml';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import type { Document } from '../../../types';
|
import type { Document } from 'types';
|
||||||
import DocumentPreview from 'components/DocumentPreview';
|
import DocumentPreview from 'components/DocumentPreview';
|
||||||
import Divider from 'components/Divider';
|
import Divider from 'components/Divider';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import type { User } from '../../../types';
|
import type { User } from 'types';
|
||||||
|
|
||||||
@inject('user')
|
@inject('user')
|
||||||
@observer
|
@observer
|
||||||
|
|
|
@ -1,25 +1,29 @@
|
||||||
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
|
import { Flex } from 'reflexbox';
|
||||||
|
|
||||||
import DashboardStore from './DashboardStore';
|
import DashboardStore from './DashboardStore';
|
||||||
|
|
||||||
import { Flex } from 'reflexbox';
|
|
||||||
import Layout from 'components/Layout';
|
import Layout from 'components/Layout';
|
||||||
import AtlasPreview from 'components/AtlasPreview';
|
import AtlasPreview from 'components/AtlasPreview';
|
||||||
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
user: Object,
|
||||||
|
router: Object,
|
||||||
|
};
|
||||||
|
|
||||||
@withRouter
|
@withRouter
|
||||||
@inject('user')
|
@inject('user')
|
||||||
@observer
|
@observer
|
||||||
class Dashboard extends React.Component {
|
class Dashboard extends React.Component {
|
||||||
static propTypes = {
|
props: Props;
|
||||||
user: React.PropTypes.object.isRequired,
|
store: DashboardStore;
|
||||||
router: React.PropTypes.object.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.store = new DashboardStore({
|
this.store = new DashboardStore({
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
|
// @flow
|
||||||
import { observable, action, runInAction } from 'mobx';
|
import { observable, action, runInAction } from 'mobx';
|
||||||
import { client } from 'utils/ApiClient';
|
import { client } from 'utils/ApiClient';
|
||||||
|
import type { Pagination, Collection } from 'types';
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
team: Object,
|
||||||
|
router: Object,
|
||||||
|
};
|
||||||
|
|
||||||
class DashboardStore {
|
class DashboardStore {
|
||||||
@observable collections;
|
team: Object;
|
||||||
@observable pagination;
|
router: Object;
|
||||||
|
@observable collections: Array<Collection>;
|
||||||
|
@observable pagination: Pagination;
|
||||||
|
|
||||||
@observable isFetching = true;
|
@observable isFetching: boolean = true;
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
|
|
||||||
|
@ -19,18 +28,13 @@ class DashboardStore {
|
||||||
this.collections = data;
|
this.collections = data;
|
||||||
this.pagination = pagination;
|
this.pagination = pagination;
|
||||||
});
|
});
|
||||||
|
|
||||||
// If only one collection, visit it automatically
|
|
||||||
if (this.collections.length === 1) {
|
|
||||||
this.router.push(this.collections[0].url);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Something went wrong');
|
console.error('Something went wrong');
|
||||||
}
|
}
|
||||||
this.isFetching = false;
|
this.isFetching = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(options) {
|
constructor(options: Options) {
|
||||||
this.team = options.team;
|
this.team = options.team;
|
||||||
this.router = options.router;
|
this.router = options.router;
|
||||||
this.fetchCollections();
|
this.fetchCollections();
|
||||||
|
|
|
@ -3,14 +3,14 @@ import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Flex } from 'reflexbox';
|
import { Flex } from 'reflexbox';
|
||||||
|
|
||||||
|
import ApiKeyRow from './components/ApiKeyRow';
|
||||||
|
import styles from './Settings.scss';
|
||||||
|
import SettingsStore from './SettingsStore';
|
||||||
|
|
||||||
import Layout, { Title } from 'components/Layout';
|
import Layout, { Title } from 'components/Layout';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
import SlackAuthLink from 'components/SlackAuthLink';
|
import SlackAuthLink from 'components/SlackAuthLink';
|
||||||
import ApiKeyRow from './components/ApiKeyRow';
|
|
||||||
|
|
||||||
import styles from './Settings.scss';
|
|
||||||
|
|
||||||
import SettingsStore from './SettingsStore';
|
|
||||||
|
|
||||||
@observer class Settings extends React.Component {
|
@observer class Settings extends React.Component {
|
||||||
store = SettingsStore;
|
store = SettingsStore;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// @flow
|
||||||
export type User = {
|
export type User = {
|
||||||
avatarUrl: string,
|
avatarUrl: string,
|
||||||
id: string,
|
id: string,
|
||||||
|
@ -7,10 +8,10 @@ export type User = {
|
||||||
|
|
||||||
export type Collection = {
|
export type Collection = {
|
||||||
createdAt: string,
|
createdAt: string,
|
||||||
description: string,
|
description: ?string,
|
||||||
id: string,
|
id: string,
|
||||||
name: string,
|
name: string,
|
||||||
type: string,
|
type: 'atlas' | 'journal',
|
||||||
updatedAt: string,
|
updatedAt: string,
|
||||||
url: string,
|
url: string,
|
||||||
};
|
};
|
||||||
|
@ -30,3 +31,9 @@ export type Document = {
|
||||||
updatedBy: string,
|
updatedBy: string,
|
||||||
url: string,
|
url: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type Pagination = {
|
||||||
|
limit: number,
|
||||||
|
nextPath: string,
|
||||||
|
offset: number,
|
||||||
|
};
|
|
@ -9,7 +9,9 @@
|
||||||
"build": "npm run clean && npm run build:webpack",
|
"build": "npm run clean && npm run build:webpack",
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"dev": "cross-env NODE_ENV=development DEBUG=sql,cache,presenters ./node_modules/.bin/nodemon --watch server index.js",
|
"dev": "cross-env NODE_ENV=development DEBUG=sql,cache,presenters ./node_modules/.bin/nodemon --watch server index.js",
|
||||||
"lint": "eslint frontend",
|
"lint": "npm run lint:js && npm run lint:flow",
|
||||||
|
"lint:js": "eslint frontend",
|
||||||
|
"lint:flow": "flow check",
|
||||||
"deploy": "git push heroku master",
|
"deploy": "git push heroku master",
|
||||||
"heroku-postbuild": "npm run build && npm run sequelize db:migrate",
|
"heroku-postbuild": "npm run build && npm run sequelize db:migrate",
|
||||||
"sequelize": "./node_modules/.bin/sequelize",
|
"sequelize": "./node_modules/.bin/sequelize",
|
||||||
|
@ -92,6 +94,7 @@
|
||||||
"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",
|
||||||
|
"flow": "^0.2.3",
|
||||||
"highlight.js": "9.4.0",
|
"highlight.js": "9.4.0",
|
||||||
"history": "3.0.0",
|
"history": "3.0.0",
|
||||||
"html-webpack-plugin": "2.17.0",
|
"html-webpack-plugin": "2.17.0",
|
||||||
|
@ -174,4 +177,4 @@
|
||||||
"react-addons-test-utils": "^15.3.1",
|
"react-addons-test-utils": "^15.3.1",
|
||||||
"react-test-renderer": "^15.3.1"
|
"react-test-renderer": "^15.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3036,6 +3036,10 @@ flow-parser@0.43.0:
|
||||||
version "0.43.0"
|
version "0.43.0"
|
||||||
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.43.0.tgz#e2b8eb1ac83dd53f7b6b04a7c35b6a52c33479b7"
|
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.43.0.tgz#e2b8eb1ac83dd53f7b6b04a7c35b6a52c33479b7"
|
||||||
|
|
||||||
|
flow@^0.2.3:
|
||||||
|
version "0.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/flow/-/flow-0.2.3.tgz#f8da65efa249127ec99376a28896572a9795d1af"
|
||||||
|
|
||||||
for-in@^0.1.5:
|
for-in@^0.1.5:
|
||||||
version "0.1.6"
|
version "0.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"
|
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"
|
||||||
|
|
Reference in New Issue