Skip to content

Birthday Filter with Calendar Picker#45

Open
eric-sun92 wants to merge 1 commit intomainfrom
birthday_filter_with_calendar_select
Open

Birthday Filter with Calendar Picker#45
eric-sun92 wants to merge 1 commit intomainfrom
birthday_filter_with_calendar_select

Conversation

@eric-sun92
Copy link
Contributor

Screenshot 2025-03-26 at 1 34 46 PM

Added a filter for birthday, sends birth day and birth month to backend API when fetching people using elastic search. This gets updated when a date gets selected from the calendar select. Used DatePicker from "react-datepicker" (added this to the packages). Added some basic styling but can be improved with more ideas.

@ericyoondotcom
Copy link
Contributor

Eric, great work so far! It looks like you're getting pretty familiar with the codebase. Your code looks very well thought-out. I added some inline comments (most of which should be really easy to fix). I'd also like to hear your opinion on the following questions:

  • Do you think it would be helpful to have a way to select all birthdays in a given month, without selecting a certain date?
  • I'm not too familiar with the date picker library, but right now the dropdown component to select the month doesn't match too well with the rest of the design language. Could you investigate if there's any way to make it look more "Coursetable"-ish?
  • The other filters allow the selection of multiple values and it conducts an AND query on them. Would this be useful for the birthday picker? (i personally don't think it would be useful, and even if it was, it adds more complexity than is worth it)

},
};
// Convert numeric fields to numbers
if (field === 'birth_month' || field === 'birth_day') {
Copy link
Contributor

@ericyoondotcom ericyoondotcom Mar 30, 2025

Choose a reason for hiding this comment

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

Some minor styling issues, like single vs. double quotes. Should be super easy to fix automatically—just run npm run lint -- --fix (which should catch most of them); fix the outstanding ones manually

};

// Add all filters
addFilter('school');
Copy link
Contributor

Choose a reason for hiding this comment

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

this is great 👍

const [yearOptions, setYearOptions] = useState<DropdownOption[]>([]);
const [collegeOptions, setCollegeOptions] = useState<DropdownOption[]>([]);
const [majorOptions, setMajorOptions] = useState<DropdownOption[]>([]);
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the date picker into a new component? might make the code a little cleaner to read.

}) => (
<div className={styles.calendarHeader}>
<button onClick={decreaseMonth} disabled={prevMonthButtonDisabled}>
{"<"}
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any way we can use the FontAwesome caret-left and caret-right icons instead of the unicode greater-than and less-than characters? might match the UI a bit more.

value={date.getMonth()}
onChange={({ target: { value } }) => changeMonth(parseInt(value))}
>
{Array.from({ length: 12 }, (_, i) => (
Copy link
Contributor

@ericyoondotcom ericyoondotcom Mar 30, 2025

Choose a reason for hiding this comment

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

in general we try to avoid too much JS inside JSX html code. Can we move this to a variable that's generated before the return statement?

}
}

.datePickerPopper {
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like you have a good grasp on SCSS! hope you agree with the decision to use it over vanilla CSS.

position: absolute;
z-index: 1000;

:global {
Copy link
Contributor

Choose a reason for hiding this comment

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

it sucks that we have to do this, but i guess there's no way around it.

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.

2 participants