Skip to content

Commit e958f8d

Browse files
authored
Merge pull request #166 from MaaAssistantArknights/dev
feat: release
2 parents 0098864 + c07bba0 commit e958f8d

File tree

21 files changed

+6456
-5990
lines changed

21 files changed

+6456
-5990
lines changed
35.7 KB
Loading
30.4 KB
Loading
30.8 KB
Loading
28.2 KB
Loading

scripts/shared.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export async function getOperatorNames() {
4848
{
4949
id: el,
5050
...transformOperatorName(op.name),
51+
alt_name: op.appellation,
5152
},
5253
]
5354
}),

src/components/OperationCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const OperationCard = ({
103103
findLevelByStageName(levels, operationDoc.stageName) ||
104104
createCustomLevel(operationDoc.stageName)
105105
}
106-
difficulty={operation.difficulty}
106+
difficulty={operationDoc.difficulty}
107107
/>
108108
</H5>
109109
<div className="flex">

src/components/OperatorSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const OperatorSelect: FC<OperatorSelectProps> = ({
3838
const fuse = useMemo(
3939
() =>
4040
new Fuse(OPERATORS, {
41-
keys: ['name', 'pron'],
41+
keys: ['name', 'pron', 'alt_name'],
4242
threshold: 0.3,
4343
}),
4444
[],

src/components/editor/action/EditorActionAdd.tsx

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ import { CopilotDocV1 } from 'models/copilot.schema'
2828

2929
import { useLevels } from '../../../apis/arknights'
3030
import { findLevelByStageName } from '../../../models/level'
31-
import { FactItem } from '../../FactItem'
3231
import { EditorOperatorName } from '../operator/EditorOperator'
3332
import { EditorOperatorSkillUsage } from '../operator/EditorOperatorSkillUsage'
3433
import {
3534
EditorActionPreDelay,
3635
EditorActionRearDelay,
3736
} from './EditorActionDelay'
3837
import { EditorActionDistance } from './EditorActionDistance'
38+
import { EditorActionModule } from './EditorActionModule'
3939

4040
export interface EditorActionAddProps {
4141
control: Control<CopilotDocV1.Operation>
@@ -121,7 +121,7 @@ export const EditorActionAdd = ({
121121

122122
return (
123123
<form onSubmit={onSubmit}>
124-
<Card className="mb-2 pb-8 pt-4 overflow-auto h-[calc(100vh-6rem)]">
124+
<Card className="mb-2 pb-8 pt-4 overflow-auto">
125125
<div className="flex items-center mb-4">
126126
<CardTitle className="mb-0" icon={isNew ? 'add' : 'edit'}>
127127
<span>{isNew ? '添加' : '编辑'}动作</span>
@@ -258,8 +258,9 @@ export const EditorActionAdd = ({
258258

259259
<div className="h-px w-full bg-gray-200 mt-4 mb-6" />
260260

261-
<FactItem title="执行条件" icon="stopwatch" className="font-bold" />
262-
261+
<EditorActionModule
262+
title="执行条件" icon="stopwatch" className="font-bold"
263+
>
263264
<div className="flex flex-wrap">
264265
<EditorActionExecPredicateKills control={control} />
265266
<EditorActionExecPredicateCooling control={control} />
@@ -272,39 +273,43 @@ export const EditorActionAdd = ({
272273
<EditorActionPreDelay control={control} />
273274
<EditorActionRearDelay control={control} />
274275
</div>
275-
276+
</EditorActionModule>
276277
<div className="h-px w-full bg-gray-200 mt-4 mb-6" />
277278

278-
<FactItem title="日志" icon="annotation" className="font-bold" />
279-
280-
<div className="flex flex-col w-full">
281-
<EditorActionDocColor
282-
shouldUnregister
283-
control={control}
284-
name="docColor"
285-
/>
286-
287-
<FormField
288-
label="描述"
289-
field="doc"
290-
control={control}
291-
ControllerProps={{
292-
render: ({ field }) => (
293-
<TextArea
294-
fill
295-
rows={2}
296-
growVertically
297-
large
298-
id="doc"
299-
placeholder="描述,可选。会显示在界面上,没有实际作用"
300-
{...field}
301-
value={field.value || ''}
302-
/>
303-
),
304-
}}
305-
/>
306-
</div>
279+
<EditorActionModule
280+
title="日志"
281+
icon="annotation"
282+
className="font-bold"
283+
>
284+
<div className="flex flex-col w-full">
285+
<EditorActionDocColor
286+
shouldUnregister
287+
control={control}
288+
name="docColor"
289+
/>
307290

291+
<FormField
292+
label="描述"
293+
field="doc"
294+
control={control}
295+
ControllerProps={{
296+
render: ({ field }) => (
297+
<TextArea
298+
fill
299+
rows={2}
300+
growVertically
301+
large
302+
id="doc"
303+
placeholder="描述,可选。会显示在界面上,没有实际作用"
304+
{...field}
305+
value={field.value || ''}
306+
/>
307+
),
308+
}}
309+
/>
310+
</div>
311+
</EditorActionModule>
312+
308313
<div className="mt-4 flex">
309314
<Button intent="primary" type="submit" icon={isNew ? 'add' : 'edit'}>
310315
{isNew ? '添加' : '保存'}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Icon, IconName } from '@blueprintjs/core'
2+
3+
import clsx from 'clsx'
4+
import { ReactNode, useState } from 'react'
5+
import { FCC } from 'types'
6+
7+
import { FactItem } from 'components/FactItem'
8+
9+
export const EditorActionModule: FCC<{
10+
icon?: IconName
11+
title?: ReactNode
12+
dense?: boolean
13+
relaxed?: boolean
14+
className?: string
15+
}> = ({ children, ...props }) => {
16+
const [isCollapsed, setIsCollapsed] = useState(false)
17+
return (
18+
<>
19+
<FactItem {...props}>
20+
{
21+
<Icon
22+
icon="chevron-up"
23+
className={clsx(
24+
'mr-2 text-zinc-500 ml-auto transition-transform cursor-pointer',
25+
isCollapsed && 'rotate-180',
26+
)}
27+
onClick={() => setIsCollapsed(!isCollapsed)}
28+
/>
29+
}
30+
</FactItem>
31+
<div
32+
className={clsx(
33+
'overflow-hidden transition-[max-height] duration-[300ms]',
34+
isCollapsed ? 'max-h-0' : 'max-h-[499px]',
35+
)}
36+
>
37+
{children}
38+
</div>
39+
</>
40+
)
41+
}

src/components/editor/converter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { compact, uniqueId } from 'lodash-es'
22
import { DeepPartial, FieldArrayWithId } from 'react-hook-form'
3-
import snakeCaseKeys from 'snakecase-keys'
43

54
import type { CopilotDocV1 } from 'models/copilot.schema'
65
import { MinimumRequired } from 'models/operation'
76

87
import { findOperatorDirection } from '../../models/operator'
98
import { findActionType } from '../../models/types'
9+
import { snakeCaseKeysUnicode } from '../../utils/object'
1010

1111
/**
1212
* Creates an operation that can be used in editor. Used for importing.
@@ -75,7 +75,7 @@ export function toMaaOperation(
7575
delete (item as Partial<FieldArrayWithId>).id
7676
})
7777

78-
return snakeCaseKeys(operation, { deep: true })
78+
return snakeCaseKeysUnicode(operation, { deep: true })
7979
}
8080

8181
/**

0 commit comments

Comments
 (0)