Skip to content

fix: fav page issues #60

Merged
eng-raghadsami merged 1 commit into
devfrom
hot-fixes
Mar 7, 2026
Merged

fix: fav page issues #60
eng-raghadsami merged 1 commit into
devfrom
hot-fixes

Conversation

@ShadiSbaih

@ShadiSbaih ShadiSbaih commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added wishlist functionality to save and manage favorite products.
    • Introduced admin dashboard for product and category management.
    • Implemented dynamic category attributes for flexible product listings.
  • Improvements

    • Made brand, model, and storage fields optional when creating listings.
    • Updated logo and visual branding across the platform.
    • Enhanced product detail pages with wishlist integration.

@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Mar 7, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR comprehensively adds wishlist functionality, refactors category attributes from static to dynamic API-driven definitions, makes certain listing form fields optional, replaces text logos with SVG assets across headers, and updates admin services for real API integration. Changes span UI components, services, form handling, and API endpoints.

Changes

Cohort / File(s) Summary
Favicon and Logo Assets
index.html, src/pages/.../ChangePasswordPage.tsx, src/pages/.../ForgotPasswordEmailPage.tsx, src/pages/.../ForgotPasswordPhonePage.tsx, src/pages/.../OtpEmailPage.tsx, src/components/layout/.../AuthHeader.tsx, src/components/layout/.../Footer/footer.tsx, src/components/layout/.../Header/header.tsx, src/components/layout/.../AdminSidebar/AdminSidebar.tsx
Replaced text-based logo placeholders and favicon (SVG) with imported SVG logo images throughout header, footer, and sidebar components. Updated favicon from SVG to PNG in index.html.
Wishlist Service and Hooks
src/services/wishlist.service.ts, src/dto/wishlist/index.ts
Added new wishlist service module with API normalization helpers, four public hooks (useWishlist, useAddToWishlist, useRemoveFromWishlist, useToggleWishlist), error handling for 409/404 responses, and toast integration. Defined WishlistItem DTO structure.
Wishlist API Endpoints
src/constants/api-endpoints.ts
Added WISHLIST namespace with GET, ADD, and REMOVE endpoints; expanded ADMIN section with PRODUCTS and CATEGORIES nested endpoints including list, detail, decision, hide/unhide, and category activation/deactivation.
Product Card and Listing UI
src/components/homePage/HomeProductCard.tsx, src/components/homePage/ListingSection.tsx, src/pages/ProductDetailPage/components/ListingSection.tsx, src/pages/ProductDetailPage/components/ProductGallery.tsx
Added status and className props to HomeProductCard with sold badge rendering; extended ListingSection to accept wishlistedIds and onToggleFavorite callbacks; added product routing via getProductRoute; added isFavorite and onToggleFavorite props to ProductGallery; updated ListingItem interface with id property.
Home and Product Detail Pages
src/pages/HomePage/HomePage.tsx, src/pages/ProductDetailPage/ProductDetailPage.tsx, src/pages/FavoritesPage/FavoritesPage.tsx
Integrated wishlist functionality with authentication checks and toggle handlers in HomePage; wired wishlist hooks into ProductDetailPage; refactored FavoritesPage to use API-driven wishlist data, skeleton loading, and empty states.
Form Schema and Listing Fields
src/components/forms/zod-schemas.ts, src/pages/AddListingPage/components/BasicDetailsStep.tsx, src/pages/AddListingPage/components/ReviewDialog.tsx
Made brand, model, and storage fields optional in ListingFormData (changed from required strings); updated zod schema validation to remove min-length constraints and required error messages.
Dynamic Category Attributes
src/pages/AddListingPage/AddListingPage.tsx, src/pages/AddListingPage/components/MoreDetailsStep.tsx
Refactored from static hard-coded fields to API-driven dynamic attributes using useCategoryDetail; introduced categoryDetailData, dynamicAttrValues state, and attribute synchronization; added category validation before submission; exported CategoryAttributeDetail interface; updated MoreDetailsStep to render dynamic inputs (select, textarea, number, text, location) based on backend attribute definitions.
Admin Categories Service
src/services/admin-categories.service.ts, src/pages/AdminCategoriesPage/AddCategoryPage.tsx, src/pages/AdminCategoriesPage/components/form/helpers.ts, src/types/admin.ts
Replaced mock-based category operations with real API calls; added data transformation helpers for attribute type/body conversion; introduced multipart/form-data payload building with iconFile support; updated toCategoryPayload signature and CreateCategoryPayload type to include optional iconFile field.
Admin Listings Service and Routes
src/services/admin-listings.service.ts, src/routes/routes.tsx
Replaced in-memory listing mutations with real API calls for approve, reject, hide, and unhide operations; updated getListingById to fetch from API; changed admin detail route path from /admin/products/:id to /admin/listings/:id.
Product Service Enhancements
src/services/product.service.ts
Expanded getCategoryDetail return type to include richer attribute fields (id, name, type, body, isRequired); introduced useCategoryDetail React Query hook with category ID gating and 10-minute staleTime configuration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • Api connecting #52: Modifies product/category service APIs (getCategoryDetail, product hooks), updates routes and API endpoint usage, and integrates API-backed listing flows in AddListingPage, indicating overlapping changes.
  • UI/home page #37: Extends HomeProductCard, ListingSection, and HomePage UI with wishlist, sold status, routing, and new prop signatures already introduced in that PR.
  • Feat/add listing #16: Modifies the same AddListing flow files (AddListingPage, BasicDetailsStep, MoreDetailsStep, ReviewDialog) and adjusts zod listingSchema in parallel.

Suggested labels

bug, refactor, needs-review

Suggested reviewers

  • eng-raghadsami
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'fix: fav page issues' is vague and does not clearly describe the scope of changes, which extend far beyond the FavoritesPage to include wishlist integration, admin features, category attributes, logo updates, and routing changes across multiple components. Replace with a more descriptive title that captures the primary objective, such as 'feat: implement wishlist integration with dynamic category attributes and admin enhancements' or break into multiple focused PRs if these represent independent features.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hot-fixes

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 and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed needs-review Waiting for code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants