summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/actions.js8
-rw-r--r--client/index.js60
-rw-r--r--client/session.js6
-rw-r--r--client/store.js26
-rw-r--r--client/util.js2
5 files changed, 68 insertions, 34 deletions
diff --git a/client/actions.js b/client/actions.js
index ba899f06..3fd86e0d 100644
--- a/client/actions.js
+++ b/client/actions.js
@@ -1,9 +1,9 @@
import * as search from './search/search.actions'
-import * as review from './review/review.actions'
-import * as metadata from './metadata/metadata.actions'
+// import * as review from './review/review.actions'
+// import * as metadata from './metadata/metadata.actions'
export {
search,
- review,
- metadata,
+ // review,
+ // metadata,
}
diff --git a/client/index.js b/client/index.js
index eddc5fb2..03015988 100644
--- a/client/index.js
+++ b/client/index.js
@@ -3,17 +3,55 @@ import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import { Provider } from 'react-redux'
-import App from './app'
+// import App from './app'
-import { store, history } from './store'
+import { store } from './store'
-const container = document.createElement('div')
-document.body.appendChild(container)
+// const container = document.createElement('div')
+// document.body.appendChild(container)
-ReactDOM.render(
- <AppContainer>
- <Provider store={store}>
- <App history={history} />
- </Provider>
- </AppContainer>, container
-)
+toArray(document.querySelectorAll('.applet')).forEach(el => {
+ try {
+ const payload = JSON.parse(el.dataSet.getItem('payload'))
+ } catch(e) {
+ return
+ }
+ switch (payload.command) {
+ case 'load file':
+ append_tabulator(el, payload)
+ break
+ default:
+ append_react_applet(el, payload)
+ break
+ }
+})
+
+function append_react_applet(el, payload) {
+ ReactDOM.render(
+ <AppContainer>
+ <Provider store={store}>
+ <App command={payload} />
+ </Provider>
+ </AppContainer>, el
+ )
+}
+function append_tabulator(el, payload) {
+ const table = new Tabulator(el, {
+ height:"311px",
+ layout:"fitColumns",
+ placeholder:"No Data Set",
+ columns:[
+ // {title:"Name", field:"name", sorter:"string", width:200},
+ // {title:"Progress", field:"progress", sorter:"number", formatter:"progress"},
+ // {title:"Gender", field:"gender", sorter:"string"},
+ // {title:"Rating", field:"rating", formatter:"star", align:"center", width:100},
+ // {title:"Favourite Color", field:"col", sorter:"string", sortable:false},
+ // {title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
+ // {title:"Driver", field:"car", align:"center", formatter:"tickCross", sorter:"boolean"},
+ ],
+ })
+ const columns = payload.fields.split(', ')
+ console.log(columns)
+ if ()
+ table.setData(path)
+} \ No newline at end of file
diff --git a/client/session.js b/client/session.js
index 5bfae7eb..0fae31d2 100644
--- a/client/session.js
+++ b/client/session.js
@@ -1,5 +1,5 @@
-import Storage from 'store2'
+// import Storage from 'store2'
-const session = Storage.namespace('vcat.search')
+// const session = Storage.namespace('vcat.search')
-export default session
+// export default session
diff --git a/client/store.js b/client/store.js
index 043af351..9c0f78cd 100644
--- a/client/store.js
+++ b/client/store.js
@@ -1,30 +1,25 @@
import { applyMiddleware, compose, combineReducers, createStore } from 'redux'
-import { connectRouter, routerMiddleware } from 'connected-react-router'
-import { createBrowserHistory } from 'history'
import thunk from 'redux-thunk'
-import { login } from './util'
-import metadataReducer from './metadata/metadata.reducer'
-import searchReducer from './search/search.reducer'
-import reviewReducer from './review/review.reducer'
+// import metadataReducer from './metadata/metadata.reducer'
+// import searchReducer from './search/search.reducer'
+// import reviewReducer from './review/review.reducer'
const rootReducer = combineReducers({
- auth: (state = login()) => state,
- metadata: metadataReducer,
- search: searchReducer,
- review: reviewReducer,
+ // auth: (state = login()) => state,
+ // metadata: metadataReducer,
+ // search: searchReducer,
+ // review: reviewReducer,
})
-function configureStore(initialState = {}, history) {
+function configureStore(initialState = {}) {
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(
- connectRouter(history)(rootReducer), // new root reducer with router state
initialState,
composeEnhancers(
applyMiddleware(
thunk,
- routerMiddleware(history)
),
),
)
@@ -32,7 +27,6 @@ function configureStore(initialState = {}, history) {
return store
}
-const history = createBrowserHistory()
-const store = configureStore({}, history)
+const store = configureStore({})
-export { store, history }
+export { store }
diff --git a/client/util.js b/client/util.js
index ad303c64..92b4addc 100644
--- a/client/util.js
+++ b/client/util.js
@@ -6,6 +6,8 @@ export const isAndroid = !!(navigator.userAgent.match(/Android/i))
export const isMobile = isiPhone || isiPad || isAndroid
export const isDesktop = !isMobile
+export const toArray = a => Array.prototype.slice.apply(a)
+
const htmlClassList = document.body.parentNode.classList
htmlClassList.add(isDesktop ? 'desktop' : 'mobile')