Overview
The Rodando Driver app includes three specialized modal components for handling trip-related interactions. These components are built with Ionic Angular and use theModalController for presentation and dismissal.
TripAssignedModalComponent
Displays trip details when a new trip is assigned to a driver, with a countdown timer for acceptance.Component Metadata
The component selector
Standalone component that can be imported directly
Uses OnPush change detection for optimal performance
Features
- Countdown timer: Shows remaining seconds to accept/decline the trip
- Trip summary: Displays distance and duration estimates
- Route visualization: Shows origin and destination addresses with icons
- Payment information: Displays payment method and estimated price
- Action buttons: Accept or Decline buttons that integrate with
TripFacade
State Management
The component uses NgRx facade pattern:Modal View Model
ThemodalVm signal provides:
Remaining seconds for the driver to respond
Formatted distance text (e.g., “5.2 km”)
Formatted duration text (e.g., “15 min”)
Origin address or location name
Destination address or location name
Formatted price text with currency
Methods
Accepts the trip offer by calling
facade.acceptOffer()Declines the trip offer by calling
facade.declineOffer()Usage Example
DriverConfirmOrderModalComponent
Allows drivers to confirm payment collection at the end of a trip, including base fare, waiting charges, and payment method.Component Metadata
The component selector
Standalone component that can be imported directly
Input Properties
Passenger Information
The name of the passenger for this trip
Route Information
The origin address or location name
The destination address or location name
Formatted distance text (e.g., “8.5 km”)
Formatted duration text (e.g., “20 min”)
Pricing Information
The base fare amount for the trip
Additional charge for waiting time, if applicable
Total amount to charge the passenger
Currency code for displaying amounts
Waiting Information
Optional reason for the waiting charge
Number of seconds the driver waited
Payment Method
The payment method for this trip
Computed Properties
Returns
true if there is a waiting charge greater than zeroFormats
waitingSeconds as mm:ss (e.g., “05:30”)Methods
Dismisses the modal with
{ confirmed: false } and role 'cancel'Dismisses the modal with
{ confirmed: true } and role 'confirm'Usage Example
DriverWaitingPenaltyModalComponent
Notifies the driver about waiting penalties when a passenger delays pickup, showing real-time waiting duration and associated charges.Component Metadata
The component selector
Standalone component that can be imported directly
Input Properties
Passenger Information
The name of the passenger
Pricing Information
The base fare for the trip
The additional waiting penalty charge
Total fare including waiting penalty
Currency code for displaying amounts
Waiting Information
Current waiting duration in seconds (can be updated in real-time)
Optional reason for the waiting situation
Properties
Formatted waiting time display in mm:ss format
Lifecycle Hooks
Initializes the clock display on component initialization
Updates the clock display when
waitingSeconds input changes, enabling real-time updatesMethods
Dismisses the modal with
{ action: 'confirm' } - driver confirms the waiting penaltyDismisses the modal with
{ action: 'reject' } - driver disputes the waiting penaltyPrivate Methods
Updates the
clock property by converting waitingSeconds to mm:ss formatUsage Example
Real-time Updates
The component implementsOnChanges to support real-time waiting time updates:
waitingSeconds changes.
Common Patterns
Modal Styling
All trip modal components can be customized with CSS classes:Handling Dismissal
All modals return data on dismissal:Preventing Dismissal
For critical decisions, prevent backdrop dismissal:Source Code References
- TripAssignedModalComponent:
src/app/shared/components/trip-assigned-modal.component/ - DriverConfirmOrderModalComponent:
src/app/shared/components/driver-confirm-order-modal/ - DriverWaitingPenaltyModalComponent:
src/app/shared/components/driver-waiting-penalty-modal/