Skip to content

Fix/client ux UI - #120

Merged
binhminh021106 merged 3 commits into
devfrom
fix/client-ux-ui
Jul 19, 2026
Merged

binhminh021106 merged 3 commits into
devfrom
fix/client-ux-ui

Conversation

@HoangHieu21201

@HoangHieu21201 HoangHieu21201 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

cải thiện trải nghiệm người dùng, tránh gián đoạn trải nghiệm khi phải đăng nhập.

Summary by CodeRabbit

  • Tính năng mới

    • Bổ sung quy trình đăng nhập Google với trạng thái tải, đồng bộ giỏ hàng và khôi phục đúng trang trước đó.
    • Tự động đưa người dùng quay lại trang đang xem sau khi đăng nhập từ các khu vực yêu cầu xác thực.
    • Đồng bộ trạng thái đăng nhập, giỏ hàng và bộ nhớ tạm khi đăng nhập hoặc đăng xuất.
  • Cải tiến giao diện

    • Làm mới banner, biểu mẫu liên hệ, danh mục sản phẩm và các nút xác thực.
    • Cải thiện thông báo yêu cầu đăng nhập và hiệu ứng hiển thị.
  • Tài liệu

    • Bổ sung quy tắc an toàn cho các thao tác Git, terminal và cơ sở dữ liệu có khả năng xóa dữ liệu.

@HoangHieu21201 HoangHieu21201 added the enhancement New feature or request label Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@HoangHieu21201, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f3b612d-57ca-4ff5-ad8b-13921d7ef2e8

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf6e00 and acb47e1.

📒 Files selected for processing (9)
  • frontend/src/App.vue
  • frontend/src/components/ui/ProductCard.vue
  • frontend/src/components/ui/ProfileSidebar.vue
  • frontend/src/components/ui/QuickAddModal.vue
  • frontend/src/components/user/Header.vue
  • frontend/src/composables/useAuthSync.js
  • frontend/src/pages/user/auth/CallBackGoogle.vue
  • frontend/src/pages/user/auth/Login.vue
  • frontend/src/pages/user/shop/Index.vue
📝 Walkthrough

Walkthrough

PR cập nhật luồng đăng nhập Google, điều hướng quay lại sau xác thực, đồng bộ cache và trạng thái đăng xuất. Ngoài ra, nhiều trang người dùng được làm mới giao diện, cùng với quy tắc an toàn mới trong AGENTS.md.

Changes

Luồng xác thực và trạng thái phiên

Layer / File(s) Summary
Nền tảng cache và đồng bộ đăng nhập
frontend/src/main.js, frontend/src/components/ui/ProfileSidebar.vue, frontend/src/components/user/Header.vue
Cấu hình Vue Query, dọn cache khi đăng xuất và đồng bộ trạng thái người dùng qua sự kiện auth-status-changed.
Xử lý callback Google
frontend/src/pages/user/auth/CallBackGoogle.vue, frontend/src/pages/user/auth/Login.vue, frontend/src/App.vue
Callback chuyển token sang App.vue để hiển thị trạng thái, tải người dùng, hợp nhất giỏ hàng và cập nhật cache.
Điều hướng quay lại sau đăng nhập
frontend/src/components/user/Header.vue, frontend/src/composables/useWishlist.js, frontend/src/pages/user/checkout/Index.vue, frontend/src/pages/user/combo/Detail.vue, frontend/src/pages/user/favourite/Index.vue, frontend/src/utils/apiClient.js, frontend/src/utils/clientApiClient.js
Các luồng đăng nhập và interceptor 401 truyền đường dẫn hiện tại qua redirect; Login xử lý đích quay lại và chặn /admin.

Cập nhật giao diện người dùng

Layer / File(s) Summary
Kiểu dùng chung và giao diện xác thực
frontend/src/App.vue, frontend/src/components/user/Header.vue, frontend/src/pages/user/auth/Login.vue, frontend/src/pages/user/auth/Register.vue
Bổ sung kiểu gradient và cập nhật nhãn, nút cùng khoảng cách của giao diện xác thực.
Cập nhật banner các trang nội dung
frontend/src/pages/user/about/Index.vue, frontend/src/pages/user/combo/Index.vue, frontend/src/pages/user/goldPrices/GoldPrice.vue, frontend/src/pages/user/news/Index.vue, frontend/src/pages/user/services/Index.vue
Thay đổi nội dung, typography, bố cục banner và giảm chiều cao tối thiểu mặc định xuống 340px.
Giao diện liên hệ và danh mục
frontend/src/pages/user/contact/Index.vue, frontend/src/pages/user/shop/Index.vue
Cập nhật hero, thẻ thông tin, biểu mẫu liên hệ, banner shop và các thành phần danh mục premium.

Quy tắc an toàn cho agent

Layer / File(s) Summary
Chính sách lệnh phá hủy
AGENTS.md
Bổ sung yêu cầu xác nhận trước khi chạy lệnh Git, lệnh cơ sở dữ liệu phá hủy hoặc lệnh xóa dữ liệu.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GoogleOAuth
  participant CallBackGoogle
  participant AppVue
  participant UserAPI
  GoogleOAuth->>CallBackGoogle: Trả token OAuth
  CallBackGoogle->>AppVue: Chuyển token qua google_token
  AppVue->>UserAPI: Gọi /user
  AppVue->>UserAPI: Gọi /client/cart/merge nếu có cart_session_id
  AppVue->>AppVue: Cập nhật cache và phát auth-status-changed
Loading

Possibly related PRs

Suggested reviewers: dien-0903, binhminh021106

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive Tiêu đề quá chung chung và không nêu rõ thay đổi chính, chỉ phản ánh mơ hồ về UX/UI phía client. Đổi sang tiêu đề cụ thể hơn, nêu trọng tâm như luồng đăng nhập/redirect sau đăng nhập hoặc đồng bộ trạng thái auth.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/client-ux-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
frontend/src/pages/user/shop/Index.vue (1)

1638-1646: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Loại bỏ CSS trùng lặp cho text-gold-gradient.

Class .text-gold-gradient đã được định nghĩa toàn cục trong App.vue (kèm theo các cờ !important). Việc định nghĩa lại ở đây là không cần thiết và vi phạm nguyên tắc DRY. Bạn nên xóa khối CSS này để sử dụng style dùng chung của ứng dụng.

♻️ Đề xuất sửa đổi
-/* PREMIUM BANNER CSS */
-.text-gold-gradient {
-  background: linear-gradient(135deg, `#e7ce7d` 0%, `#f9f0d1` 50%, `#d4af37` 100%);
-  -webkit-background-clip: text;
-  background-clip: text;
-  color: transparent;
-  text-shadow: 0 2px 10px rgba(231, 206, 125, 0.2);
-  padding: 0.2em 0;
-  line-height: 1.3;
-}
-
 .premium-category-item {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/user/shop/Index.vue` around lines 1638 - 1646, Remove the
local .text-gold-gradient CSS block from the page styles in Index.vue, allowing
the shared global definition in App.vue to provide the styling.
frontend/src/App.vue (1)

79-101: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Logic vòng đời phiên đăng nhập/đăng xuất bị lặp lại độc lập ở 4 nơi, đã gây lệch hành vi.

Cả bốn vị trí đều tự triển khai riêng phần "đồng bộ sau đăng nhập" hoặc "dọn dẹp khi đăng xuất" thay vì dùng một composable chung (useAuthSession chẳng hạn), và điều này đã tạo ra sự khác biệt quan sát được: App.vue nuốt lỗi merge-cart im lặng còn Login.vue log lỗi; Header.vue chỉ xoá 2 key localStorage khi đăng xuất còn ProfileSidebar.vue xoá toàn bộ localStorage/sessionStorage. Gộp các thao tác này vào một composable dùng chung sẽ loại bỏ nguy cơ lệch pha khi một trong các nơi được sửa mà quên sửa các nơi còn lại.

  • frontend/src/App.vue#L79-L101: trích xuất khối lưu token/fetch /user/merge cart/invalidate cache/dispatch event thành một hàm dùng chung (ví dụ syncAfterLogin(token)).
  • frontend/src/pages/user/auth/Login.vue#L142-L182: gọi cùng hàm syncAfterLogin thay vì lặp lại logic (bao gồm cả việc log lỗi merge-cart thống nhất).
  • frontend/src/components/user/Header.vue#L520-L537: dùng cùng hàm clearAuthSession() dùng chung với ProfileSidebar.vue để đảm bảo phạm vi xoá localStorage/sessionStorage nhất quán.
  • frontend/src/components/ui/ProfileSidebar.vue#L319-L327: dùng cùng hàm clearAuthSession() nói trên, quyết định rõ ràng phạm vi xoá (toàn bộ hay chỉ các key liên quan auth) áp dụng thống nhất cho cả hai nơi.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/App.vue` around lines 79 - 101, Gộp logic vòng đời phiên đăng
nhập/đăng xuất vào composable dùng chung với các hàm syncAfterLogin và
clearAuthSession, thống nhất xử lý lỗi merge-cart và phạm vi xoá storage. Tại
frontend/src/App.vue:79-101, trích xuất toàn bộ luồng đồng bộ sau đăng nhập; tại
frontend/src/pages/user/auth/Login.vue:142-182, gọi lại syncAfterLogin. Tại
frontend/src/components/user/Header.vue:520-537 và
frontend/src/components/ui/ProfileSidebar.vue:319-327, thay logic dọn dẹp riêng
bằng clearAuthSession và áp dụng cùng một phạm vi localStorage/sessionStorage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/user/auth/CallBackGoogle.vue`:
- Around line 1-34: Update the Google callback flow in CallBackGoogle.vue to
store the received token directly in localStorage under auth_token, set a
lightweight pending_google_sync flag for App.vue, and redirect with
router.replace(redirectPath) without adding google_token to the URL. Update
App.vue’s synchronization logic to detect pending_google_sync instead of reading
the raw token from route.query.google_token, while preserving existing error and
fallback redirects.

In `@frontend/src/pages/user/auth/Login.vue`:
- Around line 164-184: Normalize the redirect selection in the login success
flow before the setTimeout navigation: accept only a string relative path,
reject arrays, absolute or malformed URLs, and use '/' as the fallback. Do not
use redirect_after_login as a fallback for ordinary login, while preserving the
existing admin-route protection, cleanup, cache invalidation, event dispatch,
and router.push behavior in the surrounding login handler.

---

Nitpick comments:
In `@frontend/src/App.vue`:
- Around line 79-101: Gộp logic vòng đời phiên đăng nhập/đăng xuất vào
composable dùng chung với các hàm syncAfterLogin và clearAuthSession, thống nhất
xử lý lỗi merge-cart và phạm vi xoá storage. Tại frontend/src/App.vue:79-101,
trích xuất toàn bộ luồng đồng bộ sau đăng nhập; tại
frontend/src/pages/user/auth/Login.vue:142-182, gọi lại syncAfterLogin. Tại
frontend/src/components/user/Header.vue:520-537 và
frontend/src/components/ui/ProfileSidebar.vue:319-327, thay logic dọn dẹp riêng
bằng clearAuthSession và áp dụng cùng một phạm vi localStorage/sessionStorage.

In `@frontend/src/pages/user/shop/Index.vue`:
- Around line 1638-1646: Remove the local .text-gold-gradient CSS block from the
page styles in Index.vue, allowing the shared global definition in App.vue to
provide the styling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e17dba62-ff12-4b0d-8dff-4eb3ba425b0b

📥 Commits

Reviewing files that changed from the base of the PR and between 2134c8b and 4cf6e00.

📒 Files selected for processing (21)
  • AGENTS.md
  • frontend/src/App.vue
  • frontend/src/components/ui/ProfileSidebar.vue
  • frontend/src/components/user/Header.vue
  • frontend/src/composables/useWishlist.js
  • frontend/src/main.js
  • frontend/src/pages/user/about/Index.vue
  • frontend/src/pages/user/auth/CallBackGoogle.vue
  • frontend/src/pages/user/auth/Login.vue
  • frontend/src/pages/user/auth/Register.vue
  • frontend/src/pages/user/checkout/Index.vue
  • frontend/src/pages/user/combo/Detail.vue
  • frontend/src/pages/user/combo/Index.vue
  • frontend/src/pages/user/contact/Index.vue
  • frontend/src/pages/user/favourite/Index.vue
  • frontend/src/pages/user/goldPrices/GoldPrice.vue
  • frontend/src/pages/user/news/Index.vue
  • frontend/src/pages/user/services/Index.vue
  • frontend/src/pages/user/shop/Index.vue
  • frontend/src/utils/apiClient.js
  • frontend/src/utils/clientApiClient.js

Comment thread frontend/src/pages/user/auth/CallBackGoogle.vue
Comment thread frontend/src/pages/user/auth/Login.vue
@binhminh021106
binhminh021106 merged commit d1cef9f into dev Jul 19, 2026
1 check passed
@HoangHieu21201
HoangHieu21201 deleted the fix/client-ux-ui branch July 19, 2026 12:46
@coderabbitai coderabbitai Bot mentioned this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants