Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notices: separate views from logic, component refactor #888

Merged
merged 16 commits into from
Dec 1, 2015

Conversation

mtias
Copy link
Member

@mtias mtias commented Nov 27, 2015

Work in progress...

<Notice> will be the base notice component in Calypso.


  • Move simple-notice.jsx to components/notice.
  • Consolidate scss code for the base component in component/notice.
  • Cleanup component (ES6, etc).
  • Update references to simple-notice in the codebase.
  • Update sections using notices/notice to use components/notice if possible.
  • Finally deprecate notices/notice and update notices-list to depend on the new component instead.

@mtias mtias added Framework [Status] In Progress Components [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 27, 2015
@artpi
Copy link
Contributor

artpi commented Nov 27, 2015

@johnHackworth , I heard that you did plugins.
We are trying to deprecate raw, button and href in notices and these are using those:
Basically, we want to use a component that was previously SimpleNotice and now will be Notice:
Can we do that here?
Can you help / advise?

/calypso/client/my-sites/plugins/plugin-item/plugin-item.jsx:

        if ( this.props.isSelectable ) {
            errors.forEach( function( error ) {
                errorNotices.push(
                    <Notice
                        type='message'
                        status='is-error'
                        text={ PluginNotices.getMessage( [ error ], PluginNotices.errorMessage.bind( PluginNotices ) ) }
                        isCompact={ true }
                        button={ PluginNotices.getErrorButton( error ) }
                        href={ PluginNotices.getErrorHref( error ) }
                        raw={ { onRemoveCallback: PluginsActions.removePluginsNotices.bind( this, [ error ] ) } }
                        inline={ true }
                        key={ 'notice-' + errorCounter } />
                );
                errorCounter++;
            }, this );
            return (
                <div>

/calypso/client/my-sites/plugins/plugin-meta/index.jsx:

    getUpdateWarning() {
        const newVersion = this.getAvailableNewVersion();
        if ( newVersion ) {
            return <Notice
                className="plugin-meta__version-notice"
                text={ i18n.translate( 'A new version is available.' ) }
                status="is-warning"
                button={ i18n.translate( 'Update to %(newPluginVersion)s', { args: { newPluginVersion: newVersion } } ) }
                onClick={ this.handlePluginUpdates }
                showDismiss={ false } />;
        }
    },

@johnHackworth
Copy link
Contributor

What's the plan for notices that require an embed action then? are we going to have a different component for those cases? (sorry if I'm a little lost here, I didn't realize that this was already on development).

ping @enejb and @lezama, you also want to be aware about this :) (hmmm, and probably @ebinnion & @roccotripaldi ? I know you are using notices in people but I'm not sure if you are using embed actions there)

@artpi
Copy link
Contributor

artpi commented Nov 27, 2015

Not yet ported to components/notice

  • /calypso/client/my-sites/draft/index.jsx:
    • using raw prop
  • /calypso/client/my-sites/plugins/plugin-item/plugin-item.jsx
    • raw, href, button
  • /calypso/client/my-sites/plugins/plugin-meta/index.jsx:
    • button
  • /calypso/client/reader/post-errors/index.jsx:
    • raw

@scruffian
Copy link
Member

I found an issue in /start:
screenshot 2015-11-27 19 02 40

The hebrew text should be right aligned.

@scruffian
Copy link
Member

I found an issue with the email verification notice:
screenshot 2015-11-27 19 04 28

At the moment this is a shade of grey. The blue is too strong IMO.

@scruffian
Copy link
Member

Another issue, possibly connected:
screenshot 2015-11-27 19 05 37

This only happens directly after signing up. Once you reload its fine.

@mtias
Copy link
Member Author

mtias commented Nov 30, 2015

@scruffian how did you hit that one? It seems there's state pollution from noSidebar, not related to this one.

@artpi
Copy link
Contributor

artpi commented Nov 30, 2015

I clicked through what I could,seems to work
If someone can have a look -- it would be good to have fresh eyes on it

@mtias mtias force-pushed the update/notices-refactor branch from edf12c4 to eb3ee3a Compare December 1, 2015 10:10
artpi and others added 4 commits December 1, 2015 11:19
Notices: notices/notice, simplenotice -> components/notice in
email-verification-notice.jsx

Notices: notices/notice -> components/notice in map-domain-step

Notices: notices/notice -> components/notice in register-domain-step

Notices: notices/notice -> components/notice in signup-form

Revert "Notices: notices/notice -> components/notice in signup-form"

This reverts commit 8533f20.

Notices: notices/notice -> components/notice in signup-form

Notices: notices/notice -> components/notice in client/me

Notices: notices/notice -> components/notice in client/my-sites

Notices: notices/notice -> components/notice reader and signup
@mtias mtias force-pushed the update/notices-refactor branch from eb3ee3a to 14924a9 Compare December 1, 2015 10:20
@artpi
Copy link
Contributor

artpi commented Dec 1, 2015

🚢

@johnHackworth
Copy link
Contributor

On /plugins (where we do a heavy use of notices) everything looks peachy... looks good to me!

artpi added a commit that referenced this pull request Dec 1, 2015
Notices: separate views from logic, component refactor
@artpi artpi merged commit a9df560 into master Dec 1, 2015
@scruffian scruffian removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Ready to Merge labels Dec 1, 2015
@mtias mtias deleted the update/notices-refactor branch December 1, 2015 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants