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(landing): add glossary #2085

Merged
merged 24 commits into from
Oct 25, 2024
Merged

Conversation

p6l-richard
Copy link
Contributor

@p6l-richard p6l-richard commented Sep 12, 2024

What does this PR do?

Demo 👇
https://33fa1ur95-b7flgfdfq-unkey.vercel.app/glossary
https://33fa1ur95-b7flgfdfq-unkey.vercel.app/glossary/mime-types

CleanShot 2024-10-23 at 17 17 03

Adding a /glossary to unkey's landing.

Fixes # (issue)

If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Test A
  • Test B

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a comprehensive glossary section with a GlossaryTermWrapper for detailed term pages.
    • Added a GlossaryClient for an interactive glossary interface, featuring search and category navigation.
    • Implemented responsive components for both desktop (TermsRolodexDesktop) and mobile (TermsStepperMobile) views for glossary term navigation.
    • Added an FAQ section and a Takeaways component to enhance user engagement with glossary terms.
    • Introduced a FilterableCommand component for searching glossary terms.
  • Documentation

    • New content file created for MIME types, providing an in-depth guide and best practices.
  • UI Enhancements

    • Introduced new UI components: Badge, Button, Card, Input, Label, and KeyIcon for improved styling and user interaction.

Copy link

changeset-bot bot commented Sep 12, 2024

⚠️ No Changeset found

Latest commit: 50536e2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 12, 2024

@p6l-richard is attempting to deploy a commit to the Unkey Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Sep 12, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Warning

Rate limit exceeded

@p6l-richard has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between 5055dea and 50536e2.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduced a comprehensive glossary feature within the application, including a new glossary term page, client interface, and various supporting components. Key functionalities include dynamic term navigation, metadata generation, and a structured FAQ section. New UI components such as badges, buttons, cards, and input fields were added for enhanced user interaction. Additionally, a new collection for glossary terms was created, and several MDX documents were introduced to provide content on specific topics like MIME types.

Changes

File Path Change Summary
apps/www/app/glossary/[slug]/page.tsx Added GlossaryTermWrapper component, generateStaticParams, and generateMetadata functions.
apps/www/app/glossary/client.tsx Introduced GlossaryClient component for displaying glossary terms with navigation and search.
apps/www/app/glossary/page.tsx Created GlossaryPage component and exported SEO metadata.
apps/www/components/svg/glossary-page.tsx Added KeyIcon component for SVG rendering.
apps/www/components/ui/badge.tsx Introduced Badge component with variant styles.
apps/www/components/ui/button.tsx Created customizable Button component with multiple variants and sizes.
apps/www/components/ui/card.tsx Added Card and subcomponents for structured content presentation.
apps/www/components/ui/input.tsx Introduced Input component as a styled input field.
apps/www/components/ui/label.tsx Created Label component for form labeling with styling.
apps/www/content-collections.ts Added new glossary collection with defined schema and properties.
apps/www/content/glossary/mime-types.mdx Created MDX document on MIME types with structured sections.
apps/www/app/glossary/data-client.tsx Added categoriesWithIcons constant to map categories with icons.
apps/www/app/glossary/data.ts Introduced categories constant and types for structured category data.
apps/www/components/glossary/search.tsx Added FilterableCommand component for searching glossary terms.
apps/www/components/glossary/terms-rolodex-desktop.tsx Introduced TermsRolodexDesktop for desktop term navigation.
apps/www/components/glossary/terms-stepper-mobile.tsx Added TermsStepperMobile for mobile term navigation.
apps/www/app/glossary/[slug]/faq.tsx Created FAQ component for rendering frequently asked questions.
apps/www/app/glossary/[slug]/takeaways.tsx Introduced Takeaways component with schema validation for key takeaways.

Suggested labels

Feature, Dashboard, 🕹️ oss.gg, :joystick: 300 points, hacktoberfest

Suggested reviewers

  • mcstepp
  • chronark
  • perkinsjr
  • MichaelUnkey

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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

github-actions bot commented Sep 12, 2024

Thank you for following the naming conventions for pull request titles! 🙏

@p6l-richard p6l-richard changed the title glossary feat(landing): add glossary Sep 12, 2024
- UI: Add `faq`, `takeaway` & `relatedTerms` components (_faq.tsx, takeaways.tsx, page.tsx)
- shadcn: Added new UI components (badge.tsx, card.tsx)
- Updated content collections (content-collections.ts) for more frontmatter schema on glossary (reviewed by, takeaways, faq, etc.)
- Add glossary content (check `mime-types.mdx`) for mocking
- Update related configurations and utilities
Copy link

vercel bot commented Oct 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 10:19am
engineering ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 10:19am
play ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 10:19am
workflows ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 10:19am
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 10:19am

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 8

🧹 Outside diff range and nitpick comments (7)
apps/www/content/glossary/mime-types.mdx (3)

2-3: Enhance the description for better SEO.

Consider adding more specific keywords and making the description more actionable.

-description: "Learn about MIME types in API development. Understand their role in defining file formats like images and PDFs. Explore our glossary for more insights."
+description: "Master MIME types in REST API development. Learn how to correctly use Content-Type headers, handle file formats, and implement secure content negotiation. Essential guide for web developers."

55-63: Enhance HTTP header examples with complete response context.

The HTTP header examples could be more educational by showing complete response contexts.

-```http
-Content-Type: application/json
-```
-This header in an API response indicates that the data is in JSON format.
-
-```http
-Content-Type: text/html
-```
+```http
+HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 234
+
+{
+  "message": "Example JSON response"
+}
+```
+This complete API response shows the JSON Content-Type in context.
+
+```http
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=UTF-8
+Content-Length: 156
+
+<!DOCTYPE html>
+<html>
+  <head><title>Example</title></head>
+  <body><h1>Hello World!</h1></body>
+</html>
+```

98-98: Format URL as markdown link.

Convert the plain text URL into a proper markdown link for better readability and accessibility.

-For further exploration, developers can refer to the official IANA Media Types registry (https://www.iana.org/assignments/media-types/) or the resources listed in the recommended reading section above.
+For further exploration, developers can refer to the [official IANA Media Types registry](https://www.iana.org/assignments/media-types/) or the resources listed in the recommended reading section above.
apps/www/app/glossary/[slug]/takeaways.tsx (1)

16-37: Add JSDoc documentation for the schemas.

Consider adding JSDoc comments to document the purpose and structure of both schemas. This would improve maintainability and help other developers understand the expected data structure.

+/**
+ * Schema for individual items in the takeaways sections
+ * @property {string} key - The label or title of the item
+ * @property {string} value - The corresponding value or description
+ */
 const itemSchema = z.object({
   key: z.string(),
   value: z.string(),
 });

+/**
+ * Schema for the complete takeaways data structure
+ * @property {string} tldr - A brief summary
+ * @property {Array<itemSchema>} definitionAndStructure - Key definitions and structural elements
+ * @property {Array<itemSchema>} historicalContext - Historical timeline or context
+ * @property {Object} usageInAPIs - API usage information with tags and description
+ * @property {Array<string>} bestPractices - List of recommended practices
+ * @property {Array<{title: string, url: string}>} recommendedReading - External resources
+ * @property {string} didYouKnow - An interesting fact
+ */
 export const takeawaysSchema = z.object({
apps/www/app/glossary/[slug]/page.tsx (3)

42-42: Consider using environment-based domain configuration

The OpenGraph URL contains a hardcoded domain "unkey.com". Consider using an environment variable to make it configurable across different environments (development, staging, production).

-      url: `https://unkey.com/glossary/${term.slug}`,
+      url: `${process.env.NEXT_PUBLIC_DOMAIN}/glossary/${term.slug}`,

76-317: Consider adding error boundaries

The component handles the "not found" case but lacks error boundaries for runtime errors. Consider wrapping the content with an error boundary to gracefully handle unexpected errors.

Example implementation:

import { ErrorBoundary } from '@/components/error-boundary';

// Inside the component
return (
  <ErrorBoundary fallback={<div>Something went wrong loading the glossary term.</div>}>
    {/* existing JSX */}
  </ErrorBoundary>
);

241-247: Enhance avatar accessibility

The avatar's alt text could be more descriptive to improve accessibility.

-                      alt={author.name}
+                      alt={`${author.name}'s profile picture`}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7a066ec and 312075b.

📒 Files selected for processing (5)
  • apps/www/app/glossary/[slug]/faq.tsx (1 hunks)
  • apps/www/app/glossary/[slug]/page.tsx (1 hunks)
  • apps/www/app/glossary/[slug]/takeaways.tsx (1 hunks)
  • apps/www/app/glossary/client.tsx (1 hunks)
  • apps/www/content/glossary/mime-types.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/www/app/glossary/client.tsx
🧰 Additional context used
🪛 Biome
apps/www/app/glossary/[slug]/page.tsx

[error] 59-59: This variable is unused.

Unused variables usually are result of incomplete refactoring, typos and other source of bugs.
Unsafe fix: If this is intentional, prepend terms with an underscore.

(lint/correctness/noUnusedVariables)

🪛 LanguageTool
apps/www/content/glossary/mime-types.mdx

[style] ~71-~71: This phrase is redundant (‘G’ stands for ‘graphic’). Use simply “PNGs”.
Context: ...egfor JPEG images -image/pngfor PNG images -image/gif` for GIF images - **Vid...

(ACRONYM_TAUTOLOGY)

🔇 Additional comments (3)
apps/www/app/glossary/[slug]/faq.tsx (1)

1-6: LGTM! Imports are well-organized.

The necessary accordion components are properly imported from the UI library.

apps/www/content/glossary/mime-types.mdx (2)

69-73: Enhance image type descriptions with full expansions.

The previous review already identified this issue. I agree with expanding the acronyms for better clarity, while avoiding redundancy.

🧰 Tools
🪛 LanguageTool

[style] ~71-~71: This phrase is redundant (‘G’ stands for ‘graphic’). Use simply “PNGs”.
Context: ...egfor JPEG images -image/pngfor PNG images -image/gif` for GIF images - **Vid...

(ACRONYM_TAUTOLOGY)


36-41: Verify the accessibility of recommended reading URLs.

The recommended reading section includes external URLs that should be validated to ensure they are accessible and up-to-date.

✅ Verification successful

All recommended reading URLs are accessible and valid

All three URLs in the recommended reading section return HTTP 200 status codes, indicating they are accessible and up-to-date:

  • RFC 6838 specification ✓
  • MDN Web Docs article ✓
  • O'Reilly book reference ✓
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the recommended reading URLs are accessible
# Expected results: All URLs should return HTTP 200 status

urls=(
  "https://tools.ietf.org/html/rfc6838"
  "https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types"
  "https://www.oreilly.com/library/view/restful-web-services/9780596529260/"
)

for url in "${urls[@]}"; do
  echo "Checking $url"
  curl -sL -w "%{http_code}\n" "$url" -o /dev/null
done

Length of output: 1057

apps/www/app/glossary/[slug]/faq.tsx Show resolved Hide resolved
apps/www/app/glossary/[slug]/faq.tsx Show resolved Hide resolved
apps/www/app/glossary/[slug]/faq.tsx Show resolved Hide resolved
apps/www/app/glossary/[slug]/faq.tsx Show resolved Hide resolved
apps/www/app/glossary/[slug]/takeaways.tsx Show resolved Hide resolved
apps/www/app/glossary/[slug]/takeaways.tsx Outdated Show resolved Hide resolved
apps/www/app/glossary/[slug]/takeaways.tsx Show resolved Hide resolved
apps/www/app/glossary/[slug]/takeaways.tsx Outdated Show resolved Hide resolved
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: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 312075b and 5055dea.

📒 Files selected for processing (2)
  • apps/www/app/glossary/[slug]/page.tsx (1 hunks)
  • apps/www/app/glossary/[slug]/takeaways.tsx (1 hunks)
🧰 Additional context used
🪛 Biome
apps/www/app/glossary/[slug]/page.tsx

[error] 59-59: This variable is unused.

Unused variables usually are result of incomplete refactoring, typos and other source of bugs.
Unsafe fix: If this is intentional, prepend terms with an underscore.

(lint/correctness/noUnusedVariables)

🔇 Additional comments (1)
apps/www/app/glossary/[slug]/page.tsx (1)

59-74: Remove unused terms array.

The terms array is declared but never used in the code.

🧰 Tools
🪛 Biome

[error] 59-59: This variable is unused.

Unused variables usually are result of incomplete refactoring, typos and other source of bugs.
Unsafe fix: If this is intentional, prepend terms with an underscore.

(lint/correctness/noUnusedVariables)

Comment on lines +76 to +78
const GlossaryTermWrapper = async ({ params }: { params: { slug: string } }) => {
const term = allGlossaries.find((term) => term.slug === params.slug);
if (!term) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using type assertion for better type safety.

The current implementation might return undefined if the term is not found. Consider using type assertion with find for better type safety.

Apply this diff:

- const term = allGlossaries.find((term) => term.slug === params.slug);
+ const term = allGlossaries.find((term) => term.slug === params.slug) ?? notFound();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const GlossaryTermWrapper = async ({ params }: { params: { slug: string } }) => {
const term = allGlossaries.find((term) => term.slug === params.slug);
if (!term) {
const GlossaryTermWrapper = async ({ params }: { params: { slug: string } }) => {
const term = allGlossaries.find((term) => term.slug === params.slug) ?? notFound();
if (!term) {

Comment on lines +27 to +57
export function generateMetadata({
params,
}: {
params: { slug: string };
}): Metadata {
const term = allGlossaries.find((term) => term.slug === params.slug);
if (!term) {
notFound();
}
return {
title: `${term.title} | Unkey Glossary`,
description: term.description,
openGraph: {
title: `${term.title} | Unkey Glossary`,
description: term.description,
url: `https://unkey.com/glossary/${term.slug}`,
siteName: "unkey.com",
type: "article",
},
twitter: {
card: "summary_large_image",
title: `${term.title} | Unkey Glossary`,
description: term.description,
site: "@unkeydev",
creator: "@unkeydev",
},
icons: {
shortcut: "/images/landing/unkey.png",
},
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance metadata generation with safer URL handling and path validation.

Consider these improvements for better robustness:

  1. Use URL constructor for safer URL handling
  2. Validate the icons path exists

Apply this diff:

   return {
     title: `${term.title} | Unkey Glossary`,
     description: term.description,
     openGraph: {
       title: `${term.title} | Unkey Glossary`,
       description: term.description,
-      url: `https://unkey.com/glossary/${term.slug}`,
+      url: new URL(`/glossary/${term.slug}`, 'https://unkey.com').toString(),
       siteName: "unkey.com",
       type: "article",
     },
     // ... rest of the metadata
   };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function generateMetadata({
params,
}: {
params: { slug: string };
}): Metadata {
const term = allGlossaries.find((term) => term.slug === params.slug);
if (!term) {
notFound();
}
return {
title: `${term.title} | Unkey Glossary`,
description: term.description,
openGraph: {
title: `${term.title} | Unkey Glossary`,
description: term.description,
url: `https://unkey.com/glossary/${term.slug}`,
siteName: "unkey.com",
type: "article",
},
twitter: {
card: "summary_large_image",
title: `${term.title} | Unkey Glossary`,
description: term.description,
site: "@unkeydev",
creator: "@unkeydev",
},
icons: {
shortcut: "/images/landing/unkey.png",
},
};
}
export function generateMetadata({
params,
}: {
params: { slug: string };
}): Metadata {
const term = allGlossaries.find((term) => term.slug === params.slug);
if (!term) {
notFound();
}
return {
title: `${term.title} | Unkey Glossary`,
description: term.description,
openGraph: {
title: `${term.title} | Unkey Glossary`,
description: term.description,
url: new URL(`/glossary/${term.slug}`, 'https://unkey.com').toString(),
siteName: "unkey.com",
type: "article",
},
twitter: {
card: "summary_large_image",
title: `${term.title} | Unkey Glossary`,
description: term.description,
site: "@unkeydev",
creator: "@unkeydev",
},
icons: {
shortcut: "/images/landing/unkey.png",
},
};
}

Comment on lines +17 to +38
const itemSchema = z.object({
key: z.string(),
value: z.string(),
});

export const takeawaysSchema = z.object({
tldr: z.string(),
definitionAndStructure: z.array(itemSchema),
historicalContext: z.array(itemSchema),
usageInAPIs: z.object({
tags: z.array(z.string()),
description: z.string(),
}),
bestPractices: z.array(z.string()),
recommendedReading: z.array(
z.object({
title: z.string(),
url: z.string(),
}),
),
didYouKnow: z.string(),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Utilize takeawaysSchema for runtime validation of props

While you've defined itemSchema and takeawaysSchema using zod for schema validation, the current implementation doesn't use them for runtime validation of props.takeaways. Consider parsing props.takeaways with takeawaysSchema.parse() to ensure the data conforms to the expected structure, which can help catch invalid data early and prevent potential runtime errors.

You can update the Takeaways component as follows:

 export default function Takeaways(props: Pick<Glossary, "term" | "takeaways">) {
+  const takeaways = takeawaysSchema.parse(props.takeaways);

   return (
-    <Card> {/* ...using props.takeaways... */}</Card>
+    <Card> {/* ...use takeaways instead of props.takeaways... */}</Card>
   );
 }

Committable suggestion was skipped due to low confidence.

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.

3 participants