Skip to content

New docs layout + remove Extensions#1248

Open
skyfallwastaken wants to merge 2 commits into
mainfrom
docs-plus-no-ext
Open

New docs layout + remove Extensions#1248
skyfallwastaken wants to merge 2 commits into
mainfrom
docs-plus-no-ext

Conversation

@skyfallwastaken
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 00:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR introduces a dedicated DocsLayout.svelte sidebar for the docs section and removes the Extensions feature (controller, helper, and page). Navigation is updated to replace the "Extensions" link with "Setup" across the app.

  • P1: resources :extensions, only: [:index] is still present in config/routes.rb even though ExtensionsController was deleted — visiting /extensions will raise a runtime error.

Confidence Score: 3/5

Not safe to merge until the stale extensions route is removed from routes.rb

One P1 bug (orphaned route pointing to a deleted controller) makes the /extensions path broken at runtime; everything else looks solid

config/routes.rb — extensions resource route must be removed

Important Files Changed

Filename Overview
config/routes.rb Extensions route still present despite controller deletion — any visit to /extensions will raise a runtime routing error (P1)
app/controllers/docs_controller.rb Adds inertia_share docs_nav with a new docs_nav_props private method that builds sidebar navigation data (sections, editors, URLs) shared with every docs page
app/javascript/layouts/DocsLayout.svelte New dedicated docs sidebar layout with mobile toggle, keyboard/resize handling, and active-link detection; external links missing noreferrer and "All editors →" link points to docs home rather than an anchor
app/controllers/inertia_controller.rb Replaces "Extensions" nav link with "Setup" (pointing to my_wakatime_setup_path) for both authenticated and unauthenticated users
app/controllers/extensions_controller.rb Deleted — controller removed as part of the Extensions feature removal
app/javascript/pages/Docs/Index.svelte Adopts DocsLayout and refreshes the docs overview with cleaner quick-link cards, popular-editor grid, collapsible all-editors section, and a help footer
app/javascript/pages/Docs/Show.svelte Adopts DocsLayout, removes unused doc_path prop, and extracts prose styling into a typed constant; cleaner article/footer markup
app/javascript/layouts/AppLayout.svelte Removes "Extensions" from long-cache link list — only "Docs" now gets 10-minute cache
app/javascript/pages/Extensions/Index.svelte Deleted — Extensions page removed as part of the Extensions feature removal

Sequence Diagram

sequenceDiagram
    participant Browser
    participant InertiaController
    participant DocsController
    participant DocsLayout

    Browser->>InertiaController: GET /docs (or /docs/*)
    InertiaController->>DocsController: route match
    DocsController->>DocsController: inertia_share docs_nav (docs_nav_props)
    DocsController-->>Browser: Inertia response with docs_nav prop

    Browser->>DocsLayout: render layout(docs_nav)
    DocsLayout->>DocsLayout: isActive(href) via docs_nav.current_path
    DocsLayout-->>Browser: sidebar + main with children

    Note over Browser,DocsLayout: Mobile: toggleNav() / closeNav() via button clicks, resize, Escape key
Loading

Comments Outside Diff (3)

  1. config/routes.rb, line 33 (link)

    P1 Stale extensions route will cause a routing error

    ExtensionsController was deleted in this PR, but resources :extensions, only: [:index] is still present in routes.rb. Any request to /extensions will now raise a LoadError/ActionController::RoutingError at runtime. The route should be removed (or replaced with a redirect) alongside the controller deletion.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: config/routes.rb
    Line: 33
    
    Comment:
    **Stale extensions route will cause a routing error**
    
    `ExtensionsController` was deleted in this PR, but `resources :extensions, only: [:index]` is still present in `routes.rb`. Any request to `/extensions` will now raise a `LoadError`/`ActionController::RoutingError` at runtime. The route should be removed (or replaced with a redirect) alongside the controller deletion.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. app/javascript/layouts/DocsLayout.svelte, line 338-343 (link)

    P2 Missing noreferrer on external links

    External links in the sidebar (GitHub, Slack) use rel="noopener" but omit noreferrer. Without noreferrer, the Referer header is still sent to third-party destinations, leaking the user's current URL. The same pattern appears on the Slack link a few lines below.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: app/javascript/layouts/DocsLayout.svelte
    Line: 338-343
    
    Comment:
    **Missing `noreferrer` on external links**
    
    External links in the sidebar (GitHub, Slack) use `rel="noopener"` but omit `noreferrer`. Without `noreferrer`, the `Referer` header is still sent to third-party destinations, leaking the user's current URL. The same pattern appears on the Slack link a few lines below.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
  3. app/javascript/layouts/DocsLayout.svelte, line 307-313 (link)

    P2 "All editors" sidebar link points to docs home, not an editors anchor

    The "All {n} editors →" link in the sidebar navigates to docs_nav.home_url (the docs overview page). Users clicking it will land on the overview and need to find and manually open the "Browse all editors" <details> accordion themselves. Consider linking to the overview with an anchor (e.g. /docs#all-editors) or just relying on the existing sidebar scroll to make the flow obvious.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: app/javascript/layouts/DocsLayout.svelte
    Line: 307-313
    
    Comment:
    **"All editors" sidebar link points to docs home, not an editors anchor**
    
    The "All {n} editors →" link in the sidebar navigates to `docs_nav.home_url` (the docs overview page). Users clicking it will land on the overview and need to find and manually open the "Browse all editors" `<details>` accordion themselves. Consider linking to the overview with an anchor (e.g. `/docs#all-editors`) or just relying on the existing sidebar scroll to make the flow obvious.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
config/routes.rb:33
**Stale extensions route will cause a routing error**

`ExtensionsController` was deleted in this PR, but `resources :extensions, only: [:index]` is still present in `routes.rb`. Any request to `/extensions` will now raise a `LoadError`/`ActionController::RoutingError` at runtime. The route should be removed (or replaced with a redirect) alongside the controller deletion.

```suggestion
  # resources :extensions, only: [ :index ]  # removed — controller deleted in this PR
```

### Issue 2 of 3
app/javascript/layouts/DocsLayout.svelte:338-343
**Missing `noreferrer` on external links**

External links in the sidebar (GitHub, Slack) use `rel="noopener"` but omit `noreferrer`. Without `noreferrer`, the `Referer` header is still sent to third-party destinations, leaking the user's current URL. The same pattern appears on the Slack link a few lines below.

```suggestion
      rel="noopener noreferrer"
```

### Issue 3 of 3
app/javascript/layouts/DocsLayout.svelte:307-313
**"All editors" sidebar link points to docs home, not an editors anchor**

The "All {n} editors →" link in the sidebar navigates to `docs_nav.home_url` (the docs overview page). Users clicking it will land on the overview and need to find and manually open the "Browse all editors" `<details>` accordion themselves. Consider linking to the overview with an anchor (e.g. `/docs#all-editors`) or just relying on the existing sidebar scroll to make the flow obvious.

Reviews (1): Last reviewed commit: "ok" | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a dedicated documentation layout (with a persistent sidebar) and removes the “Extensions” page from the app navigation and codebase.

Changes:

  • Add DocsLayout and switch Docs pages to use it via Svelte module layout exports.
  • Add shared docs_nav props from DocsController to power sidebar navigation.
  • Remove the Extensions page/controller/helper and replace the nav link with “Setup”.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
app/javascript/pages/Extensions/Index.svelte Removes the Extensions index page.
app/javascript/pages/Docs/Show.svelte Adopts DocsLayout and refactors docs article/breadcrumb/footer markup.
app/javascript/pages/Docs/Index.svelte Adopts DocsLayout and updates docs landing page layout/styling.
app/javascript/layouts/DocsLayout.svelte Adds a new docs-specific layout with responsive sidebar navigation.
app/javascript/layouts/AppLayout.svelte Updates link caching logic after removing Extensions from nav.
app/helpers/extensions_helper.rb Removes now-unused helper module.
app/controllers/inertia_controller.rb Replaces Extensions nav link with Setup.
app/controllers/extensions_controller.rb Removes Extensions controller.
app/controllers/docs_controller.rb Shares docs_nav via Inertia for the new docs sidebar.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +227 to +231
href={docs_nav.github_url}
target="_blank"
rel="noopener"
onclick={handleNavLinkClick}
class={resourceLinkClass}
Comment on lines +250 to +254
target="_blank"
rel="noopener"
onclick={handleNavLinkClick}
class={resourceLinkClass}
>
<a
href={edit_url}
target="_blank"
rel="noopener"
Comment on lines +152 to +158
rel="noopener"
class="text-primary hover:underline">#hackatime-help on Slack</a
>
<a
href="https://github.com/hackclub/hackatime/issues"
target="_blank"
rel="noopener"
Comment on lines +152 to +158
rel="noopener"
class="text-primary hover:underline">#hackatime-help on Slack</a
>
<a
href="https://github.com/hackclub/hackatime/issues"
target="_blank"
rel="noopener"
links << inertia_link("Projects", my_projects_path, active: request.path.start_with?("/my/projects"), inertia: true)
links << inertia_link("Docs", docs_path, active: helpers.current_page?(docs_path) || request.path.start_with?("/docs"), inertia: true)
links << inertia_link("Extensions", extensions_path, active: helpers.current_page?(extensions_path), inertia: true)
links << inertia_link("Setup", my_wakatime_setup_path, active: helpers.current_page?(my_wakatime_setup_path), inertia: true)
</nav>
</aside>

<main class="min-h-dvh flex-1 transition-all duration-300 ease-in-out lg:ml-72">
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.

2 participants