@nakamura-123/pages 0.1.21 → 0.1.23

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 (128) hide show
  1. package/dist/component/Basic/BasicContents.js +3 -1
  2. package/dist/component/Basic/MiniTestCard.js +11 -3
  3. package/dist/component/Basic/SelectedExamCnt.js +3 -0
  4. package/dist/component/Basic/SubCategoryList.d.ts +1 -1
  5. package/dist/component/Basic/SubCategoryList.js +28 -19
  6. package/dist/component/Grade/AllTags.d.ts +2 -2
  7. package/dist/component/Grade/AllTags.js +2 -2
  8. package/dist/component/Grade/JAllTags.d.ts +5 -0
  9. package/dist/component/Grade/JAllTags.js +45 -0
  10. package/dist/component/QuizSet/QuizOptionDrill.d.ts +2 -2
  11. package/dist/component/QuizSet/QuizOptionDrill.js +9 -5
  12. package/dist/component/Result/QuizFlatList.js +20 -7
  13. package/dist/component/SettingBtns/TransBtn.d.ts +4 -0
  14. package/dist/component/SettingBtns/TransBtn.js +119 -0
  15. package/dist/component/SubCagegoryList.js +182 -95
  16. package/dist/component/Tag5s.js +2 -2
  17. package/dist/component/TagBadge5s.js +14 -33
  18. package/dist/component/TagBadge5sPress.js +2 -2
  19. package/dist/functions/commonFilter.d.ts +0 -0
  20. package/dist/functions/commonFilter.js +12 -0
  21. package/dist/functions/createQuizFnc.d.ts +6 -13
  22. package/dist/functions/createQuizFnc.js +18 -18
  23. package/dist/functions/createQuizFncD.d.ts +18 -0
  24. package/dist/functions/createQuizFncD.js +80 -0
  25. package/dist/functions/createQuizFncJ.d.ts +9 -0
  26. package/dist/functions/createQuizFncJ.js +63 -0
  27. package/dist/functions/gradeFnc.js +1 -1
  28. package/dist/functions/questionFilter.d.ts +1 -3
  29. package/dist/functions/questionFilterD.d.ts +14 -0
  30. package/dist/functions/questionFilterD.js +79 -0
  31. package/dist/functions/questionFilterJ.d.ts +10 -0
  32. package/dist/functions/questionFilterJ.js +36 -0
  33. package/dist/functions/questionFilterJLPT.d.ts +5 -0
  34. package/dist/functions/questionFilterJLPT.js +17 -0
  35. package/dist/functions/questionFormat copy.d.ts +7 -0
  36. package/dist/functions/questionFormat copy.js +103 -0
  37. package/dist/functions/questionFormat.d.ts +2 -2
  38. package/dist/functions/questionFormatD.d.ts +7 -0
  39. package/dist/functions/questionFormatD.js +104 -0
  40. package/dist/functions/questionFormatJ.d.ts +8 -0
  41. package/dist/functions/questionFormatJ.js +95 -0
  42. package/dist/functions/tagFnc.js +14 -14
  43. package/dist/functions/tagFncD.d.ts +18 -0
  44. package/dist/functions/tagFncD.js +114 -0
  45. package/dist/functions/tagFncJ.d.ts +7 -0
  46. package/dist/functions/tagFncJ.js +44 -0
  47. package/dist/functions/tagFncJLPT.d.ts +5 -0
  48. package/dist/functions/tagFncJLPT.js +18 -0
  49. package/dist/hooks/basicHook.d.ts +3 -0
  50. package/dist/hooks/basicHook.js +20 -1
  51. package/dist/hooks/quizActionHook.d.ts +3 -3
  52. package/dist/hooks/quizActionHook.js +22 -5
  53. package/dist/hooks/quizHook.d.ts +9 -2
  54. package/dist/hooks/quizHook.js +51 -5
  55. package/dist/index.d.ts +4 -1
  56. package/dist/index.js +7 -1
  57. package/dist/page/BootPage.js +6 -6
  58. package/dist/page/DatailSettingPage.d.ts +3 -0
  59. package/dist/page/DatailSettingPage.js +25 -0
  60. package/dist/page/GetBadgePage.js +1 -1
  61. package/dist/page/GradePage.js +5 -2
  62. package/dist/page/GuidePage.d.ts +10 -0
  63. package/dist/page/GuidePage.js +112 -0
  64. package/dist/page/JDatailSettingPage.d.ts +3 -0
  65. package/dist/page/JDatailSettingPage.js +25 -0
  66. package/dist/page/JDetailSettingPage.d.ts +3 -0
  67. package/dist/page/JDetailSettingPage.js +51 -0
  68. package/dist/page/QuizPage.js +15 -69
  69. package/dist/page/QuizSetupPage.js +20 -8
  70. package/dist/page/ReportPage.js +1 -1
  71. package/dist/page/TestPage.js +15 -5
  72. package/dist/quiz/QuizContentDrill.d.ts +15 -0
  73. package/dist/quiz/QuizContentDrill.js +34 -0
  74. package/dist/quiz/QuizContentsDrill.d.ts +16 -0
  75. package/dist/quiz/QuizContentsDrill.js +70 -0
  76. package/dist/quiz/QuizContentsJLPT.d.ts +16 -0
  77. package/dist/quiz/QuizContentsJLPT.js +31 -0
  78. package/dist/quiz/Title.js +3 -1
  79. package/dist/quiz/answer/Answer.js +7 -6
  80. package/dist/quiz/answer/BlankBtn.js +7 -2
  81. package/dist/quiz/answer/Input/InputAnswerBtn.js +1 -1
  82. package/dist/quiz/answer/MultiChoice.js +2 -0
  83. package/dist/quiz/answer/NormalChoice.js +1 -1
  84. package/dist/quiz/check/NextQuizBtn.js +1 -0
  85. package/dist/quiz/check/SelectTag.js +21 -5
  86. package/dist/quiz/common/MyTextqqyy.js +1 -2
  87. package/dist/quiz/common/PageContainerWrap.d.ts +1 -1
  88. package/dist/quiz/common/RenderImgOrText.d.ts +4 -4
  89. package/dist/quiz/common/RenderImgOrText.js +7 -3
  90. package/dist/quiz/common/RubyText.d.ts +6 -1
  91. package/dist/quiz/common/RubyText.js +58 -39
  92. package/dist/quiz/common/ZoomableImage.d.ts +1 -0
  93. package/dist/quiz/common/ZoomableImage.js +2 -2
  94. package/dist/quiz/explain/Explain.js +4 -2
  95. package/dist/quiz/jAnswer/JAnswer.d.ts +8 -0
  96. package/dist/quiz/jAnswer/JAnswer.js +57 -0
  97. package/dist/quiz/jAnswer/JAnswerContents.d.ts +16 -0
  98. package/dist/quiz/jAnswer/JAnswerContents.js +82 -0
  99. package/dist/quiz/jQuestion/JQuestion.d.ts +8 -0
  100. package/dist/quiz/jQuestion/JQuestion.js +41 -0
  101. package/dist/quiz/jQuestion/JQuestionBottomText.d.ts +7 -0
  102. package/dist/quiz/jQuestion/JQuestionBottomText.js +46 -0
  103. package/dist/quiz/jQuestion/JQuestionText.d.ts +7 -0
  104. package/dist/quiz/jQuestion/JQuestionText.js +43 -0
  105. package/dist/quiz/jQuestion/QuizCnt.d.ts +3 -0
  106. package/dist/quiz/jQuestion/QuizCnt.js +44 -0
  107. package/dist/quiz/jQuestion/TimeLimit.d.ts +6 -0
  108. package/dist/quiz/jQuestion/TimeLimit.js +97 -0
  109. package/dist/quiz/question/Question.js +3 -1
  110. package/dist/quiz/setting/Above3BtnJ copy.d.ts +8 -0
  111. package/dist/quiz/setting/Above3BtnJ copy.js +78 -0
  112. package/dist/quiz/setting/Above3BtnJ.d.ts +8 -0
  113. package/dist/quiz/setting/Above3BtnJ.js +56 -0
  114. package/dist/quiz/setting/Bottom2BtnJ.d.ts +8 -0
  115. package/dist/quiz/setting/Bottom2BtnJ.js +86 -0
  116. package/dist/quiz/setting/Bottom3Btn.js +1 -23
  117. package/dist/quiz/setting/Bottom3BtnJ.d.ts +8 -0
  118. package/dist/quiz/setting/Bottom3BtnJ.js +78 -0
  119. package/dist/quiz/setting/GuideBtn.d.ts +8 -0
  120. package/dist/quiz/setting/GuideBtn.js +38 -0
  121. package/dist/quiz/setting/RepeatBtn.d.ts +6 -0
  122. package/dist/quiz/setting/RepeatBtn.js +77 -0
  123. package/dist/quiz/system/QuizContentDrill.d.ts +0 -0
  124. package/dist/quiz/system/QuizContentDrill.js +1 -0
  125. package/dist/tsconfig.tsbuildinfo +1 -1
  126. package/dist/types/filterType.d.ts +15 -0
  127. package/dist/types/filterType.js +2 -0
  128. package/package.json +2 -2
@@ -0,0 +1,31 @@
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 Guide_1 = __importDefault(require("../component/Guide"));
9
+ var PageContainerWrap_1 = __importDefault(require("./common/PageContainerWrap"));
10
+ var JQuestion_1 = __importDefault(require("./jQuestion/JQuestion"));
11
+ var JAnswer_1 = __importDefault(require("./jAnswer/JAnswer"));
12
+ var QuizContentDrill = function (_a) {
13
+ var navigation = _a.navigation, guideName = _a.guideName, showSwipe1Guide = _a.showSwipe1Guide, showSwipe2Guide = _a.showSwipe2Guide, isCheck = _a.isCheck, isResult = _a.isResult, isNotInput = _a.isNotInput, isNotQuiz = _a.isNotQuiz, isInputQuizMode = _a.isInputQuizMode, turn = _a.turn;
14
+ return (<PageContainerWrap_1.default scrollViewRef={null} navigation={navigation}>
15
+ <Guide_1.default name={guideName} isVisible={showSwipe1Guide || showSwipe2Guide}>
16
+ <react_native_1.View></react_native_1.View>
17
+ </Guide_1.default>
18
+ <react_native_1.View style={styles.container}>
19
+ <JQuestion_1.default navigation={navigation}/>
20
+ <JAnswer_1.default navigation={navigation}/>
21
+ </react_native_1.View>
22
+ <></>
23
+ </PageContainerWrap_1.default>);
24
+ };
25
+ var styles = react_native_1.StyleSheet.create({
26
+ container: {
27
+ flex: 1,
28
+ justifyContent: "space-between",
29
+ },
30
+ });
31
+ exports.default = QuizContentDrill;
@@ -12,9 +12,11 @@ var quizHook_1 = require("../hooks/quizHook");
12
12
  var QuizTitle = function () {
13
13
  var _a;
14
14
  var turn = (0, react_redux_1.useSelector)(function (state) { return state.quiz.currentInfo.state.turn; });
15
- var question = (0, quizHook_1.useQuestionData)();
15
+ var question = (0, quizHook_1.useQuestionDataD)();
16
16
  var allQuizCnt = (0, react_redux_1.useSelector)(function (state) { return state.quiz.quizList.length; });
17
17
  var isShowTag = (0, react_redux_1.useSelector)(function (state) { return state.quizCfg.inQuizOption.isShowTag; });
18
+ if (!question)
19
+ return null;
18
20
  var title = question.title;
19
21
  var cntText = "".concat(turn + 1, " / ").concat(allQuizCnt, "\u554F\u76EE");
20
22
  var tagColor = ((_a = lib_1.tagLevels.find(function (tag) { return tag.level === question.tag; })) === null || _a === void 0 ? void 0 : _a.color) || "ltBlack";
@@ -8,7 +8,6 @@ var react_native_1 = require("react-native");
8
8
  var types_1 = require("@nakamura-123/types");
9
9
  var NormalChoice_1 = __importDefault(require("./NormalChoice"));
10
10
  var quizHook_1 = require("../../hooks/quizHook");
11
- var qGardType_1 = require("@nakamura-123/types/dist/gard/qGardType");
12
11
  var MultiChoice_1 = __importDefault(require("./MultiChoice"));
13
12
  var MultiNextBtn_1 = __importDefault(require("./MultiNextBtn"));
14
13
  var quizHook_2 = require("../../hooks/quizHook");
@@ -17,23 +16,25 @@ var BlankBtn_1 = __importDefault(require("./BlankBtn"));
17
16
  var InputNav_1 = __importDefault(require("./InputNav"));
18
17
  var isDQInStoreNormal = types_1.qGard.isDQInStoreNormal;
19
18
  var Answer = function (_a) {
20
- var question = (0, quizHook_1.useQuestionData)();
19
+ var question = (0, quizHook_1.useQuestionDataD)();
20
+ if (!question)
21
+ return null;
21
22
  var mode = (0, quizHook_2.useGetMode)();
22
23
  return (<react_native_1.View style={styles.container}>
23
24
  {/* 1.ノーマルモード */}
24
- {isDQInStoreNormal(question) && <NormalChoice_1.default question={question}/>}
25
+ {types_1.qGard.isDQInStoreNormal(question) && (<NormalChoice_1.default question={question}/>)}
25
26
  {/* 2.Multiモード */}
26
- {(0, qGardType_1.isDQInStoreMulti)(question) && mode === "quiz" && (<>
27
+ {types_1.qGard.isDQInStoreMulti(question) && mode === "quiz" && (<>
27
28
  <MultiChoice_1.default question={question}/>
28
29
  <MultiNextBtn_1.default question={question}/>
29
30
  </>)}
30
31
  {/* 3.穴埋めモード */}
31
- {(0, qGardType_1.isDQInStoreBlank)(question) && mode === "quiz" && (<>
32
+ {types_1.qGard.isDQInStoreBlank(question) && mode === "quiz" && (<>
32
33
  <BlankAnswer_1.default question={question}/>
33
34
  <BlankBtn_1.default />
34
35
  </>)}
35
36
  {/* 4.記述モード */}
36
- {(0, qGardType_1.isDQInStoreInput)(question) && <InputNav_1.default question={question}/>}
37
+ {types_1.qGard.isDQInStoreInput(question) && <InputNav_1.default question={question}/>}
37
38
  </react_native_1.View>);
38
39
  };
39
40
  var styles = react_native_1.StyleSheet.create({
@@ -10,9 +10,14 @@ var quizActionHook_1 = require("../../hooks/quizActionHook");
10
10
  var lib_1 = require("@nakamura-123/lib");
11
11
  var BlankBtn = function () {
12
12
  var useHandleCheck = (0, quizActionHook_1.useChangeModeToCheck)();
13
+ var handleCheck = function (isCorrect) {
14
+ if (!useHandleCheck)
15
+ return;
16
+ useHandleCheck(isCorrect);
17
+ };
13
18
  return (<react_native_1.View style={styles.container}>
14
- <CheckButton text="不正解" iconName="times" backgroundColor={lib_1.colors.blue} onPress={function () { return useHandleCheck(false); }}/>
15
- <CheckButton text="正解" iconName="check" backgroundColor={lib_1.colors.red} onPress={function () { return useHandleCheck(true); }}/>
19
+ <CheckButton text="不正解" iconName="times" backgroundColor={lib_1.colors.blue} onPress={function () { return handleCheck(false); }}/>
20
+ <CheckButton text="正解" iconName="check" backgroundColor={lib_1.colors.red} onPress={function () { return handleCheck(true); }}/>
16
21
  </react_native_1.View>);
17
22
  };
18
23
  var CheckButton = function (_a) {
@@ -26,7 +26,7 @@ var InputAnswerBtn = function () {
26
26
  { text: "正 解", color: "red", icon: "check", isCheck: true },
27
27
  ];
28
28
  return (<react_native_1.View style={styles.container}>
29
- {buttons.map(function (btn, index) { return (<react_native_1.TouchableOpacity key={index} style={__assign(__assign({}, styles.btn), { backgroundColor: lib_1.colors[btn.color] })} onPress={function () { return useHandleCheck(btn.isCheck); }} activeOpacity={0.7}>
29
+ {buttons.map(function (btn, index) { return (<react_native_1.TouchableOpacity key={index} style={__assign(__assign({}, styles.btn), { backgroundColor: lib_1.colors[btn.color] })} onPress={function () { return useHandleCheck && useHandleCheck(btn.isCheck); }} activeOpacity={0.7}>
30
30
  <common_1.IconInCircle name={btn.icon} circleColor="white" iconColor={btn.color} size={13} cStyle={styles.icon}/>
31
31
  <common_1.MyText weight={700} color="white">
32
32
  {btn.text}
@@ -45,6 +45,8 @@ var MultiChoice = function (_a) {
45
45
  if (!isLastTurn(mTurn, multiSel))
46
46
  return;
47
47
  var isCorrectedQuiz = newMCorrects.every(function (c) { return c; });
48
+ if (!useHandleCheck)
49
+ return;
48
50
  useHandleCheck(isCorrectedQuiz, false);
49
51
  };
50
52
  // ChoiceViewに必要なロジックを作成(normalとほぼ共通)
@@ -43,7 +43,7 @@ var NormalChoice = function (_a) {
43
43
  // 選択肢を選択(複数答えがあるときは全て)選んだ場合、checkモードへ移行する際の処理
44
44
  var isCorrected = newSelectedIndexes.every(function (index) { var _a; return (_a = choices[index]) === null || _a === void 0 ? void 0 : _a.isCorrect; });
45
45
  // 共通処理
46
- useHandleCheck(isCorrected);
46
+ useHandleCheck && useHandleCheck(isCorrected);
47
47
  };
48
48
  // 選択肢のアウトラインの色を決める
49
49
  var wordAndColors = choices.map(function (_a, i) {
@@ -18,6 +18,7 @@ var NextQuiz = function (_a) {
18
18
  var _b = (0, react_redux_1.useSelector)(function (state) { return state.quiz.currentInfo.state; }), turn = _b.turn, activeTurn = _b.activeTurn, mode = _b.mode;
19
19
  var isResult = mode === "result";
20
20
  var isActiveTurn = turn === activeTurn;
21
+ // 画面遷移のための関数を定義
21
22
  // 2つのボタンを定義
22
23
  var btnInfo = {
23
24
  next: { icon: "gesture-swipe-left", text: "次へ" },
@@ -23,20 +23,36 @@ var common_1 = require("@nakamura-123/common");
23
23
  var quizHook_1 = require("../../hooks/quizHook");
24
24
  var db_1 = require("@nakamura-123/db");
25
25
  var react_i18next_1 = require("react-i18next");
26
+ var react_redux_2 = require("react-redux");
26
27
  var changeTagLevel = db_1.TagModel.changeTagLevel;
27
28
  var SelectTag = function () {
28
29
  var realm = (0, react_2.useRealm)();
29
30
  var dispatch = (0, react_redux_1.useDispatch)();
30
31
  var t = (0, react_i18next_1.useTranslation)().t;
31
- var question = (0, quizHook_1.useQuestionData)();
32
- var tagInfos = getTagInfos(lib_1.tagLevels, question.tag);
33
- var tagId = question
34
- ? (0, quizHook_1.useTagIdByYearNum)(question.yearId, question.num)
35
- : null;
32
+ var selected = (0, react_redux_2.useSelector)(function (state) { return state.quiz.selected; });
33
+ var selectedSystem = selected.system || "drill";
34
+ var tagInfos = null;
35
+ var tagId = null;
36
+ if (selectedSystem === "JlptBasic" || selectedSystem === "JlptListen") {
37
+ var question = (0, quizHook_1.useQuestionDataJ)();
38
+ if (!question)
39
+ return null;
40
+ tagInfos = getTagInfos(lib_1.tagLevels, question.tag);
41
+ tagId = (0, quizHook_1.useTagIdJ)(question.quizId, selected.tagName);
42
+ }
43
+ else {
44
+ var question = (0, quizHook_1.useQuestionDataD)();
45
+ if (!question)
46
+ return null;
47
+ tagInfos = getTagInfos(lib_1.tagLevels, question.tag);
48
+ tagId = (0, quizHook_1.useTagIdByYearNum)(question.yearId, question.num);
49
+ }
36
50
  var onPress = function (level) {
37
51
  if (tagId)
38
52
  dispatch(changeTagLevel({ realm: realm, tagId: tagId, level: level }));
39
53
  };
54
+ if (!tagInfos)
55
+ return null;
40
56
  return (<react_native_1.View style={styles.container}>
41
57
  {tagInfos.map(function (_a, i) {
42
58
  var circleColor = _a.circleColor, iconColor = _a.iconColor, textColor = _a.textColor, level = _a.level;
@@ -109,8 +109,7 @@ var renderText = function (item, onSearch, fsize, fWeight, dispatch) {
109
109
  };
110
110
  var styles = react_native_1.StyleSheet.create({
111
111
  p: {
112
- marginVertical: 5,
113
- marginHorizontal: 5,
112
+ margin: 5,
114
113
  },
115
114
  searchText: {
116
115
  // color: colors.blue,
@@ -3,7 +3,7 @@ import { StackNavigationProp } from "@react-navigation/stack";
3
3
  import { Nav } from "@nakamura-123/types";
4
4
  interface PageContainerProps {
5
5
  navigation: StackNavigationProp<Nav.RootStackParamList>;
6
- scrollViewRef: React.RefObject<any>;
6
+ scrollViewRef: React.RefObject<any> | null;
7
7
  children: React.ReactNode;
8
8
  }
9
9
  declare const PageContainerWrap: React.FC<PageContainerProps>;
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import { StackNavigationProp } from "@react-navigation/stack";
3
3
  import { Nav } from "@nakamura-123/types";
4
- interface RenderChoiceProps {
4
+ interface Props {
5
5
  word: string;
6
- imgKey: string;
6
+ imgKey?: string;
7
7
  navigation?: StackNavigationProp<Nav.RootStackParamList>;
8
8
  isNotSearch?: boolean;
9
9
  selectable?: boolean;
10
10
  }
11
- declare const RenderChoice: React.FC<RenderChoiceProps>;
12
- export default RenderChoice;
11
+ declare const RenderImgOrText: React.FC<Props>;
12
+ export default RenderImgOrText;
@@ -9,15 +9,19 @@ var lib_1 = require("@nakamura-123/lib");
9
9
  var MyTextqqyy_1 = __importDefault(require("./MyTextqqyy"));
10
10
  var common_1 = require("@nakamura-123/common");
11
11
  var ZoomableImage_1 = __importDefault(require("./ZoomableImage"));
12
- var RenderChoice = function (_a) {
13
- var word = _a.word, imgKey = _a.imgKey, navigation = _a.navigation, isNotSearch = _a.isNotSearch, selectable = _a.selectable;
12
+ var RubyText_1 = __importDefault(require("./RubyText"));
13
+ var RenderImgOrText = function (_a) {
14
+ var word = _a.word, _b = _a.imgKey, imgKey = _b === void 0 ? null : _b, navigation = _a.navigation, isNotSearch = _a.isNotSearch, selectable = _a.selectable;
14
15
  var qImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.qImgs; });
16
+ var regex = /\)ff\(/;
15
17
  if (typeof word === "string" && /^\//.test(word)) {
16
18
  var path = lib_1.utilFnc.getImgPathFromWord(qImgs, imgKey, word);
17
19
  return navigation ? (<ZoomableImage_1.default path={path} navigation={navigation}/>) : (<common_1.MyImage path={path}/>);
18
20
  }
21
+ else if (regex.test(word))
22
+ return <RubyText_1.default>{word}</RubyText_1.default>;
19
23
  return (<MyTextqqyy_1.default isNotSearch={isNotSearch} selectable={selectable}>
20
24
  {word}
21
25
  </MyTextqqyy_1.default>);
22
26
  };
23
- exports.default = RenderChoice;
27
+ exports.default = RenderImgOrText;
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
+ import { ViewStyle } from "react-native";
3
+ import { FontSize } from "@nakamura-123/lib";
2
4
  interface RubyTextProps {
3
- text: string;
5
+ children: string;
6
+ cStyle?: ViewStyle;
7
+ fsize?: FontSize;
8
+ isNoWrap?: boolean;
4
9
  }
5
10
  declare const RubyText: React.FC<RubyTextProps>;
6
11
  export default RubyText;
@@ -1,4 +1,15 @@
1
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
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -6,58 +17,66 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
17
  var react_1 = __importDefault(require("react"));
7
18
  var react_native_1 = require("react-native");
8
19
  var MyTextqqyy_1 = __importDefault(require("./MyTextqqyy"));
9
- var parseRubyText = function (text) {
10
- var regex = /\(([^)]+)\)ff\(([^)]+)\)/g; // [] → () に変更
11
- var match;
12
- var parts = [];
13
- var lastIndex = 0;
14
- while ((match = regex.exec(text)) !== null) {
15
- // () の前のテキストを追加
16
- if (match.index > lastIndex) {
17
- parts.push({ base: text.slice(lastIndex, match.index) });
18
- }
19
- // ルビ付きの部分を追加
20
- parts.push({ base: match[1], ruby: match[2] });
21
- lastIndex = regex.lastIndex;
22
- }
23
- // 残りのテキストを追加
24
- if (lastIndex < text.length) {
25
- parts.push({ base: text.slice(lastIndex) });
26
- }
27
- return parts;
28
- };
20
+ var react_redux_1 = require("react-redux");
21
+ var lib_1 = require("@nakamura-123/lib");
29
22
  var RubyText = function (_a) {
30
- var text = _a.text;
31
- var parsedText = parseRubyText(text);
32
- return (<react_native_1.Text style={styles.container}>
23
+ var fsize = _a.fsize, cStyle = _a.cStyle, isNoWrap = _a.isNoWrap, children = _a.children;
24
+ var parsedText = lib_1.utilFnc.parseRubyText(children);
25
+ var fontSize = (0, react_redux_1.useSelector)(function (state) { return state.quizCfg.inQuizOption.fsize; });
26
+ // const nextSize = getNextFontSize(fontSize);
27
+ fontSize = fsize || fontSize;
28
+ // const marginBottom = fontSize === "xxl" ? 0 : -5;
29
+ var flexWrap = isNoWrap ? "nowrap" : "wrap";
30
+ var _b = getLineHeight(fontSize), bHeight = _b.bHeight, oHeight = _b.oHeight;
31
+ return (<react_native_1.View style={__assign(__assign({}, styles.lineWrap), { flexWrap: flexWrap })}>
33
32
  {parsedText.map(function (part, index) {
34
- return part.ruby ? (<react_native_1.View key={index} style={styles.rubyContainer}>
35
- <react_native_1.Text style={styles.ruby}>{part.ruby}</react_native_1.Text>
36
- <MyTextqqyy_1.default style={styles.base}>{part.base}</MyTextqqyy_1.default>
37
- </react_native_1.View>) : (<react_native_1.Text key={index} style={styles.base}>
33
+ return part.ruby ? (<react_native_1.Text key={index} style={__assign(__assign({}, styles.rubyWrapper), cStyle)}>
34
+ <MyTextqqyy_1.default style={__assign({}, styles.ruby)} fsize="xs">
35
+ {part.ruby}
36
+ </MyTextqqyy_1.default>
37
+ {"\n"}
38
+ <MyTextqqyy_1.default style={__assign(__assign({}, styles.base), { lineHeight: bHeight })} fsize={fontSize}>
39
+ {part.base}
40
+ </MyTextqqyy_1.default>
41
+ </react_native_1.Text>) : (<MyTextqqyy_1.default key={index} style={__assign(__assign({}, styles.onlyBase), { lineHeight: oHeight })} fsize={fontSize}>
38
42
  {part.base}
39
- </react_native_1.Text>);
43
+ </MyTextqqyy_1.default>);
40
44
  })}
41
- </react_native_1.Text>);
45
+ </react_native_1.View>);
46
+ };
47
+ // LineHeightを算出し、返す
48
+ var getLineHeight = function (fontSize) {
49
+ var lineHeightMap = {
50
+ xxxl: { bHeight: 28, oHeight: 42 },
51
+ xxl: { bHeight: 24, oHeight: 39 },
52
+ xl: { bHeight: 20, oHeight: 36 },
53
+ lg: { bHeight: 18, oHeight: 34 },
54
+ md: { bHeight: 16, oHeight: 34 },
55
+ sm: { bHeight: 14, oHeight: 33 },
56
+ xs: { bHeight: 11, oHeight: 32 },
57
+ };
58
+ return lineHeightMap[fontSize];
42
59
  };
43
60
  var styles = react_native_1.StyleSheet.create({
44
- container: {
61
+ lineWrap: {
45
62
  flexDirection: "row",
46
- flexWrap: "wrap",
47
63
  },
48
- rubyContainer: {
49
- alignItems: "center",
50
- marginBottom: -10,
64
+ rubyWrapper: {
65
+ lineHeight: 30,
66
+ marginHorizontal: 1,
51
67
  },
52
68
  ruby: {
53
- fontSize: 10,
54
- lineHeight: 10,
69
+ lineHeight: 12,
55
70
  textAlign: "center",
56
- marginBottom: -15,
71
+ color: "#555",
57
72
  },
58
73
  base: {
59
- fontSize: 16,
60
- lineHeight: 30,
74
+ lineHeight: 20,
75
+ textAlign: "center",
76
+ },
77
+ onlyBase: {
78
+ lineHeight: 35,
79
+ margin: 0,
61
80
  },
62
81
  });
63
82
  exports.default = RubyText;
@@ -4,6 +4,7 @@ import { Nav } from "@nakamura-123/types";
4
4
  interface ZoomableImageProps {
5
5
  navigation: StackNavigationProp<Nav.RootStackParamList>;
6
6
  path: number;
7
+ maxHeightValue?: number;
7
8
  }
8
9
  declare const ZoomableImage: React.FC<ZoomableImageProps>;
9
10
  export default ZoomableImage;
@@ -7,12 +7,12 @@ var react_1 = __importDefault(require("react"));
7
7
  var react_native_1 = require("react-native");
8
8
  var common_1 = require("@nakamura-123/common");
9
9
  var ZoomableImage = function (_a) {
10
- var navigation = _a.navigation, path = _a.path;
10
+ var navigation = _a.navigation, path = _a.path, maxHeightValue = _a.maxHeightValue;
11
11
  var handleImgPress = function (path) {
12
12
  return navigation === null || navigation === void 0 ? void 0 : navigation.navigate("ImgZoom", { path: path });
13
13
  };
14
14
  return (<react_native_1.TouchableOpacity onPress={function () { return handleImgPress(path); }} activeOpacity={0.7}>
15
- <common_1.MyImage path={path}/>
15
+ <common_1.MyImage path={path} maxHeightValue={maxHeightValue}/>
16
16
  </react_native_1.TouchableOpacity>);
17
17
  };
18
18
  exports.default = ZoomableImage;
@@ -15,9 +15,11 @@ var ZoomableImage_1 = __importDefault(require("../common/ZoomableImage"));
15
15
  var MyTextqqyy_1 = __importDefault(require("../common/MyTextqqyy"));
16
16
  var Explain = function (_a) {
17
17
  var navigation = _a.navigation;
18
- var question = (0, quizHook_1.useQuestionData)();
18
+ var question = (0, quizHook_1.useQuestionDataD)();
19
19
  var rImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.rImgs; });
20
20
  var mImgs = (0, react_redux_1.useSelector)(function (state) { return state.app.imgs.mImgs; });
21
+ if (!question)
22
+ return null;
21
23
  var yearId = question.yearId, explain = question.explain;
22
24
  if (!explain)
23
25
  return null;
@@ -54,7 +56,7 @@ var Explain = function (_a) {
54
56
  }
55
57
  if (I.viewType === "rImg") {
56
58
  var path = lib_1.utilFnc.getrImgPath(rImgs, I.word);
57
- return (<ZoomableImage_1.default key={index} path={path} navigation={navigation}/>);
59
+ return (<ZoomableImage_1.default key={index} path={path} navigation={navigation} maxHeightValue={1000}/>);
58
60
  }
59
61
  if (I.viewType === "mImg") {
60
62
  var pathes = lib_1.utilFnc.getmImgPathes(mImgs, I.yearId, I.num);
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { StackNavigationProp } from "@react-navigation/stack";
3
+ import { Nav } from "@nakamura-123/types";
4
+ type Prop = {
5
+ navigation: StackNavigationProp<Nav.RootStackParamList>;
6
+ };
7
+ declare const JAnswer: React.FC<Prop>;
8
+ export default JAnswer;
@@ -0,0 +1,57 @@
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 stores_1 = require("@nakamura-123/stores");
7
+ var react_1 = __importDefault(require("react"));
8
+ var react_native_1 = require("react-native");
9
+ var react_redux_1 = require("react-redux");
10
+ var quizHook_1 = require("../../hooks/quizHook");
11
+ var JAnswerContents_1 = __importDefault(require("./JAnswerContents"));
12
+ var react_redux_2 = require("react-redux");
13
+ var quizActionHook_1 = require("../../hooks/quizActionHook");
14
+ var getChoiceStyle_1 = require("../answer/styles/getChoiceStyle");
15
+ var JAnswer = function (_a) {
16
+ var navigation = _a.navigation;
17
+ var dispatch = (0, react_redux_2.useDispatch)();
18
+ var question = (0, quizHook_1.useQuestionDataJ)();
19
+ var selectedIndexes = (question === null || question === void 0 ? void 0 : question.selectedIndexes) || [];
20
+ var choices = (question === null || question === void 0 ? void 0 : question.choices) || [];
21
+ var form = question === null || question === void 0 ? void 0 : question.form;
22
+ var useHandleCheck = (0, quizActionHook_1.useChangeModeToCheck)("JLPT", question);
23
+ var isDoublePress = (0, react_redux_1.useSelector)(function (state) { return state.quizCfg.inQuizOption; }).isDoublePress;
24
+ var mode = (0, quizHook_1.useGetMode)();
25
+ // 選択肢を選んだ時の処理
26
+ var handleChoice = function (i) {
27
+ var _a;
28
+ if (mode !== "quiz")
29
+ return;
30
+ dispatch(stores_1.quizAction.replaceSelectedIndex([i]));
31
+ var isCorrected = (_a = choices[i]) === null || _a === void 0 ? void 0 : _a.isCorrect;
32
+ // 共通処理
33
+ useHandleCheck && useHandleCheck(isCorrected);
34
+ };
35
+ // 選択肢のアウトラインの色を決める
36
+ var wordAndColors = choices.map(function (_a, i) {
37
+ var choice = _a.choice, isCorrect = _a.isCorrect;
38
+ if (form === "basicSelImg" || form === "listenSelImg")
39
+ choice = "/".concat(choice);
40
+ return {
41
+ word: choice,
42
+ color: (0, getChoiceStyle_1.getChoiceOutlineColor)(selectedIndexes, mode, isCorrect, i),
43
+ };
44
+ });
45
+ // imgだった場合、表示させるためのTopKey
46
+ return (<JAnswerContents_1.default wordAndColors={wordAndColors} isDoublePress={isDoublePress} handleChoice={handleChoice} isNotSearch={false} navigation={navigation}/>);
47
+ };
48
+ var styles = react_native_1.StyleSheet.create({
49
+ container: {
50
+ backgroundColor: "#fff",
51
+ },
52
+ text: {
53
+ fontSize: 18,
54
+ color: "#333",
55
+ },
56
+ });
57
+ exports.default = JAnswer;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { ColorKeys } from "@nakamura-123/lib";
3
+ import { Nav } from "@nakamura-123/types";
4
+ import { StackNavigationProp } from "@react-navigation/stack";
5
+ type Prop = {
6
+ wordAndColors: {
7
+ word: string;
8
+ color: ColorKeys;
9
+ }[];
10
+ isDoublePress: boolean;
11
+ handleChoice: (index: number) => void;
12
+ isNotSearch?: boolean;
13
+ navigation: StackNavigationProp<Nav.RootStackParamList>;
14
+ };
15
+ declare const JAnswerContents: React.FC<Prop>;
16
+ export default JAnswerContents;
@@ -0,0 +1,82 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var common_1 = require("@nakamura-123/common");
18
+ var react_1 = __importDefault(require("react"));
19
+ var react_native_1 = require("react-native");
20
+ var RenderImgOrText_1 = __importDefault(require("../common/RenderImgOrText"));
21
+ var lib_1 = require("@nakamura-123/lib");
22
+ var RepeatBtn_1 = __importDefault(require("../setting/RepeatBtn"));
23
+ var GuideBtn_1 = __importDefault(require("../setting/GuideBtn"));
24
+ var JAnswerContents = function (_a) {
25
+ var wordAndColors = _a.wordAndColors, isDoublePress = _a.isDoublePress, handleChoice = _a.handleChoice, isNotSearch = _a.isNotSearch, navigation = _a.navigation;
26
+ return (<react_native_1.View>
27
+ <react_native_1.View style={styles.bottomBtnBox}>
28
+ <RepeatBtn_1.default isPreLoad={true}/>
29
+ <GuideBtn_1.default navigation={navigation}/>
30
+ </react_native_1.View>
31
+ <react_native_1.View style={styles.container}>
32
+ {wordAndColors.map(function (_a, i) {
33
+ var word = _a.word, color = _a.color;
34
+ return (<common_1.DoubleTapWrapper key={i} onPress={function () { return handleChoice(i); }} isDoublePress={isDoublePress}>
35
+ <react_native_1.View style={__assign(__assign({}, styles.choice), { borderColor: lib_1.colors[color] })}>
36
+ {color === "red" && (<react_native_1.View style={styles.maruBox}>
37
+ <common_1.IconInCircle name="check" size={15} iconColor="green" cStyle={{ width: 25, height: 25 }}/>
38
+ </react_native_1.View>)}
39
+ <RenderImgOrText_1.default word={word} isNotSearch={isNotSearch}/>
40
+ </react_native_1.View>
41
+ </common_1.DoubleTapWrapper>);
42
+ })}
43
+ </react_native_1.View>
44
+ </react_native_1.View>);
45
+ };
46
+ var styles = react_native_1.StyleSheet.create({
47
+ container: {
48
+ justifyContent: "space-between",
49
+ flexDirection: "row",
50
+ flexWrap: "wrap",
51
+ marginHorizontal: 5,
52
+ marginBottom: 60,
53
+ },
54
+ bottomBtnBox: {
55
+ flexDirection: "row",
56
+ justifyContent: "space-between",
57
+ marginHorizontal: 10,
58
+ marginBottom: 10,
59
+ },
60
+ maruBox: {
61
+ position: "absolute",
62
+ top: 3,
63
+ left: 3,
64
+ zIndex: 1,
65
+ borderRadius: 10,
66
+ backgroundColor: lib_1.colors.bkBeige,
67
+ justifyContent: "center",
68
+ alignItems: "center",
69
+ },
70
+ choice: {
71
+ position: "relative",
72
+ backgroundColor: lib_1.colors.bkBeige,
73
+ justifyContent: "center",
74
+ alignItems: "center",
75
+ width: "49%",
76
+ height: 111,
77
+ marginBottom: 5,
78
+ borderRadius: 5,
79
+ borderWidth: 2,
80
+ },
81
+ });
82
+ exports.default = JAnswerContents;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { Nav } from "@nakamura-123/types";
3
+ import { StackNavigationProp } from "@react-navigation/stack";
4
+ type Props = {
5
+ navigation: StackNavigationProp<Nav.RootStackParamList>;
6
+ };
7
+ declare const JQuestion: React.FC<Props>;
8
+ export default JQuestion;