@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.
Files changed (115) hide show
  1. package/dist/component/Article/ArticleCategoryList.js +88 -33
  2. package/dist/component/Article/ArticleContentView.d.ts +1 -0
  3. package/dist/component/Article/ArticleContentView.js +44 -9
  4. package/dist/component/Article/ArticleRow.d.ts +3 -2
  5. package/dist/component/Article/ArticleRow.js +42 -16
  6. package/dist/component/Basic/BasicProgressBar.js +7 -5
  7. package/dist/component/Basic/MiniTestCard.js +15 -9
  8. package/dist/component/Basic/Paw5s.js +2 -1
  9. package/dist/component/Basic/SubCategoryList.js +13 -18
  10. package/dist/component/Coin/CoinCheck.js +1 -1
  11. package/dist/component/Coin/CoinFnc.d.ts +2 -2
  12. package/dist/component/Coin/CoinFnc.js +13 -11
  13. package/dist/component/Coin/WaitingPayBanner.js +2 -3
  14. package/dist/component/Grade/GAllTags.d.ts +3 -0
  15. package/dist/component/Grade/GAllTags.js +45 -0
  16. package/dist/component/Grade/GradeCard/ChangeWeeklyModal.js +7 -3
  17. package/dist/component/Grade/GradeCard/DatePickerModal.js +2 -1
  18. package/dist/component/Grade/GradeCard/Square3sGrade.js +1 -1
  19. package/dist/component/Grade/GradeCard/TargetDate.js +1 -1
  20. package/dist/component/Grade/QuizCntGraph.js +2 -1
  21. package/dist/component/Grade/Square4s.js +4 -4
  22. package/dist/component/Grade/UnitCircles.d.ts +4 -2
  23. package/dist/component/Grade/UnitCircles.js +6 -5
  24. package/dist/component/Grade/YearCircles.d.ts +4 -2
  25. package/dist/component/Grade/YearCircles.js +7 -5
  26. package/dist/component/KeyboardCloseBar.js +2 -1
  27. package/dist/component/QuizSet/QuizOptionDrill.js +3 -14
  28. package/dist/component/Result/QuizFlatList.js +159 -56
  29. package/dist/component/Result/ResultActions.d.ts +7 -0
  30. package/dist/component/Result/ResultActions.js +107 -0
  31. package/dist/component/Result/ResultHero.d.ts +7 -0
  32. package/dist/component/Result/ResultHero.js +166 -0
  33. package/dist/component/SettingBtns/LanguageModal.d.ts +9 -0
  34. package/dist/component/SettingBtns/LanguageModal.js +103 -0
  35. package/dist/component/SettingBtns/TransBtn.js +7 -84
  36. package/dist/component/Tag5s.js +2 -2
  37. package/dist/component/TagBadge5s.js +7 -5
  38. package/dist/component/TestPage/BarChartContainer.js +2 -1
  39. package/dist/component/TestPage/Square3s.js +3 -2
  40. package/dist/engine/components.d.ts +19 -0
  41. package/dist/engine/components.js +19 -0
  42. package/dist/engine/drill.d.ts +3 -0
  43. package/dist/engine/drill.js +24 -0
  44. package/dist/engine/grammar.d.ts +3 -0
  45. package/dist/engine/grammar.js +22 -0
  46. package/dist/engine/index.d.ts +5 -0
  47. package/dist/engine/index.js +17 -0
  48. package/dist/engine/tango.d.ts +3 -0
  49. package/dist/engine/tango.js +28 -0
  50. package/dist/engine/types.d.ts +46 -0
  51. package/dist/engine/types.js +2 -0
  52. package/dist/functions/createQuizFncG.d.ts +12 -0
  53. package/dist/functions/createQuizFncG.js +40 -0
  54. package/dist/functions/nextItemFnc.d.ts +12 -0
  55. package/dist/functions/nextItemFnc.js +56 -0
  56. package/dist/functions/questionFormatG.d.ts +7 -0
  57. package/dist/functions/questionFormatG.js +31 -0
  58. package/dist/functions/tagFncG.d.ts +5 -0
  59. package/dist/functions/tagFncG.js +24 -0
  60. package/dist/functions/tagFncJ.d.ts +2 -2
  61. package/dist/functions/tagFncJ.js +1 -1
  62. package/dist/hooks/BadgeHook.d.ts +1 -1
  63. package/dist/hooks/BadgeHook.js +3 -3
  64. package/dist/hooks/ExitQuizHook.js +9 -7
  65. package/dist/hooks/basicHook.d.ts +9 -1
  66. package/dist/hooks/basicHook.js +17 -8
  67. package/dist/hooks/quizActionHook.d.ts +3 -1
  68. package/dist/hooks/quizActionHook.js +33 -1
  69. package/dist/hooks/quizHook.d.ts +6 -2
  70. package/dist/hooks/quizHook.js +39 -4
  71. package/dist/hooks/resultHook.d.ts +9 -0
  72. package/dist/hooks/resultHook.js +74 -0
  73. package/dist/page/ArticleDetail.js +25 -12
  74. package/dist/page/CoinPage.js +2 -2
  75. package/dist/page/FAQPage.js +4 -3
  76. package/dist/page/GetBadgePage.js +5 -4
  77. package/dist/page/GradePage.js +6 -9
  78. package/dist/page/HistoryPage.js +7 -4
  79. package/dist/page/HomePage.js +7 -3
  80. package/dist/page/QuizPage.js +4 -4
  81. package/dist/page/QuizSettingPage.js +3 -6
  82. package/dist/page/QuizSetupPage.js +6 -14
  83. package/dist/page/ReportPage.js +1 -1
  84. package/dist/page/ResultPage.js +6 -24
  85. package/dist/page/SettingPage.js +36 -3
  86. package/dist/page/TestPage.js +7 -14
  87. package/dist/quiz/Title.js +5 -2
  88. package/dist/quiz/check/Check.js +11 -7
  89. package/dist/quiz/check/NextQuizBtn.js +3 -2
  90. package/dist/quiz/check/SelectTag.js +7 -0
  91. package/dist/quiz/common/MyTextqqyy.d.ts +1 -0
  92. package/dist/quiz/common/MyTextqqyy.js +2 -2
  93. package/dist/quiz/common/RenderImgOrText.d.ts +2 -0
  94. package/dist/quiz/common/RenderImgOrText.js +2 -2
  95. package/dist/quiz/common/RubyText.d.ts +3 -1
  96. package/dist/quiz/common/RubyText.js +20 -5
  97. package/dist/quiz/grammar/GAnswer.d.ts +8 -0
  98. package/dist/quiz/grammar/GAnswer.js +115 -0
  99. package/dist/quiz/grammar/GGuideBtn.d.ts +8 -0
  100. package/dist/quiz/grammar/GGuideBtn.js +43 -0
  101. package/dist/quiz/grammar/GQuestion.d.ts +8 -0
  102. package/dist/quiz/grammar/GQuestion.js +109 -0
  103. package/dist/quiz/grammar/QuizContentsGrammar.d.ts +10 -0
  104. package/dist/quiz/grammar/QuizContentsGrammar.js +31 -0
  105. package/dist/quiz/jAnswer/JAnswerContents.js +12 -5
  106. package/dist/quiz/jQuestion/JQuestionBottomText.d.ts +2 -1
  107. package/dist/quiz/jQuestion/JQuestionBottomText.js +3 -1
  108. package/dist/quiz/save/QuizSaveData.js +1 -1
  109. package/dist/quiz/setting/Above3BtnJ.js +5 -4
  110. package/dist/quiz/setting/Bottom3Btn.js +5 -4
  111. package/dist/quiz/setting/GuideBtn.js +3 -2
  112. package/dist/quiz/setting/RepeatBtn.js +2 -1
  113. package/dist/tsconfig.tsbuildinfo +1 -1
  114. package/dist/types/filterType.d.ts +2 -1
  115. package/package.json +23 -3
@@ -59,7 +59,7 @@ const initializeIAP = (paymentItems, setProducts, setLoading) => __awaiter(void
59
59
  });
60
60
  exports.initializeIAP = initializeIAP;
61
61
  // 11. 購入処理
62
- const handlePurchase = (productId) => __awaiter(void 0, void 0, void 0, function* () {
62
+ const handlePurchase = (productId, t) => __awaiter(void 0, void 0, void 0, function* () {
63
63
  return new Promise((resolve, reject) => {
64
64
  console.log("購入開始: ", productId);
65
65
  // リスナーを設定
@@ -108,11 +108,11 @@ const handlePurchase = (productId) => __awaiter(void 0, void 0, void 0, function
108
108
  // トランザクションの完了
109
109
  if (react_native_1.Platform.OS === "android" &&
110
110
  (0, exports.getAndroidPurchaseState)(purchase) === "wait") {
111
- alert("手続きが完了しました。支払いが完了したら、このページにある「以前購入した方はこちらから復元」をタップしてください。");
111
+ alert(t("coin.alert.waitingAfterPurchase"));
112
112
  }
113
113
  else {
114
114
  yield (0, expo_iap_1.finishTransaction)({ purchase, isConsumable: false });
115
- alert("購入が完了しました!");
115
+ alert(t("coin.alert.purchased"));
116
116
  }
117
117
  return purchase; // 成功時に購入データを返す
118
118
  }))
@@ -131,7 +131,7 @@ const handlePurchase = (productId) => __awaiter(void 0, void 0, void 0, function
131
131
  // pushCoinError({ title: "購入処理中にエラーが発生しました", log:jerr })
132
132
  // );
133
133
  try {
134
- alert("購入処理に失敗しました(通信エラー等の可能性があります)。\nまずは「よくある質問」をご確認いただき、それでも解決しない場合は「お問い合わせフォーム」よりご連絡ください。\n※企業から貸与された端末では、課金機能自体が制限されている可能性があります。詳しくは「よくある質問」をご参照ください。");
134
+ alert(t("coin.alert.purchaseFailed"));
135
135
  }
136
136
  catch (alertError) {
137
137
  console.error("アラート表示エラー(購入失敗時): ", alertError);
@@ -141,7 +141,9 @@ const handlePurchase = (productId) => __awaiter(void 0, void 0, void 0, function
141
141
  });
142
142
  exports.handlePurchase = handlePurchase;
143
143
  // 21. 購入復元
144
- const restorePurchases = (dispatch, isAlert) => __awaiter(void 0, void 0, void 0, function* () {
144
+ const restorePurchases = (dispatch,
145
+ // 渡したときだけ結果を知らせる
146
+ t) => __awaiter(void 0, void 0, void 0, function* () {
145
147
  try {
146
148
  console.log("購入復元開始");
147
149
  // 🔧 修正3: IAP接続を確実にする(多重接続を避けるため、initializeIAPと共有のPromiseを使う)
@@ -230,19 +232,19 @@ const restorePurchases = (dispatch, isAlert) => __awaiter(void 0, void 0, void 0
230
232
  }
231
233
  console.log("購入復元完了: ", receipts.length, "件");
232
234
  // アラート表示(支払い待ち状態を考慮)
233
- if (isAlert) {
235
+ if (t) {
234
236
  try {
235
237
  if (receipts.length === 0) {
236
- alert("購入済みのアイテムがありませんでした");
238
+ alert(t("coin.alert.noItems"));
237
239
  }
238
240
  else {
239
241
  // 支払い待ち状態のアイテムがあるかチェック
240
242
  const hasWaitingPayment = receipts.some((receipt) => receipt && !receipt.isPaid);
241
243
  if (hasWaitingPayment) {
242
- alert("お支払い手続き中です。\n\n支払いが完了したら、このページにある「以前購入した方はこちらから復元」をタップしてください。");
244
+ alert(t("coin.alert.paying"));
243
245
  }
244
246
  else {
245
- alert("購入アイテムを復元しました!");
247
+ alert(t("coin.alert.restored"));
246
248
  }
247
249
  }
248
250
  }
@@ -257,9 +259,9 @@ const restorePurchases = (dispatch, isAlert) => __awaiter(void 0, void 0, void 0
257
259
  console.error("Restore Error: ", error);
258
260
  console.error("エラーの詳細: ", error instanceof Error ? error.message : String(error));
259
261
  // dispatch(pushCoinError({ title: "購入復元に失敗しました", log: error }));
260
- if (isAlert) {
262
+ if (t) {
261
263
  try {
262
- alert("購入アイテムの復元に失敗しました。しばらく時間を置いた後、もう一度実行してみてください。もしそれでも購入できない場合は「よくある質問」をご確認いただくか、必要に応じて「お問い合わせフォーム」からご連絡ください。");
264
+ alert(t("coin.alert.restoreFailed"));
263
265
  }
264
266
  catch (alertError) {
265
267
  console.error("アラート表示エラー(復元失敗時): ", alertError);
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const react_redux_1 = require("react-redux");
8
8
  const common_1 = require("@nakamura-123/common");
9
- const homeMsg = "支払い後にアンロックページで「以前購入した方はこちらから復元」をタップしてください";
10
- const coinMsg = "支払い後に「以前購入した方はこちらから復元」をタップしてください";
11
9
  const WaitingPayBanner = ({ currentPage }) => {
12
- const msg = currentPage === "home" ? homeMsg : coinMsg;
10
+ const { t } = (0, common_1.useDrillTranslation)();
11
+ const msg = t(`coin.banner.${currentPage}`);
13
12
  const allFreeState = (0, react_redux_1.useSelector)((state) => state.setting.payment.allFreeState);
14
13
  if (allFreeState !== "wait")
15
14
  return null;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const GAllTags: React.FC;
3
+ export default GAllTags;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const react_2 = require("@realm/react");
9
+ const react_redux_1 = require("react-redux");
10
+ const db_1 = require("@nakamura-123/db");
11
+ const common_1 = require("@nakamura-123/common");
12
+ const tagFncD_1 = require("../../functions/tagFncD");
13
+ // 文法(G系)の成績画面の全タグ。科目1=意味を取る問題、科目2=穴埋め
14
+ const GAllTags = () => {
15
+ const questions = (0, react_2.useQuery)(db_1.GQuestionSchema);
16
+ const { basic1, basic2 } = (0, react_redux_1.useSelector)((state) => state.app.appSetting.setting.basic);
17
+ const rows = [
18
+ { title: basic1.name, levels: questions.map((q) => q.meaningTag.level) },
19
+ { title: basic2.name, levels: questions.map((q) => q.blankTag.level) },
20
+ ];
21
+ return (<react_native_1.View style={styles.container}>
22
+ {rows.map(({ title, levels }) => (<react_native_1.View key={title}>
23
+ <common_1.MyText>{title}</common_1.MyText>
24
+ <react_native_1.View style={styles.tagBox}>
25
+ {(0, tagFncD_1.countTagsByLevel)(levels).map((tag, i) => (<common_1.Badge key={i} name={String(tag.cnt)} icon={"tag"} circleColor={tag.color} style={styles.badge}/>))}
26
+ </react_native_1.View>
27
+ </react_native_1.View>))}
28
+ </react_native_1.View>);
29
+ };
30
+ const styles = react_native_1.StyleSheet.create({
31
+ container: {
32
+ marginVertical: 10,
33
+ },
34
+ tagBox: {
35
+ flexDirection: "row",
36
+ justifyContent: "space-between",
37
+ width: "100%",
38
+ marginTop: 5,
39
+ },
40
+ badge: {
41
+ borderWidth: 0,
42
+ backgroundColor: "transparent",
43
+ },
44
+ });
45
+ exports.default = GAllTags;
@@ -7,18 +7,22 @@ const react_1 = __importDefault(require("react"));
7
7
  const react_native_1 = require("react-native");
8
8
  const common_1 = require("@nakamura-123/common");
9
9
  const ChangeWeeklyModal = ({ visible, optionInfo, handleChange, selectedValue, onClose, }) => {
10
+ const { t } = (0, common_1.useDrillTranslation)();
10
11
  return (<common_1.BaseModal isVisible={visible} onClose={onClose}>
11
- <common_1.MyText fsize="lg">目標を選んでください</common_1.MyText>
12
+ <common_1.MyText fsize="lg">{t("grade.weekly.title")}</common_1.MyText>
12
13
  <react_native_1.FlatList data={optionInfo} keyExtractor={(item) => item.value.toString()} style={styles.listContainer} showsVerticalScrollIndicator={false} renderItem={({ item }) => {
13
14
  const color = item.value === selectedValue ? "red" : "black";
14
15
  return (<react_native_1.TouchableOpacity onPress={() => handleChange(item.value)} style={styles.option}>
15
16
  <common_1.MyText fsize="md" color={color} style={{ textAlign: "center" }}>
16
- {item.text}
17
+ {t("grade.weekly.option", {
18
+ week: item.value,
19
+ day: item.value / 7,
20
+ })}
17
21
  </common_1.MyText>
18
22
  </react_native_1.TouchableOpacity>);
19
23
  }}/>
20
24
  <react_native_1.View style={styles.btnBox}>
21
- <common_1.MiniIconBtn icon="times" title="閉じる" color="red" onPress={onClose}/>
25
+ <common_1.MiniIconBtn icon="times" title={t("grade.weekly.close")} color="red" onPress={onClose}/>
22
26
  </react_native_1.View>
23
27
  </common_1.BaseModal>);
24
28
  };
@@ -12,6 +12,7 @@ const stores_1 = require("@nakamura-123/stores");
12
12
  const lib_1 = require("@nakamura-123/lib");
13
13
  const DatePickerModal = ({ targetDay, isVisible, onClose, }) => {
14
14
  const dispatch = (0, react_redux_1.useDispatch)();
15
+ const { t } = (0, common_1.useDrillTranslation)();
15
16
  const handleDateSelect = (day) => {
16
17
  if (lib_1.timeFnc.compareToday(day.dateString) !== "future")
17
18
  return;
@@ -22,7 +23,7 @@ const DatePickerModal = ({ targetDay, isVisible, onClose, }) => {
22
23
  const month = date.getMonth() + 1; // 月を取得(0ベースのため +1)
23
24
  const year = date.getFullYear(); // 年を取得
24
25
  return (<common_1.MyText style={styles.headerText}>
25
- {year}年 {month}月
26
+ {t("grade.calendar.yearMonth", { year, month })}
26
27
  </common_1.MyText>);
27
28
  };
28
29
  return (<common_1.CloseBtnModal isVisible={isVisible} onClose={onClose}>
@@ -33,7 +33,7 @@ const Square3sGrade = ({ dailyLog, weeklyQuizCntTotal, weeklyTargetCnt, color, }
33
33
  },
34
34
  {
35
35
  cnt: consecutiveDays,
36
- cntText: "日",
36
+ cntText: t("count.day"),
37
37
  label: t("grade.gradeCard.consecutive"),
38
38
  icon: "calendar-alt",
39
39
  },
@@ -52,7 +52,7 @@ const getTargetDayStr = (targetDay, t) => {
52
52
  if (limitDays < 0)
53
53
  return t("grade.gradeCard.pleaseSetTxt");
54
54
  const formattedDate = lib_1.timeFnc.formatDateYW(targetDay);
55
- return `${formattedDate}まで ${limitDays}日`;
55
+ return t("grade.untilExam", { date: formattedDate, days: limitDays });
56
56
  };
57
57
  const styles = react_native_1.StyleSheet.create({
58
58
  container: {
@@ -33,6 +33,7 @@ const lib_1 = require("@nakamura-123/lib");
33
33
  const gradeFnc_1 = require("../../functions/gradeFnc");
34
34
  const ChartControl_1 = __importDefault(require("../TestPage/ChartControl"));
35
35
  const QuizCntGraph = ({ DailyLogDB }) => {
36
+ const { t } = (0, common_1.useDrillTranslation)();
36
37
  const [isDaily, setIsDaily] = (0, react_1.useState)(true);
37
38
  const [graphData, setGraphData] = (0, react_1.useState)([]);
38
39
  const [agoDateCnt, setAgoDateCnt] = (0, react_1.useState)(0);
@@ -56,7 +57,7 @@ const QuizCntGraph = ({ DailyLogDB }) => {
56
57
  const handleRight = () => isDaily ? setAgoDateCnt(agoDateCnt - 1) : setAgoWeekCnt(agoWeekCnt - 1);
57
58
  const showLeft = isDaily ? agoDateCnt < 30 : agoWeekCnt < 5;
58
59
  const showRight = agoDateCnt > 0 || agoWeekCnt > 0;
59
- const title = `合計 ${sumWeeklyQuizCnts}問`;
60
+ const title = t("grade.graphTotal", { cnt: sumWeeklyQuizCnts });
60
61
  return (<react_native_1.View style={styles.container}>
61
62
  <ChartControl_1.default title={title} onPressLeft={handleLeft} onPressRight={handleRight} showLeft={showLeft} showRight={showRight}/>
62
63
  <common_1.BarChart data={graphData} width={25} maxValue={100} isPercent={false}/>
@@ -21,25 +21,25 @@ const Square4s = ({ DailyLogDB }) => {
21
21
  const squareInfo = [
22
22
  {
23
23
  cnt: maxQuizCnt,
24
- cntText: "問",
24
+ cntText: t("count.question"),
25
25
  label: t("grade.square4s.maxQuizCnt"),
26
26
  icon: "clock",
27
27
  },
28
28
  {
29
29
  cnt: totalCnt,
30
- cntText: "問",
30
+ cntText: t("count.question"),
31
31
  label: t("grade.square4s.totalCnt"),
32
32
  icon: "layer-group",
33
33
  },
34
34
  {
35
35
  cnt: longestConsecutiveDays,
36
- cntText: "日",
36
+ cntText: t("count.day"),
37
37
  label: t("grade.square4s.longestConsecutiveDays"),
38
38
  icon: "calendar-alt",
39
39
  },
40
40
  {
41
41
  cnt: studyDayCnt,
42
- cntText: "日",
42
+ cntText: t("count.day"),
43
43
  label: t("grade.square4s.studyDayCnt"),
44
44
  icon: "calendar",
45
45
  },
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
- import { QRQuery } from "../../types/filterType";
2
+ import { Results } from "realm";
3
+ import { EngineOps } from "../../engine";
3
4
  type Props = {
4
- QuestionDBInfo: QRQuery;
5
+ ops: EngineOps;
6
+ query: Results<any>;
5
7
  };
6
8
  declare const UnitCircles: React.FC<Props>;
7
9
  export default UnitCircles;
@@ -6,18 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  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
- const tagFncJ_1 = require("../../functions/tagFncJ");
10
9
  const tagFncD_1 = require("../../functions/tagFncD");
11
10
  const SubCategoryLeft_1 = __importDefault(require("../Basic/SubCategoryLeft"));
12
11
  const lib_1 = require("@nakamura-123/lib");
13
12
  const common_1 = require("@nakamura-123/common");
14
- const UnitCircles = ({ QuestionDBInfo }) => {
13
+ const UnitCircles = ({ ops, query }) => {
15
14
  const unitList = (0, react_redux_1.useSelector)((state) => state.app.unitList);
16
15
  const outOfYearRange = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.outOfYearRange);
17
16
  const circleInfos = unitList.map(({ key, title }) => {
18
- const tags = QuestionDBInfo.system === "JLPT"
19
- ? (0, tagFncJ_1.getCategoryTagLevelCntsJ)(QuestionDBInfo.query, key, "basicTag")
20
- : (0, tagFncD_1.getCategoryTagLevelCntsD)(QuestionDBInfo.query, key, "unit", outOfYearRange);
17
+ const tags = ops.gradeCircleTagLevels(query, {
18
+ axis: "unit",
19
+ key,
20
+ outOfYearRange,
21
+ });
21
22
  const rate = Math.round((0, tagFncD_1.getCategoryRate)(tags));
22
23
  return { title, rate };
23
24
  });
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
- import { QRQuery } from "../../types/filterType";
2
+ import { Results } from "realm";
3
+ import { EngineOps } from "../../engine";
3
4
  type Props = {
4
- QuestionDBInfo: QRQuery;
5
+ ops: EngineOps;
6
+ query: Results<any>;
5
7
  };
6
8
  declare const YearCircles: React.FC<Props>;
7
9
  export default YearCircles;
@@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  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
- const tagFncJ_1 = require("../../functions/tagFncJ");
10
9
  const tagFncD_1 = require("../../functions/tagFncD");
11
10
  const SubCategoryLeft_1 = __importDefault(require("../Basic/SubCategoryLeft"));
12
11
  const lib_1 = require("@nakamura-123/lib");
13
12
  const common_1 = require("@nakamura-123/common");
14
- const YearCircles = ({ QuestionDBInfo }) => {
13
+ const YearCircles = ({ ops, query }) => {
15
14
  const yearList = (0, react_redux_1.useSelector)((state) => state.app.yearList);
16
15
  const circleInfos = yearList.map(({ key, title }) => {
17
- const tags = QuestionDBInfo.system === "JLPT"
18
- ? (0, tagFncJ_1.getCategoryTagLevelCntsJ)(QuestionDBInfo.query, key, "listenTag")
19
- : (0, tagFncD_1.getCategoryTagLevelCntsD)(QuestionDBInfo.query, key, "year");
16
+ // 年度の円は試験範囲外の年度で絞らない
17
+ const tags = ops.gradeCircleTagLevels(query, {
18
+ axis: "year",
19
+ key,
20
+ outOfYearRange: [],
21
+ });
20
22
  const rate = Math.round((0, tagFncD_1.getCategoryRate)(tags));
21
23
  return { title, rate };
22
24
  });
@@ -38,6 +38,7 @@ const isDocked = (metrics) => {
38
38
  return Math.abs(metrics.screenY + metrics.height - screenHeight) < 1;
39
39
  };
40
40
  const KeyboardCloseBar = () => {
41
+ const { t } = (0, common_1.useDrillTranslation)();
41
42
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
42
43
  const isFocused = (0, native_1.useIsFocused)();
43
44
  const [keyboardHeight, setKeyboardHeight] = (0, react_1.useState)(null);
@@ -64,7 +65,7 @@ const KeyboardCloseBar = () => {
64
65
  // 画面全体がSafeAreaViewの内側にあるぶん、このバーの座標系は画面下端より insets.bottom 高い
65
66
  const bottom = Math.max(0, keyboardHeight - insets.bottom);
66
67
  return (<react_native_1.TouchableOpacity style={[styles.container, { bottom }]} activeOpacity={0.7} onPress={() => react_native_1.Keyboard.dismiss()}>
67
- <common_1.MyText fsize="sm">キーボードを閉じる ▼</common_1.MyText>
68
+ <common_1.MyText fsize="sm">{t("basic.closeKeyboard")}</common_1.MyText>
68
69
  </react_native_1.TouchableOpacity>);
69
70
  };
70
71
  const styles = react_native_1.StyleSheet.create({
@@ -27,21 +27,20 @@ const react_1 = __importStar(require("react"));
27
27
  const react_native_1 = require("react-native");
28
28
  const react_redux_1 = require("react-redux");
29
29
  const common_1 = require("@nakamura-123/common");
30
- const lib_1 = require("@nakamura-123/lib");
31
30
  const stores_1 = require("@nakamura-123/stores");
31
+ const engine_1 = require("../../engine");
32
+ const basicHook_1 = require("../../hooks/basicHook");
32
33
  const QuizOption = ({}) => {
33
34
  const { t } = (0, common_1.useDrillTranslation)();
34
35
  // 設定の選択
35
36
  const dispatch = (0, react_redux_1.useDispatch)();
36
37
  const selected = (0, react_redux_1.useSelector)((state) => state.quiz.selected);
37
38
  const noShuffle = selected.lesson.noShuffle;
38
- const system = selected.system || "drill";
39
39
  const storeOption = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.option);
40
40
  const handleSelect = (type, value) => {
41
41
  dispatch(stores_1.cfgAction.selectOption({ key: type, value }));
42
42
  };
43
- const jQuizStartOption = removeOptionByValue(selected.system || "drill");
44
- let quizOption = system === "drill" ? lib_1.startOption.dQuizStartOption : jQuizStartOption;
43
+ const quizOption = engine_1.engines[(0, basicHook_1.useQuizEngine)()].startOptions(selected.system);
45
44
  (0, react_1.useEffect)(() => {
46
45
  if (noShuffle)
47
46
  dispatch(stores_1.cfgAction.selectOption({ key: "isShuffle", value: false }));
@@ -70,14 +69,4 @@ const styles = react_native_1.StyleSheet.create({
70
69
  marginLeft: 5,
71
70
  },
72
71
  });
73
- function removeOptionByValue(quizSystem) {
74
- if (quizSystem !== "JlptListen")
75
- return lib_1.startOption.jQuizStartOption;
76
- const jOption = lib_1.startOption.jQuizStartOption;
77
- const TARGET_VALUE = "selectJapanese";
78
- const newOptions = jOption.map((optionGroup) => {
79
- return Object.assign(Object.assign({}, optionGroup), { options: optionGroup.options.filter((opt) => opt !== TARGET_VALUE) });
80
- });
81
- return newOptions;
82
- }
83
72
  exports.default = QuizOption;