Spaces:
Sleeping
Sleeping
File size: 4,920 Bytes
ef785b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | function ReportCard({ dimension, score, evidence = [], viewType, footnote, dataUnavailable, hrView }) {
if (viewType === 'hr' && hrView && hrView.first_impression) {
const concernLevel = hrView.hr_concern_level
const levelColor = concernLevel === 'low' ? 'var(--color-success)' : concernLevel === 'medium' ? 'var(--color-warning)' : 'var(--color-error)'
const levelLabel = concernLevel === 'low' ? '低' : concernLevel === 'medium' ? '中' : '高'
return (
<div className="card">
<h4 className="font-bold mb-12">{dimension}</h4>
<div className="hr-quote-box mb-16">
<p className="text-sm italic">"{hrView.first_impression}"</p>
</div>
<div className="flex flex-col gap-12 mb-16">
{hrView.attention_points && hrView.attention_points.map((point, i) => (
<div key={i} className="attention-point-box">
<p className="font-bold text-sm">{point.aspect}</p>
<p className="text-sm text-secondary mt-4" style={{ wordBreak: 'break-word' }}>{point.finding}</p>
{point.concern && point.concern !== '无' && (
<p className="text-sm text-error mt-4" style={{ wordBreak: 'break-word' }}>关注点: {point.concern}</p>
)}
</div>
))}
</div>
<div className="flex items-center gap-8 mb-16">
<span className="text-sm text-secondary">HR 关注度:</span>
<span className="hr-concern-tag" style={{ color: levelColor, backgroundColor: `color-mix(in srgb, ${levelColor} 15%, transparent)`, border: `1px solid color-mix(in srgb, ${levelColor} 25%, transparent)` }}>{levelLabel}</span>
</div>
{hrView.screen_summary && (
<p className="hr-summary-box">
<span className="font-bold">筛选总结: </span>{hrView.screen_summary}
</p>
)}
</div>
)
}
if (dataUnavailable) {
return (
<div className="card opacity-5">
<h4 className="font-bold">{dimension}</h4>
<p className="text-secondary mt-8">数据暂不可用</p>
</div>
)
}
if (viewType === 'hr') {
const conclusion = score >= 70 ? 'OK ✓' : score >= 40 ? '⚠️' : '✗'
const finding = evidence.length > 0 ? evidence[0].text : '暂无关键发现'
return (
<div className="card">
<div className="flex-between flex-wrap-mobile">
<h4 className="font-bold">{dimension}</h4>
<span className="text-lg font-bold">{conclusion}</span>
</div>
<p className="text-secondary mt-8">{finding}</p>
{footnote && (
<p className="text-sm text-light mt-8 py-8 px-12 bg-primary-soft">
{footnote}
</p>
)}
</div>
)
}
const evidenceObj = Array.isArray(evidence) ? (evidence.length > 0 ? evidence[0] : null) : evidence
const hasJdQuote = evidenceObj && (evidenceObj.jd_quote || evidenceObj.resume_quote)
if (hasJdQuote) {
return (
<div className="card">
<div className="flex-between flex-wrap-mobile">
<h4 className="font-bold">{dimension}</h4>
<span className="text-lg font-bold">{score}%</span>
</div>
<div className="progress-bar-md progress-bar-bg-md mt-12">
<div className="progress-bar-fill" style={{ width: `${score}%`, backgroundColor: 'var(--color-primary)' }} />
</div>
<div className="grid-2 gap-12 mt-16">
<div className="jd-quote-box">
<p className="font-bold text-sm mb-4">📋 JD要求</p>
<p className="text-sm text-secondary" style={{ wordBreak: 'break-word' }}>{evidenceObj.jd_quote}</p>
</div>
<div className="resume-quote-box">
<p className="font-bold text-sm mb-4">📝 简历匹配</p>
<p className="text-sm text-secondary" style={{ wordBreak: 'break-word' }}>{evidenceObj.resume_quote}</p>
</div>
</div>
</div>
)
}
return (
<div className="card">
<div className="flex-between flex-wrap-mobile">
<h4 className="font-bold">{dimension}</h4>
<span className="text-lg font-bold">{score}%</span>
</div>
<div className="progress-bar-md progress-bar-bg-md mt-12">
<div className="progress-bar-fill" style={{ width: `${score}%`, backgroundColor: 'var(--color-primary)' }} />
</div>
{(Array.isArray(evidence) && evidence.length > 0) && (
<ul className="mt-16 evidence-list">
{evidence.map((item, i) => (
<li key={i} className="evidence-item">
<span className="text-primary" style={{ wordBreak: 'break-word' }}>{item.text}</span>
{item.source && (
<span className="evidence-source">— {item.source}</span>
)}
</li>
))}
</ul>
)}
</div>
)
}
export default ReportCard
|