@@ -2,22 +2,27 @@ import alertsData from '../lib/alerts/index.jsx';
22import { AlertTypes , AlertLevels } from '../lib/alerts/index.jsx' ;
33import extensionData from '../lib/libraries/extensions/index.jsx' ;
44
5- const SHOW_STANDARD_ALERT = 'scratch-gui/alerts/SHOW_STANDARD_ALERT ' ;
5+ const SHOW_ALERT = 'scratch-gui/alerts/SHOW_ALERT ' ;
66const SHOW_EXTENSION_ALERT = 'scratch-gui/alerts/SHOW_EXTENSION_ALERT' ;
77const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT' ;
88const CLOSE_ALERTS_WITH_ID = 'scratch-gui/alerts/CLOSE_ALERTS_WITH_ID' ;
99
10+ /**
11+ * Initial state of alerts reducer
12+ *
13+ * {bool} visible - whether the alerts are visible
14+ * {array} alertsList - list of alerts, each with properties:
15+ * * alert type (required): one of AlertTypes
16+ * * closeButton (optional): bool indicating that we should show close button
17+ * * content (optional): react element (a <FormattedMessage />)
18+ * * extentionId (optional): id string that identifies the extension
19+ * * iconURL (optional): string
20+ * * level (required): string, one of AlertLevels
21+ * * message (optional): string
22+ * * showReconnect (optional): bool
23+ */
1024const initialState = {
1125 visible : true ,
12- // list of alerts, each with properties:
13- // * alert type (required): one of AlertTypes
14- // * closeButton (optional): bool indicating that we should show close button
15- // * content (optional): react element (a <FormattedMessage />)
16- // * extentionId (optional): id string that identifies the extension
17- // * iconURL (optional): string
18- // * level (required): string, one of AlertLevels
19- // * message (optional): string
20- // * showReconnect (optional): bool
2126 alertsList : [ ]
2227} ;
2328
@@ -37,7 +42,7 @@ const filterInlineAlerts = alertsList => (
3742const reducer = function ( state , action ) {
3843 if ( typeof state === 'undefined' ) state = initialState ;
3944 switch ( action . type ) {
40- case SHOW_STANDARD_ALERT : { // also will show inline alerts
45+ case SHOW_ALERT : { // shows standard and inline alerts
4146 const alertId = action . alertId ;
4247 if ( alertId ) {
4348 const newAlert = {
@@ -147,7 +152,7 @@ const closeAlertsWithId = function (alertId) {
147152 */
148153const showStandardAlert = function ( alertId ) {
149154 return {
150- type : SHOW_STANDARD_ALERT ,
155+ type : SHOW_ALERT ,
151156 alertId
152157 } ;
153158} ;
0 commit comments