-
Notifications
You must be signed in to change notification settings - Fork 79
Fix: Added second handle to Budget Range slider for proper range selection #128
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe Sponsorships page now includes state management for a budget range slider, tracking values between 1000 and 10000. The Slider component is wired as a controlled component via value and onValueChange props, enabling dual-handle functionality for both minimum and maximum budget selection. Changes
Sequence DiagramsequenceDiagram
participant User
participant SponsorshipsPage as Sponsorships Page<br/>(with useState)
participant Slider
User->>Slider: Drags handle (min/max)
Slider->>SponsorshipsPage: Triggers onValueChange
SponsorshipsPage->>SponsorshipsPage: Updates range state
SponsorshipsPage->>Slider: Passes updated value prop
Slider->>Slider: Re-renders both handles
Slider->>User: Displays updated range
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Frontend/src/pages/Sponsorships.tsx (1)
1-1: LGTM! State management correctly added for dual-handle slider.The
useStateimport and initialization properly enable controlled range selection. The initial range[1000, 10000]provides sensible defaults within the slider's 0-20000 bounds.Optional TypeScript refinement:
For stronger type safety, consider annotating the state with a tuple type:
- const [range, setRange] = useState([1000, 10000]) + const [range, setRange] = useState<[number, number]>([1000, 10000])This ensures the range is always a two-element tuple rather than a generic number array.
Also applies to: 44-44
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Frontend/src/pages/Sponsorships.tsx(11 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
Frontend/src/pages/Sponsorships.tsx (8)
Frontend/src/components/ui/card.tsx (5)
CardDescription(84-84)CardHeader(81-81)CardContent(85-85)Card(80-80)CardTitle(83-83)Frontend/src/components/ui/label.tsx (1)
Label(25-25)Frontend/src/components/ui/slider.tsx (1)
Slider(24-24)Frontend/src/components/ui/select.tsx (3)
SelectItem(156-156)SelectContent(154-154)Select(150-150)Frontend/src/components/ui/button.tsx (1)
Button(54-54)Frontend/src/components/ui/tabs.tsx (4)
Tabs(52-52)TabsList(52-52)TabsTrigger(52-52)TabsContent(52-52)Frontend/src/components/ui/avatar.tsx (3)
Avatar(50-50)AvatarImage(50-50)AvatarFallback(50-50)Frontend/src/components/ui/badge.tsx (1)
Badge(36-36)
🔇 Additional comments (2)
Frontend/src/pages/Sponsorships.tsx (2)
152-159: Excellent fix! Slider now operates as a controlled range component.By wiring
value={range}andonValueChange={(value) => setRange(value)}, the Slider correctly renders dual handles for independent min/max selection. This directly resolves issue #123 where only a single handle was visible. The min/max/step configuration is appropriate for budget filtering.
162-168: LGTM! Range values display correctly with proper formatting.The display reads
range[0]andrange[1]to show the current min/max budget values. UsingtoLocaleString()ensures numbers render with thousand separators (e.g., "$1,000" instead of "$1000"), improving readability.
Closes #123
📝 Description
This PR resolves the issue in the Sponsorship Matchmaking dashboard where the Budget Range slider displayed only a single handle, preventing users from selecting both minimum and maximum budget values.
The slider component has now been updated to include two round handles — one for the minimum value and one for the maximum value — allowing accurate range selection and better user control.
🔧 Changes Made
📷 Screenshots or Visual Changes (if applicable)
Before
After
Inpact.mp4
How to Test:
✅ Checklist
Additional Notes:
This update enhances user experience in the sponsorship filtering process by enabling precise budget range selection, aligning with expected modern dashboard functionality.
Summary by CodeRabbit
Refactor
Style