,
onItemClick: (contact: EventType) => void,
+ onSlotClick?: (start: Date, end: Date) => void,
};
constructor(props: any) {
@@ -39,18 +40,27 @@ class Calendar extends React.PureComponent {
this.state = {};
this.onNavigate = this.onNavigate.bind(this);
+ this.slotClicked = this.slotClicked.bind(this);
}
onNavigate(currentDate: Date) {
this.setState({currentDate});
}
+ slotClicked(slotInfo: {start: Date, end: Date}) {
+ if (this.props.onSlotClick) {
+ this.props.onSlotClick(slotInfo.start, slotInfo.end);
+ }
+ }
+
render() {
return (
void;
onDelete: (event: EventType, journalUid: string) => void;
onCancel: () => void;
+ location: Location;
};
constructor(props: any) {
@@ -57,6 +61,17 @@ class EventEdit extends React.PureComponent {
journalUid: '',
showDeleteDialog: false,
};
+
+ const locState = this.props.location.state;
+ // FIXME: Hack to determine if all day. Should be passed as a proper state.
+ this.state.allDay = (locState.start &&
+ (locState.start.getHours() === 0) &&
+ (locState.start.getMinutes() === 0) &&
+ (locState.start.getHours() === locState.end.getHours()) &&
+ (locState.start.getMinutes() === locState.end.getMinutes()));
+ this.state.start = (locState.start) ? locState.start : undefined;
+ this.state.end = (locState.end) ? locState.end : undefined;
+
if (this.props.item !== undefined) {
const event = this.props.item;
@@ -306,4 +321,4 @@ class EventEdit extends React.PureComponent {
}
}
-export default EventEdit;
+export default withRouter(EventEdit);