Initial commit - WhyRating Engine (Google Reviews Scraper)

This commit is contained in:
Alejandro Gutiérrez
2026-02-02 18:19:00 +00:00
parent 0543a08242
commit 2206ddeff2
136 changed files with 51138 additions and 855 deletions

View File

@@ -16,7 +16,7 @@ import {
Award,
} from 'lucide-react';
import { useTranslation } from '@/hooks/useTranslation';
import type { Insights, WeaknessItem, OpportunitySpan, OpportunityMatrix, DomainScore, URTDomain, Synthesis } from '../types';
import type { Insights, WeaknessItem, OpportunitySpan, OpportunityMatrix, DomainScore, URTDomain } from '../types';
import { getSubcodeDefinition } from '@/lib/taxonomy/data';
interface ExecutiveSummaryProps {
@@ -25,8 +25,6 @@ interface ExecutiveSummaryProps {
domainScores?: DomainScore[];
onDriverClick?: (subcode: string) => void;
onDomainClick?: (domain: URTDomain) => void;
// AI-generated narrative (optional - enhances when available)
synthesis?: Synthesis | null;
}
// User-friendly domain config
@@ -204,13 +202,12 @@ export function ExecutiveSummary({
domainScores,
onDriverClick,
onDomainClick,
synthesis,
}: ExecutiveSummaryProps) {
const { strengths, weaknesses, executive_summary, opportunity_matrix, rating_simulator } = insights;
const [showFullSummary, setShowFullSummary] = useState(false);
// Use AI narrative if available, otherwise fall back to generated summary
const narrativeText = synthesis?.executive_narrative || executive_summary;
// Use the generated summary from insights
const narrativeText = executive_summary;
const topStrength = strengths[0];
const topWeakness = weaknesses[0];
@@ -294,20 +291,13 @@ export function ExecutiveSummary({
</div>
</div>
{/* AI Summary */}
{/* Summary */}
{narrativeText && (
<div className="px-6 pb-4">
<div className={`p-4 rounded-xl border ${
synthesis?.executive_narrative
? 'bg-gradient-to-r from-purple-50 to-blue-50 border-purple-200'
: 'bg-white/70 border-blue-100'
}`}>
<div className="p-4 rounded-xl border bg-white/70 border-blue-100">
<div className="flex items-start gap-2">
<span className="text-lg">{synthesis?.executive_narrative ? '✨' : '💡'}</span>
<span className="text-lg">💡</span>
<div className="flex-1">
{synthesis?.executive_narrative && (
<div className="text-xs font-medium text-purple-600 mb-1">AI-Generated Insight</div>
)}
<p className={`text-gray-700 leading-relaxed ${!showFullSummary && 'line-clamp-3'}`}>
{narrativeText}
</p>