Overview
TheOrderCard component renders an individual order as a visually distinct card within the kanban board. It displays essential order information including partner details, order number, priority level, and active timer, with color-coded styling based on the order’s current status.
Props Interface
The order data object containing all information to display.OrderListDto Structure:
Optional callback function invoked when the card is clicked. Typically used to open order details.
When
true, applies special styling for drag overlay rendering. Used during drag-and-drop operations.Visual Features
Status Colors
Each order status has a unique color scheme for instant visual recognition
Priority Badge
High-priority orders display a prominent badge
Active Timer
Shows how long the order has been in its current status
Partner Logo
Displays partner branding when available
Status-Based Styling
The component applies different CSS classes based on the order status:- RECEIVED
- CONFIRMED
- PREPARING
- READY
- PICKED_UP
- DELIVERED
- CANCELLED
Initial status when an order enters the system. Typically styled with a neutral or info color.
Component Structure
Content Layout
Main Content
The card displays information in a structured layout:Partner Name
Displays the restaurant or partner name at the top of the card.Order Number
Shows the human-readable order display number prefixed with “Orden:”.Priority Badge
- High Priority
- Normal Priority
Active Timer
Conditionally rendered when an order has an active timer:The timer uses the
formatHour helper to display elapsed time in a human-readable format (e.g., “12:34”).Partner Logo
When available, displays the partner’s logo:Images use lazy loading to improve initial page load performance.
Click Handling
The card implements click event handling with propagation control:stopPropagation?
The event propagation is stopped to prevent triggering parent drag-and-drop handlers when clicking the card. This allows:
- Clicking to open order details
- Dragging to move the order
Priority Logic
- Badge text (“Alta” vs “Normal”)
- Badge styling (distinct colors)
- Visual prominence in the UI
Usage Examples
Basic Usage
As Drag Overlay
With Order Details Modal
Styling Considerations
The component uses CSS modules for scoped styling:s.card: Base card styless.content: Content container layouts.partnerName: Partner name typographys.orderNumber: Order number displays.priority: Priority badge base styless.priorityHigh: High priority badge stylings.priorityNormal: Normal priority badge stylings.time: Timer display containers.clockIcon: Clock emoji stylings.logoWrapper: Partner logo containers.overlay: Special styling for drag overlay
Integration Points
Base Components
- Card: Base card component providing elevation and sizing
- clsx: Utility for conditional class composition
Helpers
- formatHour: Formats timer values into human-readable time strings
Types
- OrderListDto: Order data transfer object
- OrderStatus: Enumeration of valid order statuses
Accessibility
Consider adding ARIA attributes for improved accessibility:
role="button"when onClick is providedaria-labeldescribing the ordertabIndex={0}for keyboard navigation
Related Components
- Kanban: Parent kanban board
- Riders: Alternative card for picked-up orders
- Column: Container for order cards (internal component)
Source Location
components/card/OrderCard.tsx:1