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): Organization parent subpage - Use organization layout in case theme is not set to 'standalone' #17144

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Dec 5, 2024

Organization parent subpage - Use organization layout in case theme is not set to 'standalone'

Screenshots / Gifs

Before

Screenshot 2024-12-05 at 14 08 12

After

Screenshot 2024-12-05 at 14 07 10

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 OrganizationParentSubpage component for enhanced organization-related content display.
    • Added navigation functionality with a new getSubpageNavList method for improved routing.
  • Improvements

    • Updated pageFeaturedImage property to allow explicit null values for better flexibility.
    • Enhanced code modularity by separating the getProps function from the component definition.
  • Bug Fixes

    • Preserved error handling for missing organization pages and subpages to maintain stability.

@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Dec 5, 2024
@RunarVestmann RunarVestmann requested review from a team as code owners December 5, 2024 14:08
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces several modifications across multiple files, primarily focusing on the handling of organization-related pages in a web application. Key changes include updating the WrapperProps interface to allow null for pageFeaturedImage, adding a new OrganizationParentSubpage component, and modifying existing routing logic to accommodate this new page type. The getProps functions have been refactored for better modularity, and new navigation functionality has been introduced to streamline the organization of navigation items.

Changes

File Change Summary
apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx Updated WrapperProps interface to allow pageFeaturedImage to be null.
apps/web/pages/s/[...slugs]/index.tsx Added OrganizationParentSubpage component and updated pageMap to include PageType.PARENT_SUBPAGE.
Modified getProps logic to handle PARENT_SUBPAGE routing.
apps/web/screens/Organization/ParentSubpage.tsx Introduced OrganizationParentSubpage component with various props and layout structure.
Added getProps method for data fetching in the new component.
apps/web/screens/Organization/Standalone/ParentSubpage.tsx Refactored getProps function to be exported independently from the StandaloneParentSubpage component.
apps/web/screens/Organization/SubPage.tsx Added getSubpageNavList function for constructing a navigation list, replacing inline logic in the SubPage component.

Possibly related PRs

Suggested reviewers

  • mannipje

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.

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.

@RunarVestmann RunarVestmann changed the title Add different layout in case theme is not set to 'standalone' feat(web): Add different layout in case theme is not set to 'standalone' Dec 5, 2024
@RunarVestmann RunarVestmann changed the title feat(web): Add different layout in case theme is not set to 'standalone' feat(web): Organization parent subpage - Use organization layout in case theme is not set to 'standalone' Dec 5, 2024
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 38 lines in your changes missing coverage. Please review.

Project coverage is 35.74%. Comparing base (3d20608) to head (896d81e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
apps/web/screens/Organization/ParentSubpage.tsx 0.00% 24 Missing ⚠️
apps/web/screens/Organization/SubPage.tsx 0.00% 7 Missing ⚠️
apps/web/pages/s/[...slugs]/index.tsx 0.00% 5 Missing ⚠️
.../screens/Organization/Standalone/ParentSubpage.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17144      +/-   ##
==========================================
- Coverage   35.74%   35.74%   -0.01%     
==========================================
  Files        6925     6926       +1     
  Lines      147647   147582      -65     
  Branches    42049    42012      -37     
==========================================
- Hits        52779    52753      -26     
+ Misses      94868    94829      -39     
Flag Coverage Δ
web 2.43% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nents/Organization/Wrapper/OrganizationWrapper.tsx 0.00% <ø> (ø)
.../screens/Organization/Standalone/ParentSubpage.tsx 0.00% <0.00%> (ø)
apps/web/pages/s/[...slugs]/index.tsx 0.00% <0.00%> (ø)
apps/web/screens/Organization/SubPage.tsx 0.00% <0.00%> (ø)
apps/web/screens/Organization/ParentSubpage.tsx 0.00% <0.00%> (ø)

... and 17 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d20608...896d81e. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Dec 5, 2024

Datadog Report

Branch report: feature/web-parent-subpage-organization-layout
Commit report: 176dcea
Test service: web

✅ 0 Failed, 84 Passed, 0 Skipped, 24.8s Total Time
➡️ Test Sessions change in coverage: 1 no change

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: 4

🧹 Outside diff range and nitpick comments (3)
apps/web/screens/Organization/ParentSubpage.tsx (2)

81-83: Verify appropriate heading levels

The Text component uses variant="h1" and as="h1". Ensure that using an h1 heading here aligns with the overall heading hierarchy of the page, especially if there are multiple h1 headings which may impact accessibility and SEO.


20-23: Avoid potential circular dependencies with getProps import

Importing getProps from ./Standalone/ParentSubpage may introduce a circular dependency. Consider extracting getProps into a shared module or defining it within this file to prevent such issues.

apps/web/screens/Organization/Standalone/ParentSubpage.tsx (1)

141-141: Simplify TypeScript type declaration for getProps

Using typeof StandaloneParentSubpage['getProps'] can be less clear. Consider defining an explicit type for getProps to improve readability.

For example:

type GetPropsFunction = typeof StandaloneParentSubpage['getProps'];

export const getProps: GetPropsFunction = async ({ /* params */ }) => {
  // function body
};
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4704971 and e4723cd.

📒 Files selected for processing (5)
  • apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (1 hunks)
  • apps/web/pages/s/[...slugs]/index.tsx (6 hunks)
  • apps/web/screens/Organization/ParentSubpage.tsx (1 hunks)
  • apps/web/screens/Organization/Standalone/ParentSubpage.tsx (2 hunks)
  • apps/web/screens/Organization/SubPage.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
apps/web/screens/Organization/ParentSubpage.tsx (1)

Pattern 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/screens/Organization/SubPage.tsx (1)

Pattern 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/Organization/Wrapper/OrganizationWrapper.tsx (1)

Pattern 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/screens/Organization/Standalone/ParentSubpage.tsx (1)

Pattern 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/pages/s/[...slugs]/index.tsx (1)

Pattern 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."
🔇 Additional comments (4)
apps/web/screens/Organization/Standalone/ParentSubpage.tsx (1)

265-266: Ensure consistency in function assignments

Assigning getProps to StandaloneParentSubpage.getProps is acceptable, but ensure this pattern is consistently used across similar components for maintainability.

apps/web/pages/s/[...slugs]/index.tsx (2)

299-306: Verify error handling in getProps function

When catching errors in getProps, ensure that unhandled exceptions are properly re-thrown to avoid masking unexpected errors.

Consider modifying the catch block:

} catch (error) {
  if (!(error instanceof CustomNextError)) {
    throw error;
  }
+ // You might want to handle CustomNextError specifically or log it
}

Also applies to: 385-392, 395-396


83-85: Integration of PageType.PARENT_SUBPAGE looks good

The new PageType.PARENT_SUBPAGE has been correctly added to the pageMap and Props interface, following the existing patterns.

Also applies to: 122-128

apps/web/screens/Organization/SubPage.tsx (1)

222-223: Handle potential exceptions when using new URL()

Using new URL(router.asPath, 'https://island.is') can throw exceptions if router.asPath is not a valid URL. Ensure that router.asPath is correctly formatted or consider alternative methods to parse the path.

@kodiakhq kodiakhq bot merged commit 28a7711 into main Dec 6, 2024
34 checks passed
@kodiakhq kodiakhq bot deleted the feature/web-parent-subpage-organization-layout branch December 6, 2024 10:06
thorhildurt pushed a commit that referenced this pull request Dec 11, 2024
…ase theme is not set to 'standalone' (#17144)

* Add different layout in case theme is not set to 'standalone'

* Simplify translation code

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants