Skip to content

feat: Added an next button in the sheet module page#376

Open
Rehan959 wants to merge 2 commits into
apsinghdev:mainfrom
Rehan959:feat/next-btn
Open

feat: Added an next button in the sheet module page#376
Rehan959 wants to merge 2 commits into
apsinghdev:mainfrom
Rehan959:feat/next-btn

Conversation

@Rehan959

@Rehan959 Rehan959 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Title:
perf: memoize nextModule computation in SheetModuleHeader
Description:

Summary

Performance Optimization: Implemented useMemo hook to memoize the nextModule computation in the SheetModuleHeader component.

Changes

  • Wrapped the nextModule computation logic with useMemo hook
  • Added dependency array [currentModuleId, modules] to ensure the memoized value is recalculated only when these dependencies change
  • This prevents unnecessary recalculations of the next module on every render

Performance Benefits

  • Reduced Computation: The next module lookup algorithm (which includes sorting and filtering) now only runs when currentModuleId or modules actually change
  • Better Re-render Performance: Child components and dependent logic won't trigger expensive calculations on every render cycle
  • Improved User Experience: Especially beneficial when other state changes trigger re-renders of this component

Files Changed

  • apps/web/src/components/sheet/SheetModuleHeader.tsx - Added useMemo hook and dependency array
    Branch: feat/next-btn → main
    The commit has already been made (0c90f75). You can create the PR on GitHub directly using the details above!
image

Summary by CodeRabbit

  • New Features
    • Sheet pages now include module navigation controls: a "Back to Sheet" link for returning to the module list, and a "Next: {module name}" link for navigating sequentially through available modules.

Review Change Stack

@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown

@Rehan959 is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR adds module-to-module navigation to the sheet view. The header now accepts a list of modules and the current module ID, computes the next module in sequence, and renders navigation links including "Back to Sheet" and a conditional "Next" link to the following module.

Changes

Sheet Module Navigation

Layer / File(s) Summary
Navigation contract and next module logic
apps/web/src/components/sheet/SheetModuleHeader.tsx
ModuleInfo type and SheetModuleHeaderProps expand to include currentModuleId and modules array. A useMemo hook computes the next module by sorting modules numerically by their module-* id suffix.
Page-level module data preparation
apps/web/src/app/(main)/sheet/[moduleId]/page.tsx
The sheet page constructs a modulesInfo array from getSheetModules() and passes id, name, and currentModuleId to SheetModuleHeader.
Navigation link rendering
apps/web/src/components/sheet/SheetModuleHeader.tsx
Header JSX wraps "Back to Sheet" in a flex container and conditionally renders a "Next: {name}" link with ArrowRight icon linking to the next module.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Through modules we hop, each step onward bound,
With arrows to guide us to sheets all around,
A "next" and a "back" in the header so bright,
The navigation flows left and flows right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title refers to adding a 'next button' in the sheet module page, which aligns with the core change of adding a conditional 'Next' module navigation link in SheetModuleHeader.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/web/src/app/(main)/sheet/[moduleId]/page.tsx (1)

20-20: ⚡ Quick win

drop or lowercase this comment

Line 20 uses sentence case and explains what the next lines already make clear; please remove it or keep it lowercase only if it captures rationale.

As per coding guidelines: "Always use lowercase when writing comments" and "Avoid unnecessary comments; code should be self-documenting when possible".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/app/`(main)/sheet/[moduleId]/page.tsx at line 20, The inline
comment "Create module info for navigation (without docContent)" is sentence
case and redundant; either remove it or convert it to lowercase per the
guidelines; locate the comment above the module info construction (the lines
that build module info/ navigation data) and delete the comment or change it to
a succinct lowercase form that captures rationale only if necessary.
apps/web/src/components/sheet/SheetModuleHeader.tsx (1)

28-28: ⚡ Quick win

remove or normalize the inline comment style

Line 28 adds a "what"-style comment in sentence case; please remove it or rewrite it in lowercase only if it explains why the logic exists.

As per coding guidelines: "Always use lowercase when writing comments" and "Avoid unnecessary comments; code should be self-documenting when possible".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/components/sheet/SheetModuleHeader.tsx` at line 28, Remove or
normalize the inline sentence-case comment "Compute next module" in
SheetModuleHeader.tsx: either delete it if the code is self-explanatory, or
convert it to a lowercase why-style comment that explains intent (e.g., why we
need to compute the next module) adjacent to the logic that computes the next
module inside the SheetModuleHeader component; ensure the remaining code and any
comment follow the project's lowercase-only and minimal-comment guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/web/src/app/`(main)/sheet/[moduleId]/page.tsx:
- Line 20: The inline comment "Create module info for navigation (without
docContent)" is sentence case and redundant; either remove it or convert it to
lowercase per the guidelines; locate the comment above the module info
construction (the lines that build module info/ navigation data) and delete the
comment or change it to a succinct lowercase form that captures rationale only
if necessary.

In `@apps/web/src/components/sheet/SheetModuleHeader.tsx`:
- Line 28: Remove or normalize the inline sentence-case comment "Compute next
module" in SheetModuleHeader.tsx: either delete it if the code is
self-explanatory, or convert it to a lowercase why-style comment that explains
intent (e.g., why we need to compute the next module) adjacent to the logic that
computes the next module inside the SheetModuleHeader component; ensure the
remaining code and any comment follow the project's lowercase-only and
minimal-comment guidelines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f1637d92-c629-45c1-9770-92ce00e62ed4

📥 Commits

Reviewing files that changed from the base of the PR and between 697f361 and 0c90f75.

📒 Files selected for processing (2)
  • apps/web/src/app/(main)/sheet/[moduleId]/page.tsx
  • apps/web/src/components/sheet/SheetModuleHeader.tsx

@Rehan959 Rehan959 changed the title Feat/next btn feat: Added an next button in the sheet module page May 14, 2026
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.

1 participant