Skip to content

Commit

Permalink
Notices: Move store to proper place in tree,
Browse files Browse the repository at this point in the history
Global notices to proper component

Notices: Move action types to common file

Notices: Move global notices to /ui store tree

Notices: Move global notices according to design in #1415

Notices: fix file address
  • Loading branch information
artpi committed Dec 16, 2015
1 parent 832e370 commit 7900015
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Notice from 'components/notice';
import NoticeAction from 'components/notice/notice-action';
import notices from 'notices';
import observe from 'lib/mixins/data-observe';
import DeleteSiteNotices from './delete-site-notices';
import DeleteSiteNotices from 'notices/delete-site-notices';

const debug = debugModule( 'calypso:notices' );

Expand Down
6 changes: 2 additions & 4 deletions client/components/overlay/overlay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ var React = require( 'react/addons' ),
* Internal dependencies
*/
var Toolbar = require( './toolbar' ),
GlobalNotices = require( 'notices/global-notices' ),
NoticesList = require( 'notices/notices-list' ),
GlobalNotices = require( 'components/global-notices' ),
notices = require( 'notices' ),
page = require( 'page' ),
TitleData = require( 'components/data/screen-title' );
Expand Down Expand Up @@ -101,8 +100,7 @@ module.exports = React.createClass({
</TitleData>

<div className="wp-content" ref="overlayInnerContent">
<NoticesList id="overlay-notices" notices={ notices.list }/>
<GlobalNotices id="overlay-notices" />
<GlobalNotices id="overlay-notices" notices={ notices.list }/>
{ this.props.children }
</div>
</section>
Expand Down
6 changes: 2 additions & 4 deletions client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ var React = require( 'react' ),
*/
var Masterbar = require( './masterbar' ),
observe = require( 'lib/mixins/data-observe' ),
GlobalNotices = require( 'notices/global-notices' ),
NoticesList = require( 'notices/notices-list' ),
GlobalNotices = require( 'components/global-notices' ),
notices = require( 'notices' ),
translator = require( 'lib/translator-jumpstart' ),
TranslatorInvitation = require( './community-translator/invitation' ),
Expand Down Expand Up @@ -111,8 +110,7 @@ module.exports = React.createClass( {
</Welcome>
<InviteMessage sites={ this.props.sites }/>
<EmailVerificationNotice user={ this.props.user } />
<NoticesList id="notices" notices={ notices.list } forcePinned={ 'post' === this.state.section } />
<GlobalNotices id="notices" />
<GlobalNotices id="notices" notices={ notices.list } forcePinned={ 'post' === this.state.section } />
<TranslatorInvitation isVisible={ showInvitation } />
<div id="primary" className="wp-primary wp-section" />
<div id="secondary" className="wp-secondary" />
Expand Down
6 changes: 2 additions & 4 deletions client/layout/logged-out.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ var React = require( 'react' ),
* Internal dependencies
*/
var Masterbar = require( './masterbar' ),
NoticesList = require( 'notices/notices-list' ),
GlobalNotices = require( 'notices/global-notices' ),
GlobalNotices = require( 'components/global-notices' ),
notices = require( 'notices' );

module.exports = React.createClass( {
Expand All @@ -32,8 +31,7 @@ module.exports = React.createClass( {
<div className={ classes }>
<Masterbar />
<div id="content" className="wp-content">
<NoticesList id="notices" notices={ notices.list } />
<GlobalNotices id="notices" />
<GlobalNotices id="notices" notices={ notices.list } />
<div id="primary" className="wp-primary wp-section" />
<div id="secondary" className="wp-secondary" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/me/notification-settings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
* Internal dependencies
*/
import observe from 'lib/mixins/data-observe';
import { noticesMapDispatchToProps } from 'state/notices/actions'
import { noticesMapDispatchToProps } from 'state/ui/notices/actions'
import Main from 'components/main';
import ReauthRequired from 'me/reauth-required';
import twoStepAuthorization from 'lib/two-step-authorization';
Expand Down
4 changes: 2 additions & 2 deletions client/notices/global-notices.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';
import classNames from 'classnames';
import debugModule from 'debug';
import { connect } from 'react-redux';
import { noticesMapDispatchToProps } from 'state/notices/actions'
import { noticesMapDispatchToProps } from 'state/ui/notices/actions'

/**
* Internal Dependencies
Expand Down Expand Up @@ -80,7 +80,7 @@ const GlobalNotices = React.createClass( {
export default connect(
( state ) => {
return {
notices: state.notices.items
notices: state.ui.notices.items
};
},
noticesMapDispatchToProps
Expand Down
2 changes: 2 additions & 0 deletions client/state/action-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

export const FAIL_PUBLICIZE_CONNECTIONS_REQUEST = 'FAIL_PUBLICIZE_CONNECTIONS_REQUEST';
export const FETCH_PUBLICIZE_CONNECTIONS = 'FETCH_PUBLICIZE_CONNECTIONS';
export const NEW_NOTICE = 'NEW_NOTICE';
export const RECEIVE_PUBLICIZE_CONNECTIONS = 'RECEIVE_PUBLICIZE_CONNECTIONS';
export const RECEIVE_SITE = 'RECEIVE_SITE';
export const REMOVE_NOTICE = 'REMOVE_NOTICE';
export const SET_SELECTED_SITE = 'SET_SELECTED_SITE';
4 changes: 1 addition & 3 deletions client/state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ import { createStore, applyMiddleware, combineReducers } from 'redux';
import sharing from './sharing/reducer';
import sites from './sites/reducer';
import ui from './ui/reducer';
import notices from './notices/reducers';

/**
* Module variables
*/
const reducer = combineReducers( {
sharing,
sites,
ui,
notices
ui
} );

export function createReduxStore() {
Expand Down
2 changes: 0 additions & 2 deletions client/state/notices/action-types.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import {
NEW_NOTICE,
REMOVE_NOTICE
} from './action-types';
} from 'state/action-types';

import { uniqueId } from 'lodash';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { filter } from 'lodash';
import {
NEW_NOTICE,
REMOVE_NOTICE
} from './action-types';
} from 'state/action-types';

/**
* Tracks all known site objects, indexed by site ID.
Expand Down
4 changes: 3 additions & 1 deletion client/state/ui/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { combineReducers } from 'redux';
* Internal dependencies
*/
import { SET_SELECTED_SITE } from 'state/action-types';
import notices from './notices/reducer';

/**
* Tracks the currently selected site ID.
Expand All @@ -26,5 +27,6 @@ export function selectedSite( state = null, action ) {
}

export default combineReducers( {
selectedSite
selectedSite,
notices
} );

0 comments on commit 7900015

Please sign in to comment.