Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kadira/storybook-addon-comments

Package Overview
Dependencies
Maintainers
6
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kadira/storybook-addon-comments - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

6

.storybook/stories.js

@@ -64,2 +64,8 @@ import React from 'react';

))
.add('CommentPanel - app not available', () => (
<CommentsPanel
user={true}
appNotAvailable={{}}
/>
))
.add('CommentPanel - loggedIn with no comments', () => (

@@ -66,0 +72,0 @@ <CommentsPanel

## Changelog
### v1.6.0
12-October-2016
* Implement a better workflow for local users [PR31](https://github.com/kadirahq/storybook-addon-comments/pull/31)
* Set the protected field to true. [PR30](https://github.com/kadirahq/storybook-addon-comments/pull/30)
### v1.5.1

@@ -4,0 +10,0 @@ 12-October-2016

21

dist/manager/components/CommentsPanel/index.js

@@ -47,2 +47,14 @@ 'use strict';

value: function render() {
if (this.props.loading) {
return _react2.default.createElement(
'div',
{ style: _style2.default.wrapper },
_react2.default.createElement(
'div',
{ style: _style2.default.message },
'loading...'
)
);
}
if (!this.props.user) {

@@ -65,3 +77,4 @@ var signInUrl = 'https://hub.getstorybook.io/sign-in?redirectUrl=' + encodeURIComponent(location.href);

if (this.props.loading) {
if (this.props.appNotAvailable) {
var appsUrl = 'https://hub.getstorybook.io/apps';
return _react2.default.createElement(

@@ -73,3 +86,7 @@ 'div',

{ style: _style2.default.message },
'loading...'
_react2.default.createElement(
'a',
{ style: _style2.default.button, href: appsUrl },
'Create an app for this repo on Storybook Hub'
)
)

@@ -76,0 +93,0 @@ );

4

dist/manager/containers/CommentsPanel/dataStore.js

@@ -219,3 +219,5 @@ 'use strict';

value: function _addCommentToDatabase(comment) {
var doc = _extends({}, comment, this.currentStory);
var doc = _extends({}, comment, this.currentStory, {
sbProtected: true
});

@@ -222,0 +224,0 @@ return this.db.getCollection('comments').set(doc);

@@ -77,3 +77,3 @@ 'use strict';

this.getCurrentUser();
this.init();
}

@@ -87,4 +87,13 @@ }, {

}, {
key: 'getCurrentUser',
value: function getCurrentUser() {
key: '_getAppInfo',
value: function _getAppInfo(persister) {
return persister._getAppInfo().then(function (appInfo) {
return Promise.resolve(appInfo);
}, function (err) {
return Promise.resolve(null);
});
}
}, {
key: 'init',
value: function init() {
var _this3 = this;

@@ -101,3 +110,10 @@

_this3.store.setCurrentUser(user);
_this3.setState({ user: user, loading: false });
_this3.setState({ user: user });
return _this3._getAppInfo(db.persister);
}).then(function (appInfo) {
var updatedState = { loading: false };
if (!appInfo) {
updatedState.appNotAvailable = true;
}
_this3.setState(updatedState);
});

@@ -134,2 +150,3 @@ }

loading: this.state.loading,
appNotAvailable: this.state.appNotAvailable,
deleteComment: function deleteComment(commentId) {

@@ -136,0 +153,0 @@ return _this4.deleteComment(commentId);

{
"name": "@kadira/storybook-addon-comments",
"version": "1.5.1",
"version": "1.6.0",
"description": "Comments addon for Storybook",

@@ -10,2 +10,3 @@ "main": "preview.js",

"storybook": "STORYBOOK_CLOUD_SERVER='http://localhost:3003/graphql' STORYBOOK_CLOUD_APPID='test-app' STORYBOOK_CLOUD_DATABASE='test-db' start-storybook -p 3006",
"storybook-local": "STORYBOOK_CLOUD_SERVER='http://localhost:3003/graphql' start-storybook -p 3006",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -12,0 +13,0 @@ },

@@ -8,2 +8,10 @@ import React, { Component } from 'react';

render() {
if (this.props.loading) {
return (
<div style={style.wrapper}>
<div style={style.message}>loading...</div>
</div>
);
}
if (!this.props.user) {

@@ -20,6 +28,9 @@ const signInUrl = `https://hub.getstorybook.io/sign-in?redirectUrl=${encodeURIComponent(location.href)}`;

if (this.props.loading) {
if (this.props.appNotAvailable) {
const appsUrl = 'https://hub.getstorybook.io/apps';
return (
<div style={style.wrapper}>
<div style={style.message}>loading...</div>
<div style={style.message}>
<a style={style.button} href={appsUrl}>Create an app for this repo on Storybook Hub</a>
</div>
</div>

@@ -26,0 +37,0 @@ );

@@ -169,2 +169,3 @@ import deepEquals from 'deep-equal';

...this.currentStory,
sbProtected: true,
};

@@ -171,0 +172,0 @@

@@ -31,3 +31,3 @@ import React, { Component } from 'react';

this.getCurrentUser();
this.init();
}

@@ -40,3 +40,12 @@

getCurrentUser() {
_getAppInfo(persister) {
return persister
._getAppInfo()
.then(
(appInfo) => Promise.resolve(appInfo),
(err) => Promise.resolve(null),
);
}
init() {
const db = addons.getDatabase();

@@ -52,4 +61,12 @@

this.store.setCurrentUser(user);
this.setState({ user, loading: false });
});
this.setState({ user });
return this._getAppInfo(db.persister);
})
.then(appInfo => {
const updatedState = { loading: false }
if (!appInfo) {
updatedState.appNotAvailable = true;
}
this.setState(updatedState);
})
}

@@ -79,2 +96,3 @@

loading: this.state.loading,
appNotAvailable: this.state.appNotAvailable,
deleteComment: commentId => this.deleteComment(commentId),

@@ -81,0 +99,0 @@ addComment: text => this.addComment(text),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc