DSSD-Madison / Red-CORAL

Interactive map of organized crime in South America
MIT License
2 stars 2 forks source link

Better date filter #70

Open TetraTsunami opened 6 days ago

TetraTsunami commented 6 days ago

Check the StatsDashboard.tsx page and the filters/DateFilter.tsx component to get an idea of how the filters are going to work. Essentially:

Each filter has...

  • an id - a unique identifier for the filter used to remove or update it
    • a component that is displayed in the filter bar, displays the state of its filter, and can be clicked on to modify or remove the filter.
    • an operation - a function that takes an incident and returns a boolean. If the incident passes the filter, the function should return true.

You will need to make a new file, probably starting with a copy of filters/DateFilter.tsx. You'll also need to add your component to the filters/AddFilter.tsx component's list so it can be used.

Your filter is based on incident date. The user should be able to choose a single date or range of dates, and incidents will only pass the operation if their date is on, before, or after the chosen single date, or between the chosen two dates.

Here are some UI ideas. I don't expect you to implement the calendar view unless you're feeling exceptionally motivated.

Notion_dq86me14Ch

MysteryCoder456 commented 2 days ago

One small question: should the "between" date filter be inclusive or exclusive of the end points?

TetraTsunami commented 1 day ago

I would include the end points if possible. That's how it works in SQL, for instance.