Browse Source

renamed plugin into app

Skylsmoi 6 years ago
parent
commit
b18e60eef9

dist/plugin/pageHtml.plugin.js → dist/app/pageHtml.app.js View File

@@ -1,4 +1,4 @@
1
-var pluginPageHtml=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t,n){"use strict";e.exports=n(6)},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/*
1
+var appPageHtml=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t,n){"use strict";e.exports=n(6)},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/*
2 2
 object-assign
3 3
 (c) Sindre Sorhus
4 4
 @license MIT

+ 6 - 6
dist/index.html View File

@@ -25,27 +25,27 @@
25 25
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
26 26
     -->
27 27
 
28
-    <script src='./plugin/pageHtml.plugin.js'></script>
28
+    <script src='./app/pageHtml.app.js'></script>
29 29
 
30 30
     <script src="./dev/jquery-3.2.1.js"></script>
31 31
     <script src="./dev/popper-1.12.3.js"></script>
32 32
     <script src="./dev/bootstrap-4.0.0-beta.2.js"></script>
33 33
 
34 34
     <script type='text/javascript'>
35
-      GLOBAL_renderPlugin = data => {
35
+      GLOBAL_renderApp = data => {
36 36
         if (data.file.type === 'PageHtml') {
37
-          pluginPageHtml.renderPlugin('pluginContainer', data)
37
+          appPageHtml.renderApp('appContainer', data)
38 38
         }
39 39
       }
40 40
 
41 41
       GLOBAL_dispatchEvent = (data) => {
42
-        var event = new CustomEvent('pluginCustomEvent', {detail: data})
42
+        var event = new CustomEvent('appCustomEvent', {detail: data})
43 43
         document.dispatchEvent(event)
44 44
       }
45 45
 
46
-      GLOBAL_unmountPlugin = () => {
46
+      GLOBAL_unmountApp = () => {
47 47
         console.log('btn close clicked')
48
-        pluginPageHtml.hidePlugin('pluginContainer')
48
+        appPageHtml.hideApp('appContainer')
49 49
       }
50 50
 
51 51
       // only usefull if plugin doesn't handle fileContent himself

+ 1 - 1
jsonserver/server.js View File

@@ -25,7 +25,7 @@ server.post('/user/login', (req, res) => {
25 25
   else return res.jsonp('error')
26 26
 })
27 27
 
28
-server.get('/plugin/file_content', (req, res) => res.jsonp(jsonDb.file_content))
28
+server.get('/app/file_content', (req, res) => res.jsonp(jsonDb.file_content))
29 29
 
30 30
 server.get('/user/is_logged_in', (req, res) => res.jsonp(jsonDb.user_logged))
31 31
 

+ 7 - 7
src/action-creator.async.js View File

@@ -7,8 +7,8 @@ import {
7 7
   updateUserData,
8 8
   WORKSPACE,
9 9
   updateWorkspaceData,
10
-  PLUGIN_LIST,
11
-  setPluginList
10
+  APP_LIST,
11
+  setAppList
12 12
 } from './action-creator.sync.js'
13 13
 
14 14
 /*
@@ -117,12 +117,12 @@ export const getWorkspaceContent = workspaceId => async dispatch => {
117 117
   if (fetchGetWorkspaceContent.status === 200) dispatch(updateWorkspaceData(fetchGetWorkspaceContent.json))
118 118
 }
119 119
 
120
-export const getPluginList = () => async dispatch => {
121
-  const fetchGetPluginList = await fetchWrapper({
122
-    url: `http://localhost:3001/plugin/file_content`,
120
+export const getAppList = () => async dispatch => {
121
+  const fetchGetAppList = await fetchWrapper({
122
+    url: `http://localhost:3001/app/file_content`,
123 123
     param: {...FETCH_CONFIG, method: 'GET'},
124
-    actionName: PLUGIN_LIST,
124
+    actionName: APP_LIST,
125 125
     dispatch
126 126
   })
127
-  if (fetchGetPluginList.status === 200) dispatch(setPluginList(fetchGetPluginList.json))
127
+  if (fetchGetAppList.status === 200) dispatch(setAppList(fetchGetAppList.json))
128 128
 }

+ 2 - 2
src/action-creator.sync.js View File

@@ -12,5 +12,5 @@ export const FILE_CONTENT = 'FileContent'
12 12
 export const setActiveFileContent = file => ({ type: `Set/${FILE_CONTENT}/Active`, file })
13 13
 export const hideActiveFileContent = () => ({ type: `Set/${FILE_CONTENT}/Hide` })
14 14
 
15
-export const PLUGIN_LIST = 'Plugin/List'
16
-export const setPluginList = pluginList => ({ type: `Set/${PLUGIN_LIST}`, pluginList })
15
+export const APP_LIST = 'App/List'
16
+export const setAppList = appList => ({ type: `Set/${APP_LIST}`, appList })

src/plugin/ContentType/PageHtml/PageHtml.styl → src/app/ContentType/PageHtml/PageHtml.styl View File


src/plugin/ContentType/PageHtml/PageHtmlComponent.jsx → src/app/ContentType/PageHtml/PageHtmlComponent.jsx View File


src/plugin/ContentType/PageHtml/PageHtmlContainer.jsx → src/app/ContentType/PageHtml/PageHtmlContainer.jsx View File

@@ -20,7 +20,7 @@ class PageHtmlContainer extends React.Component {
20 20
   handleClickBtnClose = () => this.props.dispatch(hideActiveFileContent())
21 21
 
22 22
   render () {
23
-    const { activeFileContent, plugin: { PageHtml } } = this.props
23
+    const { activeFileContent, app: { PageHtml } } = this.props
24 24
 
25 25
     return (
26 26
       <PopinFixed customClass={`${PageHtml.customClass}`}>
@@ -50,5 +50,5 @@ class PageHtmlContainer extends React.Component {
50 50
   }
51 51
 }
52 52
 
53
-const mapStateToProps = ({ activeFileContent, plugin }) => ({ activeFileContent, plugin })
53
+const mapStateToProps = ({ activeFileContent, app }) => ({ activeFileContent, app })
54 54
 export default connect(mapStateToProps)(PageHtmlContainer)

src/plugin/ContentType/PageHtml/index.js → src/app/ContentType/PageHtml/index.js View File


src/plugin/ContentType/PageHtml/pageHtml.js → src/app/ContentType/PageHtml/pageHtml.js View File

@@ -1,4 +1,4 @@
1
-import { PLUGIN_LIST } from '../../../action-creator.sync.js'
1
+import { APP_LIST } from '../../../action-creator.sync.js'
2 2
 
3 3
 export default function pageHtml (state = {
4 4
   title: '',
@@ -6,8 +6,8 @@ export default function pageHtml (state = {
6 6
   icon: ''
7 7
 }, action) {
8 8
   switch (action.type) {
9
-    case `Set/${PLUGIN_LIST}`:
10
-      return action.pluginList.find(p => p.name === 'PageHtml')
9
+    case `Set/${APP_LIST}`:
10
+      return action.appList.find(p => p.name === 'PageHtml')
11 11
 
12 12
     default:
13 13
       return state

src/plugin/ContentType/Thread/Thread.jsx → src/app/ContentType/Thread/Thread.jsx View File


src/plugin/ContentType/Thread/Thread.styl → src/app/ContentType/Thread/Thread.styl View File


src/plugin/ContentType/Thread/index.js → src/app/ContentType/Thread/index.js View File


src/plugin/ContentType/Thread/thread.js → src/app/ContentType/Thread/thread.js View File

@@ -1,4 +1,4 @@
1
-import { PLUGIN_LIST } from '../../../action-creator.sync.js'
1
+import { APP_LIST } from '../../../action-creator.sync.js'
2 2
 
3 3
 export default function thread (state = {
4 4
   title: '',
@@ -6,8 +6,8 @@ export default function thread (state = {
6 6
   icon: ''
7 7
 }, action) {
8 8
   switch (action.type) {
9
-    case `Set/${PLUGIN_LIST}`:
10
-      return action.pluginList.find(p => p.name === 'Thread')
9
+    case `Set/${APP_LIST}`:
10
+      return action.appList.find(p => p.name === 'Thread')
11 11
 
12 12
     default:
13 13
       return state

+ 6 - 0
src/app/index.js View File

@@ -0,0 +1,6 @@
1
+import pageHtml from './ContentType/PageHtml/index.js'
2
+import thread from './ContentType/Thread/index.js'
3
+
4
+const appDatabase = [pageHtml, thread]
5
+
6
+export default appDatabase

+ 3 - 3
src/component/Workspace/Folder.jsx View File

@@ -21,7 +21,7 @@ class Folder extends Component {
21 21
   }
22 22
 
23 23
   render () {
24
-    const { plugin, folderData: { title, content } } = this.props
24
+    const { app, folderData: { title, content } } = this.props
25 25
     return (
26 26
       <div className={classnames('folder', {'active': this.state.open})}>
27 27
         <div className='folder__header' onClick={this.handleClickToggleFolder}>
@@ -57,7 +57,7 @@ class Folder extends Component {
57 57
           { content.map(c => c.type === 'folder'
58 58
             ? <Folder folderData={c} key={c.id} />
59 59
             : <FileItem
60
-              icon={(plugin[c.type] || {icon: ''}).icon}
60
+              icon={(app[c.type] || {icon: ''}).icon}
61 61
               name={c.title}
62 62
               type={c.type}
63 63
               status={c.status}
@@ -78,5 +78,5 @@ Folder.propTypes = {
78 78
     title: PropTypes.string.isRequired,
79 79
     content: PropTypes.array
80 80
   }),
81
-  plugin: PropTypes.object
81
+  app: PropTypes.object
82 82
 }

+ 12 - 12
src/container/WorkspaceContent.jsx View File

@@ -8,10 +8,10 @@ import PageTitle from '../component/common/layout/PageTitle.jsx'
8 8
 import PageContent from '../component/common/layout/PageContent.jsx'
9 9
 import DropdownCreateButton from '../component/common/Input/DropdownCreateButton.jsx'
10 10
 import {
11
-  getPluginList,
11
+  getAppList,
12 12
   getWorkspaceContent
13 13
 } from '../action-creator.async.js'
14
-// import pluginDatabase from '../plugin/index.js'
14
+// import appDatabase from '../app/index.js'
15 15
 
16 16
 class WorkspaceContent extends React.Component {
17 17
   constructor (props) {
@@ -23,20 +23,20 @@ class WorkspaceContent extends React.Component {
23 23
 
24 24
   componentDidMount () {
25 25
     this.props.dispatch(getWorkspaceContent(/* this.props.workspace.id */1))
26
-    this.props.dispatch(getPluginList())
26
+    this.props.dispatch(getAppList())
27 27
   }
28 28
 
29 29
   handleClickFileItem = file => {
30
-    GLOBAL_renderPlugin({
30
+    GLOBAL_renderApp({
31 31
       file,
32
-      pluginData: this.props.plugin[file.type]
32
+      appData: this.props.app[file.type]
33 33
     })
34 34
   }
35 35
 
36 36
   render () {
37
-    const { workspace, plugin } = this.props
37
+    const { workspace, app } = this.props
38 38
 
39
-    // const PluginContainer = (pluginDatabase.find(p => p.name === activeFileContent.type) || {container: '<div>unknow</div>'}).container
39
+    // const AppContainer = (appDatabase.find(p => p.name === activeFileContent.type) || {container: '<div>unknow</div>'}).container
40 40
 
41 41
     return (
42 42
       <PageWrapper customeClass='workspace'>
@@ -53,12 +53,12 @@ class WorkspaceContent extends React.Component {
53 53
             <FileItemHeader />
54 54
 
55 55
             { workspace.content.map(c => c.type === 'folder'
56
-              ? <Folder plugin={plugin} folderData={c} key={c.id} />
56
+              ? <Folder app={app} folderData={c} key={c.id} />
57 57
               : (
58 58
                 <FileItem
59 59
                   name={c.title}
60 60
                   type={c.type}
61
-                  icon={(plugin[c.type] || {icon: ''}).icon}
61
+                  icon={(app[c.type] || {icon: ''}).icon}
62 62
                   status={c.status}
63 63
                   onClickItem={() => this.handleClickFileItem(c)}
64 64
                   key={c.id}
@@ -69,8 +69,8 @@ class WorkspaceContent extends React.Component {
69 69
 
70 70
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
71 71
 
72
-          <div id='pluginContainer'>
73
-            {/* activeFileContent.display && <PluginContainer /> */}
72
+          <div id='appContainer'>
73
+            {/* activeFileContent.display && <AppContainer /> */}
74 74
           </div>
75 75
         </PageContent>
76 76
 
@@ -79,5 +79,5 @@ class WorkspaceContent extends React.Component {
79 79
   }
80 80
 }
81 81
 
82
-const mapStateToProps = ({ workspace, activeFileContent, plugin }) => ({ workspace, activeFileContent, plugin })
82
+const mapStateToProps = ({ workspace, activeFileContent, app }) => ({ workspace, activeFileContent, app })
83 83
 export default connect(mapStateToProps)(WorkspaceContent)

+ 0 - 6
src/plugin/index.js View File

@@ -1,6 +0,0 @@
1
-import pageHtml from '../plugin/ContentType/PageHtml/index.js'
2
-import thread from '../plugin/ContentType/Thread/index.js'
3
-
4
-const pluginDatabase = [pageHtml, thread]
5
-
6
-export default pluginDatabase

src/reducer/plugin.js → src/reducer/app.js View File

@@ -1,8 +1,8 @@
1 1
 import { combineReducers } from 'redux'
2
-import pluginDatabase from '../plugin/index.js'
2
+import appDatabase from '../app/index.js'
3 3
 
4 4
 const reducerList = {}
5
-pluginDatabase.forEach(p => (reducerList[p.name] = p.reducer))
5
+appDatabase.forEach(p => (reducerList[p.name] = p.reducer))
6 6
 
7 7
 export default combineReducers({
8 8
   ...reducerList

+ 2 - 2
src/reducer/root.js View File

@@ -2,8 +2,8 @@ import { combineReducers } from 'redux'
2 2
 import user from './user.js'
3 3
 import workspace from './workspace.js'
4 4
 import activeFileContent from './activeFileContent.js'
5
-import plugin from './plugin.js'
5
+import app from './app.js'
6 6
 
7
-const rootReducer = combineReducers({ user, workspace, activeFileContent, plugin })
7
+const rootReducer = combineReducers({ user, workspace, activeFileContent, app })
8 8
 
9 9
 export default rootReducer

+ 1 - 1
webpack.config.js View File

@@ -76,7 +76,7 @@ module.exports = {
76 76
     }]
77 77
   },
78 78
   resolve: {
79
-    extensions: ['.js', '.jsx', '.styl']
79
+    extensions: ['.js', '.jsx']
80 80
   },
81 81
   plugins:[
82 82
     ...[ // generic plugins always present