Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
c61a308
1
Parent(s): 87a5ed4
Fix TypeScript errors, sync AISummaryJson type with backend niche field, and fix Star icon import
Browse filesFiles changed (2)
123456789101112131411 unmodified lines2627282930313289 unmodified lines1221231241251261271287 unmodified lines13613713813914014114270 unmodified lines213214215216217218219'use client'import { useState, useEffect } from 'react'import { Lead } from '@/lib/api'import { cn } from '@/lib/utils'import {Brain, TrendingUp, DollarSign, Target, Clock, AlertCircle,Lightbulb, User as UserIcon, CheckCircle2, Phone, Check,Loader2, RefreshCw, Bot, Zap, Database, Shield, MessageSquare,AlertTriangle, ThumbsUp, PenTool, Copy, ChevronDown, ChevronUp,Mail, Archive, PhoneCall, MapPin, Briefcase, Flame} from 'lucide-react'import { useToast } from '@/contexts/ToastContext'import { motion, AnimatePresence } from 'framer-motion'11 unmodified linesexport function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversationId, tenantId }: ClientCardProps) {const { success, error } = useToast()const { t } = useTranslation()const summary = (lead.ai_summary_json || {}) as anyconst [expandedSection, setExpandedSection] = useState<string | null>(null)const [isReanalyzing, setIsReanalyzing] = useState(false)const [currentStage, setCurrentStage] = useState<any>(null)89 unmodified linesbudget: cleanValue(summary.budget || lead.budget, t('clientCard.notDefined')),authority: cleanValue(summary.authority || lead.authority, t('common.unknown')),timeline: cleanValue(summary.timeline || lead.timeline, t('clientCard.notSpecified')),industry: cleanValue(summary.niche || summary.industry || (lead as any).industry || summary.business_type, t('clientCard.notSpecified')),pain_points: Array.isArray(summary.pain_points) ? summary.pain_points : [],objections: Array.isArray(summary.objections) ? summary.objections : [],psychotype: cleanValue(summary.psychotype || lead.psychotype, 'unknown'),7 unmodified linesconst getPsychotypeInfo = (type: string) => {const map: Record<string, { label: string; color: string; bg: string; icon: any }> = {'dominant': { label: t('psychotypes.dominant'), color: 'text-red-600', bg: 'bg-red-50', icon: Zap },'influential': { label: t('psychotypes.influential'), color: 'text-amber-600', bg: 'bg-amber-50', icon: StarIcon },'steady': { label: t('psychotypes.steady'), color: 'text-emerald-600', bg: 'bg-emerald-50', icon: Shield },'conscientious': { label: t('psychotypes.conscientious'), color: 'text-blue-600', bg: 'bg-blue-50', icon: Database },'unknown': { label: t('clientCard.notDetermined'), color: 'text-slate-500', bg: 'bg-slate-50', icon: UserIcon }70 unmodified lines!hasQualField(t('clientCard.name')) && `${t('clientCard.name')}: ${lead.name || t('common.unknown')}`,data.intent && `${t('clientCard.goals')}: ${data.intent}`,!hasQualField(t('clientCard.niche')) && data.niche && `${t('clientCard.niche')}: ${data.niche}`,!hasQualField(t('clientCard.need')) && (data as any).need && (data as any).need !== t('clientCard.notDetermined') && `${t('clientCard.need')}: ${(data as any).need}`,!hasQualField(t('clientCard.budget')) && data.budget && data.budget !== t('clientCard.notDefined') && `${t('clientCard.budget')}: ${data.budget}`,!hasQualField(t('clientCard.decisionMaker')) && data.authority && data.authority !== t('common.unknown') && `${t('clientCard.decisionMaker')}: ${data.authority}`,!hasQualField(t('clientCard.timeline')) && data.timeline && data.timeline !== t('clientCard.notSpecified') && `${t('clientCard.timeline')}: ${data.timeline}`,123456789101112131411 unmodified lines2627282930313289 unmodified lines1221231241251261271287 unmodified lines13613713813914014114270 unmodified lines213214215216217218219'use client'import { useState, useEffect } from 'react'import { Lead, AISummaryJson } from '@/lib/api'import { cn } from '@/lib/utils'import {Brain, TrendingUp, DollarSign, Target, Clock, AlertCircle,Lightbulb, User as UserIcon, CheckCircle2, Phone, Check,Loader2, RefreshCw, Bot, Zap, Database, Shield, MessageSquare,AlertTriangle, ThumbsUp, PenTool, Copy, ChevronDown, ChevronUp,Mail, Archive, PhoneCall, MapPin, Briefcase, Flame, Star} from 'lucide-react'import { useToast } from '@/contexts/ToastContext'import { motion, AnimatePresence } from 'framer-motion'11 unmodified linesexport function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversationId, tenantId }: ClientCardProps) {const { success, error } = useToast()const { t } = useTranslation()const summary = (lead.ai_summary_json || {}) as AISummaryJsonconst [expandedSection, setExpandedSection] = useState<string | null>(null)const [isReanalyzing, setIsReanalyzing] = useState(false)const [currentStage, setCurrentStage] = useState<any>(null)89 unmodified linesbudget: cleanValue(summary.budget || lead.budget, t('clientCard.notDefined')),authority: cleanValue(summary.authority || lead.authority, t('common.unknown')),timeline: cleanValue(summary.timeline || lead.timeline, t('clientCard.notSpecified')),niche: cleanValue(summary.niche || summary.industry || (lead as any).industry || (lead as any).business_type, t('clientCard.notSpecified')),pain_points: Array.isArray(summary.pain_points) ? summary.pain_points : [],objections: Array.isArray(summary.objections) ? summary.objections : [],psychotype: cleanValue(summary.psychotype || lead.psychotype, 'unknown'),7 unmodified linesconst getPsychotypeInfo = (type: string) => {const map: Record<string, { label: string; color: string; bg: string; icon: any }> = {'dominant': { label: t('psychotypes.dominant'), color: 'text-red-600', bg: 'bg-red-50', icon: Zap },'influential': { label: t('psychotypes.influential'), color: 'text-amber-600', bg: 'bg-amber-50', icon: Star },'steady': { label: t('psychotypes.steady'), color: 'text-emerald-600', bg: 'bg-emerald-50', icon: Shield },'conscientious': { label: t('psychotypes.conscientious'), color: 'text-blue-600', bg: 'bg-blue-50', icon: Database },'unknown': { label: t('clientCard.notDetermined'), color: 'text-slate-500', bg: 'bg-slate-50', icon: UserIcon }70 unmodified lines!hasQualField(t('clientCard.name')) && `${t('clientCard.name')}: ${lead.name || t('common.unknown')}`,data.intent && `${t('clientCard.goals')}: ${data.intent}`,!hasQualField(t('clientCard.niche')) && data.niche && `${t('clientCard.niche')}: ${data.niche}`,!hasQualField(t('clientCard.need')) && data.need && data.need !== t('clientCard.notDetermined') && `${t('clientCard.need')}: ${data.need}`,!hasQualField(t('clientCard.budget')) && data.budget && data.budget !== t('clientCard.notDefined') && `${t('clientCard.budget')}: ${data.budget}`,!hasQualField(t('clientCard.decisionMaker')) && data.authority && data.authority !== t('common.unknown') && `${t('clientCard.decisionMaker')}: ${data.authority}`,!hasQualField(t('clientCard.timeline')) && data.timeline && data.timeline !== t('clientCard.notSpecified') && `${t('clientCard.timeline')}: ${data.timeline}`,
31 unmodified lines32333435363731 unmodified linestimeline?: stringauthority?: stringlocation?: stringindustry?: string// Soft Datapain_points?: string[]31 unmodified lines3233343536373831 unmodified linestimeline?: stringauthority?: stringlocation?: stringniche?: stringindustry?: string// Soft Datapain_points?: string[]
frontend/components/ClientCard.tsx+6-6
frontend/types/index.ts+1