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

Duplicate calendar #1048

Merged
merged 12 commits into from
Nov 26, 2024
Merged

Duplicate calendar #1048

merged 12 commits into from
Nov 26, 2024

Conversation

jotalis
Copy link
Contributor

@jotalis jotalis commented Nov 22, 2024

Summary

  • Copy to New Schedule functionality
  • Enforce unique schedule names when duplicating, creating, or renaming a schedule
  • Fix bug where schedule names aren't updated and thus displayed properly for deletion modals

Test Plan

  • Undo New Schedule Creation: Verify undo functionality removes a newly created schedule.
  • Combined Undo for Schedule Creation and Event Copying: Confirm one undo removes both a new schedule and copied events.
  • Duplicate Schedule Name on Creation: Validate a duplicate schedule name results in a suffix like (1).
  • Duplicate Schedule Name on Renaming: Check renaming to an existing name adds a suffix or prevents duplication.
  • Renaming and Duplicating Schedules: Verify renaming a schedule and duplicating it results in proper suffixes.
  • Adding Custom Events: Verify custom events are added with all details intact.
  • Start with existing schedule 2025-Winter. Create new schedule with same name. Expect 2025-Winter(1). Try renaming schedule to 2025-Winter. Expect 2025-Winter(1)
  • Deleting schedule modal shows correct name of schedule to delete; Create 3 schedules; delete the second schedule; open up the delete modal for the third schedule. It should display the name of the third schedule and not the second schedule

Issues

Closes #1034, #1032

@jotalis jotalis requested a review from KevinWu098 November 22, 2024 00:44
@jotalis jotalis marked this pull request as ready for review November 22, 2024 02:25
@MinhxNguyen7
Copy link
Member

While you're here, can you replace the dropdown with a list of buttons? There's no reason to select, then having to press a button.

Copy link
Member

@KevinWu098 KevinWu098 left a comment

Choose a reason for hiding this comment

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

Congrats on your first PR! Looks solid, barring one issue I've noted below.

apps/antalmanac/src/components/dialogs/CopySchedule.tsx Outdated Show resolved Hide resolved
@jotalis
Copy link
Contributor Author

jotalis commented Nov 24, 2024

Update: discussed with AA team to prioritize a simpler and more familiar duplication functionality (e.g. Make a Copy from Google Docs). The copy schedule modal is now only going to allow the making of duplicate schedules, removing "Copy to All Schedules" and "Copy to Schedule".

@jotalis
Copy link
Contributor Author

jotalis commented Nov 24, 2024

Currently when the user tries to duplicate a schedule, a unique schedule name is enforced upon schedule creation, even if what they enter already exists.

For example, if Winter-2025 exists, and a schedule tries to be duplicated with the name Winter-2025, a number (e.g. (1)) will be appended to the schedule name upon creation.

However, users are still able to have schedule with duplicate names in these cases:

  1. They have existing schedules with duplicate names already
  2. They rename a schedule to an already existing schedule name
  3. They create a new schedule using an already existing schedule name

To help migrate towards a system where all schedule names are unique, we should enforce the same naming validation in the duplicate schedule feature for 2 and 3 (renaming and creating schedules).

@jotalis jotalis linked an issue Nov 24, 2024 that may be closed by this pull request
Copy link
Member

@KevinWu098 KevinWu098 left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

2 non-blocking questions for you, but otherwise, it looks good to merge

apps/antalmanac/src/stores/Schedules.ts Outdated Show resolved Hide resolved
apps/antalmanac/src/stores/Schedules.ts Outdated Show resolved Hide resolved
Copy link
Member

@MinhxNguyen7 MinhxNguyen7 left a comment

Choose a reason for hiding this comment

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

If this breaks prod, I blame @KevinWu098

@MinhxNguyen7 MinhxNguyen7 merged commit a1684de into main Nov 26, 2024
4 checks passed
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.

Duplicate schedule instead of just copying Enforce unique schedule names
3 participants