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

Revamp tp calendar #479

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Revamp tp calendar #479

merged 2 commits into from
Jul 11, 2024

Conversation

rsiminel
Copy link
Contributor

@rsiminel rsiminel commented Jul 8, 2024

@mboudet

The events are shown as bars instead of dots now but there is no guarantee that the bars corresponding to one event are contiguous.
Events are given a color corresponding to whether they are pending, active or over with a little bit of semi-random variation to distinguish events from one another. Perhaps a better "UX engineer" than I can come up with sexier colors and a better way to introduce their semi-randomness.
Shall I write up the styling in proper CSS or leave it as is ?

closes #467

Comment on lines 56 to 66
private choseColor(id: string, over: boolean, created: boolean) {
let baseColor;
if (over) { baseColor = eventColors.over; }
else if (created) { baseColor = eventColors.created; }
else { baseColor = eventColors.pending; }
let color = { ...baseColor }
const hash = id.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
const red = (hash % 128).toString(16).padStart(2, '0');
color.primary = `#${red}${color.primary.slice(3)}`;
return color;
}
Copy link
Member

@mboudet mboudet Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the color should be variable only for 'active' event. We can keep the same color for all the other events.
How variable are the colors?

Edit: Actually, do we even need different colors for the various states? Maybe a reservation should only have one 'unique' color. We already now the state (if it end before today's date, or start after today's...)

@abretaud thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On askomics we use this to generate the color, not sure if it's 'better'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the way it looked before:
TpCalendar1

Here it is with the color scheme you are recommending:
TpCalendar2

This is way better indeed. Any other improvements ?

@mboudet
Copy link
Member

mboudet commented Jul 8, 2024

Should be fine even if lines are not continuous. We won't have more than 2-3 reservations at the same time at most. As long as they have distinct color, it's fine.

Can you provide some screenshots to see the alignement issue?

@mboudet mboudet merged commit 1576ca8 into genouest:master Jul 11, 2024
1 check passed
@rsiminel rsiminel deleted the revamp-TP-calendar2 branch July 11, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overhaul calendar
2 participants