@nakamura-123/pages 1.3.16 → 1.4.0
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/dist/component/Article/ArticleCategoryList.js +88 -33
- package/dist/component/Article/ArticleContentView.d.ts +1 -0
- package/dist/component/Article/ArticleContentView.js +44 -9
- package/dist/component/Article/ArticleRow.d.ts +3 -2
- package/dist/component/Article/ArticleRow.js +42 -16
- package/dist/component/Basic/BasicProgressBar.js +7 -5
- package/dist/component/Basic/MiniTestCard.js +15 -9
- package/dist/component/Basic/Paw5s.js +2 -1
- package/dist/component/Basic/SubCategoryList.js +13 -18
- package/dist/component/Coin/CoinCheck.js +1 -1
- package/dist/component/Coin/CoinFnc.d.ts +2 -2
- package/dist/component/Coin/CoinFnc.js +13 -11
- package/dist/component/Coin/WaitingPayBanner.js +2 -3
- package/dist/component/Grade/GAllTags.d.ts +3 -0
- package/dist/component/Grade/GAllTags.js +45 -0
- package/dist/component/Grade/GradeCard/ChangeWeeklyModal.js +7 -3
- package/dist/component/Grade/GradeCard/DatePickerModal.js +2 -1
- package/dist/component/Grade/GradeCard/Square3sGrade.js +1 -1
- package/dist/component/Grade/GradeCard/TargetDate.js +1 -1
- package/dist/component/Grade/QuizCntGraph.js +2 -1
- package/dist/component/Grade/Square4s.js +4 -4
- package/dist/component/Grade/UnitCircles.d.ts +4 -2
- package/dist/component/Grade/UnitCircles.js +6 -5
- package/dist/component/Grade/YearCircles.d.ts +4 -2
- package/dist/component/Grade/YearCircles.js +7 -5
- package/dist/component/KeyboardCloseBar.js +2 -1
- package/dist/component/QuizSet/QuizOptionDrill.js +3 -14
- package/dist/component/Result/QuizFlatList.js +159 -56
- package/dist/component/Result/ResultActions.d.ts +7 -0
- package/dist/component/Result/ResultActions.js +107 -0
- package/dist/component/Result/ResultHero.d.ts +7 -0
- package/dist/component/Result/ResultHero.js +166 -0
- package/dist/component/SettingBtns/LanguageModal.d.ts +9 -0
- package/dist/component/SettingBtns/LanguageModal.js +103 -0
- package/dist/component/SettingBtns/TransBtn.js +7 -84
- package/dist/component/Tag5s.js +2 -2
- package/dist/component/TagBadge5s.js +7 -5
- package/dist/component/TestPage/BarChartContainer.js +2 -1
- package/dist/component/TestPage/Square3s.js +3 -2
- package/dist/engine/components.d.ts +19 -0
- package/dist/engine/components.js +19 -0
- package/dist/engine/drill.d.ts +3 -0
- package/dist/engine/drill.js +24 -0
- package/dist/engine/grammar.d.ts +3 -0
- package/dist/engine/grammar.js +22 -0
- package/dist/engine/index.d.ts +5 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine/tango.d.ts +3 -0
- package/dist/engine/tango.js +28 -0
- package/dist/engine/types.d.ts +46 -0
- package/dist/engine/types.js +2 -0
- package/dist/functions/createQuizFncG.d.ts +12 -0
- package/dist/functions/createQuizFncG.js +40 -0
- package/dist/functions/nextItemFnc.d.ts +12 -0
- package/dist/functions/nextItemFnc.js +56 -0
- package/dist/functions/questionFormatG.d.ts +7 -0
- package/dist/functions/questionFormatG.js +31 -0
- package/dist/functions/tagFncG.d.ts +5 -0
- package/dist/functions/tagFncG.js +24 -0
- package/dist/functions/tagFncJ.d.ts +2 -2
- package/dist/functions/tagFncJ.js +1 -1
- package/dist/hooks/BadgeHook.d.ts +1 -1
- package/dist/hooks/BadgeHook.js +3 -3
- package/dist/hooks/ExitQuizHook.js +9 -7
- package/dist/hooks/basicHook.d.ts +9 -1
- package/dist/hooks/basicHook.js +17 -8
- package/dist/hooks/quizActionHook.d.ts +3 -1
- package/dist/hooks/quizActionHook.js +33 -1
- package/dist/hooks/quizHook.d.ts +6 -2
- package/dist/hooks/quizHook.js +39 -4
- package/dist/hooks/resultHook.d.ts +9 -0
- package/dist/hooks/resultHook.js +74 -0
- package/dist/page/ArticleDetail.js +25 -12
- package/dist/page/CoinPage.js +2 -2
- package/dist/page/FAQPage.js +4 -3
- package/dist/page/GetBadgePage.js +5 -4
- package/dist/page/GradePage.js +6 -9
- package/dist/page/HistoryPage.js +7 -4
- package/dist/page/HomePage.js +7 -3
- package/dist/page/QuizPage.js +4 -4
- package/dist/page/QuizSettingPage.js +3 -6
- package/dist/page/QuizSetupPage.js +6 -14
- package/dist/page/ReportPage.js +1 -1
- package/dist/page/ResultPage.js +6 -24
- package/dist/page/SettingPage.js +36 -3
- package/dist/page/TestPage.js +7 -14
- package/dist/quiz/Title.js +5 -2
- package/dist/quiz/check/Check.js +11 -7
- package/dist/quiz/check/NextQuizBtn.js +3 -2
- package/dist/quiz/check/SelectTag.js +7 -0
- package/dist/quiz/common/MyTextqqyy.d.ts +1 -0
- package/dist/quiz/common/MyTextqqyy.js +2 -2
- package/dist/quiz/common/RenderImgOrText.d.ts +2 -0
- package/dist/quiz/common/RenderImgOrText.js +2 -2
- package/dist/quiz/common/RubyText.d.ts +3 -1
- package/dist/quiz/common/RubyText.js +20 -5
- package/dist/quiz/grammar/GAnswer.d.ts +8 -0
- package/dist/quiz/grammar/GAnswer.js +115 -0
- package/dist/quiz/grammar/GGuideBtn.d.ts +8 -0
- package/dist/quiz/grammar/GGuideBtn.js +43 -0
- package/dist/quiz/grammar/GQuestion.d.ts +8 -0
- package/dist/quiz/grammar/GQuestion.js +109 -0
- package/dist/quiz/grammar/QuizContentsGrammar.d.ts +10 -0
- package/dist/quiz/grammar/QuizContentsGrammar.js +31 -0
- package/dist/quiz/jAnswer/JAnswerContents.js +12 -5
- package/dist/quiz/jQuestion/JQuestionBottomText.d.ts +2 -1
- package/dist/quiz/jQuestion/JQuestionBottomText.js +3 -1
- package/dist/quiz/save/QuizSaveData.js +1 -1
- package/dist/quiz/setting/Above3BtnJ.js +5 -4
- package/dist/quiz/setting/Bottom3Btn.js +5 -4
- package/dist/quiz/setting/GuideBtn.js +3 -2
- package/dist/quiz/setting/RepeatBtn.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/filterType.d.ts +2 -1
- package/package.json +23 -3
|
@@ -7,20 +7,20 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const react_native_1 = require("react-native");
|
|
8
8
|
const react_redux_1 = require("react-redux");
|
|
9
9
|
const common_1 = require("@nakamura-123/common");
|
|
10
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
10
11
|
const stores_1 = require("@nakamura-123/stores");
|
|
11
12
|
const SubCategoryLeft_1 = __importDefault(require("../Basic/SubCategoryLeft"));
|
|
12
13
|
const tagFncD_1 = require("../../functions/tagFncD");
|
|
13
14
|
const Tag5s_1 = __importDefault(require("../Tag5s"));
|
|
14
|
-
const createQuizFncD_1 = require("../../functions/createQuizFncD");
|
|
15
15
|
const quizActionHook_1 = require("../../hooks/quizActionHook");
|
|
16
16
|
const basicHook_1 = require("../../hooks/basicHook");
|
|
17
|
-
const createQuizFncJ_1 = require("../../functions/createQuizFncJ");
|
|
18
|
-
const tagFncJ_1 = require("../../functions/tagFncJ");
|
|
19
17
|
const articleListFnc_1 = require("../../functions/articleListFnc");
|
|
20
18
|
const ArticleRow_1 = __importDefault(require("./ArticleRow"));
|
|
19
|
+
const resultHook_1 = require("../../hooks/resultHook");
|
|
21
20
|
const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
22
21
|
var _a;
|
|
23
22
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
23
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
24
24
|
// Redux states
|
|
25
25
|
const categoryList = (0, react_redux_1.useSelector)((state) => state.app[topSubject.list]);
|
|
26
26
|
const articleList = (0, react_redux_1.useSelector)((state) => state.app.articleList);
|
|
@@ -35,8 +35,9 @@ const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
35
35
|
const subCategories = (_a = selectedList.sub) !== null && _a !== void 0 ? _a : [];
|
|
36
36
|
// この章のarticleList定義(未登録の章はunitカードのみのフォールバック)
|
|
37
37
|
const articleEntry = articleList.find((a) => a.key === selectKey);
|
|
38
|
-
const
|
|
38
|
+
const { ops, query } = (0, basicHook_1.useEngineQuery)();
|
|
39
39
|
const useStartQuiz = (0, quizActionHook_1.useStartQuizAction)();
|
|
40
|
+
const makeNext = (0, resultHook_1.useMakeNext)();
|
|
40
41
|
const getLessonTitle = (index) => {
|
|
41
42
|
if (topSubject.type === "unit")
|
|
42
43
|
return `${selectedList.label} ${subCategories[index].title}`;
|
|
@@ -54,6 +55,8 @@ const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
54
55
|
system: topSubject.system,
|
|
55
56
|
category: selectKey,
|
|
56
57
|
lesson,
|
|
58
|
+
// 結果画面の「次へ」:見せている並びで決める。並びのない章は単元カードだけなので単元表の順
|
|
59
|
+
next: makeNext(articleEntry ? "lesson" : "list", topSubject.type, selectKey, lesson.key),
|
|
57
60
|
};
|
|
58
61
|
dispatch(stores_1.quizAction.setLesson(selected));
|
|
59
62
|
return selected;
|
|
@@ -76,10 +79,7 @@ const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
76
79
|
const selected = handleSetLesson(index);
|
|
77
80
|
if (!selected)
|
|
78
81
|
return;
|
|
79
|
-
const
|
|
80
|
-
const quizList = system === "JLPT"
|
|
81
|
-
? (0, createQuizFncJ_1.getBasicQuizListJ)(query, startCfg, selected)
|
|
82
|
-
: (0, createQuizFncD_1.getBasicQuizList)(query, startCfg, selected);
|
|
82
|
+
const quizList = ops.basicQuizList(query, startCfg, selected);
|
|
83
83
|
const { subject } = selected;
|
|
84
84
|
dispatch(stores_1.setAction.saveBasicPreSelect({
|
|
85
85
|
subject: topSubject.name,
|
|
@@ -103,6 +103,8 @@ const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
103
103
|
chapterKey: selectKey,
|
|
104
104
|
articleId,
|
|
105
105
|
title,
|
|
106
|
+
tag: topSubject.tag,
|
|
107
|
+
system: topSubject.system,
|
|
106
108
|
});
|
|
107
109
|
};
|
|
108
110
|
// 付箋(手動)を循環させる
|
|
@@ -110,21 +112,19 @@ const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
110
112
|
dispatch({ type: "setting/toggleArticleFlag", payload: { articleId } });
|
|
111
113
|
dispatch(stores_1.settingStorage.saveSetting());
|
|
112
114
|
};
|
|
113
|
-
//
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
? (0, tagFncJ_1.getUnitSubTagLevelCntsJ)(query, selectKey, key, topSubject.tag)
|
|
123
|
-
: getTagFnc(query, selectKey, key, outOfYearRange);
|
|
115
|
+
// isJoined: 上にレッスンの行がつながっている(上の角を丸めず、下の余白は組の側で取る)
|
|
116
|
+
const renderUnitCard = (key, title, i, isJoined = false) => {
|
|
117
|
+
const subTags = ops.subCategoryTagLevels(query, {
|
|
118
|
+
subjectType: topSubject.type,
|
|
119
|
+
tag: topSubject.tag,
|
|
120
|
+
key: selectKey,
|
|
121
|
+
subKey: key,
|
|
122
|
+
outOfYearRange,
|
|
123
|
+
});
|
|
124
124
|
const isPreSelect = !preSelectArticle &&
|
|
125
125
|
preSelect.category === selectKey &&
|
|
126
126
|
preSelect.lessonKey === key;
|
|
127
|
-
return (<common_1.RectangleCard key={`unit-${key}`} title={title} titleLines={1} left={<SubCategoryLeft_1.default rate={(0, tagFncD_1.getCategoryRate)(subTags)} isLocked={isLocked}/>} bottom={<Tag5s_1.default tags={subTags}/>} onPress={() => handleSubCategory(i)} borderColor={isPreSelect ? "ltRed" : undefined} outerStyle={styles.cardSpacing} onLongPress={() => handleLongPress(i)}/>);
|
|
127
|
+
return (<common_1.RectangleCard key={`unit-${key}`} title={title} titleLines={1} left={<SubCategoryLeft_1.default rate={(0, tagFncD_1.getCategoryRate)(subTags)} isLocked={isLocked}/>} bottom={<Tag5s_1.default tags={subTags}/>} onPress={() => handleSubCategory(i)} borderColor={isPreSelect ? "ltRed" : undefined} outerStyle={!isJoined && styles.cardSpacing} style={isJoined && styles.joinedCard} onLongPress={() => handleLongPress(i)}/>);
|
|
128
128
|
};
|
|
129
129
|
// articleListに章の定義が無い場合は、従来通りunitカードのみ表示
|
|
130
130
|
if (!articleEntry) {
|
|
@@ -132,24 +132,79 @@ const ArticleCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
132
132
|
{subCategories.map(({ key, title }, i) => renderUnitCard(key, title, i))}
|
|
133
133
|
</react_native_1.View>);
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
const renderArticleRow = (item, isContinued = false) => {
|
|
136
|
+
var _a;
|
|
137
|
+
const articleId = (0, articleListFnc_1.getArticleId)(item.key);
|
|
138
|
+
const articleState = articles[articleId];
|
|
139
|
+
const title = item.titleKey ? t(item.titleKey) : item.title;
|
|
140
|
+
return (<ArticleRow_1.default key={`article-${item.key}`} title={title} kind={item.kind} isContinued={isContinued} isRead={!!(articleState === null || articleState === void 0 ? void 0 : articleState.isRead)} flagColor={(_a = articleState === null || articleState === void 0 ? void 0 : articleState.flag) !== null && _a !== void 0 ? _a : null} borderColor={(preSelectArticle === null || preSelectArticle === void 0 ? void 0 : preSelectArticle.articleId) === articleId ? "ltRed" : undefined} onPress={() => handleArticle(articleId, title)} onToggleFlag={() => handleToggleFlag(articleId)}/>);
|
|
141
|
+
};
|
|
142
|
+
// すぐ後ろの単元に紐づくレッスンを溜めておき、単元カードと1つにつなげて出す
|
|
143
|
+
const rows = [];
|
|
144
|
+
let lessons = [];
|
|
145
|
+
const flushLessons = () => {
|
|
146
|
+
lessons.forEach((lesson, j) => rows.push(renderArticleRow(lesson, j > 0)));
|
|
147
|
+
lessons = [];
|
|
148
|
+
};
|
|
149
|
+
articleEntry.items.forEach((item, n) => {
|
|
150
|
+
if (item.type === "article" && item.kind === "lesson") {
|
|
151
|
+
lessons.push(item);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (item.type === "unit") {
|
|
143
155
|
const i = subCategories.findIndex((s) => s.key === item.key);
|
|
144
|
-
if (i === -1)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
156
|
+
if (i === -1) {
|
|
157
|
+
flushLessons();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (lessons.length === 0) {
|
|
161
|
+
rows.push(renderUnitCard(subCategories[i].key, subCategories[i].title, i));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
rows.push(<react_native_1.View key={`pair-${item.key}`} style={styles.cardSpacing}>
|
|
165
|
+
{lessons.map((lesson, j) => renderArticleRow(lesson, j > 0))}
|
|
166
|
+
{renderUnitCard(subCategories[i].key, subCategories[i].title, i, true)}
|
|
167
|
+
</react_native_1.View>);
|
|
168
|
+
lessons = [];
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// 後ろに単元が来なかったレッスンは、単独の行として出す
|
|
172
|
+
flushLessons();
|
|
173
|
+
if (item.type === "heading") {
|
|
174
|
+
rows.push(<react_native_1.View key={`heading-${n}`} style={styles.heading}>
|
|
175
|
+
<react_native_1.View style={styles.headingBar}/>
|
|
176
|
+
<common_1.MyText fsize="sm" weight={700} color="text">
|
|
177
|
+
{item.title}
|
|
178
|
+
</common_1.MyText>
|
|
179
|
+
</react_native_1.View>);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
rows.push(renderArticleRow(item));
|
|
183
|
+
});
|
|
184
|
+
flushLessons();
|
|
185
|
+
return <react_native_1.View style={{ flex: 1 }}>{rows}</react_native_1.View>;
|
|
149
186
|
};
|
|
150
187
|
const styles = react_native_1.StyleSheet.create({
|
|
151
188
|
cardSpacing: {
|
|
152
189
|
marginBottom: 20,
|
|
153
190
|
},
|
|
191
|
+
joinedCard: {
|
|
192
|
+
borderTopLeftRadius: 0,
|
|
193
|
+
borderTopRightRadius: 0,
|
|
194
|
+
},
|
|
195
|
+
heading: {
|
|
196
|
+
flexDirection: "row",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
// 前のグループ(まとめ)との切れ目。下の余白16と合わせて30
|
|
199
|
+
marginTop: 14,
|
|
200
|
+
marginBottom: 10,
|
|
201
|
+
},
|
|
202
|
+
headingBar: {
|
|
203
|
+
width: 4,
|
|
204
|
+
height: 16,
|
|
205
|
+
borderRadius: 2,
|
|
206
|
+
marginRight: 8,
|
|
207
|
+
backgroundColor: lib_1.colors.red,
|
|
208
|
+
},
|
|
154
209
|
});
|
|
155
210
|
exports.default = ArticleCategoryList;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ArticleContent } from "@nakamura-123/types";
|
|
3
3
|
interface ArticleContentViewProps {
|
|
4
4
|
content: ArticleContent;
|
|
5
|
+
articleId: string;
|
|
5
6
|
}
|
|
6
7
|
declare const ArticleContentView: React.FC<ArticleContentViewProps>;
|
|
7
8
|
export default ArticleContentView;
|
|
@@ -30,8 +30,10 @@ const lib_1 = require("@nakamura-123/lib");
|
|
|
30
30
|
const common_1 = require("@nakamura-123/common");
|
|
31
31
|
const articleContentFnc_1 = require("../../functions/articleContentFnc");
|
|
32
32
|
const isJudgmentBlock = (block) => (block === null || block === void 0 ? void 0 : block.type) === "incorrect" || (block === null || block === void 0 ? void 0 : block.type) === "correct";
|
|
33
|
-
const ArticleContentView = ({ content }) => {
|
|
33
|
+
const ArticleContentView = ({ content, articleId, }) => {
|
|
34
34
|
let exampleCount = 0;
|
|
35
|
+
// 例文の絵。keyは「説明のkey-例文の番号」("2-1")。絵の無い例文・アプリは絵なしの形で出す
|
|
36
|
+
const exImgs = (0, react_redux_1.useSelector)((state) => state.app.imgs.exImgs);
|
|
35
37
|
const userFsize = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fsize);
|
|
36
38
|
const userFWeight = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fWeight);
|
|
37
39
|
return (<react_native_1.View style={styles.container}>
|
|
@@ -57,12 +59,15 @@ const ArticleContentView = ({ content }) => {
|
|
|
57
59
|
? "top"
|
|
58
60
|
: "only";
|
|
59
61
|
}
|
|
60
|
-
return (<ArticleBlockView key={index} block={block} exampleNumber={exampleCount}
|
|
62
|
+
return (<ArticleBlockView key={index} block={block} exampleNumber={exampleCount} exampleImg={block.type === "example"
|
|
63
|
+
? exImgs === null || exImgs === void 0 ? void 0 : exImgs[`${articleId}-${exampleCount}`]
|
|
64
|
+
: undefined} groupPosition={groupPosition} userFsize={userFsize} userFWeight={userFWeight}/>);
|
|
61
65
|
})}
|
|
62
66
|
</react_native_1.View>
|
|
63
67
|
</react_native_1.View>);
|
|
64
68
|
};
|
|
65
|
-
const ArticleBlockView = ({ block, exampleNumber, groupPosition, userFsize, userFWeight, }) => {
|
|
69
|
+
const ArticleBlockView = ({ block, exampleNumber, exampleImg, groupPosition, userFsize, userFWeight, }) => {
|
|
70
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
66
71
|
const [isRevealed, setIsRevealed] = (0, react_1.useState)(false);
|
|
67
72
|
switch (block.type) {
|
|
68
73
|
case "heading":
|
|
@@ -88,12 +93,21 @@ const ArticleBlockView = ({ block, exampleNumber, groupPosition, userFsize, user
|
|
|
88
93
|
return (<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={styles.paragraph}>
|
|
89
94
|
{block.text}
|
|
90
95
|
</common_1.MyText>);
|
|
91
|
-
case "example":
|
|
96
|
+
case "example": {
|
|
97
|
+
const exampleLabel = (<common_1.MyText fsize="sm" weight={700} color="green">
|
|
98
|
+
{String(exampleNumber).padStart(2, "0")}
|
|
99
|
+
</common_1.MyText>);
|
|
92
100
|
return (<react_native_1.View style={styles.exampleBox}>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
{/* 絵があるときは16:9で上に置き、番号を絵の左上に重ねる(番号だけの行を作らず高さを抑える) */}
|
|
102
|
+
{exampleImg !== undefined && (<react_native_1.View style={styles.exampleImgWrap}>
|
|
103
|
+
<react_native_1.Image source={exampleImg} resizeMode="cover" style={styles.exampleImg}/>
|
|
104
|
+
<react_native_1.View style={styles.exampleImgLabel}>{exampleLabel}</react_native_1.View>
|
|
105
|
+
</react_native_1.View>)}
|
|
106
|
+
<react_native_1.View style={[
|
|
107
|
+
styles.exampleTop,
|
|
108
|
+
exampleImg !== undefined && styles.exampleTopWithImg,
|
|
109
|
+
]}>
|
|
110
|
+
{exampleImg === undefined && exampleLabel}
|
|
97
111
|
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={styles.exampleText}>
|
|
98
112
|
{block.japanese}
|
|
99
113
|
</common_1.MyText>
|
|
@@ -106,11 +120,12 @@ const ArticleBlockView = ({ block, exampleNumber, groupPosition, userFsize, user
|
|
|
106
120
|
{!isRevealed && (<react_native_1.View style={styles.exampleBottomOverlay}>
|
|
107
121
|
<common_1.Icon5 name="eye" size={14} color="ltBlack" style={styles.exampleBottomIcon}/>
|
|
108
122
|
<common_1.MyText fsize="xs" color="ltBlack">
|
|
109
|
-
|
|
123
|
+
{t("article.tapToShowTrans")}
|
|
110
124
|
</common_1.MyText>
|
|
111
125
|
</react_native_1.View>)}
|
|
112
126
|
</react_native_1.TouchableOpacity>)}
|
|
113
127
|
</react_native_1.View>);
|
|
128
|
+
}
|
|
114
129
|
case "incorrect":
|
|
115
130
|
case "correct": {
|
|
116
131
|
const position = groupPosition !== null && groupPosition !== void 0 ? groupPosition : "only";
|
|
@@ -192,6 +207,26 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
192
207
|
padding: 12,
|
|
193
208
|
paddingTop: 3,
|
|
194
209
|
},
|
|
210
|
+
exampleTopWithImg: {
|
|
211
|
+
paddingTop: 8,
|
|
212
|
+
},
|
|
213
|
+
// Imageに直接width:"100%"とaspectRatioを付けると、絵の元の大きさで出てしまう。枠のViewで16:9を取り、絵はそこに敷く
|
|
214
|
+
exampleImgWrap: {
|
|
215
|
+
width: "100%",
|
|
216
|
+
aspectRatio: 16 / 9,
|
|
217
|
+
},
|
|
218
|
+
exampleImg: {
|
|
219
|
+
width: "100%",
|
|
220
|
+
height: "100%",
|
|
221
|
+
},
|
|
222
|
+
exampleImgLabel: {
|
|
223
|
+
position: "absolute",
|
|
224
|
+
left: 10,
|
|
225
|
+
top: 8,
|
|
226
|
+
paddingHorizontal: 8,
|
|
227
|
+
borderRadius: 8,
|
|
228
|
+
backgroundColor: lib_1.colors.bkBeige,
|
|
229
|
+
},
|
|
195
230
|
exampleText: {
|
|
196
231
|
marginTop: 4,
|
|
197
232
|
},
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ColorKeys } from "@nakamura-123/lib";
|
|
3
3
|
import { Store } from "@nakamura-123/types";
|
|
4
|
-
export type
|
|
4
|
+
export type ArticleRowKind = "lesson" | "summary";
|
|
5
5
|
interface ArticleRowProps {
|
|
6
6
|
title: string;
|
|
7
|
-
|
|
7
|
+
kind: ArticleRowKind;
|
|
8
|
+
isContinued?: boolean;
|
|
8
9
|
isRead: boolean;
|
|
9
10
|
flagColor: Store.ArticleFlagColor | null;
|
|
10
11
|
borderColor?: ColorKeys;
|
|
@@ -11,19 +11,29 @@ const FLAG_ICON_COLOR = {
|
|
|
11
11
|
none: "ltBlack",
|
|
12
12
|
yellow: "yellow",
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const KIND_STYLE = {
|
|
15
|
+
// 下の行・カードと枠線を1本に重ねる。角は1つ目の行の上だけ丸める(ArticleCategoryListが組で並べる)
|
|
16
|
+
lesson: {
|
|
17
|
+
height: 44,
|
|
18
|
+
marginBottom: -1,
|
|
19
|
+
borderBottomLeftRadius: 0,
|
|
20
|
+
borderBottomRightRadius: 0,
|
|
21
|
+
},
|
|
22
|
+
summary: { height: 52, marginBottom: 16 },
|
|
17
23
|
};
|
|
18
|
-
const ArticleRow = ({ title,
|
|
24
|
+
const ArticleRow = ({ title, kind, isContinued, isRead, flagColor, borderColor, onPress, onToggleFlag, }) => {
|
|
25
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
19
26
|
return (<common_1.PressAnimatedWrap onPress={onPress} style={[
|
|
20
27
|
styles.rectangle,
|
|
21
|
-
|
|
28
|
+
KIND_STYLE[kind],
|
|
29
|
+
isContinued && styles.continued,
|
|
22
30
|
borderColor && { borderColor: lib_1.colors[borderColor], borderWidth: 2 },
|
|
23
31
|
]}>
|
|
32
|
+
{!isRead && (<react_native_1.View style={styles.ribbon} pointerEvents="none">
|
|
33
|
+
<react_native_1.Text style={styles.ribbonText}>{t("article.unread")}</react_native_1.Text>
|
|
34
|
+
</react_native_1.View>)}
|
|
24
35
|
<react_native_1.View style={styles.leftIconWrap}>
|
|
25
|
-
<common_1.Icon5 name="file-alt" size={
|
|
26
|
-
{!isRead && <react_native_1.View style={styles.unreadDot}/>}
|
|
36
|
+
<common_1.Icon5 name="file-alt" size={18} color="darkGray"/>
|
|
27
37
|
</react_native_1.View>
|
|
28
38
|
<common_1.MyText fsize="sm" color="text" style={styles.title}>
|
|
29
39
|
{title}
|
|
@@ -36,26 +46,42 @@ const ArticleRow = ({ title, size, isRead, flagColor, borderColor, onPress, onTo
|
|
|
36
46
|
};
|
|
37
47
|
const styles = react_native_1.StyleSheet.create({
|
|
38
48
|
rectangle: {
|
|
49
|
+
overflow: "hidden",
|
|
39
50
|
width: "100%",
|
|
40
51
|
flexDirection: "row",
|
|
41
52
|
alignItems: "center",
|
|
42
|
-
|
|
53
|
+
// 左は未読の帯の分あけておく(既読でも位置がそろうように常にあける)
|
|
54
|
+
paddingLeft: 30,
|
|
55
|
+
paddingRight: 15,
|
|
43
56
|
borderWidth: 1,
|
|
44
57
|
borderRadius: 12,
|
|
45
58
|
backgroundColor: lib_1.colors.bkBeige,
|
|
46
59
|
borderColor: lib_1.colors.ltBlack,
|
|
47
60
|
},
|
|
61
|
+
continued: {
|
|
62
|
+
borderTopLeftRadius: 0,
|
|
63
|
+
borderTopRightRadius: 0,
|
|
64
|
+
},
|
|
48
65
|
leftIconWrap: {
|
|
49
|
-
marginRight:
|
|
66
|
+
marginRight: 8,
|
|
50
67
|
},
|
|
51
|
-
|
|
68
|
+
// 未読:左上の角に斜めの帯。行の高さが変わっても角に収まるよう上からの位置で決める。
|
|
69
|
+
// アイコンから8pt以上離れる位置
|
|
70
|
+
ribbon: {
|
|
52
71
|
position: "absolute",
|
|
53
|
-
top:
|
|
54
|
-
|
|
55
|
-
width:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
backgroundColor: lib_1.colors.
|
|
72
|
+
top: 4,
|
|
73
|
+
left: -22,
|
|
74
|
+
width: 64,
|
|
75
|
+
paddingVertical: 1,
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
backgroundColor: lib_1.colors.red,
|
|
78
|
+
transform: [{ rotate: "-45deg" }],
|
|
79
|
+
},
|
|
80
|
+
ribbonText: {
|
|
81
|
+
color: lib_1.colors.white,
|
|
82
|
+
fontSize: 10,
|
|
83
|
+
fontWeight: "700",
|
|
84
|
+
letterSpacing: 0.5,
|
|
59
85
|
},
|
|
60
86
|
title: {
|
|
61
87
|
flex: 1,
|
|
@@ -8,17 +8,19 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const react_native_1 = require("react-native");
|
|
9
9
|
const react_redux_1 = require("react-redux");
|
|
10
10
|
const basicHook_1 = require("../../hooks/basicHook");
|
|
11
|
-
const tagFncJ_1 = require("../../functions/tagFncJ");
|
|
12
11
|
const tagFncD_1 = require("../../functions/tagFncD");
|
|
13
12
|
const BasicProgressBar = ({ subject, index }) => {
|
|
14
13
|
const selectKey = (0, react_redux_1.useSelector)((state) => state.app[subject.list][index].key);
|
|
15
14
|
const outOfYearRangeStore = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.outOfYearRange);
|
|
16
15
|
const outOfYearRange = subject.type === "unit" ? outOfYearRangeStore : undefined;
|
|
17
16
|
// Realm データベースクエリ
|
|
18
|
-
const
|
|
19
|
-
const getCategoryTags =
|
|
20
|
-
|
|
21
|
-
:
|
|
17
|
+
const { ops, query } = (0, basicHook_1.useEngineQuery)();
|
|
18
|
+
const getCategoryTags = ops.categoryTagLevels(query, {
|
|
19
|
+
subjectType: subject.type,
|
|
20
|
+
tag: subject.tag,
|
|
21
|
+
key: selectKey,
|
|
22
|
+
outOfYearRange,
|
|
23
|
+
});
|
|
22
24
|
const rate = Math.round((0, tagFncD_1.getCategoryRate)(getCategoryTags));
|
|
23
25
|
const progressColor = rate > 85 ? "red" : rate > 70 ? "green" : rate > 50 ? "yellow" : "blue";
|
|
24
26
|
return (<react_native_1.View style={styles.container}>
|
|
@@ -34,11 +34,10 @@ const react_redux_1 = require("react-redux");
|
|
|
34
34
|
const db_1 = require("@nakamura-123/db");
|
|
35
35
|
const stores_1 = require("@nakamura-123/stores");
|
|
36
36
|
const testFnc_1 = require("../../functions/testFnc");
|
|
37
|
-
const createQuizFncD_1 = require("../../functions/createQuizFncD");
|
|
38
37
|
const Paw5s_1 = __importDefault(require("./Paw5s"));
|
|
39
38
|
const basicHook_1 = require("../../hooks/basicHook");
|
|
40
|
-
const createQuizFncJ_1 = require("../../functions/createQuizFncJ");
|
|
41
39
|
const TestComponent = ({ navigation, subject, index, }) => {
|
|
40
|
+
var _a;
|
|
42
41
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
43
42
|
const { t } = (0, common_1.useDrillTranslation)();
|
|
44
43
|
// topTabsのラベルを取得
|
|
@@ -46,11 +45,13 @@ const TestComponent = ({ navigation, subject, index, }) => {
|
|
|
46
45
|
const selectedCategory = categoryList[index];
|
|
47
46
|
const selectKey = selectedCategory.key;
|
|
48
47
|
const quizCnt = selectedCategory.miniTestCnt;
|
|
48
|
+
// ミニテストだけ別の形式で出す科目がある(文法:レッスンは意味を取る問題、ミニテストは穴埋め)
|
|
49
|
+
const miniTestTag = subject.type === "unit" ? (_a = subject.miniTestTag) !== null && _a !== void 0 ? _a : subject.tag : subject.tag;
|
|
49
50
|
const testTitle = selectedCategory.title + t("basic.miniTest");
|
|
50
51
|
const testDB = (0, react_2.useQuery)(db_1.MiniTestSchema);
|
|
51
52
|
const outOfYearRange = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.outOfYearRange);
|
|
52
53
|
// const QuestionDB = useQuery(DQuestionSchema);
|
|
53
|
-
const
|
|
54
|
+
const { ops, query } = (0, basicHook_1.useEngineQuery)();
|
|
54
55
|
const levels = (0, react_1.useMemo)(() => {
|
|
55
56
|
return (0, testFnc_1.getMiniTestLevelCnts)(testDB, subject.name, selectKey);
|
|
56
57
|
}, [subject.name, selectKey]);
|
|
@@ -68,24 +69,29 @@ const TestComponent = ({ navigation, subject, index, }) => {
|
|
|
68
69
|
subject: subject.name,
|
|
69
70
|
type: "miniTest",
|
|
70
71
|
category: selectKey,
|
|
71
|
-
tagName:
|
|
72
|
+
tagName: miniTestTag,
|
|
72
73
|
system: subject.system,
|
|
73
74
|
lesson: { title: testTitle, key: quizCnt },
|
|
74
75
|
},
|
|
75
76
|
});
|
|
76
77
|
dispatch({ type: "quiz/resetCurrentInfo" });
|
|
77
78
|
// クイズ作成
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
:
|
|
79
|
+
const quizList = ops.miniTestQuestions(query, {
|
|
80
|
+
subjectType: subject.type,
|
|
81
|
+
tag: miniTestTag,
|
|
82
|
+
key: selectKey,
|
|
83
|
+
cnt: quizCnt,
|
|
84
|
+
outOfYearRange,
|
|
85
|
+
});
|
|
82
86
|
dispatch(stores_1.saveStorage.deleteQuizInStorage(subject.name));
|
|
83
87
|
dispatch({ type: "quiz/setQuizList", payload: quizList });
|
|
84
88
|
navigation.navigate("Quiz");
|
|
85
89
|
};
|
|
86
90
|
// カードに表示する問題数
|
|
87
91
|
const ONEYEAR_TEST_NUMBER = 901;
|
|
88
|
-
const displayQuizCnt = quizCnt === ONEYEAR_TEST_NUMBER
|
|
92
|
+
const displayQuizCnt = quizCnt === ONEYEAR_TEST_NUMBER
|
|
93
|
+
? t("count.oneSet")
|
|
94
|
+
: t("count.questions", { cnt: quizCnt });
|
|
89
95
|
return (<react_native_1.View style={{ marginBottom: 40 }}>
|
|
90
96
|
<common_1.RectangleCard title={testTitle} left={<common_1.IconInCircle name={icon} size={25}/>} bottom={<Paw5s_1.default levels={levels} quizCnt={displayQuizCnt}/>} onPress={() => handleStart()} color="red"/>
|
|
91
97
|
</react_native_1.View>);
|
|
@@ -10,12 +10,13 @@ const testFnc_1 = require("../../functions/testFnc");
|
|
|
10
10
|
const Paw5s = ({ levels, quizCnt }) => {
|
|
11
11
|
// Empty function body
|
|
12
12
|
const levelInfos = (0, testFnc_1.countByLevel)(levels);
|
|
13
|
+
const pawIcon = (0, common_1.usePawIcon)();
|
|
13
14
|
return (<react_native_1.View style={styles.container}>
|
|
14
15
|
<react_native_1.View>
|
|
15
16
|
<common_1.MyText style={styles.cntTxt}>{quizCnt}</common_1.MyText>
|
|
16
17
|
</react_native_1.View>
|
|
17
18
|
{levelInfos.map(({ cnt, color }, i) => (<react_native_1.View key={i} style={styles.tag}>
|
|
18
|
-
<common_1.IconInCircle name=
|
|
19
|
+
<common_1.IconInCircle name={pawIcon} size={10} iconColor={color} circleColor="darkGray" cStyle={styles.icon}/>
|
|
19
20
|
<common_1.MyText style={styles.tagTxt}>{cnt}</common_1.MyText>
|
|
20
21
|
</react_native_1.View>))}
|
|
21
22
|
</react_native_1.View>);
|
|
@@ -11,11 +11,9 @@ const stores_1 = require("@nakamura-123/stores");
|
|
|
11
11
|
const SubCategoryLeft_1 = __importDefault(require("./SubCategoryLeft"));
|
|
12
12
|
const tagFncD_1 = require("../../functions/tagFncD");
|
|
13
13
|
const Tag5s_1 = __importDefault(require("../Tag5s"));
|
|
14
|
-
const createQuizFncD_1 = require("../../functions/createQuizFncD");
|
|
15
14
|
const quizActionHook_1 = require("../../hooks/quizActionHook");
|
|
16
15
|
const basicHook_1 = require("../../hooks/basicHook");
|
|
17
|
-
const
|
|
18
|
-
const tagFncJ_1 = require("../../functions/tagFncJ");
|
|
16
|
+
const resultHook_1 = require("../../hooks/resultHook");
|
|
19
17
|
const SubCategoryList = ({ navigation, topSubject, index, }) => {
|
|
20
18
|
var _a;
|
|
21
19
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
@@ -30,8 +28,9 @@ const SubCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
30
28
|
const selectKey = selectedList.key;
|
|
31
29
|
const subCategories = (_a = selectedList.sub) !== null && _a !== void 0 ? _a : [];
|
|
32
30
|
// const QuestionDB = useQuery(DQuestionSchema);
|
|
33
|
-
const
|
|
31
|
+
const { ops, query } = (0, basicHook_1.useEngineQuery)();
|
|
34
32
|
const useStartQuiz = (0, quizActionHook_1.useStartQuizAction)();
|
|
33
|
+
const makeNext = (0, resultHook_1.useMakeNext)();
|
|
35
34
|
const getLessonTitle = (index) => {
|
|
36
35
|
if (topSubject.type === "unit")
|
|
37
36
|
return `${selectedList.label} ${subCategories[index].title}`;
|
|
@@ -49,6 +48,8 @@ const SubCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
49
48
|
system: topSubject.system,
|
|
50
49
|
category: selectKey,
|
|
51
50
|
lesson,
|
|
51
|
+
// 結果画面の「次へ」:この一覧(単元表・年度の表)で同じ章の次の小分類
|
|
52
|
+
next: makeNext("list", topSubject.type, selectKey, lesson.key),
|
|
52
53
|
};
|
|
53
54
|
dispatch(stores_1.quizAction.setLesson(selected));
|
|
54
55
|
return selected;
|
|
@@ -71,10 +72,7 @@ const SubCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
71
72
|
const selected = handleSetLesson(index);
|
|
72
73
|
if (!selected)
|
|
73
74
|
return;
|
|
74
|
-
const
|
|
75
|
-
const quizList = system === "JLPT"
|
|
76
|
-
? (0, createQuizFncJ_1.getBasicQuizListJ)(query, startCfg, selected)
|
|
77
|
-
: (0, createQuizFncD_1.getBasicQuizList)(query, startCfg, selected);
|
|
75
|
+
const quizList = ops.basicQuizList(query, startCfg, selected);
|
|
78
76
|
dispatch(stores_1.setAction.saveBasicPreSelect({
|
|
79
77
|
subject: topSubject.name,
|
|
80
78
|
category: selectKey,
|
|
@@ -87,18 +85,15 @@ const SubCategoryList = ({ navigation, topSubject, index, }) => {
|
|
|
87
85
|
return;
|
|
88
86
|
navigation.navigate("Quiz");
|
|
89
87
|
};
|
|
90
|
-
// # タグを取得する関数を選ぶ
|
|
91
|
-
const getTagFunctions = {
|
|
92
|
-
unit: tagFncD_1.getUnitSubTagLevelCnts,
|
|
93
|
-
year: tagFncD_1.getYearSubTagLevelCnts,
|
|
94
|
-
};
|
|
95
|
-
const getTagFnc = getTagFunctions[topSubject.type];
|
|
96
88
|
return (<react_native_1.View style={{ flex: 1 }}>
|
|
97
89
|
{subCategories.map(({ key, title }, i) => {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
:
|
|
90
|
+
const subTags = ops.subCategoryTagLevels(query, {
|
|
91
|
+
subjectType: topSubject.type,
|
|
92
|
+
tag: topSubject.tag,
|
|
93
|
+
key: selectKey,
|
|
94
|
+
subKey: key,
|
|
95
|
+
outOfYearRange,
|
|
96
|
+
});
|
|
102
97
|
const isPreSelect = !preSelectArticle &&
|
|
103
98
|
preSelect.category === selectKey &&
|
|
104
99
|
preSelect.lessonKey === key;
|
|
@@ -17,7 +17,7 @@ const CoinFnc_1 = require("./CoinFnc");
|
|
|
17
17
|
const stores_1 = require("@nakamura-123/stores");
|
|
18
18
|
// 00.メイン関数
|
|
19
19
|
exports.coinCheckFnc = (0, toolkit_1.createAsyncThunk)("coin/check", (allFreeId_1, _a) => __awaiter(void 0, [allFreeId_1, _a], void 0, function* (allFreeId, { dispatch }) {
|
|
20
|
-
const receipts = yield (0, CoinFnc_1.restorePurchases)(dispatch
|
|
20
|
+
const receipts = yield (0, CoinFnc_1.restorePurchases)(dispatch);
|
|
21
21
|
// null=取得失敗(通信・StoreKitエラー)。未購入と区別し、状態を変えない。
|
|
22
22
|
// ここで降格すると、課金者が通信不良だけで購入を失った上に
|
|
23
23
|
// useIsLockedの再レンダーでクラッシュしていた(2026-09-26)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Purchase, Product } from "expo-iap";
|
|
2
2
|
import { Storage } from "@nakamura-123/types";
|
|
3
3
|
export declare const initializeIAP: (paymentItems: string[] | undefined, setProducts?: (products: Product[]) => void, setLoading?: (loading: boolean) => void) => Promise<void>;
|
|
4
|
-
export declare const handlePurchase: (productId: string) => Promise<Purchase | null>;
|
|
5
|
-
export declare const restorePurchases: (dispatch: (action: any) => void,
|
|
4
|
+
export declare const handlePurchase: (productId: string, t: (key: string) => string) => Promise<Purchase | null>;
|
|
5
|
+
export declare const restorePurchases: (dispatch: (action: any) => void, t?: (key: string) => string) => Promise<Storage.Receipt[] | null>;
|
|
6
6
|
export declare const updateAllFreeState: (receipt: Storage.Receipt | null) => (dispatch: any, getState: any) => void;
|
|
7
7
|
export declare const getAndroidPurchaseState: (purchase: Purchase) => "paid" | "canceled" | "wait";
|