poi-plugin-quest-info-2 0.8.3 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/kcQuestsData/DATA_VERSION +1 -1
- package/build/kcQuestsData/index.ts +1 -1
- package/build/kcQuestsData/quests-scn-new.json +10 -1
- package/build/kcQuestsData/quests-scn.json +195 -11
- package/build/kcanotifyGamedata/DATA_VERSION +1 -1
- package/build/kcanotifyGamedata/index.ts +1 -1
- package/build/kcanotifyGamedata/quests-en.json +30 -0
- package/build/kcanotifyGamedata/quests-jp.json +31 -1
- package/build/kcanotifyGamedata/quests-ko.json +30 -0
- package/build/kcanotifyGamedata/quests-scn.json +30 -0
- package/build/kcanotifyGamedata/quests-tcn.json +18 -0
- package/build/prePostQuest.json +140 -8
- package/build/questCategory.json +16 -1
- package/build/questCodeMap.json +23 -4
- package/package.json +5 -3
- package/src/Toolbar.tsx +1 -10
- package/src/__tests__/__snapshots__/questCategory.spec.ts.snap +15 -0
- package/src/__tests__/__snapshots__/questHelper.spec.ts.snap +9 -0
- package/src/__tests__/kcanotifyData.spec.ts +1 -1
- package/src/__tests__/kcwikiData.spec.ts +1 -1
- package/src/__tests__/questCategory.spec.ts +2 -2
- package/src/components/QuestCard/index.tsx +0 -1
- package/src/components/QuestList.tsx +51 -69
- package/src/components/QuestTag.tsx +10 -2
- package/src/poi/hooks.ts +3 -1
- package/src/poi/store.ts +2 -4
- package/src/store/gameQuest.tsx +20 -0
- package/src/store/quest.ts +4 -3
- package/src/store/store.tsx +25 -23
- package/src/tags.tsx +4 -4
- package/src/utils.ts +15 -0
package/build/prePostQuest.json
CHANGED
|
@@ -1375,7 +1375,8 @@
|
|
|
1375
1375
|
"Bm4"
|
|
1376
1376
|
],
|
|
1377
1377
|
"post": [
|
|
1378
|
-
"B49"
|
|
1378
|
+
"B49",
|
|
1379
|
+
"B181"
|
|
1379
1380
|
]
|
|
1380
1381
|
},
|
|
1381
1382
|
"261": {
|
|
@@ -1753,7 +1754,7 @@
|
|
|
1753
1754
|
"C3",
|
|
1754
1755
|
"C61",
|
|
1755
1756
|
"C63",
|
|
1756
|
-
"
|
|
1757
|
+
"C64",
|
|
1757
1758
|
"C48",
|
|
1758
1759
|
"F44",
|
|
1759
1760
|
"F82",
|
|
@@ -1773,7 +1774,8 @@
|
|
|
1773
1774
|
"C2"
|
|
1774
1775
|
],
|
|
1775
1776
|
"post": [
|
|
1776
|
-
"F46"
|
|
1777
|
+
"F46",
|
|
1778
|
+
"F109"
|
|
1777
1779
|
]
|
|
1778
1780
|
},
|
|
1779
1781
|
"306": {
|
|
@@ -2025,6 +2027,7 @@
|
|
|
2025
2027
|
],
|
|
2026
2028
|
"post": [
|
|
2027
2029
|
"C49",
|
|
2030
|
+
"C66",
|
|
2028
2031
|
"F91"
|
|
2029
2032
|
]
|
|
2030
2033
|
},
|
|
@@ -2065,6 +2068,22 @@
|
|
|
2065
2068
|
],
|
|
2066
2069
|
"post": []
|
|
2067
2070
|
},
|
|
2071
|
+
"356": {
|
|
2072
|
+
"pre": [
|
|
2073
|
+
"B180"
|
|
2074
|
+
],
|
|
2075
|
+
"post": [
|
|
2076
|
+
"By12"
|
|
2077
|
+
]
|
|
2078
|
+
},
|
|
2079
|
+
"357": {
|
|
2080
|
+
"pre": [
|
|
2081
|
+
"C46"
|
|
2082
|
+
],
|
|
2083
|
+
"post": [
|
|
2084
|
+
"B182"
|
|
2085
|
+
]
|
|
2086
|
+
},
|
|
2068
2087
|
"401": {
|
|
2069
2088
|
"pre": [
|
|
2070
2089
|
"A5"
|
|
@@ -3557,7 +3576,8 @@
|
|
|
3557
3576
|
"B78"
|
|
3558
3577
|
],
|
|
3559
3578
|
"post": [
|
|
3560
|
-
"B86"
|
|
3579
|
+
"B86",
|
|
3580
|
+
"B180"
|
|
3561
3581
|
]
|
|
3562
3582
|
},
|
|
3563
3583
|
"828": {
|
|
@@ -3613,7 +3633,9 @@
|
|
|
3613
3633
|
"B79",
|
|
3614
3634
|
"B85"
|
|
3615
3635
|
],
|
|
3616
|
-
"post": [
|
|
3636
|
+
"post": [
|
|
3637
|
+
"B179"
|
|
3638
|
+
]
|
|
3617
3639
|
},
|
|
3618
3640
|
"838": {
|
|
3619
3641
|
"pre": [
|
|
@@ -4084,7 +4106,8 @@
|
|
|
4084
4106
|
"B140"
|
|
4085
4107
|
],
|
|
4086
4108
|
"post": [
|
|
4087
|
-
"Bq13"
|
|
4109
|
+
"Bq13",
|
|
4110
|
+
"By11"
|
|
4088
4111
|
]
|
|
4089
4112
|
},
|
|
4090
4113
|
"903": {
|
|
@@ -4097,7 +4120,9 @@
|
|
|
4097
4120
|
"pre": [
|
|
4098
4121
|
"B44"
|
|
4099
4122
|
],
|
|
4100
|
-
"post": [
|
|
4123
|
+
"post": [
|
|
4124
|
+
"B180"
|
|
4125
|
+
]
|
|
4101
4126
|
},
|
|
4102
4127
|
"905": {
|
|
4103
4128
|
"pre": [
|
|
@@ -4529,6 +4554,82 @@
|
|
|
4529
4554
|
],
|
|
4530
4555
|
"post": []
|
|
4531
4556
|
},
|
|
4557
|
+
"970": {
|
|
4558
|
+
"pre": [
|
|
4559
|
+
"B86"
|
|
4560
|
+
],
|
|
4561
|
+
"post": []
|
|
4562
|
+
},
|
|
4563
|
+
"971": {
|
|
4564
|
+
"pre": [],
|
|
4565
|
+
"post": [
|
|
4566
|
+
"2204B3"
|
|
4567
|
+
]
|
|
4568
|
+
},
|
|
4569
|
+
"972": {
|
|
4570
|
+
"pre": [
|
|
4571
|
+
"2204B2"
|
|
4572
|
+
],
|
|
4573
|
+
"post": []
|
|
4574
|
+
},
|
|
4575
|
+
"973": {
|
|
4576
|
+
"pre": [
|
|
4577
|
+
"B141"
|
|
4578
|
+
],
|
|
4579
|
+
"post": []
|
|
4580
|
+
},
|
|
4581
|
+
"974": {
|
|
4582
|
+
"pre": [
|
|
4583
|
+
"B79",
|
|
4584
|
+
"By1"
|
|
4585
|
+
],
|
|
4586
|
+
"post": [
|
|
4587
|
+
"C65"
|
|
4588
|
+
]
|
|
4589
|
+
},
|
|
4590
|
+
"975": {
|
|
4591
|
+
"pre": [
|
|
4592
|
+
"C65"
|
|
4593
|
+
],
|
|
4594
|
+
"post": []
|
|
4595
|
+
},
|
|
4596
|
+
"976": {
|
|
4597
|
+
"pre": [
|
|
4598
|
+
"B32",
|
|
4599
|
+
"F109"
|
|
4600
|
+
],
|
|
4601
|
+
"post": [
|
|
4602
|
+
"B182"
|
|
4603
|
+
]
|
|
4604
|
+
},
|
|
4605
|
+
"977": {
|
|
4606
|
+
"pre": [
|
|
4607
|
+
"C66",
|
|
4608
|
+
"B181"
|
|
4609
|
+
],
|
|
4610
|
+
"post": [
|
|
4611
|
+
"B183"
|
|
4612
|
+
]
|
|
4613
|
+
},
|
|
4614
|
+
"978": {
|
|
4615
|
+
"pre": [
|
|
4616
|
+
"B182"
|
|
4617
|
+
],
|
|
4618
|
+
"post": []
|
|
4619
|
+
},
|
|
4620
|
+
"980": {
|
|
4621
|
+
"pre": [],
|
|
4622
|
+
"post": [
|
|
4623
|
+
"B185"
|
|
4624
|
+
]
|
|
4625
|
+
},
|
|
4626
|
+
"981": {
|
|
4627
|
+
"pre": [
|
|
4628
|
+
"B184",
|
|
4629
|
+
"F110"
|
|
4630
|
+
],
|
|
4631
|
+
"post": []
|
|
4632
|
+
},
|
|
4532
4633
|
"1101": {
|
|
4533
4634
|
"pre": [],
|
|
4534
4635
|
"post": [
|
|
@@ -4571,12 +4672,43 @@
|
|
|
4571
4672
|
"pre": [
|
|
4572
4673
|
"F51"
|
|
4573
4674
|
],
|
|
4574
|
-
"post": [
|
|
4675
|
+
"post": [
|
|
4676
|
+
"F111"
|
|
4677
|
+
]
|
|
4575
4678
|
},
|
|
4576
4679
|
"1108": {
|
|
4577
4680
|
"pre": [
|
|
4578
4681
|
"B173"
|
|
4579
4682
|
],
|
|
4580
4683
|
"post": []
|
|
4684
|
+
},
|
|
4685
|
+
"1114": {
|
|
4686
|
+
"pre": [],
|
|
4687
|
+
"post": [
|
|
4688
|
+
"F109"
|
|
4689
|
+
]
|
|
4690
|
+
},
|
|
4691
|
+
"1115": {
|
|
4692
|
+
"pre": [
|
|
4693
|
+
"C3",
|
|
4694
|
+
"F108"
|
|
4695
|
+
],
|
|
4696
|
+
"post": [
|
|
4697
|
+
"B181"
|
|
4698
|
+
]
|
|
4699
|
+
},
|
|
4700
|
+
"1116": {
|
|
4701
|
+
"pre": [],
|
|
4702
|
+
"post": [
|
|
4703
|
+
"B185",
|
|
4704
|
+
"F111"
|
|
4705
|
+
]
|
|
4706
|
+
},
|
|
4707
|
+
"1117": {
|
|
4708
|
+
"pre": [
|
|
4709
|
+
"F101",
|
|
4710
|
+
"F110"
|
|
4711
|
+
],
|
|
4712
|
+
"post": []
|
|
4581
4713
|
}
|
|
4582
4714
|
}
|
package/build/questCategory.json
CHANGED
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
353,
|
|
92
92
|
354,
|
|
93
93
|
355,
|
|
94
|
+
357,
|
|
94
95
|
434,
|
|
95
96
|
436,
|
|
96
97
|
437,
|
|
@@ -117,6 +118,8 @@
|
|
|
117
118
|
946,
|
|
118
119
|
947,
|
|
119
120
|
948,
|
|
121
|
+
973,
|
|
122
|
+
975,
|
|
120
123
|
1103,
|
|
121
124
|
1104,
|
|
122
125
|
1105,
|
|
@@ -327,6 +330,7 @@
|
|
|
327
330
|
347,
|
|
328
331
|
351,
|
|
329
332
|
352,
|
|
333
|
+
356,
|
|
330
334
|
401,
|
|
331
335
|
405,
|
|
332
336
|
406,
|
|
@@ -591,6 +595,13 @@
|
|
|
591
595
|
970,
|
|
592
596
|
971,
|
|
593
597
|
972,
|
|
598
|
+
974,
|
|
599
|
+
976,
|
|
600
|
+
977,
|
|
601
|
+
978,
|
|
602
|
+
979,
|
|
603
|
+
980,
|
|
604
|
+
981,
|
|
594
605
|
1101,
|
|
595
606
|
1102,
|
|
596
607
|
1106,
|
|
@@ -599,6 +610,10 @@
|
|
|
599
610
|
1110,
|
|
600
611
|
1111,
|
|
601
612
|
1112,
|
|
602
|
-
1113
|
|
613
|
+
1113,
|
|
614
|
+
1114,
|
|
615
|
+
1115,
|
|
616
|
+
1116,
|
|
617
|
+
1117
|
|
603
618
|
]
|
|
604
619
|
}
|
package/build/questCodeMap.json
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"C9": 312,
|
|
206
206
|
"C61": 313,
|
|
207
207
|
"C63": 314,
|
|
208
|
-
"
|
|
208
|
+
"C64": 315,
|
|
209
209
|
"C13": 316,
|
|
210
210
|
"C15": 317,
|
|
211
211
|
"C16": 318,
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
"C21": 323,
|
|
216
216
|
"C22": 324,
|
|
217
217
|
"C23": 325,
|
|
218
|
-
"
|
|
218
|
+
"C67": 326,
|
|
219
219
|
"C25": 327,
|
|
220
220
|
"C27": 328,
|
|
221
221
|
"2201LC01": 329,
|
|
@@ -244,6 +244,8 @@
|
|
|
244
244
|
"C58": 353,
|
|
245
245
|
"C60": 354,
|
|
246
246
|
"C62": 355,
|
|
247
|
+
"C65": 356,
|
|
248
|
+
"C66": 357,
|
|
247
249
|
"D1": 401,
|
|
248
250
|
"D2": 402,
|
|
249
251
|
"D3": 403,
|
|
@@ -532,7 +534,7 @@
|
|
|
532
534
|
"B156": 929,
|
|
533
535
|
"B157": 930,
|
|
534
536
|
"B158": 931,
|
|
535
|
-
"
|
|
537
|
+
"2204B1": 932,
|
|
536
538
|
"B159": 933,
|
|
537
539
|
"B160": 934,
|
|
538
540
|
"B161": 935,
|
|
@@ -570,6 +572,18 @@
|
|
|
570
572
|
"B176": 967,
|
|
571
573
|
"B177": 968,
|
|
572
574
|
"B178": 969,
|
|
575
|
+
"B179": 970,
|
|
576
|
+
"2204B2": 971,
|
|
577
|
+
"2204B3": 972,
|
|
578
|
+
"By11": 973,
|
|
579
|
+
"B180": 974,
|
|
580
|
+
"By12": 975,
|
|
581
|
+
"B181": 976,
|
|
582
|
+
"B182": 977,
|
|
583
|
+
"B183": 978,
|
|
584
|
+
"2207B1": 979,
|
|
585
|
+
"B184": 980,
|
|
586
|
+
"B185": 981,
|
|
573
587
|
"F96": 1101,
|
|
574
588
|
"F97": 1102,
|
|
575
589
|
"F98": 1103,
|
|
@@ -581,5 +595,10 @@
|
|
|
581
595
|
"F104": 1109,
|
|
582
596
|
"21FaLF01": 1110,
|
|
583
597
|
"F105": 1111,
|
|
584
|
-
"F106": 1112
|
|
598
|
+
"F106": 1112,
|
|
599
|
+
"F107": 1113,
|
|
600
|
+
"F108": 1114,
|
|
601
|
+
"F109": 1115,
|
|
602
|
+
"F110": 1116,
|
|
603
|
+
"F111": 1117
|
|
585
604
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poi-plugin-quest-info-2",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "show quest info",
|
|
6
6
|
"homepage": "https://github.com/lawvs/poi-plugin-quest-2/",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"moize": "^6.1.1",
|
|
38
38
|
"react-use": "^17.3.1",
|
|
39
|
-
"react-virtualized": "^
|
|
39
|
+
"react-virtualized-auto-sizer": "^1.0.6",
|
|
40
|
+
"react-window": "^1.8.7"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@babel/core": "^7.12.10",
|
|
@@ -47,7 +48,8 @@
|
|
|
47
48
|
"@storybook/react": "^6.3.4",
|
|
48
49
|
"@types/jest": "^27.4.1",
|
|
49
50
|
"@types/pangu": "^3.3.0",
|
|
50
|
-
"@types/react-virtualized": "^
|
|
51
|
+
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
|
52
|
+
"@types/react-window": "^1.8.5",
|
|
51
53
|
"@types/sharp": "^0.27.1",
|
|
52
54
|
"@types/styled-components": "^5.1.7",
|
|
53
55
|
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
package/src/Toolbar.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { useQuest, useSyncWithGame } from './store'
|
|
|
11
11
|
import { useFilterTags, useSyncGameTagEffect } from './store/filterTags'
|
|
12
12
|
import { useSearchInput } from './store/search'
|
|
13
13
|
import { CategoryTags, CATEGORY_TAGS, TypeTags, TYPE_TAGS } from './tags'
|
|
14
|
+
import { And, Or } from './utils'
|
|
14
15
|
|
|
15
16
|
const ToolbarWrapper = styled.div`
|
|
16
17
|
display: flex;
|
|
@@ -115,16 +116,6 @@ const useInputStringFilter = () => {
|
|
|
115
116
|
return stringFilter
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
const And =
|
|
119
|
-
<T extends (...args: any[]) => boolean>(...fnArray: T[]) =>
|
|
120
|
-
(...args: Parameters<T>) =>
|
|
121
|
-
fnArray.every((fn) => fn(...args))
|
|
122
|
-
|
|
123
|
-
const Or =
|
|
124
|
-
<T extends (...args: any[]) => boolean>(...fnArray: T[]) =>
|
|
125
|
-
(...args: Parameters<T>) =>
|
|
126
|
-
fnArray.some((fn) => fn(...args))
|
|
127
|
-
|
|
128
119
|
const useToolbarFilter = () => {
|
|
129
120
|
const stringFilter = useInputStringFilter()
|
|
130
121
|
const { typeTags, categoryTags } = useFilterTags()
|
|
@@ -427,6 +427,11 @@ Object {
|
|
|
427
427
|
"gameId": 355,
|
|
428
428
|
"name": "精锐「第十五驱逐队」第一小队演习!",
|
|
429
429
|
},
|
|
430
|
+
Object {
|
|
431
|
+
"code": "C66",
|
|
432
|
+
"gameId": 357,
|
|
433
|
+
"name": "「大和型战舰」第一舰队演习开始!",
|
|
434
|
+
},
|
|
430
435
|
Object {
|
|
431
436
|
"code": "D32",
|
|
432
437
|
"gameId": 434,
|
|
@@ -557,6 +562,16 @@ Object {
|
|
|
557
562
|
"gameId": 948,
|
|
558
563
|
"name": "机动部队决战",
|
|
559
564
|
},
|
|
565
|
+
Object {
|
|
566
|
+
"code": "By11",
|
|
567
|
+
"gameId": 973,
|
|
568
|
+
"name": "日英美联合水上舰队,起航!",
|
|
569
|
+
},
|
|
570
|
+
Object {
|
|
571
|
+
"code": "By12",
|
|
572
|
+
"gameId": 975,
|
|
573
|
+
"name": "精锐「第十九驱逐队」,全力出击!",
|
|
574
|
+
},
|
|
560
575
|
Object {
|
|
561
576
|
"code": "F98",
|
|
562
577
|
"gameId": 1103,
|
|
@@ -15,6 +15,7 @@ Object {
|
|
|
15
15
|
"1104": true,
|
|
16
16
|
"1106": true,
|
|
17
17
|
"111": true,
|
|
18
|
+
"1117": true,
|
|
18
19
|
"112": true,
|
|
19
20
|
"113": true,
|
|
20
21
|
"114": true,
|
|
@@ -178,6 +179,7 @@ Object {
|
|
|
178
179
|
"346": true,
|
|
179
180
|
"347": true,
|
|
180
181
|
"355": true,
|
|
182
|
+
"356": true,
|
|
181
183
|
"401": true,
|
|
182
184
|
"402": true,
|
|
183
185
|
"403": true,
|
|
@@ -371,6 +373,13 @@ Object {
|
|
|
371
373
|
"967": true,
|
|
372
374
|
"968": true,
|
|
373
375
|
"969": true,
|
|
376
|
+
"970": true,
|
|
377
|
+
"973": true,
|
|
378
|
+
"974": true,
|
|
379
|
+
"975": true,
|
|
380
|
+
"976": true,
|
|
381
|
+
"977": true,
|
|
382
|
+
"978": true,
|
|
374
383
|
}
|
|
375
384
|
`;
|
|
376
385
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { version, QuestData } from '../../build/kcanotifyGamedata'
|
|
2
2
|
|
|
3
3
|
test('should Kcanotify Game data version correct', () => {
|
|
4
|
-
expect(version).toMatchInlineSnapshot(`"
|
|
4
|
+
expect(version).toMatchInlineSnapshot(`"2022071002"`)
|
|
5
5
|
})
|
|
6
6
|
|
|
7
7
|
test('should Kcanotify Game data keys correct', () => {
|
|
@@ -4,7 +4,7 @@ import newQuestData from '../../build/kcQuestsData/quests-scn-new.json'
|
|
|
4
4
|
describe('should version correct', () => {
|
|
5
5
|
test('should KcwikiQuestData Game data version correct', () => {
|
|
6
6
|
expect(version).toMatchInlineSnapshot(
|
|
7
|
-
`"
|
|
7
|
+
`"9e3d68b81583efb366edf0a296854f08e52ef6e8"`
|
|
8
8
|
)
|
|
9
9
|
})
|
|
10
10
|
|
|
@@ -8,8 +8,8 @@ describe('should questCategory correct', () => {
|
|
|
8
8
|
expect(questCategory.weeklyQuest.length).toMatchInlineSnapshot(`17`)
|
|
9
9
|
expect(questCategory.monthlyQuest.length).toMatchInlineSnapshot(`11`)
|
|
10
10
|
expect(questCategory.quarterlyQuest.length).toMatchInlineSnapshot(`25`)
|
|
11
|
-
expect(questCategory.yearlyQuest.length).toMatchInlineSnapshot(`
|
|
12
|
-
expect(questCategory.singleQuest.length).toMatchInlineSnapshot(`
|
|
11
|
+
expect(questCategory.yearlyQuest.length).toMatchInlineSnapshot(`40`)
|
|
12
|
+
expect(questCategory.singleQuest.length).toMatchInlineSnapshot(`489`)
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
test('snapshot', () => {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef } from 'react'
|
|
2
|
-
import
|
|
3
|
-
//
|
|
4
|
-
import {
|
|
5
|
-
AutoSizer,
|
|
6
|
-
CellMeasurer,
|
|
7
|
-
CellMeasurerCache,
|
|
8
|
-
List,
|
|
9
|
-
ListRowRenderer,
|
|
10
|
-
} from 'react-virtualized'
|
|
2
|
+
import AutoSizer from 'react-virtualized-auto-sizer'
|
|
3
|
+
// https://github.com/bvaughn/react-window
|
|
4
|
+
import { ListChildComponentProps, VariableSizeList as List } from 'react-window'
|
|
11
5
|
import styled from 'styled-components'
|
|
12
6
|
import { useIsQuestPluginTab } from '../poi/hooks'
|
|
13
7
|
import type { UnionQuest } from '../questHelper'
|
|
@@ -17,89 +11,77 @@ const QuestListWrapper = styled.div`
|
|
|
17
11
|
flex: 1;
|
|
18
12
|
`
|
|
19
13
|
|
|
20
|
-
const MINIMAL_CARD_HEIGHT = 70
|
|
21
|
-
// const LARGE_CARD_HEIGHT = 120
|
|
22
|
-
const cache = new CellMeasurerCache({
|
|
23
|
-
defaultHeight: MINIMAL_CARD_HEIGHT,
|
|
24
|
-
fixedWidth: true,
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const useQuestsRowRenderer = (quests: UnionQuest[]) => {
|
|
28
|
-
const rowRenderer = useCallback(
|
|
29
|
-
({ key, index, style, parent }: ListRowProps) => {
|
|
30
|
-
const quest = quests[index]
|
|
31
|
-
const { gameId } = quest
|
|
32
|
-
const { code, name, desc, memo, memo2, pre } = quest.docQuest
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<CellMeasurer
|
|
36
|
-
cache={cache}
|
|
37
|
-
columnIndex={0}
|
|
38
|
-
key={key}
|
|
39
|
-
parent={parent}
|
|
40
|
-
rowIndex={index}
|
|
41
|
-
>
|
|
42
|
-
<div style={style}>
|
|
43
|
-
<QuestCard
|
|
44
|
-
style={{ margin: '4px' }}
|
|
45
|
-
gameId={gameId}
|
|
46
|
-
code={code}
|
|
47
|
-
name={name}
|
|
48
|
-
desc={desc}
|
|
49
|
-
tip={memo}
|
|
50
|
-
tip2={memo2}
|
|
51
|
-
preQuest={pre}
|
|
52
|
-
></QuestCard>
|
|
53
|
-
</div>
|
|
54
|
-
</CellMeasurer>
|
|
55
|
-
)
|
|
56
|
-
},
|
|
57
|
-
[quests]
|
|
58
|
-
)
|
|
59
|
-
return rowRenderer
|
|
60
|
-
}
|
|
61
|
-
|
|
62
14
|
export const QuestList = ({ quests }: { quests: UnionQuest[] }) => {
|
|
63
15
|
const activeTab = useIsQuestPluginTab()
|
|
64
16
|
const listRef = useRef<List>(null)
|
|
65
|
-
const
|
|
17
|
+
const rowHeights = useRef<Record<number, number>>({})
|
|
66
18
|
|
|
67
19
|
useEffect(() => {
|
|
68
|
-
|
|
69
|
-
listRef.current?.recomputeRowHeights()
|
|
20
|
+
listRef.current?.resetAfterIndex(0)
|
|
70
21
|
}, [quests])
|
|
71
22
|
|
|
72
23
|
useEffect(() => {
|
|
73
24
|
if (activeTab) {
|
|
74
|
-
|
|
75
|
-
listRef.current?.recomputeRowHeights()
|
|
25
|
+
listRef.current?.resetAfterIndex(0)
|
|
76
26
|
}
|
|
77
27
|
}, [activeTab])
|
|
78
28
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
29
|
+
const setRowHeight = useCallback((index, size) => {
|
|
30
|
+
if (rowHeights.current[index] === size) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
rowHeights.current = { ...rowHeights.current, [index]: size }
|
|
34
|
+
listRef.current?.resetAfterIndex(index)
|
|
82
35
|
}, [])
|
|
83
36
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
37
|
+
const getRowHeight = useCallback((index) => {
|
|
38
|
+
return rowHeights.current[index] + 8 || 200
|
|
39
|
+
}, [])
|
|
40
|
+
|
|
41
|
+
const Row = ({ index, style }: ListChildComponentProps) => {
|
|
42
|
+
const rowRef = useRef<HTMLDivElement>(null)
|
|
43
|
+
|
|
44
|
+
const quest = quests[index]
|
|
45
|
+
const { gameId } = quest
|
|
46
|
+
const { code, name, desc, memo, memo2 } = quest.docQuest
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (rowRef.current) {
|
|
50
|
+
setRowHeight(index, rowRef.current.clientHeight)
|
|
51
|
+
}
|
|
52
|
+
}, [index])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div style={style}>
|
|
56
|
+
<div ref={rowRef}>
|
|
57
|
+
<QuestCard
|
|
58
|
+
style={{ margin: '4px' }}
|
|
59
|
+
gameId={gameId}
|
|
60
|
+
code={code}
|
|
61
|
+
name={name}
|
|
62
|
+
desc={desc}
|
|
63
|
+
tip={memo}
|
|
64
|
+
tip2={memo2}
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
88
69
|
}
|
|
89
70
|
|
|
90
71
|
return (
|
|
91
72
|
<QuestListWrapper>
|
|
92
|
-
<AutoSizer
|
|
73
|
+
<AutoSizer>
|
|
93
74
|
{({ height, width }) => (
|
|
94
75
|
<List
|
|
95
76
|
ref={listRef}
|
|
96
77
|
height={height}
|
|
97
78
|
width={width}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
79
|
+
itemCount={quests.length}
|
|
80
|
+
estimatedItemSize={200}
|
|
81
|
+
itemSize={getRowHeight}
|
|
82
|
+
>
|
|
83
|
+
{Row}
|
|
84
|
+
</List>
|
|
103
85
|
)}
|
|
104
86
|
</AutoSizer>
|
|
105
87
|
</QuestListWrapper>
|
|
@@ -35,8 +35,16 @@ const QuestTooltip = forwardRef<
|
|
|
35
35
|
<>
|
|
36
36
|
<div>{`${quest.code} - ${quest.name}`}</div>
|
|
37
37
|
<div>{quest.desc}</div>
|
|
38
|
-
{quest.memo2 &&
|
|
39
|
-
|
|
38
|
+
{quest.memo2 && (
|
|
39
|
+
<div>
|
|
40
|
+
<b>{quest.memo2}</b>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
{quest.memo && (
|
|
44
|
+
<div>
|
|
45
|
+
<i>{quest.memo}</i>
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
40
48
|
</>
|
|
41
49
|
}
|
|
42
50
|
placement={'top'}
|
package/src/poi/hooks.ts
CHANGED
|
@@ -24,10 +24,12 @@ export const usePluginTranslation = () => {
|
|
|
24
24
|
return useTranslation(PACKAGE_NAME)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
const emptyArray = [] as GameQuest[]
|
|
27
28
|
export const useGameQuest = () => {
|
|
28
29
|
const [quests, setQuests] = useState<GameQuest[]>([])
|
|
29
30
|
useEffect(() => {
|
|
30
|
-
const listener = (quests: GameQuest[] | null) =>
|
|
31
|
+
const listener = (quests: GameQuest[] | null) =>
|
|
32
|
+
setQuests(quests ?? emptyArray)
|
|
31
33
|
// See reducer.ts
|
|
32
34
|
return observePluginStore(listener, (i) => i?._?.questList)
|
|
33
35
|
}, [setQuests])
|
package/src/poi/store.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { name as PACKAGE_NAME } from '../../package.json'
|
|
2
2
|
import type { PluginState } from '../reducer'
|
|
3
|
-
import {
|
|
3
|
+
import { id, noop } from '../utils'
|
|
4
|
+
import { importFromPoi, IN_POI } from './env'
|
|
4
5
|
import type { PoiState, Store } from './types'
|
|
5
6
|
|
|
6
|
-
const noop = () => {}
|
|
7
|
-
const id = <T>(x: T) => x
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
* See https://redux.js.org/api/store#subscribelistener
|
|
11
9
|
*/
|