Skip to content

Fix time validation, standardize request modals#609

Closed
mjaydenkim wants to merge 4 commits into
masterfrom
mk2672/standardize-request-ride-modals
Closed

Fix time validation, standardize request modals#609
mjaydenkim wants to merge 4 commits into
masterfrom
mk2672/standardize-request-ride-modals

Conversation

@mjaydenkim

Copy link
Copy Markdown
Contributor

Summary

Fixed next/current ride edit button and ride table on-click function to lead to the same ride detail/edit modal; added consistent time validation when editing rides.

image

Test Plan

Tested through rigorous edge case input checking; anyone reviewing this PR should definitely do some of that on their own too to verify correctness.

@mjaydenkim mjaydenkim requested a review from a team as a code owner November 2, 2025 23:16
@dti-github-bot

Copy link
Copy Markdown
Member

[diff-counting] Significant lines: 189.

@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.

I'm a little iffy about this change, because as someone with a certified trash memory ™ I'm the kind of person that would need to press the submit button multiple times to remember what I did wrong because the error text doesn't persist 😭. Still an understandable change for various benefits, but maybe some discussion about the tradeoffs is needed

const [updating, setUpdating] = useState(false);
const [saving, setSaving] = useState(false);
const [timeErrorOpen, setTimeErrorOpen] = useState(false);
const [timeErrors, setTimeErrors] = useState<TimeValidationError[]>([]);

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.

Do timeErrorOpen and timeErrors need to be independent pieces of state? Can one be derived with a useMemo?

{
allowPastTimes,
maxDurationHours: 24,
minDurationMinutes: 5,

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.

How was 5 minutes chosen as the minimum? We might want to just make this 0 or 1 so we never get in the way on minimums.

</DialogActions>
</Dialog>

{/* Time Validation Errors Modal */}

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 might have missed when this was already discussed, but what was the reasoning behind a modal specifically for these validation errors? Wouldn't something inline on the layout be a little more clear, to avoid stacking modals on top of modals, or are we switching due to layout shift and consistency issues? Either way it might be useful if the PR summary had justification behind this consideration.

editedRide.endTime,
{
allowPastTimes: !isNewRide(editedRide),
allowPastTimes: 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.

Am I misreading something, or does this change mean past rides can never be edited? Does this effectively freeze past rides in place?

@mjaydenkim

Copy link
Copy Markdown
Contributor Author

Outdated

@mjaydenkim mjaydenkim closed this Dec 22, 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.

3 participants