Procházet zdrojové kódy

renamed app interface functions

Skylsmoi před 6 roky
rodič
revize
a033d588cd

+ 1 - 1
README.md Zobrazit soubor

@@ -58,7 +58,7 @@ To test them inside Tracim, you need to build them and copast them to tracim_fro
58 58
 You also need to make the mock api able to tell tracim_frontend that it handle you app :
59 59
 - add an entry for you App in tracim_frontend/jsonserver/static_db.json in the `app_config` property
60 60
 - reload your mock api server
61
-- add the source of your app in tracim_frontend/dist/index.html and an entry to the switch case of the function `GLOBAL_renderApp`. All of this will be handled by backend later on, this is all work in progress stuffs.
61
+- add the source of your app in tracim_frontend/dist/index.html and an entry to the switch case of the function `GLOBAL_renderAppFull`. All of this will be handled by backend later on, this is all work in progress stuffs.
62 62
 
63 63
 
64 64
 #### Urls list

+ 10 - 7
dist/appInterface.js Zobrazit soubor

@@ -15,33 +15,36 @@
15 15
   }
16 16
 
17 17
   //@TODO make a file action.tracimCustomEvent.js that will contains all customEvent that tracim_frontend call
18
+  // => pb with that is that appInterface cant use import since it is not part of the build webpack
19
+  // use module.export and require
20
+  // doesn't work, cant resolve a file outside of the build dir
18 21
 
19
-  GLOBAL_renderApp = app => { //@TODO renderAppFull
20
-    console.log('%cGLOBAL_renderApp', 'color: #5cebeb', app)
22
+  GLOBAL_renderAppFull = app => {
23
+    console.log('%cGLOBAL_renderAppFull', 'color: #5cebeb', app)
21 24
 
22 25
     const selectedApp = getSelectedApp(app.config.slug)
23 26
 
24 27
     if (selectedApp.isRendered) {
25 28
       GLOBAL_dispatchEvent({type: `${app.config.slug}_showApp`, data: app}) // handled by html-documents:src/container/HtmlDocument.jsx
26 29
     } else {
27
-      selectedApp.renderApp(app)
30
+      selectedApp.renderAppFull(app)
28 31
       selectedApp.isRendered = true
29 32
       prevSelectedApp.isRendered = false
30 33
       prevSelectedApp = selectedApp
31 34
     }
32 35
   }
33 36
 
34
-  GLOBAL_renderCreateContentApp = app => { //@TODO renderAppPopupCreation
35
-    console.log('%cGLOBAL_renderCreateContentApp', 'color: #5cebeb', app)
37
+  GLOBAL_renderAppPopupCreation = app => {
38
+    console.log('%cGLOBAL_renderAppPopupCreation', 'color: #5cebeb', app)
36 39
 
37 40
     const selectedApp = getSelectedApp(app.config.slug)
38 41
 
39 42
     if (!selectedApp) {
40
-      console.log('Error in GLOBAL_renderCreateContentApp, selectedApp is undefined', app)
43
+      console.log('Error in GLOBAL_renderAppPopupCreation, selectedApp is undefined', app)
41 44
       return
42 45
     }
43 46
 
44
-    getSelectedApp(app.config.slug).renderPopupCreation(app)
47
+    getSelectedApp(app.config.slug).renderAppPopupCreation(app)
45 48
   }
46 49
 
47 50
   GLOBAL_dispatchEvent = ({type, data}) => {

+ 2 - 2
package.json Zobrazit soubor

@@ -61,8 +61,8 @@
61 61
       "fetch",
62 62
       "btoa",
63 63
       "history",
64
-      "GLOBAL_renderApp",
65
-      "GLOBAL_renderCreateContentApp",
64
+      "GLOBAL_renderAppFull",
65
+      "GLOBAL_renderAppPopupCreation",
66 66
       "GLOBAL_dispatchEvent",
67 67
       "GLOBAL_hideApp"
68 68
     ],

+ 4 - 4
src/appFactory.js Zobrazit soubor

@@ -3,7 +3,7 @@ import { FETCH_CONFIG } from './helper.js'
3 3
 
4 4
 export function appFactory (WrappedComponent) {
5 5
   return class AppFactory extends React.Component {
6
-    renderApp = (appConfig, user, content) => GLOBAL_renderApp({
6
+    renderAppFull = (appConfig, user, content) => GLOBAL_renderAppFull({
7 7
       loggedUser: user.logged ? user : {},
8 8
       config: {
9 9
         ...appConfig,
@@ -15,7 +15,7 @@ export function appFactory (WrappedComponent) {
15 15
       content
16 16
     })
17 17
 
18
-    renderCreateContentApp = (appConfig, user, idWorkspace, idFolder) => GLOBAL_renderCreateContentApp({
18
+    renderAppPopupCreation = (appConfig, user, idWorkspace, idFolder) => GLOBAL_renderAppPopupCreation({
19 19
       loggedUser: user.logged ? user : {},
20 20
       config: {
21 21
         ...appConfig,
@@ -34,8 +34,8 @@ export function appFactory (WrappedComponent) {
34 34
       return (
35 35
         <WrappedComponent
36 36
           {...this.props}
37
-          renderApp={this.renderApp}
38
-          renderCreateContentApp={this.renderCreateContentApp}
37
+          renderAppFull={this.renderAppFull}
38
+          renderAppPopupCreation={this.renderAppPopupCreation}
39 39
           emitEventApp={this.emitEventApp}
40 40
           // hideApp={this.hideApp}
41 41
         />

+ 2 - 2
src/component/Workspace/OpenContentApp.jsx Zobrazit soubor

@@ -5,7 +5,7 @@ import appFactory from '../../appFactory.js'
5 5
 
6 6
 export class OpenContentApp extends React.Component {
7 7
   openContentApp = () => {
8
-    const { idWorkspace, appOpenedType, user, workspaceContent, contentType, renderApp, match } = this.props
8
+    const { idWorkspace, appOpenedType, user, workspaceContent, contentType, renderAppFull, match } = this.props
9 9
 
10 10
     if (isNaN(idWorkspace) || idWorkspace === -1) return
11 11
 
@@ -29,7 +29,7 @@ export class OpenContentApp extends React.Component {
29 29
         // if another app is already visible, hide it
30 30
         if (appOpenedType !== false) GLOBAL_dispatchEvent({type: `${appOpenedType}_hideApp`})
31 31
         // open app
32
-        renderApp(
32
+        renderAppFull(
33 33
           contentType.find(ct => ct.slug === contentToOpen.type),
34 34
           user,
35 35
           contentToOpen

+ 2 - 2
src/component/Workspace/OpenCreateContentApp.jsx Zobrazit soubor

@@ -7,12 +7,12 @@ const qs = require('query-string')
7 7
 
8 8
 export class OpenCreateContentApp extends React.Component {
9 9
   openCreateContentApp = () => {
10
-    const { idWorkspace, user, contentType, renderCreateContentApp, match, location } = this.props
10
+    const { idWorkspace, user, contentType, renderAppPopupCreation, match, location } = this.props
11 11
 
12 12
     if (isNaN(idWorkspace) || idWorkspace === -1) return
13 13
 
14 14
     if (['idws', 'type'].every(p => p in match.params) && contentType.map(c => c.slug).includes(match.params.type)) {
15
-      renderCreateContentApp(
15
+      renderAppPopupCreation(
16 16
         contentType.find(ct => ct.slug === match.params.type),
17 17
         user,
18 18
         idWorkspace,