Skip to content

feat: add documentation routes - #5

Merged
Truella merged 4 commits into
masterfrom
feat/docs
Jul 26, 2026
Merged

Truella merged 4 commits into
masterfrom
feat/docs

Conversation

@Truella

@Truella Truella commented Jul 26, 2026 •

Copy link
Copy Markdown
Owner

Summary
Public /docs section with sidebar navigation and four content pages. The CSV Guide includes a column reference table, a copyable example, a sample CSV download, and an interactive mini-validator using the same parseAndValidateCSV function as the upload flow.

Changed files

  • app/docs/page.tsx (new)
  • app/docs/[section]/page.tsx (new)
  • src/components/docs/DocsLayout.tsx (new)
  • src/components/docs/DocsSidebar.tsx (new)
  • src/components/docs/GettingStarted.tsx (new)
  • src/components/docs/CSVGuide.tsx (new)
  • src/components/docs/Troubleshooting.tsx (new)
  • src/components/docs/QuestionTips.tsx (new)

Checklist

  • npx tsc --noEmit passes
  • /docs accessible unauthenticated, redirects to getting-started
  • CSV mini-validator works correctly
  • Sample download produces a valid CSV
  • Sidebar active state correct on all four routes
  • Page titles set correctly via generateMetadata
  • No console.log statements
  • Branch up to date with main

Summary by CodeRabbit

  • New Features
    • Added a structured documentation area with responsive navigation (sidebar on larger screens, dropdown on small screens) and section-based pages.
    • Added Getting Started, question tips, CSV guidance, and troubleshooting documentation.
    • Added CSV utilities including copy, download, and in-browser validation with status feedback.
    • Visiting the main documentation page now redirects to Getting Started automatically.
  • Bug Fixes
    • Improved CSV validation by enforcing that the Points field, when provided, must be a valid base-10 integer.
    • Docs section routing now reliably selects the correct docs content and page title metadata based on the URL section.

@vercel

vercel Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
prep Ready Ready Preview, Comment Jul 26, 2026 12:35pm

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4dec3557-38c2-4997-85aa-38724de27144

📥 Commits

Reviewing files that changed from the base of the PR and between a496fbb and c314957.

📒 Files selected for processing (1)
  • src/components/docs/DocsLayout.tsx

📝 Walkthrough

Walkthrough

Adds a routed documentation area with responsive navigation, static guidance pages, an interactive CSV guide, section-specific metadata, CSV Points validation, and a redirect from /docs to Getting Started.

Changes

Documentation experience

Layer / File(s) Summary
Documentation shell and content
src/components/docs/DocsLayout.tsx, src/components/docs/DocsSidebar.tsx, src/components/docs/GettingStarted.tsx, src/components/docs/QuestionTips.tsx, src/components/docs/Troubleshooting.tsx
Adds responsive navigation and rendered Getting Started, question tips, and troubleshooting pages.
Interactive CSV guide and validation
src/components/docs/CSVGuide.tsx, src/utils/csvParser.ts
Adds CSV schema guidance, sample copy/download controls, pasted CSV validation, feedback messaging, and integer validation for Points.
Docs route integration
app/docs/[section]/page.tsx, app/docs/page.tsx
Maps route sections to content and metadata, provides fallbacks, and redirects /docs to /docs/getting-started.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant DocsSection
  participant DocsLayout
  participant SectionContent
  Browser->>DocsSection: request /docs/{section}
  DocsSection->>DocsLayout: render selected section
  DocsLayout->>SectionContent: render documentation component
  SectionContent-->>Browser: return documentation page
Loading

Possibly related PRs

  • Truella/prep#1: Also modifies CSV row validation in parseAndValidateCSV.
  • Truella/prep#2: Also modifies CSV parsing and validation behavior.
🚥 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.
Title check ✅ Passed The title accurately summarizes the main change: adding public documentation routes and pages.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/docs

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

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

Inline comments:
In `@src/components/docs/CSVGuide.tsx`:
- Around line 43-47: Update handleCopy to await
navigator.clipboard.writeText(EXAMPLE_CSV) before setting copied, handle
rejected clipboard access without an unhandled promise rejection, and expose the
existing or appropriate failure state when copying fails. Keep the “Copied!”
state limited to successful writes.
- Around line 60-70: Update the shared parseAndValidateCSV implementation in
csvParser.ts to validate the optional Points field as an integer when provided,
rejecting non-numeric values such as “abc” while continuing to allow omitted
points. Preserve the existing validation result and CSVGuide handleValidate
behavior, and keep the guide’s documented integer requirement aligned with the
parser.
- Around line 128-151: Add an associated label for the CSV textarea in the
validation section, using a matching id/htmlFor pair and an appropriate
descriptive label. Update the validationResult feedback paragraph to use an
aria-live region so screen readers announce success or failure messages when
handleValidate updates the result.

In `@src/components/docs/DocsLayout.tsx`:
- Around line 7-11: Update DocsLayout’s responsive navigation so documentation
navigation remains accessible below the md breakpoint. Replace the hidden-only
DocsSidebar behavior with a mobile menu/select or stacked sidebar layout, while
preserving the existing desktop sidebar and main content arrangement.

In `@src/components/docs/DocsSidebar.tsx`:
- Around line 25-31: Update the Link rendered in DocsSidebar to include
aria-current="page" when isActive is true, and omit it or leave it undefined for
inactive sections so screen readers identify only the current documentation
section.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4e1326d4-da2a-46a1-b63c-5f9514d2f19b

📥 Commits

Reviewing files that changed from the base of the PR and between 9bbf343 and 3d690e0.

📒 Files selected for processing (8)
  • app/docs/[section]/page.tsx
  • app/docs/page.tsx
  • src/components/docs/CSVGuide.tsx
  • src/components/docs/DocsLayout.tsx
  • src/components/docs/DocsSidebar.tsx
  • src/components/docs/GettingStarted.tsx
  • src/components/docs/QuestionTips.tsx
  • src/components/docs/Troubleshooting.tsx

Comment thread src/components/docs/CSVGuide.tsx Resolved
Comment thread src/components/docs/CSVGuide.tsx Resolved
Comment thread src/components/docs/CSVGuide.tsx Resolved
Comment thread src/components/docs/DocsLayout.tsx Resolved
Comment thread src/components/docs/DocsSidebar.tsx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/docs/DocsSidebar.tsx (1)

7-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Share the section registry with DocsLayout.

SECTIONS is duplicated in this file and src/components/docs/DocsLayout.tsx. A future page added to only one array would desynchronize the sidebar, mobile selector, and active-state logic. Move the configuration to one shared module and import it from both components.

🤖 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 `@src/components/docs/DocsSidebar.tsx` around lines 7 - 12, Move the shared
SECTIONS configuration out of DocsSidebar into a single reusable module, then
import and use that registry in both DocsSidebar and DocsLayout. Remove the
duplicated local definition while preserving the existing sidebar, mobile
selector, and active-state behavior.
src/components/docs/CSVGuide.tsx (1)

67-77: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle validator promise rejection.

parseAndValidateCSV can reject from its error callback in src/utils/csvParser.ts Lines 97-99, but handleValidate awaits it without try/catch. That leaves an unhandled rejection and no feedback when validation fails at the file-reader level.

Proposed fix
 	const handleValidate = async () => {
-		const file = new File([csvInput], "validate.csv", { type: "text/csv" });
-		const result = await parseAndValidateCSV(file);
-		setValidationResult(
+		try {
+			const file = new File([csvInput], "validate.csv", { type: "text/csv" });
+			const result = await parseAndValidateCSV(file);
+			setValidationResult(
 			result.success
 				? {
 						ok: true,
 						message: `Valid! ${result.data.length} question${result.data.length !== 1 ? "s" : ""} found.`,
 					}
 				: { ok: false, message: result.message },
-		);
+			);
+		} catch {
+			setValidationResult({
+				ok: false,
+				message: "Unable to validate this CSV. Please try again.",
+			});
+		}
 	};
🤖 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 `@src/components/docs/CSVGuide.tsx` around lines 67 - 77, Update handleValidate
to wrap the parseAndValidateCSV await and result handling in try/catch,
converting rejected validation promises into a failed validation result with a
user-visible error message. Preserve the existing success and returned-error
handling, and ensure file-reader failures no longer produce an unhandled
rejection.
🤖 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.

Inline comments:
In `@src/components/docs/DocsLayout.tsx`:
- Around line 28-39: Add an accessible name to the mobile section `<select>` in
`DocsLayout`, using an associated label or an `aria-label` while preserving its
current `value`, `onChange`, and section option behavior.

---

Outside diff comments:
In `@src/components/docs/CSVGuide.tsx`:
- Around line 67-77: Update handleValidate to wrap the parseAndValidateCSV await
and result handling in try/catch, converting rejected validation promises into a
failed validation result with a user-visible error message. Preserve the
existing success and returned-error handling, and ensure file-reader failures no
longer produce an unhandled rejection.

In `@src/components/docs/DocsSidebar.tsx`:
- Around line 7-12: Move the shared SECTIONS configuration out of DocsSidebar
into a single reusable module, then import and use that registry in both
DocsSidebar and DocsLayout. Remove the duplicated local definition while
preserving the existing sidebar, mobile selector, and active-state behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 91a39ecf-88a4-4ef8-98d4-85d4b4889ad5

📥 Commits

Reviewing files that changed from the base of the PR and between 3d690e0 and a496fbb.

📒 Files selected for processing (4)
  • src/components/docs/CSVGuide.tsx
  • src/components/docs/DocsLayout.tsx
  • src/components/docs/DocsSidebar.tsx
  • src/utils/csvParser.ts

Comment thread src/components/docs/DocsLayout.tsx Resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Truella
Truella merged commit 70ba9a7 into master Jul 26, 2026
5 checks passed
@Truella
Truella deleted the feat/docs branch July 26, 2026 12:36
@coderabbitai coderabbitai Bot mentioned this pull request Aug 5, 2026

This branch was successfully deployed

1 active deployment
Preview — c314957a Deployed Jul 26, 2026 by vercel[bot]
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