@nakamura-123/pages 0.0.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.
Files changed (334) hide show
  1. package/dist/component/Badge5s.d.ts +9 -0
  2. package/dist/component/Badge5s.js +46 -0
  3. package/dist/component/BasicSetting.d.ts +9 -0
  4. package/dist/component/BasicSetting.js +31 -0
  5. package/dist/component/Boot/IconTitleAndToggle.d.ts +8 -0
  6. package/dist/component/Boot/IconTitleAndToggle.js +20 -0
  7. package/dist/component/Boot/SelectRange.d.ts +6 -0
  8. package/dist/component/Boot/SelectRange.js +44 -0
  9. package/dist/component/Boot/SelectUnit.d.ts +6 -0
  10. package/dist/component/Boot/SelectUnit.js +41 -0
  11. package/dist/component/Boot/ToggleRange.d.ts +8 -0
  12. package/dist/component/Boot/ToggleRange.js +54 -0
  13. package/dist/component/Coin/AppReviews.d.ts +10 -0
  14. package/dist/component/Coin/AppReviews.js +45 -0
  15. package/dist/component/Coin/CatchCopy.d.ts +3 -0
  16. package/dist/component/Coin/CatchCopy.js +31 -0
  17. package/dist/component/Coin/Recommend.d.ts +3 -0
  18. package/dist/component/Coin/Recommend.js +87 -0
  19. package/dist/component/Grade/AllBadges.d.ts +7 -0
  20. package/dist/component/Grade/AllBadges.js +41 -0
  21. package/dist/component/Grade/AllTags.d.ts +5 -0
  22. package/dist/component/Grade/AllTags.js +32 -0
  23. package/dist/component/Grade/BasicBadge.d.ts +7 -0
  24. package/dist/component/Grade/BasicBadge.js +72 -0
  25. package/dist/component/Grade/ChangeWeeklyTargetBtn.d.ts +5 -0
  26. package/dist/component/Grade/ChangeWeeklyTargetBtn.js +39 -0
  27. package/dist/component/Grade/DatePickerModal.d.ts +8 -0
  28. package/dist/component/Grade/DatePickerModal.js +45 -0
  29. package/dist/component/Grade/GradeCard/ChangeWeeklyModal.d.ts +13 -0
  30. package/dist/component/Grade/GradeCard/ChangeWeeklyModal.js +39 -0
  31. package/dist/component/Grade/GradeCard/ChangeWeeklyTargetBtn.d.ts +7 -0
  32. package/dist/component/Grade/GradeCard/ChangeWeeklyTargetBtn.js +60 -0
  33. package/dist/component/Grade/GradeCard/DatePickerModal.d.ts +8 -0
  34. package/dist/component/Grade/GradeCard/DatePickerModal.js +49 -0
  35. package/dist/component/Grade/GradeCard/GradeCard.d.ts +7 -0
  36. package/dist/component/Grade/GradeCard/GradeCard.js +53 -0
  37. package/dist/component/Grade/GradeCard/Square3sGrade.d.ts +11 -0
  38. package/dist/component/Grade/GradeCard/Square3sGrade.js +60 -0
  39. package/dist/component/Grade/GradeCard/TargetDate.d.ts +7 -0
  40. package/dist/component/Grade/GradeCard/TargetDate.js +60 -0
  41. package/dist/component/Grade/GradeCard/WeeklyAchivedRate.d.ts +9 -0
  42. package/dist/component/Grade/GradeCard/WeeklyAchivedRate.js +28 -0
  43. package/dist/component/Grade/GradeCard/WeeklyProgress.d.ts +11 -0
  44. package/dist/component/Grade/GradeCard/WeeklyProgress.js +88 -0
  45. package/dist/component/Grade/GradeCard.d.ts +4 -0
  46. package/dist/component/Grade/GradeCard.js +53 -0
  47. package/dist/component/Grade/QuizCntGraph.d.ts +8 -0
  48. package/dist/component/Grade/QuizCntGraph.js +104 -0
  49. package/dist/component/Grade/Scuare3sGrade.d.ts +9 -0
  50. package/dist/component/Grade/Scuare3sGrade.js +35 -0
  51. package/dist/component/Grade/ShareBtn.d.ts +6 -0
  52. package/dist/component/Grade/ShareBtn.js +86 -0
  53. package/dist/component/Grade/Square3sGrade.d.ts +9 -0
  54. package/dist/component/Grade/Square3sGrade.js +63 -0
  55. package/dist/component/Grade/Square4s.d.ts +7 -0
  56. package/dist/component/Grade/Square4s.js +63 -0
  57. package/dist/component/Grade/TargetDate.d.ts +4 -0
  58. package/dist/component/Grade/TargetDate.js +56 -0
  59. package/dist/component/Grade/WeeklyAchivedRate.d.ts +7 -0
  60. package/dist/component/Grade/WeeklyAchivedRate.js +28 -0
  61. package/dist/component/Grade/WeeklyProgress.d.ts +9 -0
  62. package/dist/component/Grade/WeeklyProgress.js +80 -0
  63. package/dist/component/HeadNavigator.d.ts +0 -0
  64. package/dist/component/HeadNavigator.js +49 -0
  65. package/dist/component/HomePage.d.ts +8 -0
  66. package/dist/component/HomePage.js +44 -0
  67. package/dist/component/MiniTestCard.d.ts +9 -0
  68. package/dist/component/MiniTestCard.js +75 -0
  69. package/dist/component/Paw4s.d.ts +7 -0
  70. package/dist/component/Paw4s.js +51 -0
  71. package/dist/component/Paw5s.d.ts +7 -0
  72. package/dist/component/Paw5s.js +51 -0
  73. package/dist/component/QuizSet/QuizOptionDrill.d.ts +5 -0
  74. package/dist/component/QuizSet/QuizOptionDrill.js +46 -0
  75. package/dist/component/QuizSet/QuizSetDrill.d.ts +5 -0
  76. package/dist/component/QuizSet/QuizSetDrill.js +43 -0
  77. package/dist/component/Result/CharaCard.d.ts +7 -0
  78. package/dist/component/Result/CharaCard.js +43 -0
  79. package/dist/component/Result/LessonTitle.d.ts +3 -0
  80. package/dist/component/Result/LessonTitle.js +42 -0
  81. package/dist/component/Result/QuizFlatList.d.ts +7 -0
  82. package/dist/component/Result/QuizFlatList.js +76 -0
  83. package/dist/component/Result/ScoreBox.d.ts +7 -0
  84. package/dist/component/Result/ScoreBox.js +61 -0
  85. package/dist/component/Result/ScoreCircle.d.ts +7 -0
  86. package/dist/component/Result/ScoreCircle.js +59 -0
  87. package/dist/component/SelectRange/SelectYearRange.d.ts +7 -0
  88. package/dist/component/SelectRange/SelectYearRange.js +105 -0
  89. package/dist/component/SettingBtns/Config.d.ts +8 -0
  90. package/dist/component/SettingBtns/Config.js +17 -0
  91. package/dist/component/SettingBtns/Grade.d.ts +8 -0
  92. package/dist/component/SettingBtns/Grade.js +17 -0
  93. package/dist/component/SettingBtns/QuizOptionSelector.d.ts +7 -0
  94. package/dist/component/SettingBtns/QuizOptionSelector.js +43 -0
  95. package/dist/component/SettingBtns/Range.d.ts +5 -0
  96. package/dist/component/SettingBtns/Range.js +44 -0
  97. package/dist/component/SettingBtns/Report.d.ts +5 -0
  98. package/dist/component/SettingBtns/Report.js +16 -0
  99. package/dist/component/SettingBtns/Setting.d.ts +0 -0
  100. package/dist/component/SettingBtns/Setting.js +1 -0
  101. package/dist/component/Square3s.d.ts +7 -0
  102. package/dist/component/Square3s.js +38 -0
  103. package/dist/component/SubCagegoryList.d.ts +8 -0
  104. package/dist/component/SubCagegoryList.js +120 -0
  105. package/dist/component/SubCategoryLeft.d.ts +5 -0
  106. package/dist/component/SubCategoryLeft.js +14 -0
  107. package/dist/component/SubCategoryList.d.ts +9 -0
  108. package/dist/component/SubCategoryList.js +77 -0
  109. package/dist/component/TabAnimeView.d.ts +7 -0
  110. package/dist/component/TabAnimeView.js +61 -0
  111. package/dist/component/TabContents.d.ts +1 -0
  112. package/dist/component/TabContents.js +18 -0
  113. package/dist/component/TabContentsWrap.d.ts +7 -0
  114. package/dist/component/TabContentsWrap.js +38 -0
  115. package/dist/component/Tag5s.d.ts +6 -0
  116. package/dist/component/Tag5s.js +49 -0
  117. package/dist/component/TagBadge5s.d.ts +7 -0
  118. package/dist/component/TagBadge5s.js +63 -0
  119. package/dist/component/TagBadge5sPress.d.ts +6 -0
  120. package/dist/component/TagBadge5sPress.js +29 -0
  121. package/dist/component/TestCard.d.ts +7 -0
  122. package/dist/component/TestCard.js +57 -0
  123. package/dist/component/TestPage/AverageBar.d.ts +11 -0
  124. package/dist/component/TestPage/AverageBar.js +74 -0
  125. package/dist/component/TestPage/BarChart.d.ts +7 -0
  126. package/dist/component/TestPage/BarChart.js +107 -0
  127. package/dist/component/TestPage/BarChartContainer.d.ts +9 -0
  128. package/dist/component/TestPage/BarChartContainer.js +99 -0
  129. package/dist/component/TestPage/BarGraph.d.ts +11 -0
  130. package/dist/component/TestPage/BarGraph.js +60 -0
  131. package/dist/component/TestPage/ChartControl.d.ts +10 -0
  132. package/dist/component/TestPage/ChartControl.js +43 -0
  133. package/dist/component/TestPage/Square3s.d.ts +9 -0
  134. package/dist/component/TestPage/Square3s.js +35 -0
  135. package/dist/component/UnitPage.d.ts +10 -0
  136. package/dist/component/UnitPage.js +15 -0
  137. package/dist/functions/InQuizFnc.d.ts +0 -0
  138. package/dist/functions/InQuizFnc.js +1 -0
  139. package/dist/functions/badgeBasicFnc.d.ts +14 -0
  140. package/dist/functions/badgeBasicFnc.js +68 -0
  141. package/dist/functions/badgeDailyFnc.d.ts +15 -0
  142. package/dist/functions/badgeDailyFnc.js +65 -0
  143. package/dist/functions/badgeFilter.d.ts +17 -0
  144. package/dist/functions/badgeFilter.js +33 -0
  145. package/dist/functions/badgeFnc.d.ts +15 -0
  146. package/dist/functions/badgeFnc.js +68 -0
  147. package/dist/functions/createQuizFnc.d.ts +13 -0
  148. package/dist/functions/createQuizFnc.js +69 -0
  149. package/dist/functions/gradeFnc.d.ts +16 -0
  150. package/dist/functions/gradeFnc.js +83 -0
  151. package/dist/functions/questionFilter.d.ts +16 -0
  152. package/dist/functions/questionFilter.js +79 -0
  153. package/dist/functions/questionFormat.d.ts +7 -0
  154. package/dist/functions/questionFormat.js +89 -0
  155. package/dist/functions/tagFnc.d.ts +22 -0
  156. package/dist/functions/tagFnc.js +105 -0
  157. package/dist/functions/testFnc.d.ts +8 -0
  158. package/dist/functions/testFnc.js +21 -0
  159. package/dist/helper/scoreFnc.d.ts +10 -0
  160. package/dist/helper/scoreFnc.js +40 -0
  161. package/dist/helper/tagFnc.d.ts +23 -0
  162. package/dist/helper/tagFnc.js +69 -0
  163. package/dist/helper/testFnc.d.ts +7 -0
  164. package/dist/helper/testFnc.js +17 -0
  165. package/dist/hooks/BadgeHook.d.ts +1 -0
  166. package/dist/hooks/BadgeHook.js +65 -0
  167. package/dist/hooks/ExitQuizHook.d.ts +2 -0
  168. package/dist/hooks/ExitQuizHook.js +54 -0
  169. package/dist/hooks/basicHook.d.ts +3 -0
  170. package/dist/hooks/basicHook.js +14 -0
  171. package/dist/hooks/quizActionHook.d.ts +5 -0
  172. package/dist/hooks/quizActionHook.js +86 -0
  173. package/dist/hooks/quizHook.d.ts +15 -0
  174. package/dist/hooks/quizHook.js +60 -0
  175. package/dist/hooks/selector.d.ts +6 -0
  176. package/dist/hooks/selector.js +24 -0
  177. package/dist/index.d.ts +20 -0
  178. package/dist/index.js +68 -0
  179. package/dist/page/BadgePage.d.ts +8 -0
  180. package/dist/page/BadgePage.js +58 -0
  181. package/dist/page/BasicPage.d.ts +9 -0
  182. package/dist/page/BasicPage.js +125 -0
  183. package/dist/page/BootPage.d.ts +9 -0
  184. package/dist/page/BootPage.js +116 -0
  185. package/dist/page/CoinPage.d.ts +9 -0
  186. package/dist/page/CoinPage.js +51 -0
  187. package/dist/page/GetBadgePage.d.ts +7 -0
  188. package/dist/page/GetBadgePage.js +173 -0
  189. package/dist/page/GradePage.d.ts +7 -0
  190. package/dist/page/GradePage.js +37 -0
  191. package/dist/page/HistoryPage.d.ts +11 -0
  192. package/dist/page/HistoryPage.js +62 -0
  193. package/dist/page/HomePage.d.ts +8 -0
  194. package/dist/page/HomePage.js +80 -0
  195. package/dist/page/ImgZoom.d.ts +10 -0
  196. package/dist/page/ImgZoom.js +29 -0
  197. package/dist/page/QuixPage.d.ts +7 -0
  198. package/dist/page/QuixPage.js +33 -0
  199. package/dist/page/QuizPage.d.ts +7 -0
  200. package/dist/page/QuizPage.js +98 -0
  201. package/dist/page/QuizSettingPage.d.ts +7 -0
  202. package/dist/page/QuizSettingPage.js +72 -0
  203. package/dist/page/QuizSetupPage.d.ts +7 -0
  204. package/dist/page/QuizSetupPage.js +85 -0
  205. package/dist/page/ReportPage.d.ts +8 -0
  206. package/dist/page/ReportPage.js +185 -0
  207. package/dist/page/ResultPage.d.ts +7 -0
  208. package/dist/page/ResultPage.js +47 -0
  209. package/dist/page/SettingPage.d.ts +7 -0
  210. package/dist/page/SettingPage.js +62 -0
  211. package/dist/page/TestPage.d.ts +9 -0
  212. package/dist/page/TestPage.js +101 -0
  213. package/dist/page/UnitPage.d.ts +9 -0
  214. package/dist/page/UnitPage.js +127 -0
  215. package/dist/page/ZoomImg.d.ts +0 -0
  216. package/dist/page/ZoomImg.js +1 -0
  217. package/dist/quiz/GoBackAlert.d.ts +2 -0
  218. package/dist/quiz/GoBackAlert.js +30 -0
  219. package/dist/quiz/MyImage.d.ts +9 -0
  220. package/dist/quiz/MyImage.js +60 -0
  221. package/dist/quiz/MyTextqqyy.d.ts +10 -0
  222. package/dist/quiz/MyTextqqyy.js +80 -0
  223. package/dist/quiz/Question.d.ts +3 -0
  224. package/dist/quiz/Question.js +43 -0
  225. package/dist/quiz/Quiz.d.ts +9 -0
  226. package/dist/quiz/Quiz.js +44 -0
  227. package/dist/quiz/QuizTitle.d.ts +3 -0
  228. package/dist/quiz/QuizTitle.js +51 -0
  229. package/dist/quiz/Title.d.ts +3 -0
  230. package/dist/quiz/Title.js +51 -0
  231. package/dist/quiz/answer/Answer.d.ts +3 -0
  232. package/dist/quiz/answer/Answer.js +41 -0
  233. package/dist/quiz/answer/BlankAnswer.d.ts +7 -0
  234. package/dist/quiz/answer/BlankAnswer.js +33 -0
  235. package/dist/quiz/answer/BlankBtn.d.ts +3 -0
  236. package/dist/quiz/answer/BlankBtn.js +50 -0
  237. package/dist/quiz/answer/ChoiceView.d.ts +17 -0
  238. package/dist/quiz/answer/ChoiceView.js +53 -0
  239. package/dist/quiz/answer/CommonChoice.d.ts +0 -0
  240. package/dist/quiz/answer/CommonChoice.js +1 -0
  241. package/dist/quiz/answer/MultiChoice.d.ts +7 -0
  242. package/dist/quiz/answer/MultiChoice.js +66 -0
  243. package/dist/quiz/answer/MultiChoiceContainer.d.ts +7 -0
  244. package/dist/quiz/answer/MultiChoiceContainer.js +71 -0
  245. package/dist/quiz/answer/MultiChoiceLogic.d.ts +0 -0
  246. package/dist/quiz/answer/MultiChoiceLogic.js +1 -0
  247. package/dist/quiz/answer/MultiNextBtn.d.ts +7 -0
  248. package/dist/quiz/answer/MultiNextBtn.js +36 -0
  249. package/dist/quiz/answer/NormalChoice.d.ts +7 -0
  250. package/dist/quiz/answer/NormalChoice.js +64 -0
  251. package/dist/quiz/answer/NormalChoiceContainer.d.ts +7 -0
  252. package/dist/quiz/answer/NormalChoiceContainer.js +76 -0
  253. package/dist/quiz/answer/NormalChoiceView.d.ts +17 -0
  254. package/dist/quiz/answer/NormalChoiceView.js +53 -0
  255. package/dist/quiz/answer/NormalSelect.d.ts +5 -0
  256. package/dist/quiz/answer/NormalSelect.js +28 -0
  257. package/dist/quiz/answer/memo.d.ts +9 -0
  258. package/dist/quiz/answer/memo.js +114 -0
  259. package/dist/quiz/answer/style/getChoiceStyle.d.ts +2 -0
  260. package/dist/quiz/answer/style/getChoiceStyle.js +17 -0
  261. package/dist/quiz/answer/styles/getChoiceStyle.d.ts +5 -0
  262. package/dist/quiz/answer/styles/getChoiceStyle.js +32 -0
  263. package/dist/quiz/answer/util/choiceFnc.d.ts +2 -0
  264. package/dist/quiz/answer/util/choiceFnc.js +9 -0
  265. package/dist/quiz/check/Check.d.ts +8 -0
  266. package/dist/quiz/check/Check.js +82 -0
  267. package/dist/quiz/check/NextQuiz.d.ts +8 -0
  268. package/dist/quiz/check/NextQuiz.js +42 -0
  269. package/dist/quiz/check/NextQuizBtn.d.ts +8 -0
  270. package/dist/quiz/check/NextQuizBtn.js +67 -0
  271. package/dist/quiz/check/SelectTag.d.ts +5 -0
  272. package/dist/quiz/check/SelectTag.js +86 -0
  273. package/dist/quiz/common/MyImage.d.ts +6 -0
  274. package/dist/quiz/common/MyImage.js +56 -0
  275. package/dist/quiz/common/MyTextqqyy.d.ts +11 -0
  276. package/dist/quiz/common/MyTextqqyy.js +133 -0
  277. package/dist/quiz/common/PageContainerWrap.d.ts +10 -0
  278. package/dist/quiz/common/PageContainerWrap.js +38 -0
  279. package/dist/quiz/common/RenderImgOrText.d.ts +11 -0
  280. package/dist/quiz/common/RenderImgOrText.js +21 -0
  281. package/dist/quiz/common/ZoomableImage.d.ts +9 -0
  282. package/dist/quiz/common/ZoomableImage.js +18 -0
  283. package/dist/quiz/explain/CorrectBar.d.ts +7 -0
  284. package/dist/quiz/explain/CorrectBar.js +46 -0
  285. package/dist/quiz/explain/CorrectedBar.d.ts +7 -0
  286. package/dist/quiz/explain/CorrectedBar.js +45 -0
  287. package/dist/quiz/explain/Example.d.ts +8 -0
  288. package/dist/quiz/explain/Example.js +107 -0
  289. package/dist/quiz/explain/Explain.d.ts +8 -0
  290. package/dist/quiz/explain/Explain.js +59 -0
  291. package/dist/quiz/explain/ExplainLogic.d.ts +17 -0
  292. package/dist/quiz/explain/ExplainLogic.js +52 -0
  293. package/dist/quiz/function/choiceFnc.d.ts +2 -0
  294. package/dist/quiz/function/choiceFnc.js +9 -0
  295. package/dist/quiz/function/turnModeFnc.d.ts +0 -0
  296. package/dist/quiz/function/turnModeFnc.js +31 -0
  297. package/dist/quiz/question/FillDiagram.d.ts +10 -0
  298. package/dist/quiz/question/FillDiagram.js +27 -0
  299. package/dist/quiz/question/Question.d.ts +8 -0
  300. package/dist/quiz/question/Question.js +61 -0
  301. package/dist/quiz/question/QuestionFormat.d.ts +8 -0
  302. package/dist/quiz/question/QuestionFormat.js +69 -0
  303. package/dist/quiz/question/QuestionFormats.d.ts +9 -0
  304. package/dist/quiz/question/QuestionFormats.js +75 -0
  305. package/dist/quiz/question/QuestionMultiFormat.d.ts +7 -0
  306. package/dist/quiz/question/QuestionMultiFormat.js +43 -0
  307. package/dist/quiz/question/QuestionTxtFomat.d.ts +7 -0
  308. package/dist/quiz/question/QuestionTxtFomat.js +42 -0
  309. package/dist/quiz/question/SearchYoutue.d.ts +6 -0
  310. package/dist/quiz/question/SearchYoutue.js +20 -0
  311. package/dist/quiz/question/questionStyleFormat.d.ts +8 -0
  312. package/dist/quiz/question/questionStyleFormat.js +61 -0
  313. package/dist/quiz/save/QuizSaveData.d.ts +9 -0
  314. package/dist/quiz/save/QuizSaveData.js +68 -0
  315. package/dist/quiz/setting/Bottom3Btn.d.ts +8 -0
  316. package/dist/quiz/setting/Bottom3Btn.js +79 -0
  317. package/dist/quiz/setting/ReturnBtn.d.ts +7 -0
  318. package/dist/quiz/setting/ReturnBtn.js +77 -0
  319. package/dist/quiz/setting/ReturnSaveBtn.d.ts +7 -0
  320. package/dist/quiz/setting/ReturnSaveBtn.js +94 -0
  321. package/dist/quiz/styles/getChoiceStyle.d.ts +5 -0
  322. package/dist/quiz/styles/getChoiceStyle.js +32 -0
  323. package/dist/quiz/util/choiceFnc.d.ts +2 -0
  324. package/dist/quiz/util/choiceFnc.js +9 -0
  325. package/dist/quiz/util/commonFnc.d.ts +0 -0
  326. package/dist/quiz/util/commonFnc.js +1 -0
  327. package/dist/quiz/util/customHook.d.ts +0 -0
  328. package/dist/quiz/util/customHook.js +1 -0
  329. package/dist/quiz/util/customSelector.d.ts +5 -0
  330. package/dist/quiz/util/customSelector.js +16 -0
  331. package/dist/tsconfig.tsbuildinfo +1 -0
  332. package/dist/types/homePage.d.ts +12 -0
  333. package/dist/types/homePage.js +2 -0
  334. package/package.json +23 -0
@@ -0,0 +1,107 @@
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
+ var react_1 = __importDefault(require("react"));
7
+ var react_native_1 = require("react-native");
8
+ var react_redux_1 = require("react-redux");
9
+ var lib_1 = require("@nakamura-123/lib");
10
+ var RenderImgOrText_1 = __importDefault(require("../common/RenderImgOrText"));
11
+ var selector_1 = require("../../hooks/selector");
12
+ var common_1 = require("@nakamura-123/common");
13
+ // viewType に応じたコンポーネントのマッピング
14
+ var viewTypeHandlers = {
15
+ base: function (_a) {
16
+ var word = _a.word, yearId = _a.yearId, navigation = _a.navigation;
17
+ return (<RenderImgOrText_1.default word={word} imgKey={"a" + yearId} navigation={navigation}/>);
18
+ },
19
+ rImg: function (_a) {
20
+ var word = _a.word, rImgs = _a.rImgs;
21
+ return (<common_1.MyImage path={lib_1.utilFnc.getrImgPath(rImgs, word)}/>);
22
+ },
23
+ mImg: function (_a) {
24
+ var word = _a.word, yearId = _a.yearId, num = _a.num;
25
+ var paths = lib_1.utilFnc.getmImgPathes(word, yearId, num);
26
+ return (<>
27
+ {paths.map(function (path, index) { return (<common_1.MyImage key={index} path={path}/>); })}
28
+ </>);
29
+ },
30
+ };
31
+ var Explain = function (_a) {
32
+ var navigation = _a.navigation;
33
+ var question = (0, selector_1.useQuestionData)();
34
+ var explain = question.explain;
35
+ if (!explain)
36
+ return null;
37
+ var explainInfos = explain.map(function (word) { return getExplainDatas(word, question); });
38
+ var rImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.rImgs; });
39
+ return (<react_native_1.View style={styles.container}>
40
+ {explainInfos.map(function (info, index) {
41
+ var Component = viewTypeHandlers[info.viewType];
42
+ return Component ? (<Component key={index} {...info} rImgs={rImgs} navigation={navigation}/>) : null;
43
+ })}
44
+ </react_native_1.View>);
45
+ };
46
+ // 解説データを作成する関数
47
+ var getExplainDatas = function (word, Q) {
48
+ var isLmn = word.startsWith("lmn");
49
+ var isrImg = word.startsWith("/");
50
+ var ismImg = word.startsWith("https");
51
+ if (isLmn)
52
+ return { word: word.split("lmn")[1], color: "yellow", viewType: "base" };
53
+ if (isrImg)
54
+ return { word: word, viewType: "rImg" };
55
+ if (ismImg)
56
+ return {
57
+ word: word,
58
+ viewType: "mImg",
59
+ additionalInfo: { yearId: Q.yearId, num: Q.num },
60
+ };
61
+ if (!Q.form)
62
+ return getChoice("normal", Q.choices, word);
63
+ if (Q.form === "blank")
64
+ return getChoice("blank", Q.blankAns, word);
65
+ if (Q.form === "multi")
66
+ return getChoice("multi", Q.multiSel, word);
67
+ return { word: word, viewType: "base" };
68
+ };
69
+ // 汎用的な選択肢取得関数
70
+ var getChoice = function (type, data, word) {
71
+ return processWord(word, function (num) {
72
+ var _a, _b, _c;
73
+ if (type === "normal")
74
+ return ((_a = data.find(function (choice) { return choice.num === num; })) === null || _a === void 0 ? void 0 : _a.choice) || null;
75
+ if (type === "blank")
76
+ return data[num] || null;
77
+ if (type === "multi")
78
+ return ((_c = (_b = data[num]) === null || _b === void 0 ? void 0 : _b.find(function (choice) { return choice.num === 1; })) === null || _c === void 0 ? void 0 : _c.choice) || null;
79
+ return null;
80
+ });
81
+ };
82
+ // 選択肢取得共通関数
83
+ var processWord = function (word, getChoice) {
84
+ if (!word.startsWith("ans"))
85
+ return { word: word, viewType: "base" };
86
+ var num = extractNumber(word);
87
+ if (num === null)
88
+ return { word: word, viewType: "base" };
89
+ var choice = getChoice(num);
90
+ return choice
91
+ ? { word: choice, viewType: "base", color: "ltBlack" }
92
+ : { word: word, viewType: "base" };
93
+ };
94
+ // 数字を抽出するヘルパー関数
95
+ var extractNumber = function (input) {
96
+ var match = input.match(/\d+/);
97
+ return match ? parseInt(match[0], 10) : null;
98
+ };
99
+ var styles = react_native_1.StyleSheet.create({
100
+ container: {
101
+ justifyContent: "flex-start",
102
+ backgroundColor: lib_1.colors.ltBeige,
103
+ padding: 10,
104
+ marginBottom: 10,
105
+ },
106
+ });
107
+ exports.default = Explain;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { StackNavigationProp } from "@react-navigation/stack";
3
+ import { Nav } from "@nakamura-123/types";
4
+ interface ExplainProps {
5
+ navigation: StackNavigationProp<Nav.RootStackParamList>;
6
+ }
7
+ declare const Explain: React.FC<ExplainProps>;
8
+ export default Explain;
@@ -0,0 +1,59 @@
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
+ var react_1 = __importDefault(require("react"));
7
+ var react_native_1 = require("react-native");
8
+ var react_redux_1 = require("react-redux");
9
+ var lib_1 = require("@nakamura-123/lib");
10
+ var common_1 = require("@nakamura-123/common");
11
+ var RenderImgOrText_1 = __importDefault(require("../common/RenderImgOrText"));
12
+ var quizHook_1 = require("../../hooks/quizHook");
13
+ var ExplainLogic_1 = require("./ExplainLogic");
14
+ var ZoomableImage_1 = __importDefault(require("../common/ZoomableImage"));
15
+ var Explain = function (_a) {
16
+ var navigation = _a.navigation;
17
+ var question = (0, quizHook_1.useQuestionData)();
18
+ var rImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.rImgs; });
19
+ var mImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.mImgs; });
20
+ var yearId = question.yearId, explain = question.explain;
21
+ if (!explain)
22
+ return null;
23
+ var explainInfos = explain.map(function (word) {
24
+ return (0, ExplainLogic_1.getExplainDatas)(word, question);
25
+ });
26
+ return (<react_native_1.View style={styles.container}>
27
+ {/* 解説表示 */}
28
+ {explainInfos.map(function (I, index) {
29
+ var color = I.color && !I.word.startsWith("/") ? I.color : "ltBeige";
30
+ if (I.viewType === "base")
31
+ return (<react_native_1.View style={{ backgroundColor: lib_1.colors[color] }} key={index}>
32
+ <RenderImgOrText_1.default word={I.word} imgKey={"a" + yearId} navigation={navigation}/>
33
+ </react_native_1.View>);
34
+ if (I.viewType === "rImg") {
35
+ var path = lib_1.utilFnc.getrImgPath(rImgs, I.word);
36
+ return (<ZoomableImage_1.default key={index} path={path} navigation={navigation}/>);
37
+ }
38
+ if (I.viewType === "mImg") {
39
+ var pathes = lib_1.utilFnc.getmImgPathes(mImgs, I.yearId, I.num);
40
+ return (<react_native_1.View key={index}>
41
+ <common_1.RoundRectangle title="オリジナル解説動画はこちら>>>" onPress={function () { return lib_1.utilFnc.handleSearch(I.word); }} color="red" style={styles.imgRectangle}/>
42
+ {pathes.map(function (path, j) { return (<ZoomableImage_1.default key={j} path={path} navigation={navigation}/>); })}
43
+ </react_native_1.View>);
44
+ }
45
+ })}
46
+ </react_native_1.View>);
47
+ };
48
+ var styles = react_native_1.StyleSheet.create({
49
+ container: {
50
+ justifyContent: "flex-start",
51
+ backgroundColor: lib_1.colors.ltBeige,
52
+ padding: 10,
53
+ marginBottom: 10,
54
+ },
55
+ imgRectangle: {
56
+ marginTop: 10,
57
+ },
58
+ });
59
+ exports.default = Explain;
@@ -0,0 +1,17 @@
1
+ import { ColorKeys } from "@nakamura-123/lib";
2
+ import { Store } from "@nakamura-123/types";
3
+ type ExplainDataNormal = {
4
+ viewType: "base" | "rImg";
5
+ word: string;
6
+ color?: ColorKeys;
7
+ };
8
+ type ExplainDataMovieImg = {
9
+ word: string;
10
+ viewType: "mImg";
11
+ color?: ColorKeys;
12
+ yearId: number;
13
+ num: number;
14
+ };
15
+ type ExplainData = ExplainDataNormal | ExplainDataMovieImg;
16
+ export declare const getExplainDatas: (word: string, Q: Store.DQInStore) => ExplainData;
17
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExplainDatas = void 0;
4
+ var getExplainDatas = function (word, Q) {
5
+ var yearId = Q.yearId, num = Q.num, form = Q.form;
6
+ if (word.startsWith("lmn"))
7
+ return { word: word.slice(3), color: "yellow", viewType: "base" };
8
+ if (word.startsWith("/"))
9
+ return { word: word, viewType: "rImg" };
10
+ if (word.startsWith("https"))
11
+ return { word: word, viewType: "mImg", yearId: yearId, num: num };
12
+ if (!form)
13
+ return getNormalChoice(Q.choices, word);
14
+ switch (form) {
15
+ case "blank":
16
+ return getBlankChoice(Q.blankAns, word);
17
+ case "multi":
18
+ return getMultiChoice(Q.multiSel, word);
19
+ default:
20
+ return { word: word, viewType: "base" };
21
+ }
22
+ };
23
+ exports.getExplainDatas = getExplainDatas;
24
+ // 選択肢取得の共通ロジック
25
+ var processWord = function (word, getChoice) {
26
+ if (!word.startsWith("ans"))
27
+ return { word: word, viewType: "base" };
28
+ var num = extractNumber(word);
29
+ if (num === null)
30
+ return { word: word, viewType: "base" };
31
+ var choice = getChoice(num);
32
+ return choice
33
+ ? { word: choice, viewType: "base", color: "light" }
34
+ : { word: word, viewType: "base" };
35
+ };
36
+ // 通常選択肢
37
+ var getNormalChoice = function (choices, word) {
38
+ return processWord(word, function (num) { var _a; return ((_a = choices.find(function (choice) { return choice.num === num; })) === null || _a === void 0 ? void 0 : _a.choice) || null; });
39
+ };
40
+ // 空欄選択肢
41
+ var getBlankChoice = function (blankAns, word) {
42
+ return processWord(word, function (num) { return blankAns[num] || null; });
43
+ };
44
+ // マルチ選択肢
45
+ var getMultiChoice = function (multiSel, word) {
46
+ return processWord(word, function (num) { var _a, _b; return ((_b = (_a = multiSel[num]) === null || _a === void 0 ? void 0 : _a.find(function (choice) { return choice.num === 1; })) === null || _b === void 0 ? void 0 : _b.choice) || null; });
47
+ };
48
+ // ヘルパー関数: 数字を抽出
49
+ var extractNumber = function (input) {
50
+ var match = input.match(/\d+/);
51
+ return match ? parseInt(match[0], 10) : null;
52
+ };
@@ -0,0 +1,2 @@
1
+ import { Store } from "@nakamura-123/types";
2
+ export declare const calcMaxChoiceLength: (choices: Store.ChoiceType[]) => number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calcMaxChoiceLength = void 0;
4
+ var calcMaxChoiceLength = function (choices) {
5
+ return choices.reduce(function (max, current) {
6
+ return Math.max(max, current.choice.length);
7
+ }, 0);
8
+ };
9
+ exports.calcMaxChoiceLength = calcMaxChoiceLength;
File without changes
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // import React from "react";
3
+ // import Realm from "realm";
4
+ // import { useDispatch, useSelector } from "react-redux";
5
+ // import { AppDispatch, RootState, quizAction } from "@nakamura-123/stores";
6
+ // import { Store, Nav } from "@nakamura-123/types";
7
+ // import { saveStorage } from "@nakamura-123/stores";
8
+ // import { DailyLogModel, DailyLogSchema } from "@nakamura-123/db";
9
+ // interface HandleToCheckModeProps {
10
+ // mode: Store.Mode;
11
+ // selectIndexes: number[];
12
+ // choices: Store.ChoiceType[];
13
+ // realm: Realm;
14
+ // }
15
+ // const handleToCheckMode =
16
+ // (mode:, selectIndexes, choices, realm) => (dispatch: any) => {
17
+ // const correctCnt = choices.filter((choice) => choice.isCorrect).length;
18
+ // dispatch(quizAction.replaceSelectedIndex(selectIndexes));
19
+ // const isFinished = selectIndexes.length >= correctCnt;
20
+ // if (isFinished) {
21
+ // dispatch(quizAction.changeMode("check"));
22
+ // // 正解しているか確認(複数回答にも対応)
23
+ // const isCorrected = selectIndexes.every((i) => choices[i]?.isCorrect);
24
+ // dispatch(quizAction.setIsCorrected(isCorrected));
25
+ // // 正解しているときの動作
26
+ // if (isCorrected) dispatch(quizAction.addOnePoint());
27
+ // // AsyncStorageに保存
28
+ // dispatch(saveStorage.saveQuizToStorage());
29
+ // dispatch(DailyLogModel.addOneCntToday(realm));
30
+ // }
31
+ // };
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { StackNavigationProp } from "@react-navigation/stack";
3
+ import { Nav } from "@nakamura-123/types";
4
+ interface FillDiagramProps {
5
+ navigation: StackNavigationProp<Nav.RootStackParamList>;
6
+ word: string;
7
+ yearId: number;
8
+ }
9
+ declare const FillDiagram: React.FC<FillDiagramProps>;
10
+ export default FillDiagram;
@@ -0,0 +1,27 @@
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
+ var react_1 = __importDefault(require("react"));
7
+ var react_redux_1 = require("react-redux");
8
+ var common_1 = require("@nakamura-123/common");
9
+ var FillDiagram = function (_a) {
10
+ var navigation = _a.navigation, word = _a.word, yearId = _a.yearId;
11
+ var qImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.qImgs; });
12
+ var diagramPathNum = getFullImgPathFromWord(word, qImgs, yearId);
13
+ return (<common_1.MiniIconBtn onPress={function () { return navigation.navigate("ImgZoom", { path: diagramPathNum }); }} icon="image" title="全体図" color="beige" size="sm" outline outerStyle={{ marginLeft: 5 }}/>);
14
+ };
15
+ // 関数定義
16
+ // 画像パスを取得
17
+ var getFullImgPathFromWord = function (word, qImgs, yearId) {
18
+ var num = extractNumberFromString(word);
19
+ var path = qImgs["diagram"]["q".concat(yearId, "_").concat(num)];
20
+ return path;
21
+ };
22
+ // 数字を抽出
23
+ var extractNumberFromString = function (input) {
24
+ var match = input.match(/\d+/);
25
+ return match ? parseInt(match[0], 10) : null;
26
+ };
27
+ exports.default = FillDiagram;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { StackNavigationProp } from "@react-navigation/stack";
3
+ import { Nav } from "@nakamura-123/types";
4
+ interface QuestionProps {
5
+ navigation: StackNavigationProp<Nav.RootStackParamList>;
6
+ }
7
+ declare const Question: React.FC<QuestionProps>;
8
+ export default Question;
@@ -0,0 +1,61 @@
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
+ var react_1 = __importDefault(require("react"));
7
+ var react_native_1 = require("react-native");
8
+ var react_redux_1 = require("react-redux");
9
+ var lib_1 = require("@nakamura-123/lib");
10
+ var FillDiagram_1 = __importDefault(require("./FillDiagram"));
11
+ var SearchYoutue_1 = __importDefault(require("./SearchYoutue"));
12
+ var RenderImgOrText_1 = __importDefault(require("../common/RenderImgOrText"));
13
+ var quizHook_1 = require("../../hooks/quizHook");
14
+ var QuestionFormats_1 = require("./QuestionFormats");
15
+ var quizHook_2 = require("../../hooks/quizHook");
16
+ var Question = function (_a) {
17
+ var navigation = _a.navigation;
18
+ var question = (0, quizHook_1.useQuestionData)();
19
+ // クイズの問題文を取得
20
+ var yearId = question.yearId, style = question.style, title = question.title, form = question.form;
21
+ var multiState = (0, react_redux_1.useSelector)(function (state) { return state.quiz.currentInfo.multi; });
22
+ var mode = (0, quizHook_2.useGetMode)();
23
+ var isQuizMode = mode === "quiz";
24
+ if (form === "multi")
25
+ question = (0, QuestionFormats_1.formatMultiQuestion)({ question: question, multiState: multiState, isQuizMode: isQuizMode });
26
+ if (form === "blank")
27
+ question = (0, QuestionFormats_1.formatBlankQuestion)(question, question.blankAns, isQuizMode);
28
+ var questionWords = question.question;
29
+ // ボタン部分
30
+ var diagramPath = findDiagramInStyle(style);
31
+ var isYoutubeSearch = (0, react_redux_1.useSelector)(function (state) { var _a; return (_a = state.app.appSetting.setting) === null || _a === void 0 ? void 0 : _a.isYoutubeSearch; });
32
+ // 問題文章がmultiの場合の整形
33
+ return (<react_native_1.View style={styles.container}>
34
+ {/* 問題表示 */}
35
+ {questionWords.map(function (word, index) { return (<RenderImgOrText_1.default key={index} word={word} imgKey={"q" + yearId} navigation={navigation}/>); })}
36
+ {/* ボタン類(youtube、全体図) */}
37
+ <react_native_1.View style={styles.btnBox}>
38
+ {isYoutubeSearch && <SearchYoutue_1.default title={title}/>}
39
+ {diagramPath && (<FillDiagram_1.default navigation={navigation} word={diagramPath} yearId={yearId}/>)}
40
+ </react_native_1.View>
41
+ </react_native_1.View>);
42
+ };
43
+ // 関数定義
44
+ // styleから図のパスを取得
45
+ var findDiagramInStyle = function (style) {
46
+ return style.find(function (item) { return item.includes("diagram"); });
47
+ };
48
+ var styles = react_native_1.StyleSheet.create({
49
+ container: {
50
+ justifyContent: "flex-start",
51
+ backgroundColor: lib_1.colors.ltBeige,
52
+ padding: 10,
53
+ marginBottom: 10,
54
+ },
55
+ btnBox: {
56
+ flexDirection: "row",
57
+ justifyContent: "flex-end",
58
+ marginVertical: 10,
59
+ },
60
+ });
61
+ exports.default = Question;
@@ -0,0 +1,8 @@
1
+ import { Store } from "@nakamura-123/types";
2
+ interface multiProps {
3
+ question: Store.DQInStoreMulti;
4
+ multiState: Store.MultiState;
5
+ }
6
+ export declare const formatMultiQuestion: ({ question, multiState, }: multiProps) => Store.DQInStoreMulti;
7
+ export declare const formatBlankQuestion: (question: Store.DQInStoreBlank, blankAns: string[]) => Store.DQInStoreBlank;
8
+ export {};
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatBlankQuestion = exports.formatMultiQuestion = void 0;
15
+ // 01.メインロジック・複数選択問題のフォーマット
16
+ var formatMultiQuestion = function (_a) {
17
+ var question = _a.question, multiState = _a.multiState;
18
+ var questionTexts = question.question, multiSel = question.multiSel;
19
+ // ansSels を抽出
20
+ var ansSels = multiSel.map(function (array) { var _a, _b; return (_b = (_a = array[0]) === null || _a === void 0 ? void 0 : _a.choice) !== null && _b !== void 0 ? _b : ""; });
21
+ var formattedQuestions = questionTexts.map(function (qText) {
22
+ return replaceMultiText(qText, multiState, ansSels);
23
+ });
24
+ return __assign(__assign({}, question), { question: formattedQuestions });
25
+ };
26
+ exports.formatMultiQuestion = formatMultiQuestion;
27
+ // 02.複数選択問題のzz1部分を赤や青、答えに置き換える
28
+ var RED_ZZ = "ZZAZZ";
29
+ var BLUE_ZZ = "ZZBZZ";
30
+ var replaceMultiText = function (qText, multiState, ansSels) {
31
+ var returnText = qText;
32
+ ansSels.forEach(function (sel, i) {
33
+ var nom = i + 1;
34
+ var regex = new RegExp("zz".concat(nom), "g");
35
+ var state = checkMultiState(multiState, i);
36
+ if (state === "red")
37
+ returnText = returnText.replace(regex, RED_ZZ);
38
+ else if (state === "blue")
39
+ returnText = returnText.replace(regex, BLUE_ZZ);
40
+ else
41
+ returnText = returnText.replace(regex, "JJ".concat(sel, "JJ"));
42
+ });
43
+ return returnText;
44
+ };
45
+ // 03.zz1などの形を判定する
46
+ var checkMultiState = function (multiState, index) {
47
+ var mTurn = multiState.turn, mMode = multiState.mode;
48
+ if (index === mTurn)
49
+ return mMode === "quiz" ? "red" : "ans";
50
+ if (index < mTurn)
51
+ return "ans";
52
+ return "blue";
53
+ };
54
+ // 10. 穴埋め問題のフォーマット
55
+ var formatBlankQuestion = function (question, blankAns) {
56
+ return __assign(__assign({}, question), { question: question.question.map(function (qText) {
57
+ return replaceBlankText(qText, blankAns);
58
+ }) });
59
+ };
60
+ exports.formatBlankQuestion = formatBlankQuestion;
61
+ var replaceBlankText = function (qText, blankAns) {
62
+ var returnText = qText;
63
+ blankAns.forEach(function (ans, i) {
64
+ var nom = i + 1;
65
+ var regex = new RegExp("zz".concat(nom), "g");
66
+ returnText = returnText.replace(regex, "XX".concat(ans, "XX"));
67
+ });
68
+ return returnText;
69
+ };
@@ -0,0 +1,9 @@
1
+ import { Store } from "@nakamura-123/types";
2
+ interface multiProps {
3
+ question: Store.DQInStoreMulti;
4
+ multiState: Store.MultiState;
5
+ isQuizMode: boolean;
6
+ }
7
+ export declare const formatMultiQuestion: ({ question, multiState, isQuizMode, }: multiProps) => Store.DQInStoreMulti;
8
+ export declare const formatBlankQuestion: (question: Store.DQInStoreBlank, blankAns: string[], isQuizMode: boolean) => Store.DQInStoreBlank;
9
+ export {};
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatBlankQuestion = exports.formatMultiQuestion = void 0;
15
+ // 01.メインロジック・複数選択問題のフォーマット
16
+ var formatMultiQuestion = function (_a) {
17
+ var question = _a.question, multiState = _a.multiState, isQuizMode = _a.isQuizMode;
18
+ var questionTexts = question.question, multiSel = question.multiSel;
19
+ // ansSels を抽出
20
+ var ansSels = multiSel.map(function (array) { var _a, _b; return (_b = (_a = array.find(function (a) { return a.isCorrect; })) === null || _a === void 0 ? void 0 : _a.choice) !== null && _b !== void 0 ? _b : ""; });
21
+ var formattedQuestions = questionTexts.map(function (qText) {
22
+ return replaceMultiText(qText, multiState, ansSels, isQuizMode);
23
+ });
24
+ console.log(formattedQuestions, "formattedQuestions");
25
+ return __assign(__assign({}, question), { question: formattedQuestions });
26
+ };
27
+ exports.formatMultiQuestion = formatMultiQuestion;
28
+ // 02.複数選択問題のzz1部分を赤や青、答えに置き換える
29
+ var RED_ZZ = "ZZAZZ";
30
+ var BLUE_ZZ = "ZZBZZ";
31
+ var replaceMultiText = function (qText, multiState, ansSels, isQuizMode) {
32
+ var returnText = qText;
33
+ ansSels.forEach(function (sel, i) {
34
+ var nom = i + 1;
35
+ var regex = new RegExp("zz".concat(nom), "g");
36
+ var state = checkMultiState(multiState, i, isQuizMode);
37
+ if (state === "red")
38
+ returnText = returnText.replace(regex, RED_ZZ);
39
+ else if (state === "blue")
40
+ returnText = returnText.replace(regex, BLUE_ZZ);
41
+ else
42
+ returnText = returnText.replace(regex, "JJ".concat(sel, "JJ"));
43
+ });
44
+ return returnText;
45
+ };
46
+ // 03.zz1などの形を判定する
47
+ var checkMultiState = function (multiState, index, isQuizMode) {
48
+ console.log(isQuizMode, "isQuizMode");
49
+ if (!isQuizMode)
50
+ return "ans";
51
+ var mTurn = multiState.turn, mMode = multiState.mode;
52
+ if (index === mTurn)
53
+ return mMode === "quiz" ? "red" : "ans";
54
+ if (index < mTurn)
55
+ return "ans";
56
+ return "blue";
57
+ };
58
+ // 10. 穴埋め問題のフォーマット
59
+ var formatBlankQuestion = function (question, blankAns, isQuizMode) {
60
+ return __assign(__assign({}, question), { question: question.question.map(function (qText) {
61
+ return replaceBlankText(qText, blankAns, isQuizMode);
62
+ }) });
63
+ };
64
+ exports.formatBlankQuestion = formatBlankQuestion;
65
+ var replaceBlankText = function (qText, blankAns, isQuizMode) {
66
+ var returnText = qText;
67
+ blankAns.forEach(function (ans, i) {
68
+ var nom = i + 1;
69
+ var regex = new RegExp("zz".concat(nom), "g");
70
+ returnText = isQuizMode
71
+ ? returnText.replace(regex, "XX".concat(nom, "XX"))
72
+ : returnText.replace(regex, "JJ".concat(ans, "JJ"));
73
+ });
74
+ return returnText;
75
+ };
@@ -0,0 +1,7 @@
1
+ import { Store } from "@nakamura-123/types";
2
+ interface multiProps {
3
+ questions: Store.DQInStoreMulti;
4
+ multiState: Store.MultiState;
5
+ }
6
+ export declare const formatMultiQuestion: ({ questions, multiState, }: multiProps) => string[];
7
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatMultiQuestion = void 0;
4
+ var types_1 = require("@nakamura-123/types");
5
+ // 01.メインロジック・複数選択問題のフォーマット
6
+ var formatMultiQuestion = function (_a) {
7
+ var questions = _a.questions, multiState = _a.multiState;
8
+ var questionTexts = questions.question;
9
+ if (types_1.qGard.isDQInStoreMulti(questions) === false)
10
+ return questionTexts;
11
+ var multiSel = questions.multiSel;
12
+ var ansSels = multiSel.map(function (array, i) { return array[0].choice; });
13
+ return questionTexts.map(function (qText) {
14
+ return replaceMultiText(qText, multiState, ansSels);
15
+ });
16
+ };
17
+ exports.formatMultiQuestion = formatMultiQuestion;
18
+ // 02.複数選択問題のzz1部分を赤や青、答えに置き換える
19
+ var RED_ZZ = "ZZAZZ";
20
+ var BLUE_ZZ = "ZZBZZ";
21
+ var replaceMultiText = function (qText, multiState, ansSels) {
22
+ var returnText = qText;
23
+ ansSels.forEach(function (sel, i) {
24
+ var nom = i + 1;
25
+ var regex = new RegExp("zz".concat(nom), "g");
26
+ var state = checkMultiState(multiState, i);
27
+ if (state === "red")
28
+ returnText = returnText.replace(regex, RED_ZZ);
29
+ else if (state === "blue")
30
+ returnText = returnText.replace(regex, BLUE_ZZ);
31
+ else
32
+ returnText = returnText.replace(regex, sel);
33
+ });
34
+ return returnText;
35
+ };
36
+ var checkMultiState = function (multiState, index) {
37
+ var mTurn = multiState.turn, mMode = multiState.mode;
38
+ if (index === mTurn)
39
+ return mMode === "quiz" ? "red" : "ans";
40
+ if (index < mTurn)
41
+ return "ans";
42
+ return "blue";
43
+ };
@@ -0,0 +1,7 @@
1
+ import { Store } from "@nakamura-123/types";
2
+ interface multiProps {
3
+ questions: Store.DQInStoreMulti;
4
+ multiState: Store.MultiState;
5
+ }
6
+ export declare const formatMultiQuestion: ({ questions, multiState, }: multiProps) => string[];
7
+ export {};