@@ -3,10 +3,11 @@ import {
3
3
Button ,
4
4
ButtonGroup ,
5
5
Card ,
6
+ Collapse ,
6
7
Elevation ,
7
8
H3 ,
8
9
H4 ,
9
- H5 ,
10
+ H6 ,
10
11
Icon ,
11
12
Menu ,
12
13
MenuItem ,
@@ -21,6 +22,7 @@ import {
21
22
useOperation ,
22
23
useRefreshOperations ,
23
24
} from 'apis/operation'
25
+ import clsx from 'clsx'
24
26
import { useAtom } from 'jotai'
25
27
import { ComponentType , FC , useEffect , useState } from 'react'
26
28
import { Link } from 'react-router-dom'
@@ -248,31 +250,16 @@ const OperatorCard: FC<{
248
250
operator : CopilotDocV1 . Operator
249
251
} > = ( { operator } ) => {
250
252
const { name, skill } = operator
253
+ const skillStr = [ null , '一' , '二' , '三' ] [ skill ?? 1 ] ?? '未知'
251
254
return (
252
- < Card elevation = { Elevation . ONE } className = "mb-2 last:mb-0 flex" >
253
- < OperatorAvatar name = { name } size = "large" className = "mr-3" />
254
- < div className = "flex items-center font-bold" > { name } </ div >
255
- < div className = "flex-1" />
256
- < div className = "flex items-center tabular-nums" >
257
- 技能< span className = "font-bold ml-1" > { skill } </ span >
258
- </ div >
259
- </ Card >
255
+ < 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
+ < span className = "text-xs text-zinc-500" > { skillStr } 技能</ span >
259
+ </ div >
260
260
)
261
261
}
262
262
263
- const EmptyOperator : FC < {
264
- title ?: string
265
- description ?: string
266
- } > = ( { title = '暂无干员' , description } ) => (
267
- < NonIdealState
268
- className = "my-2"
269
- title = { title }
270
- description = { description }
271
- icon = "slash"
272
- layout = "horizontal"
273
- />
274
- )
275
-
276
263
function OperationViewerInner ( {
277
264
levels,
278
265
operation,
@@ -390,56 +377,87 @@ function OperationViewerInner({
390
377
)
391
378
}
392
379
function OperationViewerInnerDetails ( { operation } : { operation : Operation } ) {
380
+ const [ showOperators , setShowOperators ] = useState ( true )
381
+ const [ showActions , setShowActions ] = useState ( false )
382
+
393
383
return (
394
- < div className = "grid grid-rows-1 grid-cols-3 gap-8" >
395
- < div className = "flex flex-col" >
396
- < H4 className = "mb-4" > 干员与干员组</ H4 >
397
- < H5 className = "mb-4 text-slate-600" > 干员</ H5 >
398
- < div className = "flex flex-col mb-4" >
384
+ < div >
385
+ < H4
386
+ className = "inline-flex items-center cursor-pointer hover:text-violet-500"
387
+ onClick = { ( ) => setShowOperators ( ( v ) => ! v ) }
388
+ >
389
+ 干员与干员组
390
+ < Tooltip2
391
+ className = "!flex items-center"
392
+ placement = "top"
393
+ content = "干员组:组内干员可以任选其一,自动编队时按最高练度来选择"
394
+ >
395
+ < Icon icon = "info-sign" size = { 12 } className = "text-zinc-500 ml-1" />
396
+ </ Tooltip2 >
397
+ < Icon
398
+ icon = "chevron-down"
399
+ className = { clsx (
400
+ 'ml-1 transition-transform' ,
401
+ showOperators && 'rotate-180' ,
402
+ ) }
403
+ />
404
+ </ H4 >
405
+ < Collapse isOpen = { showOperators } >
406
+ < div className = "mt-2 flex flex-wrap -ml-4" >
407
+ { ! operation . parsedContent . opers ?. length &&
408
+ ! operation . parsedContent . groups ?. length && (
409
+ < NonIdealState
410
+ className = "my-2"
411
+ title = "暂无干员"
412
+ description = "作业并未添加干员"
413
+ icon = "slash"
414
+ layout = "horizontal"
415
+ />
416
+ ) }
399
417
{ operation . parsedContent . opers ?. map ( ( operator ) => (
400
418
< OperatorCard key = { operator . name } operator = { operator } />
401
419
) ) }
402
- { ! operation . parsedContent . opers ?. length && (
403
- < EmptyOperator description = "作业并未添加干员" />
404
- ) }
405
420
</ div >
406
-
407
- < H5 className = "mb-4 text-slate-600" > 干员组</ H5 >
408
- < div className = "flex flex-col" >
421
+ < div className = "flex flex-wrap gap-4 mt-4" >
409
422
{ operation . parsedContent . groups ?. map ( ( group ) => (
410
- < Card elevation = { Elevation . ONE } className = "mb-4" key = { group . name } >
411
- < div className = "flex flex-col" >
412
- < H5 className = "text-gray-800 font-bold" > { group . name } </ H5 >
413
-
414
- < div className = "flex flex-col" >
415
- { group . opers
416
- ?. filter ( Boolean )
417
- . map ( ( operator ) => (
418
- < OperatorCard key = { operator . name } operator = { operator } />
419
- ) ) }
420
-
421
- { group . opers ?. filter ( Boolean ) . length === 0 && (
422
- < EmptyOperator description = "干员组中并未添加干员" />
423
- ) }
424
- </ div >
423
+ < Card
424
+ elevation = { Elevation . ONE }
425
+ className = "!p-2 flex flex-col items-center"
426
+ key = { group . name }
427
+ >
428
+ < H6 className = "text-gray-800" > { group . name } </ H6 >
429
+ < div className = "flex gap-1" >
430
+ { group . opers
431
+ ?. filter ( Boolean )
432
+ . map ( ( operator ) => (
433
+ < OperatorCard key = { operator . name } operator = { operator } />
434
+ ) ) }
435
+
436
+ { group . opers ?. filter ( Boolean ) . length === 0 && (
437
+ < span className = "text-zinc-500" > 无干员</ span >
438
+ ) }
425
439
</ div >
426
440
</ Card >
427
441
) ) }
428
-
429
- { ! operation . parsedContent . groups ?. length && (
430
- < EmptyOperator
431
- title = "暂无干员组"
432
- description = "作业并未添加干员组"
433
- />
434
- ) }
435
442
</ div >
436
- </ div >
437
-
438
- < div className = "col-span-2" >
439
- < H4 className = "mb-4" > 动作序列</ H4 >
443
+ </ Collapse >
440
444
445
+ < H4
446
+ className = "mt-6 inline-flex items-center cursor-pointer hover:text-violet-500"
447
+ onClick = { ( ) => setShowActions ( ( v ) => ! v ) }
448
+ >
449
+ 动作序列
450
+ < Icon
451
+ icon = "chevron-down"
452
+ className = { clsx (
453
+ 'ml-1 transition-transform' ,
454
+ showActions && 'rotate-180' ,
455
+ ) }
456
+ />
457
+ </ H4 >
458
+ < Collapse isOpen = { showActions } >
441
459
{ operation . parsedContent . actions ?. length ? (
442
- < div className = "flex flex-col pb-8" >
460
+ < div className = "mt-2 flex flex-col pb-8" >
443
461
{ operation . parsedContent . actions . map ( ( action , i ) => (
444
462
< ActionCard action = { action } key = { i } />
445
463
) ) }
@@ -453,7 +471,7 @@ function OperationViewerInnerDetails({ operation }: { operation: Operation }) {
453
471
layout = "horizontal"
454
472
/>
455
473
) }
456
- </ div >
474
+ </ Collapse >
457
475
</ div >
458
476
)
459
477
}
0 commit comments