summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/common/form.css9
-rw-r--r--frontend/store.js2
-rw-r--r--frontend/views/index/components/graph.form.js4
-rw-r--r--frontend/views/index/containers/graph.edit.js2
-rw-r--r--frontend/views/index/containers/graph.index.js16
-rw-r--r--frontend/views/index/containers/graph.new.js2
-rw-r--r--frontend/views/index/graph.reducer.js20
7 files changed, 46 insertions, 9 deletions
diff --git a/frontend/common/form.css b/frontend/common/form.css
index 5b8f1e3..8643065 100644
--- a/frontend/common/form.css
+++ b/frontend/common/form.css
@@ -56,6 +56,9 @@ form label.description {
font-size: small;
color: #ddd;
}
+form label.description span {
+ padding-top: 0;
+}
/* text input */
@@ -68,7 +71,7 @@ input[type=password] {
background: #111;
font-family: 'Roboto', sans-serif;
font-size: 0.875rem;
- width: 20rem;
+ width: 15rem;
border-radius: 0.125rem;
}
@@ -80,8 +83,8 @@ input[type=password]:focus {
}
textarea {
- width: 35rem;
- height: 20rem;
+ width: 20rem;
+ height: 10rem;
padding: 0.5rem;
border: 1px solid #ddd;
font-family: 'Roboto', sans-serif;
diff --git a/frontend/store.js b/frontend/store.js
index 445125b..d21dffb 100644
--- a/frontend/store.js
+++ b/frontend/store.js
@@ -5,12 +5,14 @@ import thunk from 'redux-thunk'
// import { login } from './util'
import uploadReducer from './views/upload/upload.reducer'
+import graphReducer from './views/index/graph.reducer'
// import collectionReducer from './views/collection/collection.reducer'
const createRootReducer = history => (
combineReducers({
auth: (state = {}) => state,
router: connectRouter(history),
+ graph: graphReducer,
upload: uploadReducer,
// collection: collectionReducer,
})
diff --git a/frontend/views/index/components/graph.form.js b/frontend/views/index/components/graph.form.js
index ef546ec..a6a0dd6 100644
--- a/frontend/views/index/components/graph.form.js
+++ b/frontend/views/index/components/graph.form.js
@@ -68,8 +68,8 @@ export default class GraphForm extends Component {
e.preventDefault()
const { isNew, onSubmit } = this.props
const { data } = this.state
- const requiredKeys = "title username".split(" ")
- const validKeys = "title username notes archived".split(" ")
+ const requiredKeys = "title username path description".split(" ")
+ const validKeys = "title username path description".split(" ")
const validData = validKeys.reduce((a,b) => { a[b] = data[b]; return a }, {})
const errorFields = requiredKeys.filter(key => !validData[key])
if (errorFields.length) {
diff --git a/frontend/views/index/containers/graph.edit.js b/frontend/views/index/containers/graph.edit.js
index 2f8c7fb..fadcabc 100644
--- a/frontend/views/index/containers/graph.edit.js
+++ b/frontend/views/index/containers/graph.edit.js
@@ -19,7 +19,7 @@ class GraphEdit extends Component {
.then(response => {
// response
console.log(response)
- history.push('/graph/' + data.id + '/show/')
+ history.push('/' + data.path)
})
}
diff --git a/frontend/views/index/containers/graph.index.js b/frontend/views/index/containers/graph.index.js
index b18c768..7ac31da 100644
--- a/frontend/views/index/containers/graph.index.js
+++ b/frontend/views/index/containers/graph.index.js
@@ -3,11 +3,23 @@ import { Link } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
-// import actions from '../../actions'
+import { Loader } from '../../../common'
+import actions from '../../../actions'
// import * as uploadActions from './upload.actions'
class GraphIndex extends Component {
+ componentDidMount() {
+ actions.graph.index()
+ }
render() {
+ const { index } = this.props
+ if (index.loading) {
+ return (
+ <div className='graphIndex'>
+ <Loader />
+ </div>
+ )
+ }
return (
<div className='graphIndex'>
<b>welcome, swimmer</b>
@@ -18,7 +30,7 @@ class GraphIndex extends Component {
}
const mapStateToProps = state => ({
- // upload: state.upload,
+ index: state.graph.index,
})
const mapDispatchToProps = dispatch => ({
diff --git a/frontend/views/index/containers/graph.new.js b/frontend/views/index/containers/graph.new.js
index 186f8f7..be96bf5 100644
--- a/frontend/views/index/containers/graph.new.js
+++ b/frontend/views/index/containers/graph.new.js
@@ -14,7 +14,7 @@ class GraphNew extends Component {
.then(res => {
console.log(res)
if (res.res && res.res.id) {
- history.push('/graph/' + res.res.name)
+ history.push('/' + res.res.path)
}
})
.catch(err => {
diff --git a/frontend/views/index/graph.reducer.js b/frontend/views/index/graph.reducer.js
new file mode 100644
index 0000000..612ac14
--- /dev/null
+++ b/frontend/views/index/graph.reducer.js
@@ -0,0 +1,20 @@
+import * as types from '../../types'
+// import { session, getDefault, getDefaultInt } from '../../session'
+
+import { crudState, crudReducer } from '../../api/crud.reducer'
+
+const initialState = crudState('graph', {
+ options: {
+ }
+})
+
+const reducer = crudReducer('graph')
+
+export default function graphReducer(state = initialState, action) {
+ // console.log(action.type, action)
+ state = reducer(state, action)
+ switch (action.type) {
+ default:
+ return state
+ }
+}