poi-plugin-quest-info-2 0.5.12 → 0.6.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/.eslintrc.js +1 -1
- package/build/kcQuestsData/DATA_VERSION +1 -1
- package/build/kcQuestsData/index.ts +1 -1
- package/build/kcQuestsData/quests-scn.json +1121 -1047
- package/build/kcanotifyGamedata/DATA_VERSION +1 -1
- package/build/kcanotifyGamedata/index.ts +1 -1
- package/build/kcanotifyGamedata/quests-jp.json +457 -457
- package/build/kcanotifyGamedata/quests-ko.json +40 -40
- package/build/kcanotifyGamedata/quests-scn.json +225 -225
- package/build/kcanotifyGamedata/quests-tcn.json +225 -225
- package/i18n/en-US.json +2 -1
- package/i18n/ja-JP.json +2 -1
- package/i18n/ko-KR.json +1 -0
- package/i18n/zh-CN.json +2 -1
- package/i18n/zh-TW.json +1 -0
- package/package.json +2 -2
- package/scripts/downloadKcQuestsData.ts +10 -2
- package/scripts/downloadKcanotifyGamedata.ts +10 -2
- package/src/Toolbar.tsx +42 -37
- package/src/__tests__/kcanotifyData.spec.ts +1 -1
- package/src/__tests__/kcwikiData.spec.ts +1 -1
- package/src/components/PreTaskTag.tsx +40 -0
- package/src/components/QuestCard/MinimalQuestCard.tsx +48 -0
- package/src/components/QuestCard/index.tsx +71 -0
- package/src/components/QuestCard/styles.ts +42 -0
- package/src/components/QuestCard/utils.tsx +68 -0
- package/src/components/QuestList.tsx +2 -1
- package/src/questHelper.ts +1 -0
- package/src/store/filterTags.ts +44 -0
- package/src/store/search.ts +17 -0
- package/src/store/store.tsx +25 -2
- package/src/components/QuestCard.tsx +0 -213
package/src/store/store.tsx
CHANGED
|
@@ -78,9 +78,12 @@ export const useStore = () => {
|
|
|
78
78
|
const store = useContext(StateContext)
|
|
79
79
|
const setStore = useContext(SetStateContext)
|
|
80
80
|
const updateStore = useCallback(
|
|
81
|
-
(newStore: Partial<State>) =>
|
|
82
|
-
|
|
81
|
+
(newStore: Partial<State>) => {
|
|
82
|
+
setStore((previousStore) => ({ ...previousStore, ...newStore }))
|
|
83
|
+
},
|
|
84
|
+
[setStore]
|
|
83
85
|
)
|
|
86
|
+
|
|
84
87
|
return { store, setStore, updateStore }
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -91,3 +94,23 @@ export const useRemoveStorage = () => {
|
|
|
91
94
|
updateStore(initialState)
|
|
92
95
|
}
|
|
93
96
|
}
|
|
97
|
+
|
|
98
|
+
export const useSyncWithGame = () => {
|
|
99
|
+
const {
|
|
100
|
+
store: { syncWithGame },
|
|
101
|
+
updateStore,
|
|
102
|
+
} = useStore()
|
|
103
|
+
const setSyncWithGame = useCallback(
|
|
104
|
+
(value: boolean) => {
|
|
105
|
+
updateStore({ syncWithGame: value })
|
|
106
|
+
},
|
|
107
|
+
[updateStore]
|
|
108
|
+
)
|
|
109
|
+
const toggleSyncWithGame = useCallback(() => {
|
|
110
|
+
setSyncWithGame(!syncWithGame)
|
|
111
|
+
}, [setSyncWithGame, syncWithGame])
|
|
112
|
+
return {
|
|
113
|
+
syncWithGame,
|
|
114
|
+
toggleSyncWithGame,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { Card, Elevation, H5, Text, Tooltip, Icon } from '@blueprintjs/core'
|
|
2
|
-
import { IconNames } from '@blueprintjs/icons'
|
|
3
|
-
import React, { useCallback } from 'react'
|
|
4
|
-
import styled from 'styled-components'
|
|
5
|
-
import { usePluginTranslation } from '../poi/hooks'
|
|
6
|
-
import {
|
|
7
|
-
guessQuestCategory,
|
|
8
|
-
QUEST_CATEGORY,
|
|
9
|
-
QUEST_STATUS,
|
|
10
|
-
} from '../questHelper'
|
|
11
|
-
import { IconComposition } from '../../build/assets'
|
|
12
|
-
import { IconExpedition } from '../../build/assets'
|
|
13
|
-
import { IconArsenal } from '../../build/assets'
|
|
14
|
-
import { IconModernization } from '../../build/assets'
|
|
15
|
-
import { IconExercise } from '../../build/assets'
|
|
16
|
-
import { IconSortie } from '../../build/assets'
|
|
17
|
-
import { IconSupplyDocking } from '../../build/assets'
|
|
18
|
-
import { IconInProgress } from '../../build/assets'
|
|
19
|
-
import { IconCompleted } from '../../build/assets'
|
|
20
|
-
import { useLargeCard } from '../store/quest'
|
|
21
|
-
|
|
22
|
-
const FlexCard = styled(Card)`
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
|
|
26
|
-
& > * + * {
|
|
27
|
-
margin-left: 8px;
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
const CardMedia = styled.img`
|
|
32
|
-
width: 64px;
|
|
33
|
-
height: 64px;
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
const CatIndicator = styled.span<{ color: string }>`
|
|
37
|
-
height: 1em;
|
|
38
|
-
width: 4px;
|
|
39
|
-
background-color: ${({ color }) => color};
|
|
40
|
-
`
|
|
41
|
-
|
|
42
|
-
const CardBody = styled.div`
|
|
43
|
-
display: flex;
|
|
44
|
-
flex: 1;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
|
|
47
|
-
* + * {
|
|
48
|
-
margin-top: 8px;
|
|
49
|
-
}
|
|
50
|
-
`
|
|
51
|
-
|
|
52
|
-
const CardTail = styled.div`
|
|
53
|
-
display: flex;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
align-items: center;
|
|
56
|
-
|
|
57
|
-
img {
|
|
58
|
-
height: 20px;
|
|
59
|
-
}
|
|
60
|
-
`
|
|
61
|
-
|
|
62
|
-
// transparent GIF pixel
|
|
63
|
-
const PLACEHOLDER =
|
|
64
|
-
'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
|
|
65
|
-
|
|
66
|
-
const questIconMap = {
|
|
67
|
-
[QUEST_CATEGORY.Composition]: IconComposition,
|
|
68
|
-
[QUEST_CATEGORY.Sortie]: IconSortie,
|
|
69
|
-
[QUEST_CATEGORY.Exercise]: IconExercise,
|
|
70
|
-
[QUEST_CATEGORY.Expedition]: IconExpedition,
|
|
71
|
-
[QUEST_CATEGORY.SupplyOrDocking]: IconSupplyDocking,
|
|
72
|
-
[QUEST_CATEGORY.Arsenal]: IconArsenal,
|
|
73
|
-
[QUEST_CATEGORY.Modernization]: IconModernization,
|
|
74
|
-
[QUEST_CATEGORY.Unknown]: PLACEHOLDER,
|
|
75
|
-
} as const
|
|
76
|
-
|
|
77
|
-
const questStatusMap: Record<QUEST_STATUS, React.FC> = {
|
|
78
|
-
[QUEST_STATUS.LOCKED]: function Locked() {
|
|
79
|
-
const { t } = usePluginTranslation()
|
|
80
|
-
return (
|
|
81
|
-
<Tooltip content={t('Locked')}>
|
|
82
|
-
<Icon icon={IconNames.LOCK} iconSize={Icon.SIZE_LARGE}></Icon>
|
|
83
|
-
</Tooltip>
|
|
84
|
-
)
|
|
85
|
-
},
|
|
86
|
-
// Display nothing
|
|
87
|
-
[QUEST_STATUS.DEFAULT]: () => null,
|
|
88
|
-
[QUEST_STATUS.IN_PROGRESS]: function InProgress() {
|
|
89
|
-
const { t } = usePluginTranslation()
|
|
90
|
-
return (
|
|
91
|
-
<Tooltip content={t('In Progress')}>
|
|
92
|
-
<img src={IconInProgress}></img>
|
|
93
|
-
</Tooltip>
|
|
94
|
-
)
|
|
95
|
-
},
|
|
96
|
-
[QUEST_STATUS.COMPLETED]: function Completed() {
|
|
97
|
-
const { t } = usePluginTranslation()
|
|
98
|
-
return (
|
|
99
|
-
<Tooltip content={t('Completed')}>
|
|
100
|
-
<img src={IconCompleted}></img>
|
|
101
|
-
</Tooltip>
|
|
102
|
-
)
|
|
103
|
-
},
|
|
104
|
-
[QUEST_STATUS.ALREADY_COMPLETED]: function AlreadyCompleted() {
|
|
105
|
-
const { t } = usePluginTranslation()
|
|
106
|
-
return (
|
|
107
|
-
<Tooltip content={t('Already Completed')}>
|
|
108
|
-
<Icon icon={IconNames.TICK} iconSize={Icon.SIZE_LARGE}></Icon>
|
|
109
|
-
</Tooltip>
|
|
110
|
-
)
|
|
111
|
-
},
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
type QuestCardProps = {
|
|
115
|
-
code: string
|
|
116
|
-
name: string
|
|
117
|
-
desc: string | JSX.Element
|
|
118
|
-
tips?: string
|
|
119
|
-
status?: QUEST_STATUS
|
|
120
|
-
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void
|
|
121
|
-
style?: React.CSSProperties
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export const LargeQuestCard: React.FC<QuestCardProps> = ({
|
|
125
|
-
code,
|
|
126
|
-
name,
|
|
127
|
-
desc,
|
|
128
|
-
tips,
|
|
129
|
-
status = QUEST_STATUS.DEFAULT,
|
|
130
|
-
onClick,
|
|
131
|
-
style,
|
|
132
|
-
}) => {
|
|
133
|
-
const headIcon = questIconMap[guessQuestCategory(code).type]
|
|
134
|
-
const TailIcon = questStatusMap[status]
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<FlexCard
|
|
138
|
-
elevation={Elevation.ZERO}
|
|
139
|
-
interactive={true}
|
|
140
|
-
onClick={onClick}
|
|
141
|
-
style={style}
|
|
142
|
-
>
|
|
143
|
-
<CardMedia src={headIcon}></CardMedia>
|
|
144
|
-
<CardBody>
|
|
145
|
-
<H5>{[code, name].filter((i) => i != undefined).join(' - ')}</H5>
|
|
146
|
-
<Text>{desc}</Text>
|
|
147
|
-
<Text tagName="i">{tips}</Text>
|
|
148
|
-
</CardBody>
|
|
149
|
-
|
|
150
|
-
<CardTail>
|
|
151
|
-
<TailIcon></TailIcon>
|
|
152
|
-
</CardTail>
|
|
153
|
-
</FlexCard>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export const MinimalQuestCard: React.FC<QuestCardProps> = ({
|
|
158
|
-
code,
|
|
159
|
-
name,
|
|
160
|
-
desc,
|
|
161
|
-
tips,
|
|
162
|
-
status = QUEST_STATUS.DEFAULT,
|
|
163
|
-
onClick,
|
|
164
|
-
style,
|
|
165
|
-
}) => {
|
|
166
|
-
const indicatorColor = guessQuestCategory(code).color
|
|
167
|
-
const TailIcon = questStatusMap[status]
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<Tooltip
|
|
171
|
-
targetTagName="div"
|
|
172
|
-
content={
|
|
173
|
-
<>
|
|
174
|
-
{desc}
|
|
175
|
-
<br />
|
|
176
|
-
{tips}
|
|
177
|
-
</>
|
|
178
|
-
}
|
|
179
|
-
>
|
|
180
|
-
<FlexCard
|
|
181
|
-
elevation={Elevation.ZERO}
|
|
182
|
-
interactive={true}
|
|
183
|
-
onClick={onClick}
|
|
184
|
-
style={style}
|
|
185
|
-
>
|
|
186
|
-
<CatIndicator color={indicatorColor}></CatIndicator>
|
|
187
|
-
<CardBody>
|
|
188
|
-
<Text>{[code, name].filter((i) => i != undefined).join(' - ')}</Text>
|
|
189
|
-
</CardBody>
|
|
190
|
-
|
|
191
|
-
<CardTail>
|
|
192
|
-
<TailIcon></TailIcon>
|
|
193
|
-
</CardTail>
|
|
194
|
-
</FlexCard>
|
|
195
|
-
</Tooltip>
|
|
196
|
-
)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export const QuestCard: React.FC<QuestCardProps & { gameId: string }> = ({
|
|
200
|
-
gameId,
|
|
201
|
-
...props
|
|
202
|
-
}) => {
|
|
203
|
-
const { largeCard, setLarge, setMinimal } = useLargeCard()
|
|
204
|
-
const setQuestCardLarge = useCallback(
|
|
205
|
-
() => setLarge(gameId),
|
|
206
|
-
[gameId, setLarge]
|
|
207
|
-
)
|
|
208
|
-
return gameId === largeCard ? (
|
|
209
|
-
<LargeQuestCard onClick={setMinimal} {...props}></LargeQuestCard>
|
|
210
|
-
) : (
|
|
211
|
-
<MinimalQuestCard onClick={setQuestCardLarge} {...props}></MinimalQuestCard>
|
|
212
|
-
)
|
|
213
|
-
}
|