Skip to content

Commit 6098015

Browse files
authored
Merge pull request #182 from MaaAssistantArknights/dev
2 parents e958f8d + 44e5d32 commit 6098015

File tree

18 files changed

+6104
-6016
lines changed

18 files changed

+6104
-6016
lines changed

.github/workflows/azure-deploy.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- main
77
- dev
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
deploy:
1115
timeout-minutes: 20
@@ -17,11 +21,11 @@ jobs:
1721
- name: Setup Node.js environment
1822
uses: actions/setup-node@v3
1923
with:
20-
node-version: 16
21-
cache: "yarn"
24+
node-version-file: '.node-version'
25+
cache: 'yarn'
2226

2327
- name: Install dependencies
24-
run: yarn
28+
run: yarn install --frozen-lockfile
2529

2630
- name: Build
2731
run: yarn build:azure
@@ -32,9 +36,9 @@ jobs:
3236
with:
3337
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLUE_DESERT_0E46AFE00 }}
3438
repo_token: ${{ secrets.GITHUB_TOKEN }}
35-
action: "upload"
36-
production_branch: "main"
37-
app_location: "dist"
38-
api_location: ""
39+
action: 'upload'
40+
production_branch: 'main'
41+
app_location: 'dist'
42+
api_location: ''
3943
skip_app_build: true
4044
skip_api_build: true

.github/workflows/scripts-update.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
name: scripts-update
1+
name: Update Embedded Resources
22

33
on:
4-
# schedule:
5-
# - cron: '0 0 * * *'
4+
schedule:
5+
- cron: '41 16 * * *'
66
workflow_dispatch:
77

88
permissions:
99
contents: write
1010
pull-requests: write
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
update:
1418
timeout-minutes: 20
@@ -20,11 +24,11 @@ jobs:
2024
- name: Setup Node.js environment
2125
uses: actions/setup-node@v3
2226
with:
23-
node-version: 16
27+
node-version-file: '.node-version'
2428
cache: 'yarn'
2529

2630
- name: Install dependencies
27-
run: yarn
31+
run: yarn install --frozen-lockfile
2832

2933
- name: Update static
3034
run: |

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"npm-run-all2": "^6.0.2",
8383
"pinyin": "^3.0.0-alpha.5",
8484
"prettier": "^2.7.1",
85+
"simplebig": "^0.0.3",
8586
"tailwindcss": "^3.1.4",
8687
"typescript": "^4.6.3",
8788
"vite": "^4.2.1"
49.3 KB
Loading
37.2 KB
Loading
36.7 KB
Loading

scripts/shared.ts

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
import { uniqBy } from 'lodash-es'
1+
import { uniq, uniqBy } from 'lodash-es'
22
import fetch from 'node-fetch'
33
import pinyin from 'pinyin'
4+
import simplebig from 'simplebig'
5+
6+
function pinyinify(name: string) {
7+
return [
8+
pinyin(name, {
9+
compact: true,
10+
heteronym: true,
11+
style: pinyin.STYLE_NORMAL,
12+
}),
13+
pinyin(name, {
14+
compact: true,
15+
heteronym: true,
16+
style: pinyin.STYLE_FIRST_LETTER,
17+
}),
18+
].flatMap((py) => py.map((el) => el.join('')))
19+
}
420

521
function transformOperatorName(name: string) {
6-
const cleanedName = name.replace(/["]/g, '')
22+
const cleanedSimplifiedName = name.replace(/["]/g, '')
723

8-
const fullPinyin = pinyin(cleanedName, {
9-
compact: true,
10-
heteronym: true,
11-
style: pinyin.STYLE_NORMAL,
12-
})
13-
const partialPinyin = pinyin(cleanedName, {
14-
compact: true,
15-
heteronym: true,
16-
style: pinyin.STYLE_FIRST_LETTER,
17-
})
24+
const traditional = simplebig.s2t(name) as string
25+
const cleanedTraditional = traditional.replace(/["]/g, '')
1826
return {
1927
name,
20-
pron:
21-
// in: [[['a', 'mi', 'ya'], ['e', 'mi', 'ya']], [['a', 'm', 'y'], ['e', 'm', 'y']]]
22-
[fullPinyin, partialPinyin]
23-
// out: ['amiya', 'emiya', 'amy', 'emy']
24-
.flatMap((py) => py.map((el) => el.join('')))
25-
// out: 'amiya emiya amy emy'
26-
.join(' '),
28+
alias: uniq([
29+
...pinyinify(cleanedSimplifiedName),
30+
traditional,
31+
cleanedTraditional,
32+
...pinyinify(cleanedTraditional),
33+
]).join(' '),
2734
}
2835
}
2936

src/components/OperationCard.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
Button,
23
Card,
34
Drawer,
45
DrawerSize,
@@ -11,6 +12,7 @@ import {
1112
import { Tooltip2 } from '@blueprintjs/popover2'
1213

1314
import { useState } from 'react'
15+
import { handleCopyShortCode, handleDownloadJSON } from 'services/operation'
1416

1517
import { RelativeTime } from 'components/RelativeTime'
1618
import { OperationRating } from 'components/viewer/OperationRating'
@@ -32,6 +34,7 @@ export const OperationCard = ({
3234
}) => {
3335
const levels = useLevels()?.data?.data || []
3436
const [drawerOpen, setDrawerOpen] = useState(false)
37+
3538
return (
3639
<>
3740
<Drawer
@@ -52,9 +55,37 @@ export const OperationCard = ({
5255
onClick={() => setDrawerOpen(true)}
5356
>
5457
<div className="flex items-start">
55-
<H4 className="inline-block pb-1 border-b-2 border-zinc-200 border-solid mb-2">
58+
<H4 className="inline-block pb-1 border-b-2 border-zinc-200 border-solid mb-2 mr-2">
5659
{operationDoc.doc.title}
5760
</H4>
61+
<Tooltip2
62+
placement="bottom"
63+
content={<div className="max-w-sm">下载原 JSON</div>}
64+
>
65+
<Button
66+
small
67+
className="mr-2 mb-2"
68+
icon="download"
69+
onClick={(e) => {
70+
e.stopPropagation()
71+
handleDownloadJSON(operationDoc)
72+
}}
73+
/>
74+
</Tooltip2>
75+
<Tooltip2
76+
placement="bottom"
77+
content={<div className="max-w-sm">复制神秘代码</div>}
78+
>
79+
<Button
80+
small
81+
className="mb-2"
82+
icon="clipboard"
83+
onClick={(e) => {
84+
e.stopPropagation()
85+
handleCopyShortCode(operation)
86+
}}
87+
/>
88+
</Tooltip2>
5889
<div className="flex-1" />
5990
<div className="flex flex-col items-end">
6091
<div className="w-full flex justify-end text-zinc-500">

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', 'alt_name'],
41+
keys: ['name', 'alias', 'alt_name'],
4242
threshold: 0.3,
4343
}),
4444
[],

0 commit comments

Comments
 (0)