poi-plugin-quest-info-2 0.8.9 → 0.9.1
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/CHANGELOG.md +20 -0
- package/README.md +3 -2
- package/build/kcQuestsData/DATA_VERSION +1 -1
- package/build/kcQuestsData/index.ts +1 -1
- package/build/kcQuestsData/quests-scn-new.json +1 -0
- package/build/kcQuestsData/quests-scn.json +57 -16
- package/build/kcanotifyGamedata/DATA_VERSION +1 -1
- package/build/kcanotifyGamedata/index.ts +1 -1
- package/build/prePostQuest.json +40 -5
- package/build/questCodeMap.json +6 -2
- package/i18n/en-US.json +8 -3
- package/i18n/index.ts +23 -4
- package/i18n/ja-JP.json +3 -3
- package/i18n/ko-KR.json +3 -2
- package/i18n/zh-CN.json +3 -3
- package/i18n/zh-TW.json +3 -3
- package/package.json +4 -2
- package/shims/globals.d.ts +6 -0
- package/src/Settings.tsx +67 -7
- package/src/Toolbar.tsx +53 -33
- package/src/__tests__/fixtures/firstLoginWithOneComplete.json +72 -0
- package/src/__tests__/fixtures/questList.json +338 -0
- package/src/__tests__/kcanotifyData.spec.ts +1 -1
- package/src/__tests__/kcwikiData.spec.ts +1 -1
- package/src/components/QuestCard/index.tsx +3 -3
- package/src/components/QuestCard/utils.tsx +3 -3
- package/src/patch.ts +3 -4
- package/src/poi/env.ts +4 -0
- package/src/poi/hooks.ts +55 -2
- package/src/poi/store.ts +25 -8
- package/src/poi/utils.ts +50 -0
- package/src/store/filterTags.ts +34 -13
- package/src/store/gameQuest.tsx +108 -5
- package/src/store/quest.ts +27 -83
- package/src/store/store.tsx +25 -19
- package/src/tags.tsx +83 -24
- package/tsconfig.json +1 -1
package/src/tags.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tag } from '@blueprintjs/core'
|
|
2
|
+
import { IconNames } from '@blueprintjs/icons'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
import styled from 'styled-components'
|
|
4
|
-
import { IN_POI } from './poi/env'
|
|
5
5
|
import { useGameTab, usePluginTranslation } from './poi/hooks'
|
|
6
6
|
import { GameQuest, QuestTab } from './poi/types'
|
|
7
7
|
import type { UnionQuest } from './questHelper'
|
|
@@ -25,17 +25,14 @@ import {
|
|
|
25
25
|
isYearlyQuest,
|
|
26
26
|
newQuestNumber,
|
|
27
27
|
} from './questHelper'
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} as const
|
|
37
|
-
|
|
38
|
-
export const ALL_TYPE_TAG = ALL_CATEGORY_TAG
|
|
28
|
+
import {
|
|
29
|
+
ALL_CATEGORY_TAG,
|
|
30
|
+
ALL_TYPE_TAG,
|
|
31
|
+
PROGRESS_TAG,
|
|
32
|
+
useSyncWithGame,
|
|
33
|
+
} from './store'
|
|
34
|
+
import { useFilterProgressTag, useFilterTags } from './store/filterTags'
|
|
35
|
+
import { useGlobalGameQuest, useGlobalQuestStatusNum } from './store/gameQuest'
|
|
39
36
|
|
|
40
37
|
const withDocQuest =
|
|
41
38
|
<T,>(filterFn: (q: UnionQuest['docQuest']) => T) =>
|
|
@@ -78,9 +75,9 @@ export const TYPE_TAGS = [
|
|
|
78
75
|
{ name: 'Yearly', filter: isYearlyQuest },
|
|
79
76
|
] as const
|
|
80
77
|
|
|
81
|
-
// TODO tag Lock / Completed
|
|
82
|
-
|
|
83
78
|
const TagsWrapper = styled.div`
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-wrap: wrap;
|
|
84
81
|
margin-left: -4px;
|
|
85
82
|
margin-right: -4px;
|
|
86
83
|
|
|
@@ -89,10 +86,61 @@ const TagsWrapper = styled.div`
|
|
|
89
86
|
}
|
|
90
87
|
`
|
|
91
88
|
|
|
92
|
-
export const
|
|
89
|
+
export const ProgressTags = () => {
|
|
93
90
|
const { t } = usePluginTranslation()
|
|
91
|
+
const { progressTag, toggleTag } = useFilterProgressTag()
|
|
92
|
+
const {
|
|
93
|
+
lockedQuestNum,
|
|
94
|
+
unlockedQuestNum,
|
|
95
|
+
completedQuestNum,
|
|
96
|
+
alreadyCompletedQuestNum,
|
|
97
|
+
} = useGlobalQuestStatusNum()
|
|
98
|
+
const completedQuestSuffix =
|
|
99
|
+
completedQuestNum > 0
|
|
100
|
+
? `${alreadyCompletedQuestNum} + ${completedQuestNum}`
|
|
101
|
+
: alreadyCompletedQuestNum
|
|
102
|
+
return (
|
|
103
|
+
<>
|
|
104
|
+
<Tag
|
|
105
|
+
onClick={() => {
|
|
106
|
+
toggleTag(PROGRESS_TAG.Locked)
|
|
107
|
+
}}
|
|
108
|
+
intent={progressTag === PROGRESS_TAG.Locked ? 'success' : 'none'}
|
|
109
|
+
interactive={true}
|
|
110
|
+
>
|
|
111
|
+
{t('Locked', { number: lockedQuestNum })}
|
|
112
|
+
</Tag>
|
|
113
|
+
<Tag
|
|
114
|
+
icon={IconNames.EXCHANGE}
|
|
115
|
+
onClick={() => {
|
|
116
|
+
toggleTag(PROGRESS_TAG.Unlocked)
|
|
117
|
+
}}
|
|
118
|
+
intent={progressTag === PROGRESS_TAG.Unlocked ? 'success' : 'none'}
|
|
119
|
+
interactive={true}
|
|
120
|
+
>
|
|
121
|
+
{t('Unlocked', { number: unlockedQuestNum })}
|
|
122
|
+
</Tag>
|
|
123
|
+
<Tag
|
|
124
|
+
onClick={() => {
|
|
125
|
+
toggleTag(PROGRESS_TAG.AlreadyCompleted)
|
|
126
|
+
}}
|
|
127
|
+
intent={
|
|
128
|
+
progressTag === PROGRESS_TAG.AlreadyCompleted ? 'success' : 'none'
|
|
129
|
+
}
|
|
130
|
+
interactive={true}
|
|
131
|
+
>
|
|
132
|
+
{t('Already Completed', {
|
|
133
|
+
number: completedQuestSuffix,
|
|
134
|
+
})}
|
|
135
|
+
</Tag>
|
|
136
|
+
</>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
94
139
|
|
|
140
|
+
export const CategoryTags = () => {
|
|
141
|
+
const { t } = usePluginTranslation()
|
|
95
142
|
const { categoryTags, setCategoryTags } = useFilterTags()
|
|
143
|
+
|
|
96
144
|
return (
|
|
97
145
|
<TagsWrapper>
|
|
98
146
|
{CATEGORY_TAGS.map(({ name }) => (
|
|
@@ -111,6 +159,8 @@ export const CategoryTags = () => {
|
|
|
111
159
|
{t(name)}
|
|
112
160
|
</Tag>
|
|
113
161
|
))}
|
|
162
|
+
|
|
163
|
+
<ProgressTags />
|
|
114
164
|
</TagsWrapper>
|
|
115
165
|
)
|
|
116
166
|
}
|
|
@@ -120,6 +170,8 @@ export const TypeTags = () => {
|
|
|
120
170
|
const gameTab = useGameTab()
|
|
121
171
|
const { syncWithGame } = useSyncWithGame()
|
|
122
172
|
const gameQuests = useGlobalGameQuest()
|
|
173
|
+
const { progressTag } = useFilterProgressTag()
|
|
174
|
+
|
|
123
175
|
const inProgressQuest = gameQuests.filter((gameQuest) =>
|
|
124
176
|
isInProgressQuest(gameQuest)
|
|
125
177
|
)
|
|
@@ -136,15 +188,22 @@ export const TypeTags = () => {
|
|
|
136
188
|
>
|
|
137
189
|
{t('All')}
|
|
138
190
|
</Tag>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
191
|
+
|
|
192
|
+
<Tag
|
|
193
|
+
intent={
|
|
194
|
+
typeTags['In Progress']
|
|
195
|
+
? progressTag === PROGRESS_TAG.AlreadyCompleted ||
|
|
196
|
+
progressTag === PROGRESS_TAG.Locked
|
|
197
|
+
? 'warning'
|
|
198
|
+
: 'primary'
|
|
199
|
+
: 'none'
|
|
200
|
+
}
|
|
201
|
+
interactive={true}
|
|
202
|
+
onClick={() => setTypeTags('In Progress')}
|
|
203
|
+
>
|
|
204
|
+
{t('In Progress', { number: inProgressQuest.length })}
|
|
205
|
+
</Tag>
|
|
206
|
+
|
|
148
207
|
{hasNewQuest && (
|
|
149
208
|
<Tag
|
|
150
209
|
intent={typeTags['New'] ? 'primary' : 'none'}
|
package/tsconfig.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
] /* Specify library files to be included in the compilation. */,
|
|
14
14
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
15
15
|
// "checkJs": true, /* Report errors in .js files. */
|
|
16
|
-
"jsx": "
|
|
16
|
+
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
17
17
|
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
18
18
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
19
19
|
// "sourceMap": true, /* Generates corresponding '.map' file. */
|