Skip to content

Feat/carousel#485

Open
dmaduzia wants to merge 7 commits intomainfrom
feat/carousel
Open

Feat/carousel#485
dmaduzia wants to merge 7 commits intomainfrom
feat/carousel

Conversation

@dmaduzia
Copy link
Copy Markdown
Contributor

@dmaduzia dmaduzia commented Oct 24, 2025

Adds a POC for a related articles wrapper. Currently, it renders 2 elements for each related article returned by the backend for presentation purposes. According to my findings, we need to update the YARPP plugin configuration to change the number of returned related articles from 2 to 4.

I've utilized the ngx-owl-carousel-o library for implementing the carousel. I'm leaving the final decision on including it in the package.json on the main branch for further consideration.

Additionally, this PR adds a missing translation for the Related Articles title and ensures proper accessibility for the carousel navigation.

Summary by CodeRabbit

  • New Features

    • Carousel-based related articles section with previous/next slide navigation
    • Multi-language labels for related articles (English and Polish)
  • Improvements

    • Carousel styles integrated for consistent appearance
    • Related articles fetch limited to up to 4 items
    • Avatar component now uses explicit pixel sizing for predictable dimensions

Copilot AI review requested due to automatic review settings October 24, 2025 12:07
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 24, 2025

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2ef877b-f456-4d76-91a5-79e32e95ecc7

📥 Commits

Reviewing files that changed from the base of the PR and between b297e2c and 725b228.

📒 Files selected for processing (1)
  • apps/blog/src/styles.scss
✅ Files skipped from review due to trivial changes (1)
  • apps/blog/src/styles.scss

📝 Walkthrough

Walkthrough

Adds a Transloco-backed carousel for related articles (ngx-owl-carousel-o), new i18n keys (EN/PL), a package + SCSS import, limits related-articles fetch to 4, and binds explicit pixel sizes on the avatar root element.

Changes

Cohort / File(s) Summary
Internationalization
apps/blog/src/assets/i18n/en.json, apps/blog/src/assets/i18n/pl.json
Added top-level relatedArticles translations: title, previousSlide, nextSlide.
Related Articles Component
libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts
Replaced grid with ngx-owl-carousel-o carousel, added public customOptions: OwlOptions, navigation buttons using Transloco ARIA labels, and added imports for TranslocoDirective, CarouselModule, ButtonComponent.
Data Access & Store
libs/blog/articles/data-access/src/lib/infrastructure/articles.service.ts, libs/blog/articles/data-access/src/lib/state/related-article.store.ts
getRelatedArticles signature now accepts query?: { limit?: number }; store calls it with { limit: 4 } to constrain results.
Styling & Dependency
apps/blog/src/styles.scss, package.json
Imported owl.carousel and owl.theme.default SCSS; added ngx-owl-carousel-o dependency (^20.1.0).
UI Avatar
libs/blog/shared/ui-avatar/src/lib/avatar.component.html
Bound root <div> width and height inline to size() via [style.width.px] and [style.height.px].

Sequence Diagram

sequenceDiagram
    participant Component as RelatedArticles Component
    participant Store as Article Store
    participant Carousel as ngx-owl-carousel-o
    participant i18n as Transloco

    Component->>Store: fetchArticleList(id) (ngOnInit)
    activate Store
    Store-->>Component: relatedArticles$ (observable)
    deactivate Store

    Component->>Carousel: initialize with customOptions
    activate Carousel
    Carousel-->>Component: slides rendered / ready
    deactivate Carousel

    Component->>i18n: request `relatedArticles` keys
    activate i18n
    i18n-->>Component: title / previousSlide / nextSlide
    deactivate i18n

    rect rgba(200,220,240,0.5)
    Note over Component,Carousel: User interaction
    Component->>Carousel: prev()/next() (button click)
    Carousel->>Carousel: animate slide transition
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • DamianBrzezinskiHoA
  • mateuszbasinski

Poem

🐇 I hopped to related reads tonight,
A carousel spun letters into light,
Polish and English sang beside the slide,
Four friends rolled out, snug in stride,
Hop, click, and read — a rabbit's pride.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Feat/carousel' is related to the main changes in the changeset, which adds a carousel component using ngx-owl-carousel-o for displaying related articles. However, the title is vague and overly generic—it lacks specificity and doesn't clearly convey what the carousel is used for or what feature is being added. Consider using a more descriptive title like 'Add carousel for related articles' or 'Implement related articles carousel UI' to better communicate the feature's purpose and improve clarity for developers reviewing the commit history.
✅ Passed checks (2 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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/carousel

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.

@valueadd-robot
Copy link
Copy Markdown

PR is detected, will deploy to dev environment

Copy link
Copy Markdown

Copilot AI left a comment

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 implements a carousel feature for displaying related articles on the blog, replacing the static grid layout with an interactive carousel component. It introduces the ngx-owl-carousel-o library to enable smooth navigation through related articles with responsive breakpoints and accessibility features.

Key changes:

  • Addition of ngx-owl-carousel-o carousel library with custom navigation controls
  • Implementation of internationalization for carousel navigation labels and titles
  • Enhancement of avatar component sizing capabilities

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Adds ngx-owl-carousel-o library dependency
libs/blog/shared/ui-avatar/src/lib/avatar.component.html Adds dynamic sizing support for avatar component
libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts Replaces grid layout with carousel implementation including custom navigation buttons and accessibility features
apps/blog/src/styles.scss Imports carousel library styles
apps/blog/src/assets/i18n/pl.json Adds Polish translations for carousel navigation
apps/blog/src/assets/i18n/en.json Adds English translations for carousel navigation
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +71 to +89
customOptions: OwlOptions = {
loop: true,
mouseDrag: false,
touchDrag: true,
pullDrag: true,
dots: true,
margin: 24,
navSpeed: 700,
navText: ['', ''],
responsive: {
// Keep in mind these breakpoints refer to container width, not the viewport width
0: {
items: 1,
},
540: {
items: 2,
},
},
};
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

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

The carousel configuration object should be declared as readonly since it's never modified after initialization. This prevents accidental mutations and clearly communicates intent.

Copilot uses AI. Check for mistakes.
(click)="carousel.prev()"
size="small"
>
<span class="text-2xl">‹</span>
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

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

Using raw Unicode characters (‹ and ›) for navigation buttons may not be announced properly by screen readers. Consider using icon components with proper aria-hidden attributes or text alternatives instead.

Copilot uses AI. Check for mistakes.
@valueadd-robot
Copy link
Copy Markdown

Deployed to dev environment
Branch: feat/carousel
BFF URL: https://04962c09-blog-bff-dev.contact-ef8.workers.dev
Deploy URL: https://23a60d66.angular-love-client.pages.dev
Alias URL: https://feat-carousel.angular-love-client.pages.dev

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts (1)

71-89: Consider disabling built-in navigation and review mouseDrag setting.

Since custom navigation buttons are implemented, explicitly set nav: false to prevent potential conflicts with the library's default navigation.

Additionally, mouseDrag: false disables desktop drag functionality, which some users might expect. Consider whether this is intentional for the UX or if it should be enabled.

Apply this diff to disable built-in navigation:

 customOptions: OwlOptions = {
   loop: true,
   mouseDrag: false,
   touchDrag: true,
   pullDrag: true,
   dots: true,
+  nav: false,
   margin: 24,
   navSpeed: 700,
   navText: ['', ''],

Additionally, consider enabling mouseDrag for desktop users:

-  mouseDrag: false,
+  mouseDrag: true,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd190d7 and 379c811.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • apps/blog/src/assets/i18n/en.json (1 hunks)
  • apps/blog/src/assets/i18n/pl.json (1 hunks)
  • apps/blog/src/styles.scss (1 hunks)
  • libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts (1 hunks)
  • libs/blog/shared/ui-avatar/src/lib/avatar.component.html (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts (2)
libs/blog/articles/feature-article/src/lib/article-details/article-details.component.ts (1)
  • Component (36-69)
libs/blog/articles/data-access/src/lib/state/related-article.store.ts (1)
  • RelatedArticleListStore (25-60)
🔇 Additional comments (9)
libs/blog/shared/ui-avatar/src/lib/avatar.component.html (1)

3-4: LGTM! Explicit sizing improves layout consistency.

The explicit width and height style bindings ensure the container matches the image dimensions, preventing potential layout shifts.

apps/blog/src/styles.scss (1)

5-6: LGTM! Carousel styling properly integrated.

The imports for ngx-owl-carousel-o styles are correctly placed and will provide the necessary styling for the carousel component.

apps/blog/src/assets/i18n/en.json (1)

316-320: LGTM! Clear and appropriate translation keys.

The new i18n keys for related articles provide proper labels for the carousel title and navigation controls, enhancing accessibility.

apps/blog/src/assets/i18n/pl.json (1)

319-323: LGTM! Consistent Polish translations.

The Polish translations for related articles are properly structured and match the English keys, ensuring consistent i18n support.

libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts (4)

8-13: LGTM! Dependencies correctly imported.

The new imports for TranslocoDirective, CarouselModule, OwlOptions, and ButtonComponent properly support the carousel-based i18n implementation.


19-30: LGTM! Strong accessibility implementation.

The carousel implementation demonstrates good accessibility practices:

  • Transloco integration for i18n support
  • role="list" on the carousel container
  • List items wrapped in <li> elements
  • Padding added to prevent focus ring clipping

32-56: LGTM! Custom navigation with proper ARIA labels.

The custom navigation buttons with ARIA labels provide better accessibility than default carousel controls. The positioning for large viewports is appropriate.


69-96: Verify YARPP plugin configuration for article count.

As noted in the PR description, the YARPP plugin configuration needs to be updated to return four related articles instead of two for proper carousel presentation.

Verify that the backend/YARPP plugin is configured to return the expected number of related articles. This can be confirmed by checking the API response or configuration settings.

package.json (1)

60-60: Package version verified as valid with no security vulnerabilities.

ngx-owl-carousel-o version 20.0.1 is the latest version on NPM, and no security advisories were found for this package.

@dmaduzia dmaduzia marked this pull request as draft October 24, 2025 13:20
@valueadd-robot
Copy link
Copy Markdown

PR is detected, will deploy to dev environment

@valueadd-robot
Copy link
Copy Markdown

Deployed to dev environment
Branch: feat/carousel
BFF URL: https://f29d429e-blog-bff-dev.contact-ef8.workers.dev
Deploy URL: https://b92552fa.angular-love-client.pages.dev
Alias URL: https://feat-carousel.angular-love-client.pages.dev

@DDonochVA DDonochVA marked this pull request as ready for review March 27, 2026 09:39
@valueadd-robot
Copy link
Copy Markdown

PR is detected, will deploy to dev environment

@valueadd-robot
Copy link
Copy Markdown

Deployed to dev environment
Branch: feat/carousel
BFF URL: https://a4eb58bf-blog-bff-dev.contact-ef8.workers.dev
Deploy URL: https://4381bea5.angular-love-client.pages.dev
Alias URL: https://feat-carousel.angular-love-client.pages.dev

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
libs/blog/articles/data-access/src/lib/state/related-article.store.ts (1)

41-41: Consider extracting the magic number 4 to a named constant.

The hardcoded limit value could be extracted to a constant for clarity and maintainability, making it easier to adjust if requirements change.

const RELATED_ARTICLES_LIMIT = 4;

This is a minor suggestion since the PR notes this is a proof-of-concept and the value aligns with the YARPP plugin configuration mentioned in the PR description.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libs/blog/articles/data-access/src/lib/state/related-article.store.ts` at
line 41, Extract the magic number 4 used in the call
articlesService.getRelatedArticles(articleId, { limit: 4 }) into a named
constant (e.g. RELATED_ARTICLES_LIMIT) placed near the top of
related-article.store.ts (or alongside other constants) and replace the literal
with that constant so the call becomes
articlesService.getRelatedArticles(articleId, { limit: RELATED_ARTICLES_LIMIT })
to improve clarity and maintainability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/blog/src/styles.scss`:
- Around line 5-6: Move the two SCSS import statements so they appear before any
content-generating statements: place "@import
'ngx-owl-carousel-o/lib/styles/scss/owl.carousel';" and "@import
'ngx-owl-carousel-o/lib/styles/scss/owl.theme.default';" above the "@include
cdk.a11y-visually-hidden();" call so `@import` rules are at the top of the file
and comply with CSS/SCSS import positioning.

---

Nitpick comments:
In `@libs/blog/articles/data-access/src/lib/state/related-article.store.ts`:
- Line 41: Extract the magic number 4 used in the call
articlesService.getRelatedArticles(articleId, { limit: 4 }) into a named
constant (e.g. RELATED_ARTICLES_LIMIT) placed near the top of
related-article.store.ts (or alongside other constants) and replace the literal
with that constant so the call becomes
articlesService.getRelatedArticles(articleId, { limit: RELATED_ARTICLES_LIMIT })
to improve clarity and maintainability.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b27bd570-8e33-4f4f-a296-96c4df14ec76

📥 Commits

Reviewing files that changed from the base of the PR and between 379c811 and b297e2c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • apps/blog/src/assets/i18n/en.json
  • apps/blog/src/assets/i18n/pl.json
  • apps/blog/src/styles.scss
  • libs/blog/articles/data-access/src/lib/infrastructure/articles.service.ts
  • libs/blog/articles/data-access/src/lib/state/related-article.store.ts
  • libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts
  • libs/blog/shared/ui-avatar/src/lib/avatar.component.html
  • package.json
✅ Files skipped from review due to trivial changes (2)
  • package.json
  • apps/blog/src/assets/i18n/en.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • libs/blog/shared/ui-avatar/src/lib/avatar.component.html
  • libs/blog/articles/feature-related-articles/src/lib/related-articles.component.ts

@valueadd-robot
Copy link
Copy Markdown

PR is detected, will deploy to dev environment

@valueadd-robot
Copy link
Copy Markdown

Deployed to dev environment
Branch: feat/carousel
BFF URL: https://3b02915e-blog-bff-dev.contact-ef8.workers.dev
Deploy URL: https://9c35ec38.angular-love-client.pages.dev
Alias URL: https://feat-carousel.angular-love-client.pages.dev

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.

4 participants