Add vehicle URL generation and refactor inventory services#6
Merged
Conversation
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
✅ Deploy Preview for chevynhinventory ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for chevynhinventory ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
src/utils/vehicleUrl.ts): ImplementsgenerateVehicleUrl()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.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
src/services/inventoryService.ts): Extracted Excel parsing logic from hooks into a dedicated service withexcelInventoryServiceimplementing a cleanInventoryServiceinterface. Centralizes inventory path configuration and data parsing.src/constants/drillTypes.ts): Moved hardcoded drill type strings into a constants file withDRILL_TYPESobject and helper functions (isModelDrill,getModelFromDrill), improving maintainability and reducing magic strings.src/hooks/useInventoryLoader.ts): Refactored to use the newexcelInventoryServiceinstead of inline Excel parsing, reducing hook complexity.Testing & Quality
src/components/VirtualizedTable.test.tsx): Added 161 lines of test coverage for table rendering, grouping, sorting, and user interactions.VirtualizedTable.tsx,FiltersBar.tsx,KpiBar.tsx,ChartsSection.tsx) for better screen reader support.Code Quality
src/components/ErrorBoundary.tsx): Converted inline styles to Tailwind CSS classes for consistency and maintainability..gitattributes): Added configuration to ensure consistent LF line endings across the repository.Implementation Details
https://claude.ai/code/session_016m2i5SSgpx7MLBkJhwVEyC