Skip to content

Add vehicle URL generation and refactor inventory services#6

Merged
mpalmer79 merged 9 commits intomainfrom
claude/update-claude-md-fIZ8v
Mar 3, 2026
Merged

Add vehicle URL generation and refactor inventory services#6
mpalmer79 merged 9 commits intomainfrom
claude/update-claude-md-fIZ8v

Conversation

@mpalmer79
Copy link
Copy Markdown
Owner

Summary

This PR introduces comprehensive vehicle URL generation functionality for dealer inventory, refactors inventory data loading into a dedicated service layer, and improves code organization with new constants and test coverage.

Key Changes

New Features

  • Vehicle URL Generation (src/utils/vehicleUrl.ts): Implements generateVehicleUrl() function that generates SEO-friendly inventory URLs for different vehicle types (trucks, Corvettes, SUVs) across multiple dealer domains (Chevrolet, Buick, GMC). Handles complex URL patterns including drive types, body styles, and model variants.
  • Comprehensive URL Generation Tests (src/utils/vehicleUrl.test.ts): 350+ lines of test coverage for URL generation across domain routing, truck variants, Corvette models, and SUV configurations with edge case handling.

Refactoring

  • Inventory Service Layer (src/services/inventoryService.ts): Extracted Excel parsing logic from hooks into a dedicated service with excelInventoryService implementing a clean InventoryService interface. Centralizes inventory path configuration and data parsing.
  • Drill Types Constants (src/constants/drillTypes.ts): Moved hardcoded drill type strings into a constants file with DRILL_TYPES object and helper functions (isModelDrill, getModelFromDrill), improving maintainability and reducing magic strings.
  • Updated Inventory Loader (src/hooks/useInventoryLoader.ts): Refactored to use the new excelInventoryService instead of inline Excel parsing, reducing hook complexity.

Testing & Quality

  • VirtualizedTable Tests (src/components/VirtualizedTable.test.tsx): Added 161 lines of test coverage for table rendering, grouping, sorting, and user interactions.
  • Accessibility Improvements: Added ARIA labels and roles to table components (VirtualizedTable.tsx, FiltersBar.tsx, KpiBar.tsx, ChartsSection.tsx) for better screen reader support.

Code Quality

  • ErrorBoundary Refactoring (src/components/ErrorBoundary.tsx): Converted inline styles to Tailwind CSS classes for consistency and maintainability.
  • Line Ending Normalization (.gitattributes): Added configuration to ensure consistent LF line endings across the repository.
  • App.tsx Updates: Integrated new drill type constants and improved code organization with proper imports.

Implementation Details

  • Vehicle URL generation intelligently handles brand-specific domain routing and model-specific URL patterns
  • Service layer provides abstraction for future inventory source implementations
  • Constants consolidation reduces string duplication and improves type safety
  • Test coverage includes edge cases like missing VINs, empty bodies, and various vehicle configurations

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC

claude added 9 commits March 3, 2026 13:56
These hooks duplicated functionality already provided by useInventoryLoader
and were not imported anywhere in the codebase.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Create src/constants/drillTypes.ts with DRILL_TYPES, DRILL_TITLES,
and model drill helpers. Refactor App.tsx to use these constants
instead of inline string literals.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Cover domain routing (Chevrolet, GMC, Buick), truck URLs with cab types
and drive formats, Corvette URLs with sub-models and body types, SUV URLs
for multiple models, and edge cases (empty VIN, missing Body/Trim).

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Replace all inline style objects with Tailwind utility classes.
Remove onMouseOver/onMouseOut handlers in favor of hover: variants.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Enforce LF line endings across the repository. CRLF is only
preserved for Windows batch/cmd files.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Add src/services/inventoryService.ts with InventoryService interface
and excelInventoryService implementation. Update useInventoryLoader to
delegate fetch and parse logic to the service layer.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Add aria-label to AgingBucket buttons, KPI cards, filter select
triggers, stock number search input. Add role=table/rowgroup/row/
columnheader to VirtualizedTable for screen reader support.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Cover row rendering, vehicle count display, row click handler,
year/model grouping, empty rows returning null, year descending
sort order, stock number opening in new tab, column headers,
MSRP formatting, and group badge count.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
Generated from npm install to lock dependency versions.

https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 3, 2026

Deploy Preview for chevynhinventory ready!

Name Link
🔨 Latest commit 0cd3ec0
🔍 Latest deploy log https://app.netlify.com/projects/chevynhinventory/deploys/69a6eb269657b000076eb085
😎 Deploy Preview https://deploy-preview-6--chevynhinventory.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.

@mpalmer79 mpalmer79 merged commit 8706678 into main Mar 3, 2026
1 check passed
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 3, 2026

Deploy Preview for chevynhinventory ready!

Name Link
🔨 Latest commit 66db1d9
🔍 Latest deploy log https://app.netlify.com/projects/chevynhinventory/deploys/69a6eb269e5a0d0007558f89
😎 Deploy Preview https://deploy-preview-6--chevynhinventory.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.

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