poi-plugin-quest-info-2 0.13.3 → 0.14.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/config.json +6 -1
- package/CHANGELOG.md +16 -0
- package/build/index.ts +4 -0
- package/build/kcQuestsData/DATA_VERSION +1 -1
- package/build/kcQuestsData/index.ts +9 -1
- package/build/kcQuestsData/quests-scn-new.json +9 -0
- package/build/kcQuestsData/quests-scn.json +99 -10
- package/build/kcanotifyGamedata/DATA_VERSION +1 -1
- package/build/kcanotifyGamedata/index.ts +42 -4
- package/build/kcanotifyGamedata/quests-en.json +340 -0
- package/build/kcanotifyGamedata/quests-jp.json +357 -0
- package/build/kcanotifyGamedata/quests-ko.json +357 -0
- package/build/kcanotifyGamedata/quests-scn.json +361 -4
- package/build/kcanotifyGamedata/quests-tcn.json +357 -0
- package/build/prePostQuest.json +93 -9
- package/build/questCategory.json +11 -0
- package/build/questCodeMap.json +10 -1
- package/i18n/en-US.json +3 -0
- package/i18n/ja-JP.json +3 -0
- package/i18n/ko-KR.json +3 -0
- package/i18n/zh-CN.json +3 -0
- package/i18n/zh-TW.json +3 -0
- package/package.json +2 -1
- package/src/Settings.tsx +58 -41
- package/src/Toolbar.tsx +21 -4
- package/src/components/QuestCard/index.tsx +0 -11
- package/src/patch.ts +7 -16
- package/src/questHelper.ts +0 -5
- package/src/store/filterTags.ts +1 -1
- package/src/store/gameQuest.tsx +1 -1
- package/src/store/index.ts +1 -2
- package/src/store/quest.ts +28 -28
- package/src/store/store.tsx +9 -14
- package/src/tags.tsx +4 -15
- package/tsconfig.json +1 -1
- package/src/store/kcwiki.ts +0 -33
package/i18n/zh-CN.json
CHANGED
package/i18n/zh-TW.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poi-plugin-quest-info-2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "show quest info",
|
|
6
6
|
"homepage": "https://github.com/lawvs/poi-plugin-quest-2/",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@babel/preset-react": "^7.22.15",
|
|
52
52
|
"@babel/preset-typescript": "^7.23.2",
|
|
53
53
|
"@blueprintjs/core": "^4.19.5",
|
|
54
|
+
"@changesets/changelog-github": "^0.5.0",
|
|
54
55
|
"@changesets/cli": "^2.27.7",
|
|
55
56
|
"@storybook/addon-actions": "^7.5.2",
|
|
56
57
|
"@storybook/addon-essentials": "^7.5.2",
|
package/src/Settings.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnchorButton,
|
|
3
3
|
Button,
|
|
4
|
-
|
|
4
|
+
HTMLSelect,
|
|
5
5
|
Intent,
|
|
6
6
|
Text,
|
|
7
7
|
TextArea,
|
|
@@ -10,31 +10,23 @@ import { IconNames } from '@blueprintjs/icons'
|
|
|
10
10
|
import type { ChangeEvent } from 'react'
|
|
11
11
|
import React, { StrictMode, useCallback, useState } from 'react'
|
|
12
12
|
import styled from 'styled-components'
|
|
13
|
+
import { QUEST_DATA } from '../build'
|
|
13
14
|
import { version as DATA_VERSION } from '../build/kcanotifyGamedata'
|
|
14
15
|
import PKG from '../package.json'
|
|
15
16
|
import { IN_POI } from './poi/env'
|
|
16
17
|
import { usePluginTranslation, useStateExporter } from './poi/hooks'
|
|
17
18
|
import { tips } from './poi/utils'
|
|
18
|
-
import {
|
|
19
|
-
StoreProvider,
|
|
20
|
-
useLanguage,
|
|
21
|
-
usePreferKcwiki,
|
|
22
|
-
useRemoveStorage,
|
|
23
|
-
} from './store'
|
|
19
|
+
import { StoreProvider, useDataSource, useRemoveStorage } from './store'
|
|
24
20
|
|
|
25
21
|
const Container = styled.div`
|
|
26
22
|
display: flex;
|
|
27
23
|
flex-direction: column;
|
|
28
24
|
align-items: flex-start;
|
|
29
25
|
user-select: text;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
margin-top: 8px;
|
|
33
|
-
}
|
|
26
|
+
gap: 8px;
|
|
27
|
+
padding: 8px;
|
|
34
28
|
`
|
|
35
29
|
|
|
36
|
-
const useIsSimplifiedChinese = () => useLanguage() === 'zh-CN'
|
|
37
|
-
|
|
38
30
|
const DataExportArea = () => {
|
|
39
31
|
const [text, setText] = useState<string>('')
|
|
40
32
|
const { t } = usePluginTranslation()
|
|
@@ -83,52 +75,77 @@ const DataExportArea = () => {
|
|
|
83
75
|
)
|
|
84
76
|
}
|
|
85
77
|
|
|
86
|
-
const
|
|
78
|
+
const Group = styled.div`
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: 8px;
|
|
82
|
+
margin-bottom: 8px;
|
|
83
|
+
`
|
|
84
|
+
|
|
85
|
+
export const SettingsMain = () => {
|
|
87
86
|
const { t } = usePluginTranslation()
|
|
88
|
-
const isSimplifiedChinese = useIsSimplifiedChinese()
|
|
89
87
|
const removeStorage = useRemoveStorage()
|
|
90
|
-
const
|
|
91
|
-
const handleEnabledChange: React.FormEventHandler<HTMLInputElement> =
|
|
92
|
-
useCallback(() => {
|
|
93
|
-
setPreferKcwiki(!preferKcwiki)
|
|
94
|
-
}, [preferKcwiki, setPreferKcwiki])
|
|
88
|
+
const { dataSource, setDataSource } = useDataSource()
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
const handleChangeQuestSource = useCallback(
|
|
91
|
+
(e: ChangeEvent<HTMLSelectElement>) => {
|
|
92
|
+
const value = e.target.value
|
|
93
|
+
if (!value) {
|
|
94
|
+
setDataSource(null)
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
setDataSource(value as any)
|
|
98
|
+
},
|
|
99
|
+
[setDataSource],
|
|
100
|
+
)
|
|
104
101
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
return (
|
|
103
|
+
<Container>
|
|
104
|
+
<Group>
|
|
105
|
+
<Text>{t('Data Source')}</Text>
|
|
106
|
+
<HTMLSelect value={dataSource} onChange={handleChangeQuestSource}>
|
|
107
|
+
<option value="">{t('Auto detect')}</option>
|
|
108
|
+
{QUEST_DATA.map((source) => (
|
|
109
|
+
<option key={source.key} value={source.key}>
|
|
110
|
+
{source.name} ({Object.keys(source.res).length})
|
|
111
|
+
</option>
|
|
112
|
+
))}
|
|
113
|
+
</HTMLSelect>
|
|
114
|
+
</Group>
|
|
114
115
|
|
|
115
116
|
<Button
|
|
117
|
+
intent={Intent.WARNING}
|
|
116
118
|
icon={IconNames.TRASH}
|
|
117
119
|
text={t('Restore defaults')}
|
|
118
120
|
onClick={removeStorage}
|
|
119
121
|
/>
|
|
120
122
|
|
|
123
|
+
<AnchorButton
|
|
124
|
+
icon={IconNames.Bug}
|
|
125
|
+
rightIcon={IconNames.SHARE}
|
|
126
|
+
text={t('Report issue')}
|
|
127
|
+
href={PKG.bugs.url}
|
|
128
|
+
target="_blank"
|
|
129
|
+
/>
|
|
130
|
+
<AnchorButton
|
|
131
|
+
icon={IconNames.Heart}
|
|
132
|
+
rightIcon={IconNames.SHARE}
|
|
133
|
+
text={t('Star project, support the author')}
|
|
134
|
+
href={PKG.homepage}
|
|
135
|
+
target="_blank"
|
|
136
|
+
/>
|
|
121
137
|
<DataExportArea />
|
|
122
|
-
|
|
138
|
+
|
|
139
|
+
<Text>{t('Version', { version: PKG.version })}</Text>
|
|
140
|
+
<Text>{t('Data Version', { version: DATA_VERSION })}</Text>
|
|
141
|
+
</Container>
|
|
123
142
|
)
|
|
124
143
|
}
|
|
125
144
|
|
|
126
145
|
export const Settings = () => (
|
|
127
146
|
<StrictMode>
|
|
128
147
|
<StoreProvider>
|
|
129
|
-
<
|
|
130
|
-
<SettingsMain />
|
|
131
|
-
</Container>
|
|
148
|
+
<SettingsMain />
|
|
132
149
|
</StoreProvider>
|
|
133
150
|
</StrictMode>
|
|
134
151
|
)
|
package/src/Toolbar.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Button, InputGroup } from '@blueprintjs/core'
|
|
1
|
+
import { Button, InputGroup, Popover } from '@blueprintjs/core'
|
|
2
2
|
import { IconNames } from '@blueprintjs/icons'
|
|
3
3
|
import type { ChangeEvent } from 'react'
|
|
4
4
|
import React, { useCallback } from 'react'
|
|
5
5
|
import styled from 'styled-components'
|
|
6
6
|
import { usePluginTranslation } from './poi/hooks'
|
|
7
7
|
import { QUEST_STATUS, UnionQuest } from './questHelper'
|
|
8
|
+
import { SettingsMain } from './Settings'
|
|
8
9
|
import { PROGRESS_TAG, useQuest } from './store'
|
|
9
10
|
import {
|
|
10
11
|
useFilterProgressTag,
|
|
@@ -20,9 +21,15 @@ const ToolbarWrapper = styled.div`
|
|
|
20
21
|
display: flex;
|
|
21
22
|
flex-direction: column;
|
|
22
23
|
padding: 4px 8px;
|
|
24
|
+
gap: 8px;
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
const Wrapper = styled.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 4px;
|
|
23
30
|
|
|
24
|
-
& >
|
|
25
|
-
|
|
31
|
+
& > *:first-child {
|
|
32
|
+
flex: 1;
|
|
26
33
|
}
|
|
27
34
|
`
|
|
28
35
|
|
|
@@ -56,13 +63,23 @@ export const SearchInput: React.FC = () => {
|
|
|
56
63
|
)
|
|
57
64
|
}
|
|
58
65
|
|
|
66
|
+
const SettingsPopover = () => {
|
|
67
|
+
return <SettingsMain />
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
export const Toolbar = () => {
|
|
60
71
|
// TODO remove
|
|
61
72
|
useSyncGameTagEffect()
|
|
62
73
|
|
|
63
74
|
return (
|
|
64
75
|
<ToolbarWrapper>
|
|
65
|
-
<
|
|
76
|
+
<Wrapper>
|
|
77
|
+
<SearchInput />
|
|
78
|
+
<Popover content={<SettingsPopover />} placement="bottom">
|
|
79
|
+
<Button icon={IconNames.Settings} />
|
|
80
|
+
</Popover>
|
|
81
|
+
</Wrapper>
|
|
82
|
+
|
|
66
83
|
<CategoryTags />
|
|
67
84
|
<TypeTags />
|
|
68
85
|
</ToolbarWrapper>
|
|
@@ -3,9 +3,7 @@ import {
|
|
|
3
3
|
Card,
|
|
4
4
|
Elevation,
|
|
5
5
|
H5,
|
|
6
|
-
Icon,
|
|
7
6
|
Menu,
|
|
8
|
-
MenuDivider,
|
|
9
7
|
MenuItem,
|
|
10
8
|
Popover,
|
|
11
9
|
} from '@blueprintjs/core'
|
|
@@ -177,15 +175,6 @@ export const MoreOptions = forwardRef<
|
|
|
177
175
|
href={`https://richelieu-manager.net/quest/${code}`}
|
|
178
176
|
target="_blank"
|
|
179
177
|
/>
|
|
180
|
-
<MenuDivider />
|
|
181
|
-
<MenuItem
|
|
182
|
-
icon={IconNames.Heart}
|
|
183
|
-
labelElement={<Icon icon="share" />}
|
|
184
|
-
text={t('Star project, support the author')}
|
|
185
|
-
tagName="a"
|
|
186
|
-
href={`https://github.com/lawvs/poi-plugin-quest-2`}
|
|
187
|
-
target="_blank"
|
|
188
|
-
/>
|
|
189
178
|
</Menu>
|
|
190
179
|
)
|
|
191
180
|
return (
|
package/src/patch.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { i18n } from 'i18next'
|
|
2
|
-
import {
|
|
3
|
-
import { KcwikiQuestData } from '../build/kcQuestsData'
|
|
2
|
+
import { QUEST_DATA } from '../build'
|
|
4
3
|
import { importFromPoi, PACKAGE_NAME } from './poi/env'
|
|
5
4
|
import { getPoiStore } from './poi/store'
|
|
6
|
-
import {
|
|
7
|
-
checkIsKcwikiSupportedLanguages,
|
|
8
|
-
getStorage,
|
|
9
|
-
isSupportedLanguages,
|
|
10
|
-
} from './store'
|
|
5
|
+
import { getStorage } from './store'
|
|
11
6
|
|
|
12
7
|
const LEGACY_QUEST_PLUGIN_ID = 'poi-plugin-quest-info'
|
|
13
8
|
const HACK_KEY = `__patched-from-${PACKAGE_NAME}`
|
|
@@ -27,17 +22,13 @@ const isLegacyQuestPluginEnabled = async () => {
|
|
|
27
22
|
}
|
|
28
23
|
|
|
29
24
|
const getQuestState = (maybeLanguage: string) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
25
|
+
const dataSource = getStorage()?.dataSource
|
|
26
|
+
const sourceData = QUEST_DATA.find((i) => i.key === dataSource)
|
|
27
|
+
const defaultData = QUEST_DATA.find((i) => i.lang === maybeLanguage)
|
|
28
|
+
const data = (sourceData ?? defaultData)?.res
|
|
29
|
+
if (!data) {
|
|
32
30
|
return {}
|
|
33
31
|
}
|
|
34
|
-
const preferKcwikiData = getStorage()?.preferKcwikiData ?? true
|
|
35
|
-
const kcwikiSupported = checkIsKcwikiSupportedLanguages(maybeLanguage)
|
|
36
|
-
|
|
37
|
-
const data =
|
|
38
|
-
preferKcwikiData && kcwikiSupported
|
|
39
|
-
? KcwikiQuestData[maybeLanguage]
|
|
40
|
-
: QuestData[maybeLanguage]
|
|
41
32
|
|
|
42
33
|
return Object.fromEntries(
|
|
43
34
|
Object.entries(data).map(([apiNo, d]) => {
|
package/src/questHelper.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import moize from 'moize'
|
|
2
|
-
import { KcwikiQuestData } from '../build/kcQuestsData'
|
|
3
2
|
import newQuestData from '../build/kcQuestsData/quests-scn-new.json'
|
|
4
|
-
import { QuestData } from '../build/kcanotifyGamedata'
|
|
5
3
|
import prePostQuest from '../build/prePostQuest.json'
|
|
6
4
|
import questCategory from '../build/questCategory.json'
|
|
7
5
|
import questCodeMap from '../build/questCodeMap.json'
|
|
@@ -45,9 +43,6 @@ export type UnionQuest = {
|
|
|
45
43
|
docQuest: DocQuest
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
export const getKcwikiQuestData = () => KcwikiQuestData
|
|
49
|
-
export const getKcanotifyQuestData = () => QuestData
|
|
50
|
-
|
|
51
46
|
const dailyQuest = new Set(questCategory.dailyQuest)
|
|
52
47
|
const weeklyQuest = new Set(questCategory.weeklyQuest)
|
|
53
48
|
const monthlyQuest = new Set(questCategory.monthlyQuest)
|
package/src/store/filterTags.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { useCallback } from 'react'
|
|
|
2
2
|
import { useUpdateEffect } from 'react-use'
|
|
3
3
|
import { useGameTab } from '../poi/hooks'
|
|
4
4
|
import { QuestTab } from '../poi/types'
|
|
5
|
-
import { CATEGORY_TAGS, TYPE_TAGS } from '../tags'
|
|
5
|
+
import type { CATEGORY_TAGS, TYPE_TAGS } from '../tags'
|
|
6
6
|
import { ALL_CATEGORY_TAG, ALL_TYPE_TAG, PROGRESS_TAG, useStore } from './store'
|
|
7
7
|
|
|
8
8
|
export const useFilterTags = () => {
|
package/src/store/gameQuest.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react'
|
|
2
2
|
import React, { createContext, useContext } from 'react'
|
|
3
3
|
import { useGameQuest } from '../poi/hooks'
|
|
4
|
-
import { GameQuest } from '../poi/types'
|
|
4
|
+
import type { GameQuest } from '../poi/types'
|
|
5
5
|
import {
|
|
6
6
|
QUEST_STATUS,
|
|
7
7
|
getCompletedQuest,
|
package/src/store/index.ts
CHANGED
package/src/store/quest.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
+
import { QUEST_DATA } from '../../build'
|
|
1
2
|
import { usePluginTranslation } from '../poi/hooks'
|
|
2
3
|
import {
|
|
3
4
|
DocQuest,
|
|
4
|
-
getKcanotifyQuestData,
|
|
5
5
|
getQuestIdByCode,
|
|
6
6
|
QUEST_STATUS,
|
|
7
7
|
UnionQuest,
|
|
8
8
|
} from '../questHelper'
|
|
9
9
|
import { useGlobalGameQuest, useGlobalQuestStatusQuery } from './gameQuest'
|
|
10
|
-
import {
|
|
10
|
+
import { DataSource, useStore } from './store'
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const checkIsKcanotifySupportedLanguages = (
|
|
15
|
-
lang: string,
|
|
16
|
-
): lang is keyof typeof kcaQuestData => {
|
|
17
|
-
const kcaQuestData = getKcanotifyQuestData()
|
|
18
|
-
return lang in kcaQuestData
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const isSupportedLanguages = (
|
|
22
|
-
lang: string,
|
|
23
|
-
): lang is keyof ReturnType<typeof getKcanotifyQuestData> =>
|
|
24
|
-
checkIsKcanotifySupportedLanguages(lang) ||
|
|
25
|
-
checkIsKcwikiSupportedLanguages(lang)
|
|
26
|
-
|
|
27
|
-
export const useLanguage = () => {
|
|
12
|
+
const useLanguage = () => {
|
|
28
13
|
const {
|
|
29
14
|
i18n: { language },
|
|
30
15
|
} = usePluginTranslation()
|
|
31
|
-
|
|
32
|
-
? language
|
|
33
|
-
: DEFAULT_LANG
|
|
34
|
-
return lang
|
|
16
|
+
return language
|
|
35
17
|
}
|
|
36
18
|
|
|
37
|
-
const
|
|
19
|
+
export const useDataSource = () => {
|
|
20
|
+
const {
|
|
21
|
+
store: { dataSource },
|
|
22
|
+
updateStore,
|
|
23
|
+
} = useStore()
|
|
38
24
|
const lang = useLanguage()
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
const setDataSource = (val: DataSource | null) =>
|
|
26
|
+
updateStore({ dataSource: val })
|
|
27
|
+
const isValid =
|
|
28
|
+
dataSource && Object.values(QUEST_DATA).find((i) => i.key === dataSource)
|
|
29
|
+
const normalizedDataSource = isValid
|
|
30
|
+
? dataSource
|
|
31
|
+
: (QUEST_DATA.find((i) => i.lang === lang)?.key ?? QUEST_DATA[0].key)
|
|
32
|
+
return { dataSource: normalizedDataSource, setDataSource }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const useQuestMap = (): Record<string, DocQuest> => {
|
|
36
|
+
const { dataSource } = useDataSource()
|
|
37
|
+
if (!QUEST_DATA.length) {
|
|
38
|
+
throw new Error('QUEST_DATA is empty')
|
|
39
|
+
}
|
|
40
|
+
const data = QUEST_DATA.find((i) => i.key === dataSource)
|
|
41
|
+
if (!data) {
|
|
42
|
+
return QUEST_DATA[0].res
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
return kcaQuestData[lang]
|
|
44
|
+
return data.res
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export const useQuest = (): UnionQuest[] => {
|
package/src/store/store.tsx
CHANGED
|
@@ -7,8 +7,9 @@ import React, {
|
|
|
7
7
|
useState,
|
|
8
8
|
} from 'react'
|
|
9
9
|
import { useMount, useUpdateEffect } from 'react-use'
|
|
10
|
+
import type { QUEST_DATA } from '../../build'
|
|
10
11
|
import { PACKAGE_NAME } from '../poi/env'
|
|
11
|
-
import {
|
|
12
|
+
import { yes } from '../utils'
|
|
12
13
|
import { GameQuestProvider } from './gameQuest'
|
|
13
14
|
|
|
14
15
|
export const ALL_CATEGORY_TAG = {
|
|
@@ -25,6 +26,9 @@ export enum PROGRESS_TAG {
|
|
|
25
26
|
AlreadyCompleted = 'AlreadyCompleted',
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
type Unpacked<T> = T extends (infer U)[] ? U : T
|
|
30
|
+
export type DataSource = Unpacked<typeof QUEST_DATA>['key']
|
|
31
|
+
|
|
28
32
|
export const initialState = {
|
|
29
33
|
searchInput: '',
|
|
30
34
|
typeTags: {
|
|
@@ -35,7 +39,11 @@ export const initialState = {
|
|
|
35
39
|
} as Record<string, boolean>,
|
|
36
40
|
progressTag: PROGRESS_TAG.All,
|
|
37
41
|
syncWithGame: false as const,
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated
|
|
44
|
+
*/
|
|
38
45
|
preferKcwikiData: true,
|
|
46
|
+
dataSource: null as DataSource | null,
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export type State = typeof initialState
|
|
@@ -110,16 +118,3 @@ export const useRemoveStorage = () => {
|
|
|
110
118
|
updateStore(initialState)
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @deprecated Use progress tag
|
|
116
|
-
*/
|
|
117
|
-
export const useSyncWithGame = () => {
|
|
118
|
-
const setSyncWithGame = noop
|
|
119
|
-
const toggleSyncWithGame = noop
|
|
120
|
-
return {
|
|
121
|
-
syncWithGame: false as const,
|
|
122
|
-
setSyncWithGame,
|
|
123
|
-
toggleSyncWithGame,
|
|
124
|
-
}
|
|
125
|
-
}
|
package/src/tags.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Tag } from '@blueprintjs/core'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
|
-
import {
|
|
5
|
-
import { GameQuest
|
|
4
|
+
import { usePluginTranslation } from './poi/hooks'
|
|
5
|
+
import type { GameQuest } from './poi/types'
|
|
6
6
|
import type { UnionQuest } from './questHelper'
|
|
7
7
|
import {
|
|
8
8
|
hasNewQuest,
|
|
@@ -24,12 +24,7 @@ import {
|
|
|
24
24
|
isYearlyQuest,
|
|
25
25
|
newQuestNumber,
|
|
26
26
|
} from './questHelper'
|
|
27
|
-
import {
|
|
28
|
-
ALL_CATEGORY_TAG,
|
|
29
|
-
ALL_TYPE_TAG,
|
|
30
|
-
PROGRESS_TAG,
|
|
31
|
-
useSyncWithGame,
|
|
32
|
-
} from './store'
|
|
27
|
+
import { ALL_CATEGORY_TAG, ALL_TYPE_TAG, PROGRESS_TAG } from './store'
|
|
33
28
|
import { useFilterProgressTag, useFilterTags } from './store/filterTags'
|
|
34
29
|
import { useGlobalGameQuest, useGlobalQuestStatusNum } from './store/gameQuest'
|
|
35
30
|
|
|
@@ -165,8 +160,6 @@ export const CategoryTags = () => {
|
|
|
165
160
|
|
|
166
161
|
export const TypeTags = () => {
|
|
167
162
|
const { t } = usePluginTranslation()
|
|
168
|
-
const gameTab = useGameTab()
|
|
169
|
-
const { syncWithGame } = useSyncWithGame()
|
|
170
163
|
const gameQuests = useGlobalGameQuest()
|
|
171
164
|
const { progressTag } = useFilterProgressTag()
|
|
172
165
|
|
|
@@ -175,8 +168,6 @@ export const TypeTags = () => {
|
|
|
175
168
|
)
|
|
176
169
|
const { typeTags, setTypeTags } = useFilterTags()
|
|
177
170
|
|
|
178
|
-
const limitSwitch = syncWithGame && gameTab !== QuestTab.ALL
|
|
179
|
-
|
|
180
171
|
return (
|
|
181
172
|
<TagsWrapper>
|
|
182
173
|
<Tag
|
|
@@ -215,9 +206,7 @@ export const TypeTags = () => {
|
|
|
215
206
|
{TYPE_TAGS.slice(3).map((tag) => (
|
|
216
207
|
<Tag
|
|
217
208
|
onClick={() => setTypeTags(tag.name)}
|
|
218
|
-
intent={
|
|
219
|
-
typeTags[tag.name] ? (limitSwitch ? 'warning' : 'primary') : 'none'
|
|
220
|
-
}
|
|
209
|
+
intent={typeTags[tag.name] ? 'primary' : 'none'}
|
|
221
210
|
interactive={true}
|
|
222
211
|
key={tag.name}
|
|
223
212
|
>
|
package/tsconfig.json
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
45
45
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
46
46
|
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
47
|
-
|
|
47
|
+
"importsNotUsedAsValues": "error",
|
|
48
48
|
|
|
49
49
|
/* Module Resolution Options */
|
|
50
50
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
package/src/store/kcwiki.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useStore } from '.'
|
|
2
|
-
import { getKcwikiQuestData } from '../questHelper'
|
|
3
|
-
|
|
4
|
-
export const usePreferKcwiki = () => {
|
|
5
|
-
const {
|
|
6
|
-
store: { preferKcwikiData },
|
|
7
|
-
updateStore,
|
|
8
|
-
} = useStore()
|
|
9
|
-
const setPreferKcwikiData = (val: boolean) =>
|
|
10
|
-
updateStore({ preferKcwikiData: val })
|
|
11
|
-
return [preferKcwikiData, setPreferKcwikiData] as const
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const checkIsKcwikiSupportedLanguages = (
|
|
15
|
-
lang: string,
|
|
16
|
-
): lang is keyof typeof kcwikiQuestData => {
|
|
17
|
-
const kcwikiQuestData = getKcwikiQuestData()
|
|
18
|
-
return lang in kcwikiQuestData
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const useKcwikiData = (lang: string) => {
|
|
22
|
-
const [preferKcwiki] = usePreferKcwiki()
|
|
23
|
-
const supported = checkIsKcwikiSupportedLanguages(lang)
|
|
24
|
-
|
|
25
|
-
if (!preferKcwiki) {
|
|
26
|
-
return null
|
|
27
|
-
}
|
|
28
|
-
if (!supported) {
|
|
29
|
-
return null
|
|
30
|
-
}
|
|
31
|
-
const kcwikiQuestData = getKcwikiQuestData()
|
|
32
|
-
return kcwikiQuestData[lang]
|
|
33
|
-
}
|