mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-01 11:56:27 +02:00
- Add ai_status column to price_history table (verified/corrected/null)
- Track AI verification status through scraper and scheduler
- Display badges next to prices:
- ✓ AI (green): AI verified the price is correct
- ⚡ AI (orange): AI corrected an incorrect price
- Show badges on Dashboard product cards and ProductDetail page
- Add legend explaining badges in Settings when AI Verification is enabled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import { AIStatus } from '../api/client';
|
|
|
|
interface AIStatusBadgeProps {
|
|
status: AIStatus;
|
|
size?: 'small' | 'normal';
|
|
}
|
|
|
|
export default function AIStatusBadge({ status, size = 'normal' }: AIStatusBadgeProps) {
|
|
if (!status) return null;
|
|
|
|
const isSmall = size === 'small';
|
|
const fontSize = isSmall ? '0.65rem' : '0.75rem';
|
|
const padding = isSmall ? '0.1rem 0.3rem' : '0.15rem 0.4rem';
|
|
|
|
if (status === 'verified') {
|
|
return (
|
|
<span
|
|
style={{
|
|
display: 'inline-flex',
|
|
alignItems: 'center',
|
|
gap: '0.2rem',
|
|
fontSize,
|
|
padding,
|
|
borderRadius: '0.25rem',
|
|
backgroundColor: 'rgba(16, 185, 129, 0.15)',
|
|
color: '#10b981',
|
|
fontWeight: 500,
|
|
}}
|
|
title="AI verified this price is correct"
|
|
>
|
|
<span style={{ fontSize: isSmall ? '0.7rem' : '0.8rem' }}>✓</span>
|
|
AI
|
|
</span>
|
|
);
|
|
}
|
|
|
|
if (status === 'corrected') {
|
|
return (
|
|
<span
|
|
style={{
|
|
display: 'inline-flex',
|
|
alignItems: 'center',
|
|
gap: '0.2rem',
|
|
fontSize,
|
|
padding,
|
|
borderRadius: '0.25rem',
|
|
backgroundColor: 'rgba(245, 158, 11, 0.15)',
|
|
color: '#f59e0b',
|
|
fontWeight: 500,
|
|
}}
|
|
title="AI corrected this price (original scrape was incorrect)"
|
|
>
|
|
<span style={{ fontSize: isSmall ? '0.7rem' : '0.8rem' }}>⚡</span>
|
|
AI
|
|
</span>
|
|
);
|
|
}
|
|
|
|
return null;
|
|
}
|