Skip to content

feat: add schedule availability filter to opportunities dashboard#420

Merged
DarrellRoberts merged 2 commits intoneed4deed-org:developfrom
Cy-fox:feature/opportunity-schedule-filter-405
Apr 30, 2026
Merged

feat: add schedule availability filter to opportunities dashboard#420
DarrellRoberts merged 2 commits intoneed4deed-org:developfrom
Cy-fox:feature/opportunity-schedule-filter-405

Conversation

@Cy-fox
Copy link
Copy Markdown
Collaborator

@Cy-fox Cy-fox commented Apr 28, 2026

Closes #405

The opportunities dashboard had no way to filter by volunteer availability/schedule. This adds the same schedule filter that already exists on the volunteers dashboard.

The ScheduleFilter type (days / times / occasional) was moved to the shared common/CardsFilter/types.ts so both dashboards can reference it without duplication. The volunteer filter now imports Availability from that shared location. Opportunity filter constants, serializer, deserializer, filter-item builder, and FiltersContent were all extended to include the availability accordion.

Changes:

  • src/components/Dashboard/common/CardsFilter/types.ts: extract ScheduleFilter interface to shared location
  • src/components/Dashboard/Volunteers/Filters/types.ts: import ScheduleFilter from common (backward-compatible)
  • src/components/Dashboard/Opportunities/Filters/types.ts: add QueryParamsKeys.AVAILABILITY: ScheduleFilter to OpportunityCardsFilter
  • src/components/Dashboard/Opportunities/Filters/constants.ts: add availability defaults plus SEPARATOR/AvailabilityKeys/AvailabilitySubKeys exports
  • src/components/Dashboard/Opportunities/helpers.ts: serialize and deserialize availability params using tilde-separated format
  • src/components/Dashboard/Opportunities/Filters/helpers.ts: add createAvailabilityFilterItems, wire into createOpportunityFilterItems and flat array helper
  • src/components/Dashboard/Opportunities/Filters/FiltersContent.tsx: render AccordionFilter with groupedItems and groupedItemsDisplayType="button"
  • public/locales/en/translations.json: add dashboard.opportunities.filters.schedule.header
  • public/locales/de/translations.json: add dashboard.opportunities.filters.schedule.header (Zeitplan)

Copy link
Copy Markdown
Collaborator

@DarrellRoberts DarrellRoberts left a comment

Choose a reason for hiding this comment

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

Looks good and well implemented! Just a short note on i18n

const { days, times, occasional } = availability;

const createAvailabilityGroup = <K extends keyof ScheduleFilter, T extends SelectionMap>(labelKey: K, obj: T) => ({
label: t(`dashboard.volunteers.filters.preferredAv.${labelKey}.header`),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in the i18n jsons, can you create an opportunities equivalent and use that for consistency?
e.g.

t(`dashboard.opportunities.filters.preferredAv.${labelKey}.header`)

const createAvailabilityGroup = <K extends keyof ScheduleFilter, T extends SelectionMap>(labelKey: K, obj: T) => ({
label: t(`dashboard.volunteers.filters.preferredAv.${labelKey}.header`),
items: Object.keys(obj).map((key) => ({
label: t(`dashboard.volunteers.filters.preferredAv.${labelKey}.${key}`),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call, added dashboard.opportunities.filters.preferredAv.* to both EN and DE translation files, and updated createAvailabilityFilterItems to use the opportunities-specific keys instead of borrowing from volunteers. Ty for reviewing Darrell

Copy link
Copy Markdown
Collaborator

@DarrellRoberts DarrellRoberts left a comment

Choose a reason for hiding this comment

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

thank you!

@DarrellRoberts DarrellRoberts merged commit e7d975b into need4deed-org:develop Apr 30, 2026
1 check passed
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.

Dashboard opportunities: filtering by VO Schedule has no effect

2 participants