Skip to content

Availability Slider - #346

Open
mirmirmirr wants to merge 51 commits into
v0.4.7from
availability-slider
Open

Availability Slider#346
mirmirmirr wants to merge 51 commits into
v0.4.7from
availability-slider

Conversation

@mirmirmirr

@mirmirmirr mirmirmirr commented Jun 19, 2026

Copy link
Copy Markdown
Member

This PR adds a slider to the results page that allows users to only show time slots with at least a certain number of people are available.

Availability Slider

The slider lives in the same panel as the "show best times" checkbox within a component named AvailabilityFilters. It acts as a master filter with the following interactions:

  • By default, the slider is set to show times available with at least one person available which means all other interactions on the results page stay the same.
  • If slider is set to showing at least x people:
    • hovering on a participant chip shows when that user is available AND when there are at least x people available
    • clicking on a participant chip is similar to hovering
    • participant chips are considered "disabled" (hover and click actions won't work) if they aren't available at a time that works for at least x people. However, this only applies if the chip isn't already selected or in removing mode.

To improve visual feedback, the slider has tick marks that are scaled and positioned based on the total number of participants. The endpoints are explicitly labeled with numbers and each major interval (multiples of 10 and 5) have sightly taller markers. The standard one by one increments are hidden if there are 50 or more participants to prevent overcrowding.

AvailabilityFilters Toast Replacement

Originally, when a user selected the checkbox and no matching times existed, a toast would appear in the bottom right corner, blocking the filter panel. This toast has been replaced with an inline banner to communicate problematic filter combinations.

Mobile Button

For mobile screens, a new filters button was added to the persistent footer, next to the Share button. The slider track was modified to be thicker for easier interaction.

@mirmirmirr mirmirmirr added enhancement New feature or request frontend Related to frontend stuff labels Jun 19, 2026
@mirmirmirr mirmirmirr linked an issue Jun 19, 2026 that may be closed by this pull request
@mirmirmirr mirmirmirr added this to the v0.4.5 milestone Jun 19, 2026
@mirmirmirr
mirmirmirr requested a review from jzgom067 June 20, 2026 16:08
Comment thread frontend/src/app/(event)/[event-code]/page-client.tsx Outdated
Comment thread frontend/src/features/event/results/attendees/desktop-panel.tsx Outdated
Comment thread frontend/src/features/event/results/components/availability-filters.tsx Outdated
Comment thread frontend/src/features/event/results/components/availability-filters.tsx Outdated
Comment thread frontend/src/features/event/results/components/availability-filters.tsx Outdated
Comment thread frontend/src/features/event/results/components/availability-filters.tsx Outdated
Comment thread frontend/src/features/event/results/components/availability-filters.tsx Outdated
@mirmirmirr
mirmirmirr requested a review from jzgom067 June 24, 2026 15:59
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a minimum-availability slider filter to the event results page. A new AvailabilityFilters component renders a Radix slider and checkbox; useEventResults gains minAvailability state and a refactored multi-stage filtering pipeline; ParticipantChip receives an includedInSlider prop; and the filter UI is wired into both the desktop sidebar and mobile attendees drawer.

Changes

Availability Filters Feature

Layer / File(s) Summary
Filtering utilities and useEventResults refactor
frontend/src/features/event/results/lib/utils.ts, frontend/src/lib/messages.ts, frontend/src/features/event/results/lib/use-results.ts
hasMutualAvailability and findConsensusAndConflicts updated to accept participantCount instead of a participants array. useEventResults gains minAvailability state with a clamping effect, replaces the prior single-pass derivation with a memoized three-stage pipeline (bestTimesCache → globalFilteredMap → filteredAvailabilities), refactors handleRemoveParticipant to await the server action and show success/error toasts, and exposes minAvailability, validParticipantsForList, and setMinAvailability. Message keys INFO_NO_MUTUAL_AVAILABILITY/INFO_NO_IDEAL_TIMES_BANNER are replaced with INFO_NO_OVERLAP.
AvailabilityFilters component
frontend/package.json, frontend/src/features/event/results/components/availability-filters.tsx
New AvailabilityFilters component reads minAvailability, showOnlyBestTimes, and filteredAvailabilities from context, computes slider tick positions via useMemo, renders a checkbox to toggle best-times mode and a Radix slider bound to minAvailability, animates the displayed count label via framer-motion, and shows an error banner when no slots match. Adds @radix-ui/react-slider dependency.
ParticipantChip and ParticipantList slider inclusion
frontend/src/features/event/results/attendees/participant-chip.tsx, frontend/src/features/event/results/attendees/participant-list.tsx
ParticipantChip receives a new includedInSlider boolean that gates hover triggering and non-removing click actions, and applies disabled/excluded styling when the participant is outside the slider range. ParticipantList computes this prop by checking each participant against validParticipantsForList from context.
Page-level UI wiring: desktop sidebar, mobile drawer, banners
frontend/src/app/(event)/[event-code]/page-client.tsx, frontend/src/features/event/results/attendees/mobile-drawer.tsx, frontend/src/features/event/results/components/banners.tsx
Removes DisplaySettings and replaces it with a shared timezoneSelector element using TimeZoneSelector directly. Refactors the desktop sidebar to a motion.div wrapper with AnimatePresence that conditionally renders AvailabilityFilters when participants.length > 1. Extends AttendeesDrawer with a numParticipants prop and adds a "View Options" FloatingDrawer containing AvailabilityFilters in the mobile footer, shown only when numParticipants > 1. Updates banners.tsx to pass participants.length and use the new message constants.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/features/event/results/lib/use-results.ts (1)

66-88: 🎯 Functional Correctness | 🟠 Major

Keep the server mutation inside the transition. removeOptimisticParticipant(...) and updateOptimisticAvailabilities(...) run in startTransition, but await removePerson(...) happens after that transition ends. With React 19 useOptimistic, the optimistic overlay only stays while the action/transition is pending, so the removed participant can briefly reappear until revalidation lands. Await the mutation inside the same transition/action.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8c2bae8b-788c-45f1-8c34-24cba5ad1bc8

📥 Commits

Reviewing files that changed from the base of the PR and between 5e7277c and 08ef96d.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • frontend/package.json
  • frontend/src/app/(event)/[event-code]/page-client.tsx
  • frontend/src/features/event/results/attendees/mobile-drawer.tsx
  • frontend/src/features/event/results/attendees/participant-chip.tsx
  • frontend/src/features/event/results/attendees/participant-list.tsx
  • frontend/src/features/event/results/components/availability-filters.tsx
  • frontend/src/features/event/results/components/banners.tsx
  • frontend/src/features/event/results/components/display-settings.tsx
  • frontend/src/features/event/results/components/share-menu.tsx
  • frontend/src/features/event/results/lib/use-results.ts
  • frontend/src/features/event/results/lib/utils.ts
  • frontend/src/lib/messages.ts
💤 Files with no reviewable changes (1)
  • frontend/src/features/event/results/components/display-settings.tsx

Comment thread frontend/src/app/(event)/[event-code]/page-client.tsx
Comment thread frontend/src/features/event/results/attendees/mobile-drawer.tsx
Comment thread frontend/src/features/event/results/lib/use-results.ts
@jzgom067
jzgom067 removed their request for review June 24, 2026 16:30
@mirmirmirr
mirmirmirr requested a review from jzgom067 June 24, 2026 17:06
@jzgom067
jzgom067 changed the base branch from v0.4.5 to v0.4.6 June 29, 2026 17:38
@jzgom067 jzgom067 modified the milestones: v0.4.5, v0.4.6 Jun 29, 2026
Comment thread frontend/src/app/(event)/[event-code]/page-client.tsx Outdated
/>
</Slider.Track>

<div className="pointer-events-none absolute inset-0 mt-10 md:m-2 md:mt-1">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of adding side margins to the ticks, I think it would look better to have the knob extend slightly over the bounds of the track. This way, the knob can be centered on the ticks, and the ticks on the ends can be lined up with the concentric points of the ends.

Let me know if that doesn't make sense.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The radix library does not allow for extending the knob over the track. It intentionally keeps it within the bounds of the track to maintain calculations.

@jzgom067

jzgom067 commented Jul 7, 2026

Copy link
Copy Markdown
Member

Also, I think it would make more sense to have the availability slider displayed above the time zone selector, since it will probably be used more often.

@jzgom067 jzgom067 modified the milestones: v0.4.6, v0.4.7 Jul 20, 2026
@jzgom067
jzgom067 changed the base branch from v0.4.6 to v0.4.7 July 20, 2026 21:05
@mirmirmirr
mirmirmirr requested a review from jzgom067 August 1, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend Related to frontend stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add timeslot filtering by availability

3 participants