Skip to content

feat: add interactive product star rating#56

Merged
bartstc merged 1 commit into
corefrom
feat/rate-product
Apr 17, 2026
Merged

feat: add interactive product star rating#56
bartstc merged 1 commit into
corefrom
feat/rate-product

Conversation

@bartstc
Copy link
Copy Markdown
Owner

@bartstc bartstc commented Apr 17, 2026

Summary

  • Adds PATCH /api/marketing/products/:id/rate mutation with optimistic cache update and automatic rollback on failure
  • Introduces useRateProduct use-case hook with auth guard, session-scoped hasRated disable, and success/error/unauthenticated toast notifications
  • Makes StarRating interactive: clicking a star submits a 1–5 rating, stars are disabled while the mutation is pending or after a successful submission, and hovering highlights stars 1–N in yellow with a smooth transition

@github-actions
Copy link
Copy Markdown

Summary

Summary
Generated on: 04/17/2026 - 22:27:16
Parser: MultiReport (2x LCov)
Assemblies: 1
Classes: 174
Files: 174
Line coverage: 65.9% (793 of 1203)
Covered lines: 793
Uncovered lines: 410
Coverable lines: 1203
Total lines: 6776
Branch coverage: 49.4% (236 of 477)
Covered branches: 236
Total branches: 477
Method coverage: Feature is only available for sponsors
Tag: 348_24589355383

Coverage

Default - 65.9%
Name Line Branch
Default 65.9% 49.4%
src/app/App.tsx 0% 0%
src/app/design/ColorModeProvider.tsx 100%
src/app/design/DesignProvider.tsx 100%
src/app/Providers.tsx 0%
src/features/auth/application/auth-store.ts 71.8% 71.4%
src/features/auth/application/AuthProvider.tsx 0%
src/features/auth/application/RequireAuth.tsx 33.3% 0%
src/features/auth/application/RequirePub.tsx 33.3% 0%
src/features/auth/application/with-require-auth.tsx 50%
src/features/auth/application/with-require-pub.tsx 50%
src/features/auth/components/SignInForm.tsx 90.9%
src/features/auth/components/use-sign-in-notifications.ts 100%
src/features/authv2/application/auth-context.tsx 0% 0%
src/features/authv2/application/auth-machine.ts 88.8% 50%
src/features/authv2/application/AuthProvider.tsx 0% 0%
src/features/authv2/application/storage-machine.ts 0% 0%
src/features/authv2/application/use-authorized-context-selector.ts 0%
src/features/authv2/models/permissions.ts 100%
src/features/authv2/models/user-roles.ts 100%
src/features/authv2/providers/get-roles.ts 0%
src/features/carts/application/use-add-to-cart-notifications.ts 71.4%
src/features/carts/application/use-add-to-cart.ts 59% 16.6%
src/features/carts/application/use-clear-cart-notifications.ts 87.5%
src/features/carts/application/use-clear-cart.ts 84.6% 50%
src/features/carts/application/use-product-added-dialog-store.ts 100%
src/features/carts/application/use-purchase-notifications.ts 87.5%
src/features/carts/application/use-purchase.ts 81.8%
src/features/carts/components/AddToCartButton/AddToCartButton.tsx 100% 100%
src/features/carts/components/AddToCartButton/ProductAddedDialog.tsx 72.7% 0%
src/features/carts/components/CartItem.tsx 77.7%
src/features/carts/components/CartsList.tsx 90%
src/features/carts/components/CheckoutButton/CheckoutButton.tsx 100%
src/features/carts/components/CheckoutButton/CheckoutDialog.tsx 80% 0%
src/features/carts/components/CheckoutButton/use-purchase-dialog-store.ts 100%
src/features/carts/components/CheckoutForm.tsx 100% 50%
src/features/carts/components/ClearCartButton/ClearCartButton.tsx 100%
src/features/carts/components/ClearCartButton/ConfirmClearCartDialog.tsx 87.5% 25%
src/features/carts/components/ClearCartButton/use-confirm-clear-cart-dialog
-store.ts
100%
src/features/carts/providers/use-cart-products-query.ts 50%
src/features/demo/application/use-counter.ts 100%
src/features/demo/components/Demo.tsx 83.3%
src/features/marketing/components/FeatureSection.tsx 28.5%
src/features/marketing/components/HeroSection.tsx 40%
src/features/marketing/components/PricingSection.tsx 28.5%
src/features/products/application/use-rate-product-notifications.ts 70%
src/features/products/application/use-rate-product.ts 46.6% 0%
src/features/products/components/ProductCard.tsx 71.4%
src/features/products/components/ProductDetails.tsx 100% 50%
src/features/products/components/ProductNotFoundResult.tsx 80%
src/features/products/components/ProductsList.tsx 100% 100%
src/features/products/components/StarRating.tsx 75% 60%
src/features/products/components/use-category-label.ts 100% 50%
src/features/products/providers/product-query.ts 50%
src/features/products/providers/products-query.ts 100%
src/features/products/providers/use-marketing-product-query.ts 50%
src/lib/api/auth/login/login-mutation.ts 100%
src/lib/api/auth/users/{user-id}/user-query.ts 100%
src/lib/api/carts/{cart-id}/add-to-cart-mutation.ts 41.1% 0%
src/lib/api/carts/{cart-id}/cart-products-query.ts 50% 0%
src/lib/api/carts/{cart-id}/cart-query.ts 0%
src/lib/api/carts/{cart-id}/clear-cart-mutation.ts 80%
src/lib/api/carts/{cart-id}/purchase-mutation.ts 100%
src/lib/api/carts/cart-query-keys.ts 80%
src/lib/api/marketing/{product-id}/marketing-product-query.ts 33.3%
src/lib/api/marketing/{product-id}/use-rate-product-mutation.ts 23.8% 0%
src/lib/api/marketing/marketing-query-keys.ts 33.3%
src/lib/api/products/{product-id}/product-dto.ts 100%
src/lib/api/products/{product-id}/product-query.ts 100%
src/lib/api/products/products-list/products-list-query.ts 100% 50%
src/lib/api/products/products-query-keys.ts 100%
src/lib/assert-value.ts 100% 100%
src/lib/build-url.ts 75% 50%
src/lib/components/ErrorBoundary/ErrorBoundary.tsx 40% 16.6%
src/lib/components/ErrorBoundary/with-error-boundary.tsx 0%
src/lib/components/Form/conditional-rendering.ts 81.2% 50%
src/lib/components/Form/configuration.ts 57.1% 80%
src/lib/components/Form/fields/MoneyInput.tsx 100% 88.8%
src/lib/components/Form/fields/NumberInput.tsx 100% 77.7%
src/lib/components/Form/fields/SelectInput.tsx 100% 100%
src/lib/components/Form/fields/TextareaInput.tsx 100% 100%
src/lib/components/Form/fields/TextInput.tsx 100% 100%
src/lib/components/Form/fields/use-error-message.ts 100%
src/lib/components/Form/fields/utils.ts 100% 50%
src/lib/components/Form/form-context.ts 83.3% 50%
src/lib/components/Form/FormProvider.tsx 100%
src/lib/components/Form/map-grid-props.ts 40% 10%
src/lib/components/Form/presentation/CurrencyInput.tsx 100% 50%
src/lib/components/Form/presentation/FormField.tsx 100% 42.8%
src/lib/components/Form/presentation/NumberInput.tsx 100%
src/lib/components/Form/presentation/SelectInput.tsx 80% 61.7%
src/lib/components/Form/use-form.ts 100%
src/lib/components/Icon/Icon.tsx 0% 0%
src/lib/components/Layout/Footer/index.tsx 100%
src/lib/components/Layout/Footer/Logo.tsx 100%
src/lib/components/Layout/Layout.tsx 0%
src/lib/components/Layout/Navbar/DesktopNav.tsx 100% 75%
src/lib/components/Layout/Navbar/index.tsx 95.8% 87.5%
src/lib/components/Layout/Navbar/LoaderBar.tsx 80% 50%
src/lib/components/Layout/Navbar/MobileNav.tsx 100% 87.5%
src/lib/components/Layout/Navbar/use-nav-items.ts 100% 100%
src/lib/components/Layout/Page.tsx 100% 100%
src/lib/components/Layout/PageHeader.tsx 100% 100%
src/lib/components/Layout/ToggleModeButton.tsx 100% 100%
src/lib/components/Modal/create-modal-store.ts 100% 100%
src/lib/components/Result/Buttons/ContactUsButton.tsx 100%
src/lib/components/Result/Buttons/ResetFiltersButton.tsx 100%
src/lib/components/Result/EmptyStateResult.tsx 100%
src/lib/components/Result/ErrorPageStrategy.tsx 0% 0%
src/lib/components/Result/Icons/ErrorIcon.tsx 100%
src/lib/components/Result/Icons/InfoIcon.tsx 0%
src/lib/components/Result/Icons/SuccessIcon.tsx 0%
src/lib/components/Result/Icons/WarningIcon.tsx 100%
src/lib/components/Result/InternalErrorResult.tsx 100%
src/lib/components/Result/InternalServerErrorResult.tsx 100%
src/lib/components/Result/NotFoundResult.tsx 100%
src/lib/components/Result/Result.tsx 100%
src/lib/components/Suspense/with-suspense.tsx 0%
src/lib/components/Toast/Toaster.tsx 100% 87.5%
src/lib/components/Toast/use-not-implemented-yet-toast.ts 80%
src/lib/components/Toast/use-toast.ts 100% 100%
src/lib/components/Tooltip/Tooltip.tsx 50% 0%
src/lib/compose.ts 0%
src/lib/date/date.ts 91.3% 85.7%
src/lib/date/use-format-date-time.ts 100% 100%
src/lib/date/use-format-date.ts 100% 100%
src/lib/date/use-relative-time.ts 100% 100%
src/lib/debounce.ts 100% 100%
src/lib/format/money.ts 88.8% 75%
src/lib/format/number.ts 87.5% 75%
src/lib/get.ts 100%
src/lib/http/ajax-error.ts 0% 0%
src/lib/http/exceptions/internal-server-exception.ts 0%
src/lib/http/exceptions/resource-not-found-exception.ts 0% 0%
src/lib/http/http-service.ts 62.5%
src/lib/http/index.ts 100%
src/lib/http/ky-client.ts 63.6% 28.5%
src/lib/i18n/i18n.ts 68.4% 37.5%
src/lib/i18n/use-transations.ts 100%
src/lib/is-empty.ts 100%
src/lib/is-guid.ts 100% 100%
src/lib/logger/console-logger.ts 33.3% 10%
src/lib/logger/index.ts 47.6% 41.6%
src/lib/logger/logger-types.ts 100%
src/lib/logger/mock-logger.ts 0%
src/lib/logger/storybook-logger.ts 0%
src/lib/machine/replace.ts 0% 0%
src/lib/machine/union-context-selector.ts 0% 0%
src/lib/machine/use-actor-ref.ts 0% 0%
src/lib/permissions/use-has-permission.ts 0% 0%
src/lib/permissions/when-permitted-to.tsx 0% 0%
src/lib/query.ts 100%
src/lib/router/handle-lazy-import-error.ts 0% 0%
src/lib/router/index.ts 100% 50%
src/lib/router/routes.ts 100%
src/lib/router/use-route-error.ts 50%
src/lib/sleep.ts 100%
src/lib/theme/theme.ts 100%
src/lib/theme/use-brand-color.ts 100%
src/lib/theme/use-color-mode.ts 83.3% 25%
src/lib/theme/use-secondary-text-color.ts 100%
src/lib/to-kebab-case.ts 100%
src/lib/types/unauthorized-error.ts 0%
src/lib/types/unknown-error.ts 0%
src/main.tsx 0%
src/pages/Cart/index.tsx 33.3%
src/pages/Cart/loader.ts 100%
src/pages/Home/index.tsx 33.3% 0%
src/pages/Home/loader.ts 100%
src/pages/Product/index.tsx 20% 0%
src/pages/Product/loader.ts 100%
src/pages/Products/index.tsx 90.9% 50%
src/pages/Products/loader.ts 100%
src/pages/router.tsx 0%
src/pages/SignIn/index.tsx 100%

@bartstc bartstc merged commit cada1a2 into core Apr 17, 2026
8 checks passed
@bartstc bartstc deleted the feat/rate-product branch April 17, 2026 22:29
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.

1 participant