File size: 6,032 Bytes
61fd574
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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