This document outlines all the changes made to the CSR (Corporate Social Representative) dashboard to improve functionality and user experience.
- β
Removed Scoreboard Statistics
- Removed stats state for:
totalShortlisted,inProgress,completed,declined,totalHoursVolunteered - Removed API call to
/api/shortlist/stats - Removed 5-card statistics grid from UI
- Cleaned up all dependencies
- Removed stats state for:
- Quick action buttons to Browse Requests, My Shortlist, and History
- Recent shortlist table (last 5 items)
- Clean, minimal dashboard without stats clutter
- β Replaced Old Filter System with modern search functionality
- β Implemented Visual Card Grid Layout (matching PIN dashboard design)
- β Added Heart Icon for Shortlisting (π€ = not shortlisted, β€οΈ = shortlisted)
- β Real-time Shortlist Toggle without page refresh
- Keyword Search: Search by title or description
- Service Type Filter: Dropdown with all 10 service types
- Results Counter: Shows number of filtered results
- Clear Filters Button: Reset all filters at once
- 3-column responsive grid (1 column mobile, 2 tablet, 3 desktop)
- Request images displayed at top of each card
- Heart icon toggle in card header for instant shortlist add/remove
- Key information displayed:
- π Service Type
- π Region (Singapore neighborhoods)
- π Requested By Date
- "View Details" button links to full opportunity page
- Fetches all ACTIVE PIN requests from database
- Tracks which requests are already shortlisted
- Toggle shortlist status with heart icon click
- Client-side filtering for instant results
- Success/error messages for user feedback
- β Old filter inputs (category, priority, location_city)
- β Pagination system (replaced with client-side filtering)
- β Priority badges
- β "Add to Shortlist" button (replaced with heart icon)
This is a brand new page for viewing complete details of volunteering opportunities.
- Full-width image display of the request
- Complete request information:
- Title and status badge
- Full description
- Service type with icon
- Region/location
- Requested by date
- Requester's name (PIN user)
- Posted date
- Heart icon toggle for shortlisting (same as browse page)
- Two action buttons:
- Primary: Add/Remove from Shortlist
- Secondary: Back to Browse
- Real-time shortlist status with visual feedback
- Accessible from browse page cards via "View Details" button
- URL pattern:
/csr/browse/[request-id]
- Service Type Dropdown: Filter by specific service type
- Date Range Picker:
- From Date input
- To Date input
- Filters based on
requested_by_date(not shortlist date)
- Results Counter: Shows filtered item count
- Clear Filters Button: Reset all filters
- Combines service type AND date range (both must match if set)
- Client-side filtering for instant results
- Preserves status tab filtering
- Status filter tabs (All, Shortlisted, In Progress, Completed, Declined)
- Edit mode for updating status, notes, and hours
- Remove from shortlist functionality
- View complete request details in expanded view
Browse Page:
- serviceTypes: Array of service type objects from API
- shortlistedIds: Array of request IDs that are shortlisted
- searchKeyword: String for text search
- searchServiceType: String for service type filter
- filteredRequests: Computed array of filtered resultsShortlist Page:
- serviceTypes: Array of service type objects from API
- searchServiceType: String for service type filter
- startDate: Date string for range start
- endDate: Date string for range end
- filteredShortlist: Computed array of filtered resultsGET /api/requests- Fetch ACTIVE requests (with status param)GET /api/requests/service-types- Fetch service type dropdown optionsGET /api/shortlist- Fetch user's shortlisted itemsPOST /api/shortlist- Add request to shortlist (body: {request_id})DELETE /api/shortlist/{id}- Remove from shortlistGET /api/requests/{id}- Fetch single request details
Browse Page (Keyword + Service Type):
const filteredRequests = requests.filter(request => {
const matchesKeyword = !searchKeyword ||
request.title?.toLowerCase().includes(searchKeyword.toLowerCase()) ||
request.description?.toLowerCase().includes(searchKeyword.toLowerCase());
const matchesServiceType = !searchServiceType ||
request.service_type === searchServiceType;
return matchesKeyword && matchesServiceType;
});Shortlist Page (Service Type + Date Range):
const filteredShortlist = shortlist.filter(item => {
const matchesServiceType = !searchServiceType ||
item.requests?.service_type === searchServiceType;
const matchesDateRange = (() => {
if (!startDate && !endDate) return true;
const requestDate = new Date(item.requests?.requested_by_date);
if (startDate && new Date(startDate) > requestDate) return false;
if (endDate && new Date(endDate) < requestDate) return false;
return true;
})();
return matchesServiceType && matchesDateRange;
});- White background with rounded corners and shadow
- Hover effect: Shadow increases on hover
- Image section: 192px height, covers entire card width
- Content padding: 24px (p-6)
- Icon usage: Consistent emoji icons for service type, region, date
- Primary: Purple (#7C3AED) for CSR-related actions
- Success: Green for completed items
- Info: Blue for in-progress items
- Danger: Red for declined/remove actions
- Heart Icon: π€ (white) for not shortlisted, β€οΈ (red) for shortlisted
- Mobile (default): 1 column grid
- Tablet (md: 768px+): 2 columns
- Desktop (lg: 1024px+): 3 columns
| Feature | Before | After |
|---|---|---|
| Dashboard Stats | 5 stat cards (shortlisted, in progress, completed, declined, hours) | Clean dashboard with quick actions only |
| Browse Layout | Simple table/list | Visual card grid with images |
| Shortlist Action | Button with text | Heart icon toggle (instant visual feedback) |
| Search | Basic text inputs | Keyword search + service type dropdown |
| Filters | Apply/Clear buttons needed | Instant client-side filtering |
| View Details | Not available | Dedicated details page with full info |
| Shortlist Filters | Status tabs only | Status + Service Type + Date Range |
| Navigation | Linear flow | Flexible with breadcrumb-style back buttons |
- CSR logs in β Sees clean dashboard with quick actions
- Clicks "Browse Requests" β Visual grid of opportunities with images
- Searches/Filters β Results update instantly
- Clicks heart icon β Added to shortlist (no page reload)
- Clicks "View Details" β Full information page
- Navigates to "My Shortlist" β Filtered view of saved opportunities
- Filters by service type/date β Sees relevant opportunities
- Updates status β Tracks progress through volunteering stages
The refactoring uses existing database tables and relationships:
- requests: PIN requests with ACTIVE status
- service_types: 10 volunteer-focused service types (IDs 7-16)
- shortlist (assumed to exist): Junction table for CSR-request relationships
- users: PIN and CSR user information
- requests.service_type: TEXT field (should match service_types.service_name)
- requests.region: TEXT field (renamed from location_city)
- requests.requested_by_date: DATE field for filtering
- requests.image_url: TEXT field for card images
- requests.status: ENUM (ACTIVE, SUSPENDED, FULFILLED, CANCELLED)
- β Loads all ACTIVE requests
- β Service type dropdown populates correctly
- β Keyword search filters title and description
- β Service type filter works
- β Combined filters work together
- β Clear filters resets search
- β Heart icon toggles between π€ and β€οΈ
- β Heart icon state persists across page refreshes
- β "View Details" navigates to correct page
- β Images load correctly (or hide gracefully if missing)
- β Loads request details correctly
- β Displays full image
- β Shows all request information
- β Heart icon reflects current shortlist status
- β Add/Remove from shortlist works
- β "Back to Browse" navigates correctly
- β Handles missing request (404) gracefully
- β Status tabs filter correctly
- β Service type dropdown populates
- β Service type filter works
- β Date range filtering works (from date only)
- β Date range filtering works (to date only)
- β Date range filtering works (both dates)
- β Combined filters work together
- β Clear filters resets all inputs
- β Results counter updates correctly
- β Edit mode still works for status updates
- β Scoreboard stats removed
- β Quick action buttons navigate correctly
- β Recent shortlist table loads
- β No console errors
- Shortlist API Assumption: Code assumes shortlist endpoints exist and return expected data structure
- Image Handling: Images fail silently if not found (could add placeholder)
- Pagination: Removed in favor of client-side filtering (may need server-side pagination for large datasets)
- Real-time Updates: Changes to shortlist don't automatically reflect in other open tabs
- Pagination: Add server-side pagination if request count exceeds 100+
- Image Placeholders: Add default images for requests without photos
- Advanced Filters: Add region filter to browse page
- Sort Options: Sort by date, service type, or alphabetically
- Bulk Actions: Select multiple requests to shortlist at once
- Notifications: Alert CSR when new opportunities match their interests
- Calendar View: View opportunities on a calendar by requested_by_date
- Export: Export shortlist to PDF or CSV
- All functionality uses existing API endpoints
- Database schema unchanged
- No new migrations needed
- Ensure all service types exist in database (IDs 7-16)
- Verify shortlist API endpoints are working
- Test image upload paths (
/static/uploads/requests/) - Clear browser cache to load new components
- Test on multiple screen sizes (mobile, tablet, desktop)
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Requires JavaScript enabled
- CSS Grid and Flexbox support
- src/app/csr/page.js - Removed scoreboard stats
- src/app/csr/browse/page.js - Complete refactor with visual cards and search
- src/app/csr/browse/[id]/page.js - NEW FILE - Details page
- src/app/csr/shortlist/page.js - Added service type and date range filters
The CSR dashboard has been successfully refactored to provide:
- β Cleaner Interface: Removed cluttered stats cards
- β Better Search: Keyword + service type filtering
- β Visual Design: Card grid with images matching PIN dashboard
- β Instant Shortlisting: Heart icon toggle without page reload
- β Complete Information: Dedicated details page for opportunities
- β Advanced Filtering: Service type and date range filters for shortlist
All changes maintain consistency with the PIN dashboard design while adding CSR-specific features like shortlisting and status tracking.