Skip to content

templates page#1967

Merged
ComputelessComputer merged 4 commits intomainfrom
feat/category-search-navigation
Nov 28, 2025
Merged

templates page#1967
ComputelessComputer merged 4 commits intomainfrom
feat/category-search-navigation

Conversation

@ComputelessComputer
Copy link
Collaborator

  • Added category search and navigation support for templates
  • Implemented detailed template view page with routing
  • Restructured templates page using modular components
  • Updated route configuration for templates and images

@netlify
Copy link

netlify bot commented Nov 28, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit d2c2e4b
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6929361c06dbc100080cd0df
😎 Deploy Preview https://deploy-preview-1967--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 28, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit d2c2e4b
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6929361c1892f2000859ea8a
😎 Deploy Preview https://deploy-preview-1967--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

📝 Walkthrough

Walkthrough

The PR restructures the templates route from a single file to a folder-based structure. It removes apps/web/src/routes/_view/templates.tsx and adds two new routes: index.tsx for browsing and filtering templates, and $slug.tsx for viewing individual template details.

Changes

Cohort / File(s) Summary
Templates Route Restructuring
apps/web/src/routes/_view/templates.tsx (removed)
Deleted entire templates viewing page module, including the main Route export, UI components (hero, search, category filters, template list), state management, and helper utilities.
Templates Route Restructuring
apps/web/src/routes/_view/templates/index.tsx (added)
Added comprehensive templates browse page with category-based filtering, search functionality, modal preview for templates, responsive design (desktop sidebar / mobile category strip), accessibility support, and multiple composed subcomponents (HeroSection, TemplatesGrid, TemplateModal, ContributeBanner).
Templates Route Restructuring
apps/web/src/routes/_view/templates/$slug.tsx (added)
Added template detail view with route loader (fetches template by slug), meta tag generation, three-panel layout (left sidebar with navigation, main content with MDX rendering, right sidebar with promo/GitHub contribution prompt), and composed subcomponents (TemplateHeader, TemplateContent, ExamplesSection, SuggestedTemplates).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • index.tsx: Requires careful review of state management logic (searchQuery, selectedTemplate, selectedCategory), filter/grouping logic, modal interaction handlers (Escape key, URL restoration), and multiple interacting subcomponents.
  • $slug.tsx: Verify loader logic correctly handles missing templates (notFound), meta tag generation for SEO, three-panel layout composition, and integration with MDX rendering.
  • Overall: Verify that the restructuring preserves all functionality from the deleted file, especially filtering and categorization logic; cross-check data flow from allTemplates through both routes.

Possibly related PRs

  • landing-2 #1598: New/updated /_view/templates pages use the DownloadButton component added in this PR—direct code-level dependency.
  • working on products sub-landings #1642: Both PRs modify templates UX and related helpers (TemplateCard, getTemplatesByCategory, getIconForTemplate) across route files.
  • landing wip #1646: Both PRs directly modify apps/web/src/routes/_view/templates.tsx—the retrieved PR adds/changes the templates route while this PR removes and restructures it.

Suggested reviewers

  • yujonglee

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'templates page' is vague and generic, using a non-descriptive term that does not convey meaningful information about the specific changes made in the changeset. Consider a more specific title that highlights the main change, such as 'Add templates browsing and detail views with category navigation' or 'Refactor templates page with modular components and detail routing'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description is clearly related to the changeset, detailing the addition of category search/navigation, template detail view implementation, component restructuring, and route configuration updates that align with the code changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/category-search-navigation

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

@argos-ci
Copy link

argos-ci bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
web (Inspect) ⚠️ Changes detected (Review) 1 changed Nov 28, 2025, 5:44 AM

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

🧹 Nitpick comments (2)
apps/web/src/routes/_view/templates/index.tsx (2)

58-69: Consider using TanStack Router's navigate instead of window.history.pushState.

Using window.history.pushState bypasses TanStack Router's state management. This can cause inconsistencies:

  1. The router won't be aware of the URL change
  2. Browser back/forward navigation may not work as expected
  3. The URL shows /templates/{slug} but the actual route (/$slug.tsx) isn't loaded

Since there's already a dedicated $slug.tsx route, consider either:

  • Option A: Navigate to the actual route using navigate({ to: '/templates/$slug', params: { slug: template.slug } }) instead of showing a modal
  • Option B: Use search params for modal state (e.g., ?preview=slug) to keep routing consistent
 const handleTemplateClick = (template: (typeof allTemplates)[0]) => {
   setSelectedTemplate(template);
-  window.history.pushState({}, "", `/templates/${template.slug}`);
+  navigate({ 
+    search: { ...search, preview: template.slug }, 
+    resetScroll: false 
+  });
 };

 const handleModalClose = useCallback(() => {
   setSelectedTemplate(null);
-  const url = selectedCategory
-    ? `/templates?category=${encodeURIComponent(selectedCategory)}`
-    : "/templates";
-  window.history.pushState({}, "", url);
+  navigate({ 
+    search: selectedCategory ? { category: selectedCategory } : {}, 
+    resetScroll: false 
+  });
 }, [selectedCategory]);

485-589: Consider adding accessibility attributes to the modal.

The modal works functionally but lacks accessibility attributes. For screen reader users:

-  return (
-    <div className="fixed inset-0 z-50">
+  return (
+    <div 
+      className="fixed inset-0 z-50"
+      role="dialog"
+      aria-modal="true"
+      aria-labelledby="modal-title"
+    >
       <div
         className="absolute inset-0 bg-black/50 backdrop-blur-sm"
         onClick={onClose}
+        aria-hidden="true"
       />

And on Line 527:

-            <h2 className="font-serif text-2xl sm:text-3xl text-stone-700 mb-3">
+            <h2 id="modal-title" className="font-serif text-2xl sm:text-3xl text-stone-700 mb-3">
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35b1859 and d2c2e4b.

⛔ Files ignored due to path filters (1)
  • apps/web/src/routeTree.gen.ts is excluded by !**/*.gen.ts
📒 Files selected for processing (3)
  • apps/web/src/routes/_view/templates.tsx (0 hunks)
  • apps/web/src/routes/_view/templates/$slug.tsx (1 hunks)
  • apps/web/src/routes/_view/templates/index.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/src/routes/_view/templates.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Avoid creating a bunch of types/interfaces if they are not shared. Especially for function props, just inline them instead.
Never do manual state management for form/mutation. Use useForm (from tanstack-form) and useQuery/useMutation (from tanstack-query) instead for 99% of cases. Avoid patterns like setError.
If there are many classNames with conditional logic, use cn (import from @hypr/utils). It is similar to clsx. Always pass an array and split by logical grouping.
Use motion/react instead of framer-motion.

Files:

  • apps/web/src/routes/_view/templates/$slug.tsx
  • apps/web/src/routes/_view/templates/index.tsx
🧬 Code graph analysis (1)
apps/web/src/routes/_view/templates/index.tsx (4)
apps/web/src/routes/_view/templates/$slug.tsx (1)
  • Route (10-39)
apps/web/src/components/slash-separator.tsx (1)
  • SlashSeparator (1-8)
packages/utils/src/cn.ts (1)
  • cn (20-22)
apps/web/src/components/download-button.tsx (1)
  • DownloadButton (5-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Redirect rules - hyprnote
  • GitHub Check: Header rules - hyprnote
  • GitHub Check: Pages changed - hyprnote
  • GitHub Check: ci (macos, macos-14)
  • GitHub Check: fmt
🔇 Additional comments (14)
apps/web/src/routes/_view/templates/$slug.tsx (5)

10-39: Route configuration looks good overall.

The loader correctly handles the 404 case with notFound(), and the meta tags are well-structured for SEO.

One minor observation: Line 22 uses non-null assertion loaderData!. While TanStack Router guarantees loaderData exists in head when loader succeeds, the type assertion is acceptable here since notFound() prevents reaching head on failure.


57-106: LGTM!

The LeftSidebar correctly uses TanStack Router's Link with search params for category navigation and standard anchor links for in-page navigation. The prop type is appropriately inlined.


108-181: LGTM!

The main content area is well-structured with clear component composition. MDX rendering via MDXContent is handled correctly. The ExamplesSection placeholder is appropriate for future implementation.


183-218: LGTM!

The SuggestedTemplates component correctly filters same-category templates, excludes the current template, and gracefully returns null when empty. The Link usage with params follows TanStack Router conventions.


234-277: LGTM!

The RightSidebar correctly uses cn with array syntax per coding guidelines. External links have proper target="_blank" with rel="noopener noreferrer" for security.

apps/web/src/routes/_view/templates/index.tsx (9)

12-42: LGTM!

The route configuration correctly uses validateSearch for type-safe search params and provides appropriate SEO meta tags. The TemplatesSearch type is defined locally which aligns with the coding guidelines.


71-90: LGTM!

Both useEffect hooks are well-implemented with proper cleanup functions and correct dependency arrays. The body overflow control prevents background scrolling when modal is open.


92-113: LGTM!

The useMemo hook correctly memoizes the filtered templates with appropriate dependencies. The filtering logic handles both category and search query.


151-211: LGTM!

Both components are well-implemented. ContributeBanner correctly uses cn with array syntax. HeroSection has inline prop types as per coding guidelines. The search input is properly controlled.


223-263: LGTM!

The mobile category navigation is well-implemented with horizontal scroll and proper active state styling. The cn usage follows the coding guidelines.


265-351: LGTM!

The TemplatesSection and DesktopSidebar components are well-structured. The sticky sidebar positioning and category navigation work correctly. All cn calls use array syntax per coding guidelines.


353-434: LGTM!

Good implementations with proper empty state handling in TemplatesGrid. Using <button> for TemplateCard is correct for accessibility. The target badge overflow handling with "+X more" is a nice UX touch.


436-483: LGTM!

Both components are clean and follow the established patterns. External links have proper security attributes.


591-603: LGTM!

The helper function correctly groups templates by category using a reduce pattern.

@ComputelessComputer ComputelessComputer merged commit c3636f1 into main Nov 28, 2025
13 of 14 checks passed
@ComputelessComputer ComputelessComputer deleted the feat/category-search-navigation branch November 28, 2025 10:03
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