-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI+server : working states displayed in UI
- Loading branch information
Showing
12 changed files
with
228 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react' | ||
|
||
|
||
const states = { | ||
"needs_review" : { | ||
text : "Needs Review", | ||
color : "orange" | ||
}, | ||
"validated" : { | ||
text : "Validated", | ||
color : "green" | ||
}, | ||
"rejected" : { | ||
text : "Rejected", | ||
color : "red" | ||
} | ||
} | ||
|
||
const style = { | ||
border : "1px solid #ccc", | ||
borderRadius : "5px", | ||
fontSize : ".7em", | ||
padding : ".5em 1em" | ||
} | ||
|
||
export default class ContentState extends React.Component { | ||
render() { | ||
|
||
let {state, errors} = this.props; | ||
|
||
if (!errors) errors = [] | ||
|
||
let text = errors.length ? | ||
`${errors.length} errors ` | ||
: | ||
states[state].text | ||
|
||
let color = errors.length ? | ||
"red" | ||
: | ||
states[state].color | ||
|
||
|
||
return ( | ||
<span style={Object.assign(style, {color, borderColor : color})}> | ||
{text} | ||
</span> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.