Skip to content

WIP: Custom Location Enhancements#629

Open
anika-4444 wants to merge 15 commits into
masterfrom
custom-loc-enhancements
Open

WIP: Custom Location Enhancements#629
anika-4444 wants to merge 15 commits into
masterfrom
custom-loc-enhancements

Conversation

@anika-4444

Copy link
Copy Markdown
Contributor

Summary

This pull request is the first step towards implementing feature Foo

  • implemented better date and time validation
  • the ability to overlay CU-Lift's operation radius, updates dynamically with CU-Lift updates to Google Maps file
  • better location checking

Test Plan

image

Notes

The KML link is not CU-Lift's actual radius right now because I did not have the proper permissions to export the file. Also, I plan on adding location validation in this PR that checks whether or not a custom location is actually allowed

Breaking Changes

@anika-4444 anika-4444 requested a review from a team as a code owner December 7, 2025 03:07
@dti-github-bot

Copy link
Copy Markdown
Member

[diff-counting] Significant lines: 125.

@benkoppe benkoppe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good work! Is this PR still in WIP because the changes need to be standardized to the admin version of the modal?

if (selectionState === 'pickup') {
// Show all locations for pickup selection
return supportLocsWithOther;
return supportLocsWithOther;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this duplicate line might be a mistake.

setConfirmDialogOpen(false);
};

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There might have been some git merge issues in this file. There are some duplicate line additions, such as this comment!

const handleDateChange =
(field: keyof Pick<FormData, 'date' | 'time' | 'repeatEndDate'>) =>
(newDate: Date | null) => {
if (field === 'time') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be better to separate time changes into a separate function from date changes?

const isValid =
newDate !== null
? isValidTime(newDate)
: setFormData({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm confused by the flow of this function. If working with a time field, does this mean you call setFormData from within the ternary statement, and then also call setFormData again lower down? I think there may be a better way of doing things.

});
};

const isValidTime = (time: Date) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a useful function but it might be better suited for some sort of shared utility file, especially since it enforces rules that we will probably want to keep in-sync across the codebase.


useEffect(() => {
if (overlayRadius) {
setKMLLink(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I love how you integrated KML files! But is this the best place to store the constant value of the link? We probably don't want to hard-code it in a useEffect.

Additionally, useEffect probably isn't needed here at all. Because what you're doing here is effectively making kmlLink a derived state of overlayRadius -- if it's false, the link is null, if it's true, the link is set to the constant string. A useMemo is always better in this case (fully derived state w/ no side effects).

<InputLabel>Pickup Location</InputLabel>
<Select<string>
value={formData.pickupLocation?.id || ''}
onChange={(event) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Definitely consider extracting this to a function, it's a lot of code to embed in the layout.

<Select<string>
value={formData.dropoffLocation?.id || ''}
disabled={!formData.pickupLocation} //makes ensuring start and end locations are different simpler
onChange={(event) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Like the above comment, I think this might also be better as a separate function.

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.

3 participants