Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/relax/relax
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno12mota committed Feb 8, 2017
2 parents b93a60d + f5062c5 commit 73b4ad0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 12 deletions.
12 changes: 10 additions & 2 deletions lib/shared/helpers/configure-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ import combineActionsMiddleware from 'redux-combine-actions';
import thunkMiddleware from 'redux-thunk';
import {applyMiddleware, compose, createStore} from 'redux';

const IS_DEV_MODE = process.env.NODE_ENV === 'development';
const WINDOW_EXISTS = typeof window !== 'undefined';

const middleware = [];

const composeEnhancers =
IS_DEV_MODE && WINDOW_EXISTS && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
: compose;

middleware.push(combineActionsMiddleware);
middleware.push(thunkMiddleware);

if (process.env.NODE_ENV === 'development' && typeof window !== 'undefined') {
if (IS_DEV_MODE && WINDOW_EXISTS) {
const createLogger = require('redux-logger');
const logger = createLogger();
middleware.push(logger);
}

export default function configureStore (routerMiddleware, reducers, initialState) {
const store = compose(
const store = composeEnhancers(
applyMiddleware(
...middleware
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import DataSchemaForm from './form';
}),
(dispatch) => bindActionCreators(schemaEntryActions, dispatch),
(props) => {
let result;
let result = {};

if (props.entryId) {
result = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class Autocomplete extends Component {
autoFocus: React.PropTypes.bool,
value: React.PropTypes.string.isRequired,
onChange: React.PropTypes.func.isRequired,
suggestion: React.PropTypes.string
suggestion: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.bool]).isRequired
};

static defaultProps = {
Expand Down Expand Up @@ -60,6 +60,7 @@ export default class Autocomplete extends Component {
<div className={styles.autocomplete}>
<span onClick={this.focus}>{before}</span>
<span
suppressContentEditableWarning
ref='editable'
className={styles.editable}
onInput={this.onInput}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class ElementsMenu extends Component {
};

static propTypes = {
symbols: PropTypes.array.isRequired,
symbols: PropTypes.array,
pageBuilderActions: PropTypes.object.isRequired,
elementsMenuOptions: PropTypes.object.isRequired,
categories: PropTypes.array.isRequired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import ElementsMenu from './elements-menu';

@dataConnect(
(state) => ({
symbols: state.symbols,
elementsMenuOptions: state.pageBuilder.elementsMenuOptions,
categories: state.pageBuilder.categories,
categoriesCollapsed: state.pageBuilder.categoriesCollapsed
Expand All @@ -23,7 +22,7 @@ import ElementsMenu from './elements-menu';
)
export default class ElementsMenuContainer extends Component {
static propTypes = {
symbols: PropTypes.object.isRequired,
symbols: PropTypes.array,
pageBuilderActions: PropTypes.object.isRequired
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ export default class List extends Component {
addElement: PropTypes.func.isRequired,
addSymbol: PropTypes.func.isRequired,
toggleCategory: PropTypes.func.isRequired,
symbols: PropTypes.object.isRequired,
categories: PropTypes.object.isRequired,
symbols: PropTypes.array,
categories: PropTypes.array.isRequired,
categoriesCollapsed: PropTypes.object.isRequired
};

static defaultProps = {
symbols: []
};

toggleCategory (category, event) {
event.preventDefault();
this.props.toggleCategory(category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ export default class Search extends Component {
addSymbol: PropTypes.func.isRequired,
onSearchChange: PropTypes.func.isRequired,
suggestions: PropTypes.array.isRequired,
suggestion: PropTypes.string.isRequired,
suggestion: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,
search: PropTypes.string.isRequired,
symbols: PropTypes.object.isRequired,
categories: PropTypes.object.isRequired
symbols: PropTypes.array.isRequired,
categories: PropTypes.array.isRequired
};

static defaultProps = {
suggestion: false
};

componentDidMount () {
Expand Down
12 changes: 12 additions & 0 deletions lib/shared/screens/public/screens/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ export default class PageContainer extends Component {
pageSlug: PropTypes.string
};

componentWillReceiveProps (nextProps) {
if (nextProps.pageSlug !== this.props.pageSlug) {
this.props.relate.setVariables({
page: {
slug: nextProps.pageSlug,
state: 'published',
public: true
}
});
}
}

render () {
const {page} = this.props;

Expand Down

0 comments on commit 73b4ad0

Please sign in to comment.