Overview
TheRiders component is a specialized card that displays courier (rider) information for orders in the “PICKED_UP” status. It shows rider details, order information, and a visual avatar, providing a distinct visual representation for orders currently with delivery couriers.
This component is used exclusively in the kanban board’s “PICKED_UP” column, replacing the standard OrderCard for better courier tracking.
Props Interface
The rider data object containing courier and order information.RiderDto Structure:
Optional callback function invoked when the card is clicked. Typically used to open order details or rider information.
RiderDto Fields
- id
- name
- orderId
- displayNumber
- riderNumber
- partnerName
Type:
stringUnique identifier for the rider/order combination. Used as the React key and for lookups.Component Structure
Visual Layout
The component uses a two-column layout:Left Column
Displays textual information:
- Partner name (if available)
- Order display number
- Courier name
- Rider number
Right Column
Shows a visual rider avatar for quick recognition
Information Display
Partner Name
Order Number
Rider Name
Rider Number
Click Handling
The component implements the same click handling pattern as OrderCard:Event propagation is stopped to prevent conflicts with drag-and-drop handlers. This allows clicking to view order details while still supporting drag operations.
Memoization
The component is wrapped with React’smemo for performance optimization:
- Prevents unnecessary re-renders when parent components update
- Improves performance in lists with many rider cards
- Only re-renders when props actually change
Usage in Kanban
The Riders component is used in the Kanban board for picked-up orders:Rider Data Transformation
Rider data is typically derived from orders with PICKED_UP status:Usage Examples
Basic Usage
With Order Details
In Drag Overlay
Styling
The component uses CSS modules for scoped styling:s.riderCard: Base card stylings.content: Main content containers.info: Information column layouts.partner: Partner name stylings.orderNumber: Order number displays.name: Rider name typographys.number: Rider number stylings.avatar: Avatar container positioning
Integration Points
Base Components
- Card: Provides the base card structure with elevation
- RiderAvatar: Visual avatar representation of the courier
- clsx: Utility for conditional class composition
Related Types
- RiderDto: Data transfer object for rider information
- OrderListDto: Source order data (transformed to RiderDto)
Visual Differentiation
The Riders component provides several advantages over using OrderCard for picked-up orders:Courier Focus
Emphasizes the courier rather than order status
Avatar Visual
Provides quick visual recognition with rider avatar
Rider Number
Includes rider-specific identification for tracking
Delivery Context
Better represents the delivery phase of the order lifecycle
Performance Considerations
- Memoization: Component is wrapped in
memo()to prevent unnecessary re-renders - Stable Props: Use stable callbacks (e.g.,
useCallback) for onClick to maintain memoization benefits - Lazy Avatar: RiderAvatar component likely implements its own optimization
Accessibility Recommendations
Consider enhancing accessibility with:
role="button"when onClick is providedaria-labeldescribing the rider and order (e.g., “Rider Juan Pérez, Order 1234”)tabIndex={0}for keyboard navigation- Focus indicators for keyboard users
Related Components
- Kanban: Parent component using Riders for picked-up orders
- OrderCard: Alternative card for non-picked-up orders
- DraggableRiderCard: Wrapper providing drag functionality (internal component)
Source Location
components/Riders/Riders.tsx:1