diff --git a/client/coral-framework/actions/index.js b/client/coral-framework/actions/index.js
new file mode 100644
index 000000000..be107a613
--- /dev/null
+++ b/client/coral-framework/actions/index.js
@@ -0,0 +1,11 @@
+import * as authActions from './auth';
+import * as assetActions from './asset';
+import * as notificationActions from './notification';
+import {actionsImporter} from '../helpers/importer';
+
+export default {
+ authActions,
+ assetActions,
+ notificationActions,
+ pluginActions: actionsImporter
+};
diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js
index 313a7d114..4e9dca9ac 100644
--- a/client/coral-framework/components/Slot.js
+++ b/client/coral-framework/components/Slot.js
@@ -1,5 +1,5 @@
import React, {Component} from 'react';
-import injectedPlugins from 'coral-framework/helpers/importer';
+import { importer as injectPlugins } from 'coral-framework/helpers/importer';
class Slot extends Component {
componentDidMount() {
@@ -9,7 +9,7 @@ class Slot extends Component {
const {fill} = this.props;
return (
- {injectedPlugins(fill)}
+ {injectPlugins(fill)}
);
}
diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js
index c653cde54..e42441ff7 100644
--- a/client/coral-framework/helpers/importer.js
+++ b/client/coral-framework/helpers/importer.js
@@ -19,20 +19,6 @@ function importer (fill) {
.map(key => shapeData(key));
}
- function shapeData(test) {
-
- /**
- * shapeData shapes each item in the plugins array with useful data
- * returns an Object with the name of the plugin, the format, and it's key(filename)
- */
- const match = test.match(/\.\/(.*)\/client\/.*.(json|js)$/);
- return {
- name: match[1],
- format: match[2],
- key: match[0]
- };
- }
-
function getConfig (name) {
/**
@@ -85,5 +71,47 @@ function importer (fill) {
return init();
}
-export default importer;
+function shapeData(test) {
+
+ /**
+ * shapeData shapes each item in the plugins array with useful data
+ * returns an Object with the name of the plugin, the format, and it's key(filename)
+ */
+ const match = test.match(/\.\/(.*)\/client\/.*.(json|js)$/);
+ return {
+ name: match[1],
+ format: match[2],
+ key: match[0]
+ };
+}
+
+function actionsImporter () {
+ const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/);
+
+ return context
+ .keys()
+ .map(key => shapeData(key))
+ .reduce((entry, actionsPlugin, i) => {
+ entry[actionsPlugin.name] = context(actionsPlugin.key);
+ return entry;
+ }, {});
+}
+
+function reducersImporter () {
+ const context = require.context('plugins', true, /\.\/(.*)\/client\/reducer.js$/);
+
+ return context
+ .keys()
+ .map(key => shapeData(key))
+ .reduce((entry, reducerPlugin, i) => {
+ entry[reducerPlugin.name] = context(reducerPlugin.key);
+ return entry;
+ }, {});
+}
+
+export default {
+ importer,
+ actionsImporter: actionsImporter(),
+ reducersImporter: reducersImporter()
+};
diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js
index 88044b2a8..4de928168 100644
--- a/client/coral-framework/index.js
+++ b/client/coral-framework/index.js
@@ -1,23 +1,14 @@
import store from './services/store';
import pym from './services/PymConnection';
import I18n from './modules/i18n/i18n';
-import * as authActions from './actions/auth';
-import * as assetActions from './actions/asset';
-import * as notificationActions from './actions/notification';
+import actions from './actions';
import Slot from './components/Slot';
-const context = require.context('plugins', true, /\.\/(.*)\/client\/actions.js$/);
-const pluginsActions = context
- .keys()
- .reduce(entry, key => entry[key] = context(key), {});
-
-export {
+console.log(actions)
+export default {
pym,
Slot,
I18n,
store,
- authActions,
- assetActions,
- notificationActions,
- pluginsActions
+ ...actions
};
diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js
index 9e98c901a..c97c13f45 100644
--- a/client/coral-framework/reducers/index.js
+++ b/client/coral-framework/reducers/index.js
@@ -1,9 +1,11 @@
import auth from './auth';
import user from './user';
import asset from './asset';
+import {reducersImporter} from '../helpers/importer';
export default {
auth,
user,
asset,
+ ...reducersImporter
};
diff --git a/plugins/coral-plugin-love/client/config.json b/plugins/coral-plugin-love/client/config.json
deleted file mode 100644
index cf846a647..000000000
--- a/plugins/coral-plugin-love/client/config.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "Coral Plugin Love",
- "slot": "Comment.InfoBar"
-}
\ No newline at end of file
diff --git a/plugins/coral-plugin-love/client/index.js b/plugins/coral-plugin-love/client/index.js
deleted file mode 100644
index 6af9c8d8c..000000000
--- a/plugins/coral-plugin-love/client/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from 'react';
-import styles from './style.css';
-
-export default (props) => (
-
-
-
-);
diff --git a/plugins/coral-plugin-love/client/style.css b/plugins/coral-plugin-love/client/style.css
deleted file mode 100644
index a83bb003b..000000000
--- a/plugins/coral-plugin-love/client/style.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.Love {
- display: inline-block;
- button {
- padding: 10px 2px;
- border-radius: 3px;
- background: deepskyblue;
- color: #161616;
- }
-}
\ No newline at end of file
diff --git a/plugins/coral-plugin-love/index.js b/plugins/coral-plugin-love/index.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/plugins/coral-plugin-monitor/client/config.json b/plugins/coral-plugin-monitor/client/config.json
deleted file mode 100644
index 9f39c4e6c..000000000
--- a/plugins/coral-plugin-monitor/client/config.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "Coral Plugin Tab Monitor",
- "slot": "Stream"
-}
\ No newline at end of file
diff --git a/plugins/coral-plugin-monitor/client/index.js b/plugins/coral-plugin-monitor/client/index.js
deleted file mode 100644
index a2585c42f..000000000
--- a/plugins/coral-plugin-monitor/client/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import {TabBar, Tab} from 'coral-ui';
-
-console.log('exported');
-
-export default (props) => (
-
-
- Monitor
-
-
-);
diff --git a/plugins/coral-plugin-monitor/index.js b/plugins/coral-plugin-monitor/index.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js
new file mode 100644
index 000000000..5259ef664
--- /dev/null
+++ b/plugins/coral-plugin-respect/client/actions.js
@@ -0,0 +1 @@
+export const clickButton = () => ({type: 'BUTTON_CLICKED'});
\ No newline at end of file
diff --git a/plugins/coral-plugin-respect/client/reducer.js b/plugins/coral-plugin-respect/client/reducer.js
new file mode 100644
index 000000000..3809aaf46
--- /dev/null
+++ b/plugins/coral-plugin-respect/client/reducer.js
@@ -0,0 +1,12 @@
+import {Map} from 'immutable';
+
+const initialState = Map({
+ clicked: false
+});
+
+export default function reducer (state = initialState, action) {
+ switch (action.type) {
+ default:
+ return state;
+ }
+}
diff --git a/plugins/coral-plugin-sideview/client/actions.js b/plugins/coral-plugin-sideview/client/actions.js
deleted file mode 100644
index 0f38834c9..000000000
--- a/plugins/coral-plugin-sideview/client/actions.js
+++ /dev/null
@@ -1 +0,0 @@
-export const SomeAction = () => ({type: 'SomeAction'});
\ No newline at end of file
diff --git a/plugins/coral-plugin-sideview/client/config.json b/plugins/coral-plugin-sideview/client/config.json
deleted file mode 100644
index 18ac9fa2d..000000000
--- a/plugins/coral-plugin-sideview/client/config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "name": "Coral Plugin"
-}
\ No newline at end of file
diff --git a/plugins/coral-plugin-sideview/client/index.js b/plugins/coral-plugin-sideview/client/index.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/plugins/coral-plugin-sideview/client/reducer.js b/plugins/coral-plugin-sideview/client/reducer.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/plugins/coral-plugin-sideview/index.js b/plugins/coral-plugin-sideview/index.js
deleted file mode 100644
index e69de29bb..000000000