Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Digital Iceland mailing list component #17816

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Feb 5, 2025

Digital Iceland mailing list component

Screenshot 2025-02-05 at 10 54 26

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features
    • Introduced a new mailing list thumbnail card that dynamically displays localized texts, ensuring clear headings, descriptions, and navigation links based on the user's language preferences.
    • Added a new component for rendering the mailing list thumbnail card with a visually appealing design and interactive navigation controls.
    • Enhanced content rendering capabilities to support the new mailing list thumbnail card, improving overall user experience with adaptive messaging in multiple languages.

@RunarVestmann RunarVestmann requested review from a team as code owners February 5, 2025 11:14
Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

Walkthrough

This pull request introduces new components for mailing list thumbnails. The DigitalIcelandMailingListThumbnailCard component computes locale-specific texts using the useI18n hook and renders the MailingListThumbnailCard with these values. The MailingListThumbnailCard component displays the mailing list information in a styled layout with a navigational link. Additionally, the module's public API is expanded through an export statement, and the rich text renderer is updated to support the new component type by adding a dedicated case that wraps it in a GridContainer.

Changes

File(s) Change Summary
apps/web/components/connected/MailingListThumbnailCard/…DigitalIcelandMailingListThumbnailCard.tsx
apps/web/components/connected/MailingListThumbnailCard/…MailingListThumbnailCard.tsx
Introduced two new components: DigitalIcelandMailingListThumbnailCard, which dynamically sets locale-specific texts using useI18n, and MailingListThumbnailCard, which renders the mailing list layout with required props. Both files include new interface definitions.
apps/web/components/connected/index.ts Added an export statement for DigitalIcelandMailingListThumbnailCard to extend the module’s public API.
apps/web/utils/richText.tsx Added a new case to the webRenderConnectedComponent switch statement to render DigitalIcelandMailingListThumbnailCard wrapped within a GridContainer.

Sequence Diagram(s)

sequenceDiagram
    participant CMS as CMS
    participant Renderer as webRenderConnectedComponent
    participant Grid as GridContainer
    participant DIComponent as DigitalIcelandMailingListThumbnailCard
    participant Thumbnail as MailingListThumbnailCard

    CMS->>Renderer: Provide slice with type "DigitalIcelandMailingListThumbnailCard"
    Renderer->>Grid: Wrap component in GridContainer
    Grid->>DIComponent: Render DigitalIcelandMailingListThumbnailCard
    DIComponent->>DIComponent: Use useI18n to compute texts
    DIComponent->>Thumbnail: Pass texts and link props for rendering
Loading

Possibly related PRs

  • feat(web): Add new component for latest news at digital iceland #17776: The changes in the main PR, which introduce the DigitalIcelandMailingListThumbnailCard component, are related to the modifications in the retrieved PR as both involve the creation of new components for Digital Iceland, although they do not modify the same functions or classes directly.

Suggested labels

deploy-feature

Suggested reviewers

  • mannipje

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3a0266 and fceef4e.

📒 Files selected for processing (1)
  • apps/web/components/connected/MailingListThumbnailCard/MailingListThumbnailCard.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/components/connected/MailingListThumbnailCard/MailingListThumbnailCard.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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)
apps/web/components/connected/MailingListThumbnailCard/DigitalIcelandMailingListThumbnailCard.tsx (1)

15-27: Extract default texts to constants for better maintainability.

Consider extracting the default texts to named constants to improve readability and maintainability.

+const DEFAULT_TEXTS = {
+  is: {
+    heading: 'Fylgstu með því nýjasta',
+    description: 'Skráðu þig á póstlista Stafræns Íslands og fylgstu með því nýjasta í stafrænni opinberri þjónustu.',
+    linkLabel: 'Skrá mig á póstlista'
+  },
+  en: {
+    heading: 'Subscribe',
+    description: 'Sign up for the Digital Iceland mailing list and stay up to date with the latest in digital public services.',
+    linkLabel: 'Subscribe to mailing list'
+  }
+}
+
 const headingText =
-  slice.json?.headingText ?? activeLocale === 'is'
-    ? 'Fylgstu með því nýjasta'
-    : 'Subscribe'
+  slice.json?.headingText ?? DEFAULT_TEXTS[activeLocale].heading
 const descriptionText =
-  slice.json?.descriptionText ?? activeLocale === 'is'
-    ? 'Skráðu þig á póstlista Stafræns Íslands og fylgstu með því nýjasta í stafrænni opinberri þjónustu.'
-    : 'Sign up for the Digital Iceland mailing list and stay up to date with the latest in digital public services.'
+  slice.json?.descriptionText ?? DEFAULT_TEXTS[activeLocale].description
 const linkHref = slice.json?.linkHref
 const linkLabel =
-  slice.json?.linkLabel ?? activeLocale === 'is'
-    ? 'Skrá mig á póstlista'
-    : 'Subscribe to mailing list'
+  slice.json?.linkLabel ?? DEFAULT_TEXTS[activeLocale].linkLabel
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63a7e74 and c3a0266.

📒 Files selected for processing (4)
  • apps/web/components/connected/MailingListThumbnailCard/DigitalIcelandMailingListThumbnailCard.tsx (1 hunks)
  • apps/web/components/connected/MailingListThumbnailCard/MailingListThumbnailCard.tsx (1 hunks)
  • apps/web/components/connected/index.ts (1 hunks)
  • apps/web/utils/richText.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`apps/**/*`: "Confirm that the code adheres to the following...

apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
  • apps/web/components/connected/index.ts
  • apps/web/utils/richText.tsx
  • apps/web/components/connected/MailingListThumbnailCard/MailingListThumbnailCard.tsx
  • apps/web/components/connected/MailingListThumbnailCard/DigitalIcelandMailingListThumbnailCard.tsx
🔇 Additional comments (4)
apps/web/components/connected/index.ts (1)

8-8: LGTM!

The new export follows the established pattern and maintains consistency with other exports.

apps/web/components/connected/MailingListThumbnailCard/MailingListThumbnailCard.tsx (1)

10-15: LGTM!

The component is well-structured with:

  • Clear and typed props interface
  • Consistent use of island-ui components
  • Proper layout and spacing

Also applies to: 17-52

apps/web/components/connected/MailingListThumbnailCard/DigitalIcelandMailingListThumbnailCard.tsx (1)

6-8: LGTM!

The component is well-implemented with:

  • Type-safe props
  • Proper localization handling
  • Safe access to slice data with fallbacks

Also applies to: 10-37

apps/web/utils/richText.tsx (1)

20-20: LGTM!

The changes are well-implemented with:

  • Proper imports
  • Consistent component wrapping in GridContainer
  • Correct prop passing

Also applies to: 32-32, 207-213

Copy link

nx-cloud bot commented Feb 5, 2025

View your CI Pipeline Execution ↗ for commit c3a0266.

Command Status Duration Result
nx run-many --target=build --projects=web --par... ✅ Succeeded 10m 24s View ↗
nx run-many --projects web --target test --para... ✅ Succeeded 22s View ↗
nx run-many --target=lint --projects=web --para... ✅ Succeeded 34s View ↗
nx run-many --target=codegen/frontend-client --... ✅ Succeeded 12s View ↗
nx run-many --target=codegen/backend-schema --a... ✅ Succeeded 22s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-05 11:44:48 UTC

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