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

Replace date time picker #9909

Merged
merged 33 commits into from
Jan 7, 2025
Merged

Replace date time picker #9909

merged 33 commits into from
Jan 7, 2025

Conversation

luucvanderzee
Copy link
Contributor

@luucvanderzee luucvanderzee commented Dec 24, 2024

Changelog

Changed

  • Replace old date time picker by new one

Technical

  • Remove react-datepicker dependency

@cl-dev-bot
Copy link
Collaborator

cl-dev-bot commented Dec 26, 2024

Warnings
⚠️ The PR title contains no Jira issue key (case-sensitive)
⚠️ The branch name contains no Jira issue key (case-sensitive)
Messages
📖 Changelog provided 🎉
📖

Run the e2e tests

📖 Check translation progress

Generated by 🚫 dangerJS against 10eaf67

@luucvanderzee luucvanderzee marked this pull request as ready for review December 27, 2024 14:00
Copy link
Contributor

@brentguf brentguf left a comment

Choose a reason for hiding this comment

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

If there are larger fixes, could you open a new PR against this PR for that? Otherwise it can become hard/time-consuming to review again.

: initialRoundedEndDate.toISOString(),
});
if (event) return;
setAttributeDiff(initializeEventTimes());
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment would have sped up understanding of this code for me. :-)

Suggested change
setAttributeDiff(initializeEventTimes());
// if we're creating a new event, initialize start/end date
setAttributeDiff(initializeEventTimes());

Copy link
Contributor

Choose a reason for hiding this comment

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

(Would still be helpful if we'd go for the param check as described earlier.)

Comment on lines -54 to -55
roundToNearestMultipleOfFive,
calculateRoundedEndDate,
Copy link
Contributor

Choose a reason for hiding this comment

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

These functions are not used anymore now, so they can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be a component we want to reuse in different places? If we do, should we put it in a different folder? And then it would need to be slightly changed (use a generic onChange handler that doesn't require a state setter to be passed).

};

return (
<Box display="flex" flexDirection="column" maxWidth="400px">
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maxWidth should rather be defined where this component is imported/used. Reason: it is clearer if all such page-specific styles are defined at the page level, so you don't need to dive inside components to fix issues.

Also, if the plan for this component is to be reusable, maxWidth should rather not live here.

onChange: (newDate: Date) => void;
}

const TimeInput = ({ selectedDate, onChange }: Props) => {
Copy link
Contributor

@brentguf brentguf Dec 30, 2024

Choose a reason for hiding this comment

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

I think it's good that all new things we build are accessible out of the box (use semantic HTML when possible). This is a textbook select component. It will help prevent bugs (such as the esc key bug described earlier) and accessibility bugs (the current solution is not keyboard navigable and reads out all 96 options on focusing the options menu, and has possibly more problems).

Because this will likely only be used in the admin, and we're not compliant with a11y there, it's not blocking for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand your point, but the HTML select is too limited in terms of what styles you can apply. For the same reason, libraries like react-select don't use it either. And since a11y is indeed not an issue for the admin screen I will skip the keyboard navigation issues for now (except for the escape one, that one is really strange)

Copy link
Contributor

Choose a reason for hiding this comment

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

We should upgrade our Select component so we can more easily style it. But we're already applying custom Select styling it in several places already. If that's what you mean. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@brentguf
Copy link
Contributor

@luucvanderzee There's also a failing E2E test: https://app.circleci.com/pipelines/github/CitizenLabDotCo/citizenlab/237791/workflows/3ab4f984-a895-421e-9669-3f42a1076298/jobs/524106/tests#failed-test-1

@brentguf
Copy link
Contributor

brentguf commented Jan 3, 2025

@luucvanderzee Just FYI, this PR still has some unresolved issues.

Base automatically changed from TAN-2973-replace-old-date-range-picker to master January 7, 2025 15:19
@luucvanderzee luucvanderzee merged commit c3e25c5 into master Jan 7, 2025
10 checks passed
@luucvanderzee luucvanderzee deleted the replace-date-time-picker branch January 7, 2025 15:20
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