Skip to content

Add file-path component for consistent path rendering#73

Merged
fgilio merged 3 commits into
mainfrom
claude/bold-file-names-1SWcI
Apr 29, 2026
Merged

Add file-path component for consistent path rendering#73
fgilio merged 3 commits into
mainfrom
claude/bold-file-names-1SWcI

Conversation

@fgilio
Copy link
Copy Markdown
Owner

@fgilio fgilio commented Apr 28, 2026

Summary

Introduces a new <x-file-path> Blade component that standardizes how file paths are displayed throughout the application. The component implements an identifier-first visual hierarchy where the basename is emphasized and the directory is dimmed, with intelligent truncation that preserves the filename when space is constrained.

Key Changes

  • New component: resources/views/components/file-path.blade.php

    • Renders paths with semantic DOM structure (directory + basename as continuous text)
    • Supports optional old-path prop for displaying file renames with arrow
    • Uses inline-flex layout with shrinkable directory and fixed-width basename to prevent filename clipping
    • Applies identifier-first styling: font-semibold on basename, opacity-60 on directory
    • Sets full path in title attribute by default; allows caller override
  • Comprehensive test suite: tests/Feature/View/FilePathComponentTest.php

    • 10 tests covering basic rendering, title attributes, renames, edge cases, and layout behavior
  • Updated documentation: resources/CLAUDE.md

    • New "Paths & identifiers" section establishing design rules for path rendering
    • Guidelines for when to use the component vs. alternatives
    • Notes on Alpine-rendered paths with helper functions
  • Applied component across codebase:

    • resources/views/components/diff/file-header.blade.php: Replaced manual rename rendering
    • resources/views/pages/⚡review-page.blade.php: Updated trash list and added pathDir()/pathBase() Alpine helpers
    • resources/views/livewire/⚡comments-drawer.blade.php: Replaced truncated path display
    • resources/views/components/project-list.blade.php: Replaced project path rendering
  • Test update: tests/Unit/Livewire/DiffFileTest.php

    • Updated assertion to expect (Unicode arrow) instead of &rarr; HTML entity

Implementation Details

The component encodes a key UX principle: when scanning lists, users hunt for the identifier (filename) first; the directory only disambiguates when basenames collide. The layout uses inline-flex with min-w-0 on the directory span to allow it to shrink and ellipsize while shrink-0 on the basename ensures it never gets clipped. This prevents the frustrating UX of seeing app/Domains/Metadata/Traits/HasTaxonomies.p… where the critical identifier is hidden.

For Alpine-rendered paths (client-side text updates), the review page now includes pathDir() and pathBase() helper functions that mirror the component's splitting logic, ensuring visual consistency.

https://claude.ai/code/session_01XdgmqDwfhqvV7FRr2jyfjw

Summary by CodeRabbit

  • New Features

    • Reusable file-path UI so directories are muted, filenames emphasized, and renames show old→new clearly; basename never truncates.
    • Alpine helpers to split directory/basename for consistent rendering.
  • Documentation

    • Added guidelines for standardized file path rendering and accessibility (full-path tooltips/labels).
  • Tests

    • Added tests covering rendering, titles, renames, truncation, and accessibility.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8f2240bd-198c-46b1-93d9-cf2122fd1963

📥 Commits

Reviewing files that changed from the base of the PR and between 5fa3a4a and 023e03f.

📒 Files selected for processing (9)
  • resources/CLAUDE.md
  • resources/views/components/diff/file-header.blade.php
  • resources/views/components/file-path.blade.php
  • resources/views/components/project-list.blade.php
  • resources/views/livewire/⚡comments-drawer.blade.php
  • resources/views/livewire/⚡diff-file.blade.php
  • resources/views/pages/⚡review-page.blade.php
  • tests/Feature/View/FilePathComponentTest.php
  • tests/Unit/Livewire/DiffFileTest.php
✅ Files skipped from review due to trivial changes (3)
  • resources/views/livewire/⚡diff-file.blade.php
  • tests/Unit/Livewire/DiffFileTest.php
  • resources/CLAUDE.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • resources/views/components/project-list.blade.php
  • tests/Feature/View/FilePathComponentTest.php
  • resources/views/pages/⚡review-page.blade.php

📝 Walkthrough

Walkthrough

Introduces a reusable <x-file-path> Blade component, documents file-path rendering standards, updates multiple views to use the component (including Alpine helpers for segmentation), and adds tests to validate segmentation, styling, rename display, and titles.

Changes

Cohort / File(s) Summary
Documentation
resources/CLAUDE.md
Adds standards for identifier-first path rendering, truncation rules, rename display, accessibility (title/aria), and advises using <x-file-path> instead of ad-hoc spans.
New Component
resources/views/components/file-path.blade.php
New Blade component accepting path and optional oldPath; splits into directory (muted, truncatable) and basename (non-truncated, emphasized), renders rename arrow and default title.
View Integrations
resources/views/components/diff/file-header.blade.php, resources/views/components/project-list.blade.php, resources/views/livewire/⚡comments-drawer.blade.php, resources/views/pages/⚡review-page.blade.php
Replaces inline path markup with <x-file-path>; review-page also adds Alpine helpers for pathDir/pathBase and updates recently-reviewed rows to use segmented rendering.
Minor Markup
resources/views/livewire/⚡diff-file.blade.php
Inserts a descriptive Blade comment marking the "File body" section; no behavior change.
Tests
tests/Feature/View/FilePathComponentTest.php, tests/Unit/Livewire/DiffFileTest.php
Adds feature tests validating segmentation, classes, title behavior, rename formatting; updates a unit test to expect the literal arrow character.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A slash, a split, a basename bright,

directory dimmed, kept tidy and light.
One component now hops through each view,
Old paths and new—an arrow or two.
Hooray for neat code, and carrots too! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: introducing a new reusable Blade component for standardized file-path rendering across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ 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 claude/bold-file-names-1SWcI

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown

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

🧹 Nitpick comments (1)
tests/Feature/View/FilePathComponentTest.php (1)

84-89: Remove non-essential inline comments in this assertion block.

The comments at Line 84 and Line 88 describe straightforward expectations and can be dropped to keep the test body cleaner.

♻️ Proposed cleanup
-    // Directory span: shrinkable + ellipsizing
     expect($html)
         ->toContain('min-w-0')
         ->toContain('truncate')
-        // Basename span: shrink-0 keeps it whole when the row narrows
         ->toContain('shrink-0');

As per coding guidelines, "Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/Feature/View/FilePathComponentTest.php` around lines 84 - 89, Remove
the two non-essential inline comments in the assertion block that starts with
expect($html) and asserts
->toContain('min-w-0')->toContain('truncate')->toContain('shrink-0');
specifically delete the comment describing "Directory span: shrinkable +
ellipsizing" and the inline comment "Basename span: shrink-0 keeps it whole when
the row narrows", leaving only the chain of expectations intact in the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/Feature/View/FilePathComponentTest.php`:
- Around line 84-89: Remove the two non-essential inline comments in the
assertion block that starts with expect($html) and asserts
->toContain('min-w-0')->toContain('truncate')->toContain('shrink-0');
specifically delete the comment describing "Directory span: shrinkable +
ellipsizing" and the inline comment "Basename span: shrink-0 keeps it whole when
the row narrows", leaving only the chain of expectations intact in the test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 48bce30d-df11-4a75-bed5-3745b26f29bf

📥 Commits

Reviewing files that changed from the base of the PR and between 5e44b47 and 5fa3a4a.

📒 Files selected for processing (9)
  • resources/CLAUDE.md
  • resources/views/components/diff/file-header.blade.php
  • resources/views/components/file-path.blade.php
  • resources/views/components/project-list.blade.php
  • resources/views/livewire/⚡comments-drawer.blade.php
  • resources/views/livewire/⚡diff-file.blade.php
  • resources/views/pages/⚡review-page.blade.php
  • tests/Feature/View/FilePathComponentTest.php
  • tests/Unit/Livewire/DiffFileTest.php

Adds <x-file-path> as the single way to render a path: directory dimmed,
basename in font-semibold. The component lays out inline-flex so the
directory ellipsizes first when a row narrows — the basename is never the
clipped token.

Migrated the review-page sidebar file list, recently-reviewed list,
diff-file header (including renames), comments-drawer header, and
project-list path subtitle. Codified the rules under "Paths & identifiers"
in resources/CLAUDE.md so future call sites stay consistent.

https://claude.ai/code/session_01XdgmqDwfhqvV7FRr2jyfjw
@fgilio fgilio force-pushed the claude/bold-file-names-1SWcI branch from 5fa3a4a to 0660ea3 Compare April 28, 2026 20:44
claude added 2 commits April 28, 2026 20:57
Renders 9 path-treatment variants — control, three opacity-only
variants at 60/50/40 dim, color-+-medium-weight, real-muted-color,
muted+medium, muted+medium with no emphasis on single-token rows,
and a tracking-tight option — across narrow/medium/wide column
widths so we can pick before committing to one. Sample paths cover
deep nesting, long basenames, single-token files, and the dotted
hidden-dir case from the screenshots.

Delete the route in routes/web.php and the page once a treatment
is picked.

https://claude.ai/code/session_01XdgmqDwfhqvV7FRr2jyfjw
Drops font-semibold on the basename and opacity-60 on the directory
in favor of real muted colors: directory at text-gh-muted/70, basename
at text-gh-text. Renames keep the old path slightly more faded
(text-gh-muted/50). Same change applied to the Alpine-rendered
recently-reviewed list on the review page.

Why color over weight: monospace bold is loud and produced a "shouty"
texture in long lists. Color-only hierarchy reads calmer while still
making the basename pop. Why real colors over opacity: opacity-60 of
an already-muted parent (e.g. project-list path subtitle) compounded
to barely-legible — real colors compose predictably across contexts.

Removes /file-path-lab and its route now that the variant is picked.

https://claude.ai/code/session_01XdgmqDwfhqvV7FRr2jyfjw
@fgilio fgilio merged commit e82cfbe into main Apr 29, 2026
15 checks passed
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