5
5
DrawerSize ,
6
6
Elevation ,
7
7
H4 ,
8
+ H5 ,
8
9
Icon ,
9
10
Tag
10
11
} from '@blueprintjs/core'
@@ -15,16 +16,17 @@ import { handleCopyShortCode, handleDownloadJSON } from 'services/operation'
15
16
16
17
import { RelativeTime } from 'components/RelativeTime'
17
18
import { OperationRating } from 'components/viewer/OperationRating'
18
- import { OperationListItem } from 'models/operation'
19
+ import { OpDifficulty , OperationListItem } from 'models/operation'
19
20
20
21
import { useLevels } from '../apis/arknights'
21
22
import { CopilotDocV1 } from '../models/copilot.schema'
22
23
import { createCustomLevel , findLevelByStageName } from '../models/level'
23
24
import { Paragraphs } from './Paragraphs'
24
- import { EDifficultyLevel } from './entity/ELevel'
25
+ import { EDifficulty } from './entity/EDifficulty'
26
+ import { EDifficultyLevel , NeoELevel } from './entity/ELevel'
25
27
import { OperationViewer } from './viewer/OperationViewer'
26
28
27
- export const OperationCard = ( {
29
+ export const NeoOperationCard = ( {
28
30
operation,
29
31
operationDoc,
30
32
} : {
@@ -97,13 +99,11 @@ export const OperationCard = ({
97
99
</ Tooltip2 >
98
100
</ div >
99
101
< div className = "flex items-center text-slate-900" >
100
- < EDifficultyLevel
101
- level = {
102
- findLevelByStageName ( levels , operationDoc . stageName ) ||
103
- createCustomLevel ( operationDoc . stageName )
104
- }
105
- difficulty = { operationDoc . difficulty }
106
- />
102
+ < div className = "flex flex-wrap" >
103
+ < NeoELevel level = { findLevelByStageName ( levels , operationDoc . stageName ) ||
104
+ createCustomLevel ( operationDoc . stageName ) } />
105
+ < EDifficulty difficulty = { operationDoc . difficulty ?? OpDifficulty . UNKNOWN } />
106
+ </ div >
107
107
</ div >
108
108
< div className = 'flex-1 flex flex-col gap-2 justify-center' >
109
109
< div className = "text-gray-700 leading-normal" >
@@ -162,6 +162,147 @@ export const OperationCard = ({
162
162
)
163
163
}
164
164
165
+ export const OperationCard = ( {
166
+ operation,
167
+ operationDoc,
168
+ } : {
169
+ operation : OperationListItem
170
+ operationDoc : CopilotDocV1 . Operation
171
+ } ) => {
172
+ const levels = useLevels ( ) ?. data ?. data || [ ]
173
+ const [ drawerOpen , setDrawerOpen ] = useState ( false )
174
+
175
+ return (
176
+ < >
177
+ < Drawer
178
+ size = { DrawerSize . LARGE }
179
+ isOpen = { drawerOpen }
180
+ onClose = { ( ) => setDrawerOpen ( false ) }
181
+ >
182
+ < OperationViewer
183
+ operationId = { operation . id }
184
+ onCloseDrawer = { ( ) => setDrawerOpen ( false ) }
185
+ />
186
+ </ Drawer >
187
+
188
+ < Card
189
+ interactive = { true }
190
+ elevation = { Elevation . TWO }
191
+ className = "mb-4 sm:mb-2 last:mb-0"
192
+ onClick = { ( ) => setDrawerOpen ( true ) }
193
+ >
194
+ < div className = "flex flex-wrap mb-4 sm:mb-2" >
195
+ { /* title */ }
196
+ < div className = "flex flex-col gap-3" >
197
+ < div className = "flex gap-2" >
198
+ < H4 className = "inline-block pb-1 border-b-2 border-zinc-200 border-solid mb-2" >
199
+ { operationDoc . doc . title }
200
+ </ H4 >
201
+ < Tooltip2
202
+ placement = "bottom"
203
+ content = {
204
+ < div className = "max-w-sm dark:text-slate-900" >
205
+ 下载原 JSON
206
+ </ div >
207
+ }
208
+ >
209
+ < Button
210
+ small
211
+ icon = "download"
212
+ onClick = { ( e ) => {
213
+ e . stopPropagation ( )
214
+ handleDownloadJSON ( operationDoc )
215
+ } }
216
+ />
217
+ </ Tooltip2 >
218
+ < Tooltip2
219
+ placement = "bottom"
220
+ content = {
221
+ < div className = "max-w-sm dark:text-slate-900" >
222
+ 复制神秘代码
223
+ </ div >
224
+ }
225
+ >
226
+ < Button
227
+ small
228
+ icon = "clipboard"
229
+ onClick = { ( e ) => {
230
+ e . stopPropagation ( )
231
+ handleCopyShortCode ( operation )
232
+ } }
233
+ />
234
+ </ Tooltip2 >
235
+ </ div >
236
+ < H5 className = "flex items-center text-slate-900 -mt-3" >
237
+ < EDifficultyLevel
238
+ level = {
239
+ findLevelByStageName ( levels , operationDoc . stageName ) ||
240
+ createCustomLevel ( operationDoc . stageName )
241
+ }
242
+ difficulty = { operationDoc . difficulty }
243
+ />
244
+ </ H5 >
245
+ </ div >
246
+
247
+ < div className = "lg:flex-1 hidden" />
248
+
249
+ { /* meta */ }
250
+ < div className = "flex flex-col flex-1 gap-y-1.5 gap-x-4" >
251
+ < div className = "flex flex-wrap sm:justify-end items-center gap-x-4 gap-y-1 text-zinc-500" >
252
+ < div className = "flex items-center gap-1.5" >
253
+ < Icon icon = "star" />
254
+ < OperationRating
255
+ className = "text-sm"
256
+ operation = { operation }
257
+ layout = "horizontal"
258
+ />
259
+ </ div >
260
+
261
+ < Tooltip2 placement = "top" content = { `访问量:${ operation . views } ` } >
262
+ < div >
263
+ < Icon icon = "eye-open" className = "mr-1.5" />
264
+ < span > { operation . views } </ span >
265
+ </ div >
266
+ </ Tooltip2 >
267
+
268
+ < div >
269
+ < Icon icon = "time" className = "mr-1.5" />
270
+ < RelativeTime
271
+ Tooltip2Props = { { placement : 'top' } }
272
+ moment = { operation . uploadTime }
273
+ />
274
+ </ div >
275
+ </ div >
276
+ < div className = "text-zinc-500 self-end" >
277
+ < Tooltip2 placement = "top" content = { `作者:${ operation . uploader } ` } >
278
+ < div >
279
+ < Icon icon = "user" className = "mr-1.5" />
280
+ < span > { operation . uploader } </ span >
281
+ </ div >
282
+ </ Tooltip2 >
283
+ </ div >
284
+ </ div >
285
+ </ div >
286
+ < div className = "flex md:flex-row flex-col gap-4" >
287
+ < div className = "text-gray-700 leading-normal md:w-1/2" >
288
+ { /* <div className="text-sm text-zinc-600 mb-2 font-bold">作业描述</div> */ }
289
+ < Paragraphs
290
+ content = { operationDoc . doc . details }
291
+ limitHeight = { 21 * 13.5 } // 13 lines, 21px per line; the extra 0.5 line is intentional so the `mask` effect is obvious
292
+ />
293
+ </ div >
294
+ < div className = "md:w-1/2" >
295
+ < div className = "text-sm text-zinc-600 mb-2 font-bold" >
296
+ 干员/干员组
297
+ </ div >
298
+ < OperatorTags operationDoc = { operationDoc } />
299
+ </ div >
300
+ </ div >
301
+ </ Card >
302
+ </ >
303
+ )
304
+ }
305
+
165
306
const OperatorTags = ( {
166
307
operationDoc : { opers, groups } ,
167
308
} : {
0 commit comments