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

[DEV-2101][DEV-2102] Add release note page to product section #1338

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

Conversation

marcobottaro
Copy link
Collaborator

@marcobottaro marcobottaro commented Feb 4, 2025

This PR depends on #1325

List of Changes

Add release note codec
Add product release note page
Add link to product release note in product menu

Motivation and Context

The page was missing

How Has This Been Tested?

By using the local Strapi instance to add a new Release note item (pointing to this space JzXl8H23oVGyUzZoVWiY) and to add the relation with a random Product.

Screenshots (if appropriate):

image

Strapi:
image

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@marcobottaro marcobottaro self-assigned this Feb 4, 2025
Copy link

changeset-bot bot commented Feb 4, 2025

🦋 Changeset detected

Latest commit: 636c82b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nextjs-website Major

Not sure what this means? Click here to learn what changesets are.

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

@marcobottaro marcobottaro changed the title [DEV-2101][DEV-2102] Add release note page in product section [DEV-2101][DEV-2102] Add release note page to product section Feb 5, 2025
Copy link
Contributor

github-actions bot commented Feb 5, 2025

Branch is not up to date with base branch

@marcobottaro it seems this Pull Request is not updated with base branch.
Please proceed with a merge or rebase to solve this.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Jira Pull Request Link

This Pull Request refers to the following Jira issue DEV-2101

bodyConfig.gitBookPagesWithTitle
);

const breadcrumbsItems: { name?: string; item?: string }[] = breadcrumbs.map(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would name this type BreadcrumbItem and have it defined in @/helpers/breadcrumbs.helpers

Comment on lines +45 to +65
export function gitBookPageToBreadcrumbs(
pagePath: string,
gitBookPagesWithTitle: readonly {
readonly title: string;
readonly path: string;
}[]
): readonly BreadcrumbSegment[] {
const currentPageBreadcrumbPaths = pagePath
.split('/')
.filter(Boolean)
.map((_, index, arr) => '/' + arr.slice(0, index + 1).join('/'))
.slice(2);

return gitBookPagesWithTitle
.filter(({ path }) => currentPageBreadcrumbPaths.includes(path))
.map(({ title, path }) => ({
name: title,
path,
}))
.sort((a, b) => a.path.length - b.path.length);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add some comment to explain what this does

Suggested change
export function gitBookPageToBreadcrumbs(
pagePath: string,
gitBookPagesWithTitle: readonly {
readonly title: string;
readonly path: string;
}[]
): readonly BreadcrumbSegment[] {
const currentPageBreadcrumbPaths = pagePath
.split('/')
.filter(Boolean)
.map((_, index, arr) => '/' + arr.slice(0, index + 1).join('/'))
.slice(2);
return gitBookPagesWithTitle
.filter(({ path }) => currentPageBreadcrumbPaths.includes(path))
.map(({ title, path }) => ({
name: title,
path,
}))
.sort((a, b) => a.path.length - b.path.length);
}
export function gitBookPageToBreadcrumbs(
pagePath: string,
gitBookPagesWithTitle: readonly {
readonly title: string;
readonly path: string;
}[]
): readonly BreadcrumbSegment[] {
// Generate a list of hierarchical breadcrumb paths from the page path
const currentPageBreadcrumbPaths = pagePath
.split('/') // Split the path into parts based on '/'
.filter(Boolean) // Remove empty segments (e.g., leading or trailing slashes)
.map((_, index, arr) => '/' + arr.slice(0, index + 1).join('/')) // Reconstruct breadcrumb paths
.slice(2); // Ignore the first two levels (e.g., "/docs/category/page" -> ["category", "page"])
// Match breadcrumb paths with available pages and sort them in hierarchical order
return gitBookPagesWithTitle
.filter(({ path }) => currentPageBreadcrumbPaths.includes(path)) // Keep only the paths present in breadcrumbs
.map(({ title, path }) => ({
name: title, // Assign title as breadcrumb name
path, // Keep the corresponding path
}))
.sort((a, b) => a.path.length - b.path.length); // Sort breadcrumbs by path length (ensuring hierarchy)
}```

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

Successfully merging this pull request may close these issues.

2 participants