File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -136,11 +136,13 @@ export const EditorOperatorName = <T extends FieldValues>({
136
136
export const OperatorAvatar = ( {
137
137
id,
138
138
name,
139
+ rarity = 0 ,
139
140
size,
140
141
className,
141
142
} : {
142
143
id ?: string
143
144
name ?: string
145
+ rarity ?: number
144
146
size ?: 'small' | 'medium' | 'large'
145
147
className ?: string
146
148
} ) => {
@@ -163,11 +165,26 @@ export const OperatorAvatar = ({
163
165
large : 'h-8 w-8' ,
164
166
} [ size ]
165
167
166
- const commonClassName = 'rounded-md object-cover bp4-elevation-1 bg-slate-100'
168
+ const colorClassName =
169
+ rarity === 6
170
+ ? [ 'bg-orange-200' , 'ring-orange-300' ]
171
+ : rarity === 5
172
+ ? [ 'bg-yellow-100' , 'ring-yellow-200' ]
173
+ : rarity === 4
174
+ ? [ 'bg-purple-100' , 'ring-purple-200' ]
175
+ : [ 'bg-slate-100' , 'ring-slate-200' ]
176
+
177
+ const commonClassName =
178
+ 'ring-inset ring-2 border-solid rounded-md object-cover'
167
179
168
180
return foundId ? (
169
181
< img
170
- className = { clsx ( sizingClassName , commonClassName , className ) }
182
+ className = { clsx (
183
+ sizingClassName ,
184
+ colorClassName ,
185
+ commonClassName ,
186
+ className ,
187
+ ) }
171
188
src = { '/assets/operator-avatars/' + foundId + '.png' }
172
189
alt = { id }
173
190
loading = "lazy"
@@ -176,6 +193,7 @@ export const OperatorAvatar = ({
176
193
< div
177
194
className = { clsx (
178
195
sizingClassName ,
196
+ colorClassName ,
179
197
commonClassName ,
180
198
'flex items-center justify-center font-bold text-2xl text-slate-300 select-none' ,
181
199
className ,
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import { useLevels } from '../../apis/level'
45
45
import { CopilotDocV1 } from '../../models/copilot.schema'
46
46
import { createCustomLevel , findLevelByStageName } from '../../models/level'
47
47
import { Level } from '../../models/operation'
48
+ import { OPERATORS } from '../../models/operator'
48
49
import { formatError } from '../../utils/error'
49
50
import { ActionCard } from '../ActionCard'
50
51
import { UserName } from '../UserName'
@@ -250,11 +251,16 @@ const OperatorCard: FC<{
250
251
operator : CopilotDocV1 . Operator
251
252
} > = ( { operator } ) => {
252
253
const { name, skill } = operator
254
+ const info = OPERATORS . find ( ( o ) => o . name === name )
253
255
const skillStr = [ null , '一' , '二' , '三' ] [ skill ?? 1 ] ?? '未知'
254
256
return (
255
257
< div className = "min-w-24 flex flex-col items-center" >
256
- < OperatorAvatar name = { name } className = "w-16 h-16 mb-1" />
257
- < span className = "mb-1 font-bold" > { name } </ span >
258
+ < OperatorAvatar
259
+ id = { info ?. id }
260
+ rarity = { info ?. rarity }
261
+ className = "w-16 h-16 mb-1"
262
+ />
263
+ < span className = { clsx ( 'mb-1 font-bold' ) } > { name } </ span >
258
264
< span className = "text-xs text-zinc-500" > { skillStr } 技能</ span >
259
265
</ div >
260
266
)
You can’t perform that action at this time.
0 commit comments