feat: update frontend for Gemini VIN decode (refs #228)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 6m31s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 23s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 6m31s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 23s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
Rename nhtsaValue to sourceValue in frontend MatchedField type and VinOcrReviewModal component. Update NHTSA references to vehicle database across guide pages, hooks, and API documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,8 +95,8 @@ const ReviewContent: React.FC<{
|
||||
const [selectedEngine, setSelectedEngine] = useState('');
|
||||
const [selectedTransmission, setSelectedTransmission] = useState('');
|
||||
|
||||
// NHTSA reference values for unmatched fields
|
||||
const [nhtsaRefs, setNhtsaRefs] = useState<Record<string, string | null>>({});
|
||||
// Source reference values for unmatched fields
|
||||
const [sourceRefs, setSourceRefs] = useState<Record<string, string | null>>({});
|
||||
|
||||
// Initialize dropdown options and pre-select decoded values
|
||||
useEffect(() => {
|
||||
@@ -109,13 +109,13 @@ const ReviewContent: React.FC<{
|
||||
|
||||
if (!decodedVehicle) return;
|
||||
|
||||
// Store NHTSA reference values for unmatched fields
|
||||
setNhtsaRefs({
|
||||
make: decodedVehicle.make.confidence === 'none' ? decodedVehicle.make.nhtsaValue : null,
|
||||
model: decodedVehicle.model.confidence === 'none' ? decodedVehicle.model.nhtsaValue : null,
|
||||
trim: decodedVehicle.trimLevel.confidence === 'none' ? decodedVehicle.trimLevel.nhtsaValue : null,
|
||||
engine: decodedVehicle.engine.confidence === 'none' ? decodedVehicle.engine.nhtsaValue : null,
|
||||
transmission: decodedVehicle.transmission.confidence === 'none' ? decodedVehicle.transmission.nhtsaValue : null,
|
||||
// Store source reference values for unmatched fields
|
||||
setSourceRefs({
|
||||
make: decodedVehicle.make.confidence === 'none' ? decodedVehicle.make.sourceValue : null,
|
||||
model: decodedVehicle.model.confidence === 'none' ? decodedVehicle.model.sourceValue : null,
|
||||
trim: decodedVehicle.trimLevel.confidence === 'none' ? decodedVehicle.trimLevel.sourceValue : null,
|
||||
engine: decodedVehicle.engine.confidence === 'none' ? decodedVehicle.engine.sourceValue : null,
|
||||
transmission: decodedVehicle.transmission.confidence === 'none' ? decodedVehicle.transmission.sourceValue : null,
|
||||
});
|
||||
|
||||
const yearValue = decodedVehicle.year.value;
|
||||
@@ -277,9 +277,9 @@ const ReviewContent: React.FC<{
|
||||
});
|
||||
};
|
||||
|
||||
/** Show NHTSA reference when field had no dropdown match */
|
||||
const nhtsaHint = (field: string) => {
|
||||
const ref = nhtsaRefs[field];
|
||||
/** Show source reference when field had no dropdown match */
|
||||
const sourceHint = (field: string) => {
|
||||
const ref = sourceRefs[field];
|
||||
if (!ref) return null;
|
||||
// Only show hint when no value is currently selected
|
||||
const selected: Record<string, string> = {
|
||||
@@ -292,7 +292,7 @@ const ReviewContent: React.FC<{
|
||||
if (selected[field]) return null;
|
||||
return (
|
||||
<p className="mt-1 text-xs text-gray-500 dark:text-titanio">
|
||||
NHTSA returned: {ref}
|
||||
Decoded value: {ref}
|
||||
</p>
|
||||
);
|
||||
};
|
||||
@@ -409,7 +409,7 @@ const ReviewContent: React.FC<{
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{nhtsaHint('make')}
|
||||
{sourceHint('make')}
|
||||
</div>
|
||||
|
||||
{/* Model */}
|
||||
@@ -439,7 +439,7 @@ const ReviewContent: React.FC<{
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{nhtsaHint('model')}
|
||||
{sourceHint('model')}
|
||||
</div>
|
||||
|
||||
{/* Trim */}
|
||||
@@ -469,7 +469,7 @@ const ReviewContent: React.FC<{
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{nhtsaHint('trim')}
|
||||
{sourceHint('trim')}
|
||||
</div>
|
||||
|
||||
{/* Engine */}
|
||||
@@ -499,7 +499,7 @@ const ReviewContent: React.FC<{
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{nhtsaHint('engine')}
|
||||
{sourceHint('engine')}
|
||||
</div>
|
||||
|
||||
{/* Transmission */}
|
||||
@@ -529,7 +529,7 @@ const ReviewContent: React.FC<{
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{nhtsaHint('transmission')}
|
||||
{sourceHint('transmission')}
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user