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

add 'add to calendar' and download ics buttons for tournament #16939

Closed
wants to merge 4 commits into from

Conversation

Zhongweizhao
Copy link

@Zhongweizhao Zhongweizhao commented Feb 8, 2025

resolves #5355

I added a dropdown menu for adding tournament events to calendar and downloading ics file. The menu appears in current and future tournaments.

Also added a "calendar-plus" icon for this menu.

Here's how it looks
screenshot-20250210134829016813326

const title = encodeURIComponent(d.fullName);
const details = encodeURIComponent(`https://lichess.org/tournament/${d.id}`);
const startDate = new Date(d.startsAt);
const finishDate = new Date(d.finishesAt);
Copy link
Contributor

Choose a reason for hiding this comment

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

In case one would like to avoid introducing the field finishesAt in the JsonView, it could maybe be calculated instead, given the start time and the minutes field (which is the duration of the tournament in minutes) - i.e something like:

const finishDate = new Date(d.startsAt)
finishDate.setMinutes(finishDate.getMinutes() + d.minutes)

Copy link
Author

Choose a reason for hiding this comment

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

TournamentData doesn't have a minutes field though, the minutes field is in the Tournament interface which is not available in this view

@Zhongweizhao
Copy link
Author

I added a calendar-add icon using a free svg I found online, and used fontforge to add it to the sfd file. I think fontforge automatically changed some other fields of the file. Then I generated other files using licon.py. Not sure if I did everything correctly, let me know if I missed any steps.

@ornicar
Copy link
Collaborator

ornicar commented Feb 11, 2025

I'm not a fan. It adds code and UI complexity for something I think is extremely niche.

I don't think lichess should know about outlook, yahoo and apple calendars at all. If it did, then it should apply to all dates on the site, not just tournament dates.

If we produce semantically correct dates (?) then I suppose a browser extension could then take care of adding all these calendar functionalities to the date element. That's a better solution in my opinion, than to expect that all websites implement these 3rd party calendar specifics everywhere.

@ornicar ornicar closed this Feb 11, 2025
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.

"Add to calendar" button for tournaments and more
3 participants