Skip to content

feat: update booking#40

Merged
laithanhhung merged 1 commit into
mainfrom
booking-v2
Nov 12, 2025
Merged

feat: update booking#40
laithanhhung merged 1 commit into
mainfrom
booking-v2

Conversation

@laithanhhung

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 12, 2025 06:17
@naming-conventions-bot

Copy link
Copy Markdown

Thank you for following naming conventions! 😻

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ev-rental with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0e0690b
Status: ✅  Deploy successful!
Preview URL: https://aaacace3.ev-rental.pages.dev
Branch Preview URL: https://booking-v2.ev-rental.pages.dev

View logs

@laithanhhung laithanhhung merged commit 3105fea into main Nov 12, 2025
9 checks passed
@laithanhhung laithanhhung deleted the booking-v2 branch November 12, 2025 06:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the booking flow's step navigation logic and removes the back button from the checkout page.

  • Improved afterNextRender lifecycle management with proper cleanup and phase usage
  • Changed fragment update behavior and payment reset logic in step transitions
  • Removed the "Quay lại" (back) button from the checkout page main view

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/app/features/customer/booking/pages/cars-page/cars-page.ts Refactored setActiveStep method to use write phase for DOM updates, improved render callback cleanup with pendingRenderRef tracking, and consolidated payment reset logic
src/app/features/customer/booking/pages/checkout/checkout.html Commented out the "Quay lại" (back) button in the main checkout actions section

if (key) {
this.updateFragment(key);
const actualIndex = this.matStepper.selectedIndex;
if (shouldUpdateFragment || actualIndex !== desiredIndex) {

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition for updating the fragment has changed behavior. Previously, the fragment would only be updated when shouldUpdateFragment was true. Now it also updates when actualIndex !== desiredIndex, even if updateFragment: false was explicitly passed. This could cause unintended fragment updates when the stepper index reconciliation happens, potentially conflicting with the updateFragment: false option used in the fragment subscriber (line 104).

Suggested change
if (shouldUpdateFragment || actualIndex !== desiredIndex) {
if (shouldUpdateFragment) {

Copilot uses AI. Check for mistakes.
this.activeStep.set(actualIndex);
}

if (targetIsStart || (shouldResetPayment && actualIndex <= 1)) {

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The payment reset logic has changed. Previously, paymentStarted would be reset to false when boundedIndex <= 1 and moving backward. Now it checks actualIndex <= 1 instead. This means if the stepper cannot navigate to the desired index (e.g., validation prevents it), the payment state might not be reset as expected. Consider using boundedIndex <= 1 in the condition to maintain the original behavior.

Suggested change
if (targetIsStart || (shouldResetPayment && actualIndex <= 1)) {
if (targetIsStart || (shouldResetPayment && boundedIndex <= 1)) {

Copilot uses AI. Check for mistakes.
Comment on lines 176 to 178
if (currentIndex >= this.steps.length - 1) {
return;
}

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Blank lines removed between validation checks reduce readability. Consider keeping the blank lines to visually separate the different validation conditions for better code maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +163 to +171
<!-- <button
matButton="outlined"
type="button"
(click)="previousStep.emit()"
[disabled]="isLoading()"
aria-label="Quay lại"
>
Quay lại
</button>
</button> -->

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing the commented-out code instead of leaving it in the codebase. Commented code can cause confusion and clutter. If you need to preserve this for reference, rely on version control history instead.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants