Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add background events #1161

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rrjoson
Copy link
Contributor

@rrjoson rrjoson commented Dec 20, 2018

Summary of Changes

Notes

Screenshots

  • screen shot 2018-12-20 at 7 39 30 pm

@rrjoson rrjoson changed the title feat: Add background events (WIP) feat: Add background events Dec 20, 2018
@rrjoson rrjoson force-pushed the add-background-events-feature branch from b07da68 to 5546f41 Compare December 20, 2018 12:00
@jquense
Copy link
Owner

jquense commented Dec 20, 2018

Nice! I think this is a good start, in terms of API and internal separation from the "real" events. I think it may be helpful before continuing on an implementation to do some work speccing out a few things:

  • What use-cases should feature enable?
  • In what specific ways are bg events different from plain events (this helps us determine the api, and solve questions like "should drag and drop work on them")

at that point i think we can DRY up places where there is a lot of overlap and separate more the points in which they differ.

how's that sound?

@rrjoson
Copy link
Contributor Author

rrjoson commented Dec 21, 2018

Sounds good! Thanks for the feedback!

I'll spec out here first for feedback the use cases that the bg events feature enables and then specify how the bg events are different from plain events.

After that, I'll proceed with:

  • DRY up the code
  • Separate the points in which they differ
  • Continue with other changes to the API like "Drag and drop" feature on the bg events, etc.

@rrjoson
Copy link
Contributor Author

rrjoson commented Dec 21, 2018

Hi @jquense. Let me know your thoughts about this when you're free. Thanks!

In which use-cases should we enable this feature?

  • As a user, I want to only be able to schedule an event within certain time slots
  • As a user, I want to emphasize or highlight certain time slots on the calendar view
  • As a user, I want to emphasize certain days in the calendar month view
  • As a user, I want to show which slots are available to book an event with
  • As a user, I want to add labels to certain days or timeslots

In what specific ways are bg events different from plain events?

@jquense
Copy link
Owner

jquense commented Jan 16, 2019

looks good @rrjoson I do wonder if we need the same layout mechanism as normal events for these as well. Do you know of any prior art aside from Full calendar we can look at for UX/UI on that front?

@rrjoson
Copy link
Contributor Author

rrjoson commented Jan 16, 2019

@jquense sorry, I don't know any. Actually I was thinking of just copying the background event UI from Full calendar and just use a shade of blue so that it matches the default color for the events. What do you think?

image

@jquense
Copy link
Owner

jquense commented Jan 16, 2019

looks great 👍

@rrjoson rrjoson force-pushed the add-background-events-feature branch 2 times, most recently from 9a22c0a to fb4f7a2 Compare January 21, 2019 14:48
@rrjoson
Copy link
Contributor Author

rrjoson commented Jan 22, 2019

Latest WIP: localhost_3000_examples laptop with mdpi screen

@rohit-sourcefuse
Copy link

rohit-sourcefuse commented Feb 28, 2019

Any update on this?
I am also waiting for this pull request. That a nice feature.
And also thanks for this wonderful component.

@rrjoson
Copy link
Contributor Author

rrjoson commented Feb 28, 2019

Hi @rohit-sourcefuse

Sorry wasn't able to continue on this. Will try to finish it within the following week.

@rrjoson rrjoson force-pushed the add-background-events-feature branch from 22da0ef to e029e77 Compare February 28, 2019 21:49
@rrjoson rrjoson changed the title (WIP) feat: Add background events feat: Add background events Feb 28, 2019
@rrjoson
Copy link
Contributor Author

rrjoson commented Feb 28, 2019

Hi @jquense

When you're free, can I have a quick feedback on my progress here?

Thanks!

@stale
Copy link

stale bot commented May 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 23, 2019
@stale stale bot closed this May 30, 2019
@jackjocross
Copy link

@jquense anything I can do to help you out here? I'm creating a fork to use these changes, but would love to help merge into the official repo.

@nthgol
Copy link

nthgol commented Jan 16, 2020

we've also forked this PR and merged in master.
Our main use case is showing free/busy, read-only events pulled from a 3rd party calendar API overlaying the user's ability to select.
Here's an unstyled example.
I support reopening this and adding this functionality.
image

@sgraham3311
Copy link

This is a good PR and should be merged. Can we get an update on this @jquense

@jquense jquense reopened this May 13, 2020
@jquense jquense removed the wontfix label May 13, 2020
@jquense
Copy link
Owner

jquense commented May 13, 2020

Oops sorry this got lost in time. GH is bad at this and I'm not a good maintainer. If anyone wants to pick this and get it updated I'll merge it

@sgraham3311
Copy link

sgraham3311 commented May 15, 2020

@jquense

After doing some work/research I was able to achieve the desired result with the latest version of react-big-calendar. I essentially just provided a custom dayLayoutAlgorithm giving the background events their own styled events.

import nooverlap from 'react-big-calendar/lib/utils/layout-algorithms/no-overlap';

export default ({ events, minimumStartDifference, slotMetrics, accessors }) => [
	...nooverlap({
		events: events.filter((e) => e.type === 'background'),
		minimumStartDifference,
		slotMetrics,
		accessors
	}),
	...nooverlap({
		events: events.filter((e) => e.type !== 'background'),
		minimumStartDifference,
		slotMetrics,
		accessors
	})
];

By using the eventPropGetter I am able to apply styles to the background events and most importantly set pointer-events: none so they don't receive click events.

You can end up with something like this
Screen Shot 2020-05-15 at 1 06 00 PM

@KhaledMohamedP
Copy link
Contributor

How does this implementation handles overlapping background events?

@jmauzy
Copy link
Contributor

jmauzy commented Aug 13, 2020

I've picked this up in PR #1727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants