Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
release/next (#6)
Browse files Browse the repository at this point in the history
release/next
  • Loading branch information
RobinMalfait authored May 20, 2019
2 parents 0d0cdc4 + 311f6f7 commit 0a5862f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"uuid": "^3.3.2"
},
"peerDependencies": {
"react": "^16.0.0"
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"devDependencies": {
"@babel/preset-react": "^7.0.0",
Expand All @@ -83,8 +84,8 @@
"jest-cli": "^23.6.0",
"nwb": "0.23.0",
"prettier": "^1.15.3",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"semantic-release": "^15.12.3",
"travis-deploy-once": "^5.0.9"
},
Expand Down
11 changes: 8 additions & 3 deletions src/components/Calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ const DAY_MAP = {
const DEFAULT_SLOT_HEIGHT = 20;
const ONE_WEEK = 7;

function hasTimeChanged(start1, end1, start2, end2) {
return `${start1}` !== `${start2}` || `${end1}` !== `${end2}`;
}

class Calendar extends Component {
static MONDAY = MONDAY;
static TUESDAY = TUESDAY;
Expand Down Expand Up @@ -293,7 +297,10 @@ class Calendar extends Component {
} else if (isFunction(onEventClick) && !isDirty) {
// It is the same start & end, so we probably wanted a click...
onEventClick(event);
} else if (canUpdateEvent({ event, start, end })) {
} else if (
hasTimeChanged(event.start, event.end, start, end) &&
canUpdateEvent({ event, start, end })
) {
// We do have an existing event
// Let's update it
onEventUpdate({
Expand Down Expand Up @@ -371,7 +378,6 @@ class Calendar extends Component {
renderGutterItem,
renderEvent,
renderPlaceholder,
onEventClick,
daysToRender,
minTime,
locale,
Expand Down Expand Up @@ -567,7 +573,6 @@ class Calendar extends Component {
<Event
key={event.id || eventIndex} // assuming an id exist on the event, if not, use the index
event={event}
onEventClick={onEventClick}
interactionInfo={
event === pseudoEvent &&
event.isPlaceholderEvent
Expand Down
16 changes: 3 additions & 13 deletions src/components/Calendar/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { isFunction } from '../../utils/isFunction';

import { DragHandle } from './DragHandle';

function EventWrapper({ children, positionTop, height, onEventClick }) {
function EventWrapper({ children, positionTop, height }) {
return (
<div
className="SkedifyCalendar__EventWrapper"
style={{
transform: `translateY(${positionTop}px)`,
height,
}}
onClick={onEventClick}
>
{children}
</div>
Expand All @@ -25,29 +24,20 @@ function EventComponent({
render,
positionTop,
height,
onEventClick,
interactionInfo,
}) {
const shouldBeInteractable = isFunction(onActivate);

if (!shouldBeInteractable) {
return (
<EventWrapper
onEventClick={() => onEventClick(event)}
positionTop={positionTop}
height={height}
>
<EventWrapper positionTop={positionTop} height={height}>
{render(event, interactionInfo)}
</EventWrapper>
);
}

return (
<EventWrapper
onEventClick={() => onEventClick(event)}
positionTop={positionTop}
height={height}
>
<EventWrapper positionTop={positionTop} height={height}>
<DragHandle
placement={DragHandle.PLACEMENT_TOP}
onActivate={onActivate(event, DragHandle.PLACEMENT_TOP)}
Expand Down

0 comments on commit 0a5862f

Please sign in to comment.