poi-plugin-quest-info-2 0.7.1 → 0.7.2

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/README.md CHANGED
@@ -9,6 +9,8 @@ A [poi](https://github.com/poooi/poi) plugin that helps you view quest info. Dat
9
9
 
10
10
  ## Installation
11
11
 
12
+ Paste `poi-plugin-quest-info-2` in the plugins tab and click the install button.
13
+
12
14
  ![image](https://user-images.githubusercontent.com/18554747/161830757-0a4e500c-f246-4dbd-820d-0b9a9c5a34a4.png)
13
15
 
14
16
  ## Features
package/i18n/en-US.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Arsenal": "Arsenal",
12
12
  "Modernization": "Modernization",
13
13
  "Others": "Others",
14
- "New": "New",
14
+ "New": "New {{number}}",
15
15
  "Daily": "Daily",
16
16
  "Weekly": "Weekly",
17
17
  "Monthly": "Monthly",
@@ -19,9 +19,9 @@
19
19
  "Yearly": "Yearly",
20
20
  "One-time": "One-time",
21
21
  "Locked": "Locked",
22
- "In Progress": "In Progress",
22
+ "In Progress": "In Progress {{number}}",
23
23
  "Completed": "Completed",
24
- "TotalQuests": "Total {{count}} quests",
24
+ "TotalQuests": "Total {{number}} quests",
25
25
  "Sync with game": "Sync with game (Show in-game quests only)",
26
26
  "Version": "Version: {{version}}",
27
27
  "Data Version": "Data Version: {{version}}",
package/i18n/ja-JP.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Arsenal": "工廠",
12
12
  "Modernization": "改装",
13
13
  "Others": "その他",
14
- "New": "最新任務",
14
+ "New": "最新任務 {{number}}",
15
15
  "Daily": "デイリー",
16
16
  "Weekly": "ウィークリー",
17
17
  "Monthly": "マンスリー",
@@ -19,9 +19,9 @@
19
19
  "Yearly": "イヤーリー",
20
20
  "One-time": "単発",
21
21
  "Locked": "ロック中",
22
- "In Progress": "進行中",
22
+ "In Progress": "進行中 {{number}}",
23
23
  "Completed": "完了",
24
- "TotalQuests": "全て {{count}} 個の任務",
24
+ "TotalQuests": "全て {{number}} 個の任務",
25
25
  "Sync with game": "ゲームと連動(インゲームクエストのみ表示する)",
26
26
  "Version": "バージョン: {{version}}",
27
27
  "Data Version": "データ バージョン: {{version}}",
package/i18n/ko-KR.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Search": "검색",
5
5
  "All": "전체",
6
6
  "Locked": "잠김",
7
- "In Progress": "진행 중",
7
+ "In Progress": "진행 중 {{number}}",
8
8
  "Completed": "완료",
9
9
  "Version": "버전: {{version}}",
10
10
  "Data Version": "데이터 버전: {{version}}",
package/i18n/zh-CN.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Arsenal": "工厂",
12
12
  "Modernization": "改装",
13
13
  "Others": "其他",
14
- "New": "新任务",
14
+ "New": "新任务 {{number}}",
15
15
  "Daily": "日常",
16
16
  "Weekly": "周常",
17
17
  "Monthly": "月常",
@@ -19,9 +19,9 @@
19
19
  "Yearly": "年常",
20
20
  "One-time": "单次",
21
21
  "Locked": "未解锁",
22
- "In Progress": "进行中",
22
+ "In Progress": "进行中 {{number}}",
23
23
  "Completed": "已完成",
24
- "TotalQuests": "一共 {{count}} 个任务",
24
+ "TotalQuests": "一共 {{number}} 个任务",
25
25
  "Sync with game": "与游戏同步(仅展示游戏内任务)",
26
26
  "Version": "版本: {{version}}",
27
27
  "Data Version": "数据版本: {{version}}",
package/i18n/zh-TW.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Arsenal": "工廠",
12
12
  "Modernization": "改装",
13
13
  "Others": "其他",
14
- "New": "新任務",
14
+ "New": "新任務 {{number}}",
15
15
  "Daily": "每日",
16
16
  "Weekly": "每週",
17
17
  "Monthly": "每月",
@@ -19,9 +19,9 @@
19
19
  "Yearly": "每年",
20
20
  "One-time": "單次",
21
21
  "Locked": "未解鎖",
22
- "In Progress": "進行中",
22
+ "In Progress": "進行中 {{number}}",
23
23
  "Completed": "已完成",
24
- "TotalQuests": "一共 {{count}} 個任務",
24
+ "TotalQuests": "一共 {{number}} 個任務",
25
25
  "Sync with game": "與遊戲同步",
26
26
  "Version": "版本: {{version}}",
27
27
  "Data Version": "資料版本: {{version}}",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poi-plugin-quest-info-2",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "private": false,
5
5
  "description": "show quest info",
6
6
  "homepage": "https://github.com/lawvs/poi-plugin-quest-2/",
package/src/App.tsx CHANGED
@@ -31,7 +31,7 @@ const Main: React.FC = () => {
31
31
  return (
32
32
  <>
33
33
  <Toolbar></Toolbar>
34
- <CountText>{t('TotalQuests', { count: quests.length })}</CountText>
34
+ <CountText>{t('TotalQuests', { number: quests.length })}</CountText>
35
35
  <QuestList quests={quests}></QuestList>
36
36
  </>
37
37
  )
package/src/Toolbar.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Button, InputGroup, Intent, Tag, Tooltip } from '@blueprintjs/core'
1
+ import { Button, InputGroup, Intent, Tooltip } from '@blueprintjs/core'
2
2
  import { IconNames } from '@blueprintjs/icons'
3
3
  import type { ChangeEvent } from 'react'
4
4
  import React, { useCallback } from 'react'
@@ -10,12 +10,7 @@ import type { UnionQuest } from './questHelper'
10
10
  import { useQuest, useSyncWithGame } from './store'
11
11
  import { useFilterTags, useSyncGameTagEffect } from './store/filterTags'
12
12
  import { useSearchInput } from './store/search'
13
- import {
14
- ALL_CATEGORY_TAG,
15
- ALL_TYPE_TAG,
16
- CATEGORY_TAGS,
17
- TYPE_TAGS,
18
- } from './tags'
13
+ import { CategoryTags, CATEGORY_TAGS, TypeTags, TYPE_TAGS } from './tags'
19
14
 
20
15
  const ToolbarWrapper = styled.div`
21
16
  display: flex;
@@ -27,15 +22,6 @@ const ToolbarWrapper = styled.div`
27
22
  }
28
23
  `
29
24
 
30
- const TagsWrapper = styled.div`
31
- margin-left: -4px;
32
- margin-right: -4px;
33
-
34
- & > * {
35
- margin: 4px;
36
- }
37
- `
38
-
39
25
  const SyncButton = () => {
40
26
  const { t } = usePluginTranslation()
41
27
  const { searchInput } = useSearchInput()
@@ -91,62 +77,14 @@ export const SearchInput: React.FC = () => {
91
77
  )
92
78
  }
93
79
 
94
- const Tags = () => {
95
- const { t } = usePluginTranslation()
96
-
80
+ export const Toolbar = () => {
97
81
  useSyncGameTagEffect()
98
82
 
99
- const { typeTags, categoryTags, setCategoryTags, setTypeTags } =
100
- useFilterTags()
101
-
102
- return (
103
- <>
104
- <TagsWrapper>
105
- {CATEGORY_TAGS.map(({ name }) => (
106
- <Tag
107
- onClick={() => setCategoryTags(name)}
108
- intent={
109
- categoryTags[name]
110
- ? name === ALL_CATEGORY_TAG.name
111
- ? 'success'
112
- : 'primary'
113
- : 'none'
114
- }
115
- interactive={true}
116
- key={name}
117
- >
118
- {t(name)}
119
- </Tag>
120
- ))}
121
- </TagsWrapper>
122
- <TagsWrapper>
123
- {TYPE_TAGS.map((tag) => (
124
- <Tag
125
- onClick={() => setTypeTags(tag.name)}
126
- intent={
127
- typeTags[tag.name]
128
- ? tag.name === ALL_TYPE_TAG.name
129
- ? 'success'
130
- : 'primary'
131
- : 'none'
132
- }
133
- interactive={true}
134
- key={tag.name}
135
- >
136
- {t(tag.name)}
137
- {'suffix' in tag && ' ' + tag.suffix}
138
- </Tag>
139
- ))}
140
- </TagsWrapper>
141
- </>
142
- )
143
- }
144
-
145
- export const Toolbar = () => {
146
83
  return (
147
84
  <ToolbarWrapper>
148
85
  <SearchInput></SearchInput>
149
- <Tags></Tags>
86
+ <CategoryTags />
87
+ <TypeTags />
150
88
  </ToolbarWrapper>
151
89
  )
152
90
  }
@@ -42,9 +42,9 @@ const yearlyQuest = new Set(questCategory.yearlyQuest)
42
42
  const singleQuest = new Set(questCategory.singleQuest)
43
43
  const newQuest = new Set(newQuestData)
44
44
 
45
- export const isInProgressQuest = (quest: UnionQuest) =>
46
- quest.gameQuest?.api_state === QUEST_API_STATE.IN_PROGRESS ||
47
- quest.gameQuest?.api_state === QUEST_API_STATE.COMPLETED
45
+ export const isInProgressQuest = (quest: GameQuest) =>
46
+ quest.api_state === QUEST_API_STATE.IN_PROGRESS ||
47
+ quest.api_state === QUEST_API_STATE.COMPLETED
48
48
 
49
49
  export const isDailyQuest = (quest: UnionQuest) => dailyQuest.has(quest.gameId)
50
50
  export const isWeeklyQuest = (quest: UnionQuest) =>
package/src/tags.tsx ADDED
@@ -0,0 +1,172 @@
1
+ import { Tag } from '@blueprintjs/core'
2
+ import React from 'react'
3
+ import styled from 'styled-components'
4
+ import { IN_POI } from './poi/env'
5
+ import { useGameQuest, useGameTab, usePluginTranslation } from './poi/hooks'
6
+ import { GameQuest, QuestTab } from './poi/types'
7
+ import type { UnionQuest } from './questHelper'
8
+ import {
9
+ hasNewQuest,
10
+ isArsenalQuest,
11
+ isCompositionQuest,
12
+ isDailyQuest,
13
+ isExerciseQuest,
14
+ isExpeditionQuest,
15
+ isInProgressQuest,
16
+ isModernizationQuest,
17
+ isMonthlyQuest,
18
+ isNewQuest,
19
+ isQuarterlyQuest,
20
+ isSingleQuest,
21
+ isSortieQuest,
22
+ isSupplyOrDockingQuest,
23
+ isUnknownCategoryQuest,
24
+ isWeeklyQuest,
25
+ isYearlyQuest,
26
+ newQuestNumber,
27
+ } from './questHelper'
28
+ import { useSyncWithGame } from './store'
29
+ import { useFilterTags } from './store/filterTags'
30
+
31
+ const yes = () => true as const
32
+
33
+ export const ALL_CATEGORY_TAG = {
34
+ name: 'All',
35
+ filter: yes,
36
+ } as const
37
+
38
+ export const ALL_TYPE_TAG = ALL_CATEGORY_TAG
39
+
40
+ const withDocQuest =
41
+ <T extends any>(filterFn: (q: UnionQuest['docQuest']) => T) =>
42
+ (unionQuest: UnionQuest) =>
43
+ filterFn(unionQuest.docQuest)
44
+
45
+ const withGameQuestOr =
46
+ <T extends any>(filterFn: (q: GameQuest) => T, fallback: T) =>
47
+ ({ gameQuest }: UnionQuest) => {
48
+ if (!gameQuest) {
49
+ return fallback
50
+ }
51
+ return filterFn(gameQuest)
52
+ }
53
+
54
+ export const CATEGORY_TAGS = [
55
+ ALL_CATEGORY_TAG,
56
+ { name: 'Composition', filter: withDocQuest(isCompositionQuest) },
57
+ { name: 'Sortie', filter: withDocQuest(isSortieQuest) },
58
+ { name: 'Exercise', filter: withDocQuest(isExerciseQuest) },
59
+ { name: 'Expedition', filter: withDocQuest(isExpeditionQuest) },
60
+ { name: 'Supply / Docking', filter: withDocQuest(isSupplyOrDockingQuest) },
61
+ { name: 'Arsenal', filter: withDocQuest(isArsenalQuest) },
62
+ { name: 'Modernization', filter: withDocQuest(isModernizationQuest) },
63
+ { name: 'Others', filter: withDocQuest(isUnknownCategoryQuest) },
64
+ ] as const
65
+
66
+ export const TYPE_TAGS = [
67
+ ALL_TYPE_TAG,
68
+ {
69
+ name: 'In Progress',
70
+ filter: withGameQuestOr(isInProgressQuest, false),
71
+ },
72
+ { name: 'New', filter: isNewQuest },
73
+ { name: 'Daily', filter: isDailyQuest },
74
+ { name: 'Weekly', filter: isWeeklyQuest },
75
+ { name: 'Monthly', filter: isMonthlyQuest },
76
+ { name: 'One-time', filter: isSingleQuest },
77
+ { name: 'Quarterly', filter: isQuarterlyQuest },
78
+ { name: 'Yearly', filter: isYearlyQuest },
79
+ ] as const
80
+
81
+ // TODO tag Lock / Completed
82
+
83
+ const TagsWrapper = styled.div`
84
+ margin-left: -4px;
85
+ margin-right: -4px;
86
+
87
+ & > * {
88
+ margin: 4px;
89
+ }
90
+ `
91
+
92
+ export const CategoryTags = () => {
93
+ const { t } = usePluginTranslation()
94
+
95
+ const { categoryTags, setCategoryTags } = useFilterTags()
96
+ return (
97
+ <TagsWrapper>
98
+ {CATEGORY_TAGS.map(({ name }) => (
99
+ <Tag
100
+ onClick={() => setCategoryTags(name)}
101
+ intent={
102
+ categoryTags[name]
103
+ ? name === ALL_CATEGORY_TAG.name
104
+ ? 'success'
105
+ : 'primary'
106
+ : 'none'
107
+ }
108
+ interactive={true}
109
+ key={name}
110
+ >
111
+ {t(name)}
112
+ </Tag>
113
+ ))}
114
+ </TagsWrapper>
115
+ )
116
+ }
117
+
118
+ export const TypeTags = () => {
119
+ const { t } = usePluginTranslation()
120
+ const gameTab = useGameTab()
121
+ const { syncWithGame } = useSyncWithGame()
122
+ const gameQuests = useGameQuest()
123
+ const inProgressQuest = gameQuests.filter((gameQuest) =>
124
+ isInProgressQuest(gameQuest)
125
+ )
126
+ const { typeTags, setTypeTags } = useFilterTags()
127
+
128
+ const limitSwitch = syncWithGame && gameTab !== QuestTab.ALL
129
+
130
+ return (
131
+ <TagsWrapper>
132
+ <Tag
133
+ intent={typeTags['All'] ? 'success' : 'none'}
134
+ interactive={true}
135
+ onClick={() => setTypeTags('All')}
136
+ >
137
+ {t('All')}
138
+ </Tag>
139
+ {IN_POI && (
140
+ <Tag
141
+ intent={typeTags['In Progress'] ? 'primary' : 'none'}
142
+ interactive={true}
143
+ onClick={() => setTypeTags('In Progress')}
144
+ >
145
+ {t('In Progress', { number: inProgressQuest.length })}
146
+ </Tag>
147
+ )}
148
+ {hasNewQuest && (
149
+ <Tag
150
+ intent={typeTags['New'] ? 'primary' : 'none'}
151
+ interactive={true}
152
+ onClick={() => setTypeTags('New')}
153
+ >
154
+ {t('New', { number: newQuestNumber })}
155
+ </Tag>
156
+ )}
157
+
158
+ {TYPE_TAGS.slice(3).map((tag) => (
159
+ <Tag
160
+ onClick={() => setTypeTags(tag.name)}
161
+ intent={
162
+ typeTags[tag.name] ? (limitSwitch ? 'warning' : 'primary') : 'none'
163
+ }
164
+ interactive={true}
165
+ key={tag.name}
166
+ >
167
+ {t(tag.name)}
168
+ </Tag>
169
+ ))}
170
+ </TagsWrapper>
171
+ )
172
+ }
@@ -1,14 +0,0 @@
1
- ---
2
- name: Bug report 代码缺陷汇报
3
- about: Create a report to help us improve 汇报程序代码错误
4
- ---
5
-
6
- **poi 版本 / poi version:**
7
-
8
- **操作系统 / OS:**
9
-
10
- **插件版本 / Plugin version:**
11
-
12
- **你遇到了什么样的问题 / The problem you've met:**
13
-
14
- **有没有重现的方法,或者与问题相关的任何信息 / How to reproduce, or any information that might be related:**
@@ -1,12 +0,0 @@
1
- ---
2
- name: Feature request 功能建议
3
- about: Suggest an idea 帮助我们改进插件的功能
4
- ---
5
-
6
- **poi 版本 / poi version:**
7
-
8
- **操作系统 / OS:**
9
-
10
- **插件版本 / Plugin version:**
11
-
12
- **功能的详细描述 / Details on the feature:**
@@ -1,51 +0,0 @@
1
- name: Build
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
- branches: [main]
8
-
9
- jobs:
10
- build:
11
- strategy:
12
- matrix:
13
- node-version: [16.x]
14
- os: [ubuntu-latest]
15
-
16
- if: "!contains(github.event.head_commit.message, '[skip ci]')"
17
- runs-on: ${{ matrix.os }}
18
-
19
- steps:
20
- - uses: actions/checkout@v2
21
-
22
- - name: Use Node.js ${{ matrix.node-version }}
23
- uses: actions/setup-node@v1
24
- with:
25
- node-version: ${{ matrix.node-version }}
26
-
27
- - name: Install node modules
28
- uses: bahmutov/npm-install@v1
29
-
30
- - name: Build
31
- run: npm run build
32
-
33
- - name: Lint
34
- run: npm run lint -- --max-warnings=0
35
-
36
- - name: Type check
37
- run: npm run typeCheck
38
-
39
- - name: Test
40
- run: npm run test -- --coverage
41
-
42
- - name: Build storybook
43
- run: npm run build-storybook
44
-
45
- - name: Deploy GitHub Pages
46
- if: github.ref == 'refs/heads/main'
47
- uses: peaceiris/actions-gh-pages@v3
48
- with:
49
- github_token: ${{ secrets.GITHUB_TOKEN }}
50
- publish_dir: storybook-static
51
- force_orphan: true
@@ -1,45 +0,0 @@
1
- name: Publish
2
-
3
- on:
4
- push:
5
- # Sequence of patterns matched against refs/tags
6
- tags:
7
- - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
8
-
9
- jobs:
10
- build:
11
- strategy:
12
- matrix:
13
- node-version: [16.x]
14
- os: [ubuntu-latest]
15
-
16
- runs-on: ${{ matrix.os }}
17
-
18
- steps:
19
- - uses: actions/checkout@v2
20
-
21
- - name: Use Node.js ${{ matrix.node-version }}
22
- uses: actions/setup-node@v1
23
- with:
24
- node-version: ${{ matrix.node-version }}
25
- registry-url: 'https://registry.npmjs.org'
26
-
27
- - name: Install node modules
28
- uses: bahmutov/npm-install@v1
29
-
30
- - name: Build
31
- run: npm run build
32
-
33
- - name: Lint
34
- run: npm run lint -- --max-warnings=0
35
-
36
- - name: Type check
37
- run: npm run typeCheck
38
-
39
- - name: Test
40
- run: npm test
41
-
42
- - name: Publish
43
- run: npm publish
44
- env:
45
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,6 +0,0 @@
1
- {
2
- "recommendations": [
3
- "dbaeumer.vscode-eslint",
4
- "streetsidesoftware.code-spell-checker"
5
- ]
6
- }
@@ -1,11 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib",
3
- "editor.codeActionsOnSave": {
4
- "source.fixAll.eslint": true
5
- },
6
- "npm.packageManager": "npm",
7
- "cSpell.words": [
8
- "Kcanotify",
9
- "Kcwiki"
10
- ]
11
- }
package/src/tags.ts DELETED
@@ -1,66 +0,0 @@
1
- import { IN_POI } from './poi/env'
2
- import {
3
- isDailyQuest,
4
- isMonthlyQuest,
5
- isQuarterlyQuest,
6
- isWeeklyQuest,
7
- isYearlyQuest,
8
- isCompositionQuest,
9
- isSortieQuest,
10
- isExerciseQuest,
11
- isExpeditionQuest,
12
- isSupplyOrDockingQuest,
13
- isArsenalQuest,
14
- isModernizationQuest,
15
- isUnknownCategoryQuest,
16
- isInProgressQuest,
17
- isSingleQuest,
18
- hasNewQuest,
19
- isNewQuest,
20
- newQuestNumber,
21
- } from './questHelper'
22
- import type { UnionQuest } from './questHelper'
23
-
24
- const yes = () => true as const
25
-
26
- export const ALL_CATEGORY_TAG = {
27
- name: 'All',
28
- filter: yes,
29
- } as const
30
-
31
- export const ALL_TYPE_TAG = ALL_CATEGORY_TAG
32
-
33
- const withDocQuest =
34
- (filterFn: (q: UnionQuest['docQuest']) => boolean) =>
35
- (unionQuest: UnionQuest) =>
36
- filterFn(unionQuest.docQuest)
37
-
38
- export const CATEGORY_TAGS = [
39
- ALL_CATEGORY_TAG,
40
- { name: 'Composition', filter: withDocQuest(isCompositionQuest) },
41
- { name: 'Sortie', filter: withDocQuest(isSortieQuest) },
42
- { name: 'Exercise', filter: withDocQuest(isExerciseQuest) },
43
- { name: 'Expedition', filter: withDocQuest(isExpeditionQuest) },
44
- { name: 'Supply / Docking', filter: withDocQuest(isSupplyOrDockingQuest) },
45
- { name: 'Arsenal', filter: withDocQuest(isArsenalQuest) },
46
- { name: 'Modernization', filter: withDocQuest(isModernizationQuest) },
47
- { name: 'Others', filter: withDocQuest(isUnknownCategoryQuest) },
48
- ] as const
49
-
50
- export const TYPE_TAGS = [
51
- ALL_TYPE_TAG,
52
- ...(IN_POI
53
- ? ([{ name: 'In Progress', filter: isInProgressQuest }] as const)
54
- : []),
55
- ...(hasNewQuest
56
- ? ([{ name: 'New', filter: isNewQuest, suffix: newQuestNumber }] as const)
57
- : []),
58
- { name: 'Daily', filter: isDailyQuest },
59
- { name: 'Weekly', filter: isWeeklyQuest },
60
- { name: 'Monthly', filter: isMonthlyQuest },
61
- { name: 'One-time', filter: isSingleQuest },
62
- { name: 'Quarterly', filter: isQuarterlyQuest },
63
- { name: 'Yearly', filter: isYearlyQuest },
64
- ] as const
65
-
66
- // TODO tag In Progress / Lock / Completed