-
Notifications
You must be signed in to change notification settings - Fork 3
Admin UI for events #81
base: master
Are you sure you want to change the base?
Conversation
* Jammed delete and edit into the same UI as creating events * TODO: Clean this all up, make it inline, more sane handling of data
nyaculak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Ready to merge after dealing with the TODO's.
| import { Form } from 'semantic-ui-react' | ||
|
|
||
| class EventCreate extends React.Component { | ||
| state = {id: 0, title: '', description: '', startEpoch: 0, endEpoch: 0, location: '', beginner: false, tags: ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to extract this out of the class level as const DEFAULT_STATE = ... then state = DEFAULT_STATE inside the class level
| constructor (props) { | ||
| super(props); | ||
|
|
||
| if(this.props.edit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: space between if and (
| event.img = "http://semantic-ui.com/images/wireframe/image.png"; | ||
| } | ||
|
|
||
| let labels = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace this logic with a call to Array.prototype.map. Also, every React element in a list should have a unique key prop.
Also thinking that category should be renamed categories.
| labels.push(<Label>{cat}</Label>) | ||
| } | ||
|
|
||
| const st = (new Date(event.startTime)).toLocaleTimeString('en-US', {hour: '2-digit', minute:'2-digit'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just name these startTime and endTime for readability purposes.
Some TODOs:
imgfield