Spaces:
Sleeping
Sleeping
Download frontend/src/components/ReportCard.jsx from tryprogram/offer-puplayer: direct link, hf CLI and curl.
- Browser
- Download file 6.03 kB
-
https://huggingface.co/spaces/tryprogram/offer-puplayer/resolve/main/frontend/src/components/ReportCard.jsx
- Command line
-
hf download hf://spaces/tryprogram/offer-puplayer/frontend/src/components/ReportCard.jsx
-
curl -L -o ReportCard.jsx https://huggingface.co/spaces/tryprogram/offer-puplayer/resolve/main/frontend/src/components/ReportCard.jsx
6.03 kB
| function ReportCard({ dimension, score, evidence = [], viewType, footnote, dataUnavailable, hrView }) { | |
| if (viewType === 'hr' && hrView && hrView.first_impression) { | |
| const levelColor = hrView.hr_concern_level === 'low' ? '#10B981' : hrView.hr_concern_level === 'medium' ? '#F59E0B' : '#EF4444' | |
| const levelLabel = hrView.hr_concern_level === 'low' ? '低' : hrView.hr_concern_level === 'medium' ? '中' : '高' | |
| return ( | |
| <div className="card"> | |
| <h4 className="font-bold mb-12">{dimension}</h4> | |
| <div style={{ padding: 12, backgroundColor: 'rgba(79,70,229,0.06)', borderRadius: 'var(--radius-sm)', borderLeft: '3px solid #4F46E5', marginBottom: 16 }}> | |
| <p className="text-sm" style={{ fontStyle: '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} style={{ padding: 12, backgroundColor: '#F9FAFB', borderRadius: 'var(--radius-sm)' }}> | |
| <p className="font-bold text-sm">{point.aspect}</p> | |
| <p className="text-sm text-secondary mt-4">{point.finding}</p> | |
| {point.concern && point.concern !== '无' && ( | |
| <p className="text-sm" style={{ color: '#DC2626', marginTop: 4 }}>关注点: {point.concern}</p> | |
| )} | |
| </div> | |
| ))} | |
| </div> | |
| <div className="flex items-center gap-8 mb-16"> | |
| <span className="text-sm text-secondary">HR 关注度:</span> | |
| <span className="tag" style={{ backgroundColor: `${levelColor}18`, color: levelColor, border: `1px solid ${levelColor}40`, fontWeight: 700 }}>{levelLabel}</span> | |
| </div> | |
| {hrView.screen_summary && ( | |
| <p className="text-sm" style={{ padding: 12, backgroundColor: 'rgba(16,185,129,0.06)', borderRadius: 'var(--radius-sm)' }}> | |
| <span className="font-bold">筛选总结: </span>{hrView.screen_summary} | |
| </p> | |
| )} | |
| </div> | |
| ) | |
| } | |
| if (dataUnavailable) { | |
| return ( | |
| <div className="card" style={{ opacity: 0.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"> | |
| <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" style={{ padding: '8px 12px', backgroundColor: 'rgba(79,70,229,0.06)', borderRadius: 'var(--radius-sm)' }}> | |
| {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"> | |
| <h4 className="font-bold">{dimension}</h4> | |
| <span className="text-lg font-bold">{score}%</span> | |
| </div> | |
| <div | |
| style={{ | |
| height: 8, | |
| backgroundColor: '#E5E7EB', | |
| borderRadius: 4, | |
| marginTop: 12, | |
| overflow: 'hidden', | |
| }} | |
| > | |
| <div | |
| style={{ | |
| width: `${score}%`, | |
| height: '100%', | |
| backgroundColor: '#4F46E5', | |
| borderRadius: 4, | |
| transition: 'width 0.5s ease', | |
| }} | |
| /> | |
| </div> | |
| <div className="mt-16" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}> | |
| <div style={{ padding: 12, border: '1px solid var(--color-border)', borderRadius: 'var(--radius-sm)', backgroundColor: 'rgba(79,70,229,0.04)' }}> | |
| <p className="font-bold text-sm mb-4">📋 JD要求</p> | |
| <p className="text-sm text-secondary">{evidenceObj.jd_quote}</p> | |
| </div> | |
| <div style={{ padding: 12, border: '1px solid var(--color-border)', borderRadius: 'var(--radius-sm)', backgroundColor: 'rgba(16,185,129,0.04)' }}> | |
| <p className="font-bold text-sm mb-4">📝 简历匹配</p> | |
| <p className="text-sm text-secondary">{evidenceObj.resume_quote}</p> | |
| </div> | |
| </div> | |
| </div> | |
| ) | |
| } | |
| return ( | |
| <div className="card"> | |
| <div className="flex-between"> | |
| <h4 className="font-bold">{dimension}</h4> | |
| <span className="text-lg font-bold">{score}%</span> | |
| </div> | |
| <div | |
| style={{ | |
| height: 8, | |
| backgroundColor: '#E5E7EB', | |
| borderRadius: 4, | |
| marginTop: 12, | |
| overflow: 'hidden', | |
| }} | |
| > | |
| <div | |
| style={{ | |
| width: `${score}%`, | |
| height: '100%', | |
| backgroundColor: '#4F46E5', | |
| borderRadius: 4, | |
| transition: 'width 0.5s ease', | |
| }} | |
| /> | |
| </div> | |
| {(Array.isArray(evidence) && evidence.length > 0) && ( | |
| <ul className="mt-16" style={{ listStyle: 'none' }}> | |
| {evidence.map((item, i) => ( | |
| <li key={i} className="text-sm text-secondary" style={{ marginTop: 4 }}> | |
| <span style={{ color: '#4F46E5' }}>{item.text}</span> | |
| {item.source && ( | |
| <span className="text-light" style={{ marginLeft: 4 }}> | |
| — {item.source} | |
| </span> | |
| )} | |
| </li> | |
| ))} | |
| </ul> | |
| )} | |
| </div> | |
| ) | |
| } | |
| export default ReportCard |