@nakamura-123/pages 1.3.15 → 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 +14 -19
  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
@@ -1,93 +1,196 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
29
+ const react_1 = __importStar(require("react"));
7
30
  const react_native_1 = require("react-native");
8
31
  const react_redux_1 = require("react-redux");
9
32
  const lib_1 = require("@nakamura-123/lib");
10
33
  const common_1 = require("@nakamura-123/common");
11
34
  const MyTextqqyy_1 = __importDefault(require("../../quiz/common/MyTextqqyy"));
12
35
  const RubyText_1 = __importDefault(require("../../quiz/common/RubyText"));
36
+ const JQuestionBottomText_1 = require("../../quiz/jQuestion/JQuestionBottomText");
37
+ const quizHook_1 = require("../../hooks/quizHook");
38
+ // 見直す一覧。番号・○×・問題文・訳・今の付箋。「すべて/×だけ」で切り替え、行をタップするとその問題を見直す
13
39
  const QuizFlatList = ({ navigation }) => {
14
40
  const dispatch = (0, react_redux_1.useDispatch)();
15
- // 01_Redux からデータを取得(useSelector を使用)
41
+ const { t } = (0, common_1.useDrillTranslation)();
42
+ const [filter, setFilter] = (0, react_1.useState)("all");
16
43
  const quizList = (0, react_redux_1.useSelector)((state) => state.quiz.quizList);
17
- const listData = quizList.map((quiz, i) => {
18
- const id = String(i);
19
- const questionText = quiz.system === "JLPT" ? quiz.question : quiz.question[0];
20
- const question = `(${i + 1}) ${questionText}`;
21
- const color = lib_1.tagLevels.filter((item) => item.level === quiz.tag)[0].color;
22
- const isCorrected = quiz.isCorrected;
23
- const system = quiz.system;
24
- return { id, question, color, index: i, isCorrected, system };
44
+ const lang = (0, quizHook_1.useGrammarLang)();
45
+ const grammarTrans = (0, react_redux_1.useSelector)((state) => state.app.grammarTrans[lang]);
46
+ const items = quizList.map((quiz, index) => {
47
+ var _a;
48
+ const base = { index, isCorrected: quiz.isCorrected, tag: quiz.tag };
49
+ if (quiz.system === "grammar")
50
+ return Object.assign(Object.assign({}, base), { system: "grammar", question: quiz.sentence, sub: (_a = grammarTrans === null || grammarTrans === void 0 ? void 0 : grammarTrans[quiz.quizId]) !== null && _a !== void 0 ? _a : null });
51
+ if (quiz.system === "JLPT")
52
+ return Object.assign(Object.assign({}, base), { system: "JLPT", question: quiz.question, sub: (0, JQuestionBottomText_1.getAnswerText)(quiz, quiz.form) || null });
53
+ return Object.assign(Object.assign({}, base), { system: "drill", question: quiz.question[0].replace(/zz/g, " 空欄"), sub: null });
25
54
  });
26
- // 02_リストアイテムのレンダリング
27
- const renderItem = ({ item }) => {
28
- const text = item.question.replace(/zz/g, " 空欄");
29
- const icon = item.isCorrected ? "circle" : "times";
30
- const iconColor = item.isCorrected ? "red" : "blue";
31
- return (<react_native_1.TouchableOpacity style={styles.itemContainer} activeOpacity={0.7} onPress={() => handlePress(item.index)}>
32
- <react_native_1.View>
33
- <common_1.IconInCircle name="tag" circleColor={item.color} size={11} iconColor="white"/>
34
- <react_native_1.View style={{ position: "absolute", top: -5, right: -5 }}>
35
- <common_1.Icon5 name={icon} size={11} color={iconColor}/>
36
- </react_native_1.View>
37
- </react_native_1.View>
38
- <react_native_1.View style={styles.questionBoxJ}>
39
- {item.system === "JLPT" ? (<RubyText_1.default fsize="sm" isNoWrap>
40
- {text}
41
- </RubyText_1.default>) : (<MyTextqqyy_1.default isNotSearch fsize="xs">
42
- {text}
43
- </MyTextqqyy_1.default>)}
44
- </react_native_1.View>
45
- </react_native_1.TouchableOpacity>);
46
- };
47
- // 03_タップ時の処理
55
+ const wrongCnt = items.filter((item) => item.isCorrected !== true).length;
56
+ const shown = filter === "all" ? items : items.filter((item) => item.isCorrected !== true);
48
57
  const handlePress = (index) => {
49
- // タップ時の処理を記述してください
50
58
  dispatch({ type: "quiz/jumpToTurn", payload: index });
51
59
  dispatch({ type: "quiz/toResult" });
52
60
  navigation.navigate("Quiz");
53
61
  };
62
+ const renderItem = ({ item }) => {
63
+ var _a, _b;
64
+ return (<react_native_1.TouchableOpacity style={styles.row} activeOpacity={0.7} onPress={() => handlePress(item.index)}>
65
+ <common_1.MyText fsize="xs" color="ltBlack" style={styles.num}>
66
+ {item.index + 1}
67
+ </common_1.MyText>
68
+ <Badge isCorrected={item.isCorrected} system={item.system}/>
69
+ <react_native_1.View style={styles.texts}>
70
+ <QuestionText item={item}/>
71
+ {item.sub && (<common_1.MyText fsize="xs" color="ltBlack" numberOfLines={1}>
72
+ {item.sub}
73
+ </common_1.MyText>)}
74
+ </react_native_1.View>
75
+ <common_1.IconInCircle name="tag" size={10} iconColor="white" circleColor={(_b = (_a = lib_1.tagLevels.find((level) => level.level === item.tag)) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : "light"} cStyle={styles.tag}/>
76
+ </react_native_1.TouchableOpacity>);
77
+ };
54
78
  return (<react_native_1.View style={styles.container}>
55
- <react_native_1.FlatList data={listData} keyExtractor={(item) => item.id} renderItem={renderItem} contentContainerStyle={styles.listContent} showsVerticalScrollIndicator={false} ItemSeparatorComponent={() => <react_native_1.View style={styles.border}/>}/>
79
+ <react_native_1.View style={styles.head}>
80
+ <common_1.MyText fsize="sm" weight={700}>
81
+ {t("quiz.result.review")}
82
+ </common_1.MyText>
83
+ <react_native_1.View style={styles.seg}>
84
+ {["all", "wrong"].map((f) => (<react_native_1.Pressable key={f} onPress={() => setFilter(f)} style={[styles.segItem, filter === f && styles.segOn]}>
85
+ <common_1.MyText fsize="xs" color={filter === f ? "white" : "text"}>
86
+ {f === "all"
87
+ ? `${t("quiz.result.all")} ${items.length}`
88
+ : `${t("quiz.result.wrongOnly")} ${wrongCnt}`}
89
+ </common_1.MyText>
90
+ </react_native_1.Pressable>))}
91
+ </react_native_1.View>
92
+ </react_native_1.View>
93
+ <react_native_1.FlatList data={shown} keyExtractor={(item) => String(item.index)} renderItem={renderItem} style={styles.list} showsVerticalScrollIndicator={false} ItemSeparatorComponent={() => <react_native_1.View style={styles.border}/>}/>
94
+ </react_native_1.View>);
95
+ };
96
+ // ○は赤(過去問は丸、JLPT・文法はチェック)、×は青のバツ、答えずに進めた問題は横棒
97
+ const Badge = ({ isCorrected, system }) => {
98
+ const correctIcon = system === "drill" ? "circle" : "check";
99
+ const background = isCorrected === undefined ? lib_1.colors.light : isCorrected ? lib_1.colors.red : lib_1.colors.blue;
100
+ const icon = isCorrected === undefined ? "minus" : isCorrected ? correctIcon : "times";
101
+ return (<react_native_1.View style={[styles.badge, { backgroundColor: background }]}>
102
+ <common_1.Icon5 name={icon} size={11} color="white"/>
56
103
  </react_native_1.View>);
57
104
  };
105
+ // 文法は例文をふりがなを外して2行まで出し、文法の部分(udl[ ])に下線を引く
106
+ const QuestionText = ({ item }) => {
107
+ if (item.system === "grammar") {
108
+ const parts = lib_1.utilFnc.parseRubyText(item.question);
109
+ return (<common_1.MyText fsize="sm" numberOfLines={2}>
110
+ {parts.map((part, i) => (<react_native_1.Text key={i} style={part.udl ? styles.udl : undefined}>
111
+ {part.base}
112
+ </react_native_1.Text>))}
113
+ </common_1.MyText>);
114
+ }
115
+ if (item.system === "JLPT")
116
+ return (<RubyText_1.default fsize="sm" isNoWrap>
117
+ {item.question}
118
+ </RubyText_1.default>);
119
+ return (<MyTextqqyy_1.default isNotSearch fsize="xs" numberOfLines={2} style={styles.drillText}>
120
+ {item.question}
121
+ </MyTextqqyy_1.default>);
122
+ };
58
123
  const styles = react_native_1.StyleSheet.create({
59
124
  container: {
60
125
  flex: 1,
61
- backgroundColor: lib_1.colors.beige,
62
- borderRadius: 10,
63
- marginTop: 10,
64
- },
65
- listContent: {
66
- padding: 16,
67
126
  width: "100%",
127
+ },
128
+ head: {
129
+ flexDirection: "row",
130
+ justifyContent: "space-between",
131
+ alignItems: "center",
132
+ marginTop: 14,
133
+ marginBottom: 6,
134
+ marginHorizontal: 2,
135
+ },
136
+ seg: {
137
+ flexDirection: "row",
68
138
  backgroundColor: lib_1.colors.bkBeige,
69
- paddingVertical: 0,
139
+ borderRadius: 8,
140
+ padding: 2,
141
+ },
142
+ segItem: {
143
+ paddingHorizontal: 9,
144
+ paddingVertical: 2,
145
+ borderRadius: 6,
146
+ },
147
+ segOn: {
148
+ backgroundColor: lib_1.colors.text,
70
149
  },
71
- border: { height: 1, backgroundColor: lib_1.colors.beige },
72
- itemContainer: {
73
- flexDirection: "row", // アイコンとテキストを横並びに
150
+ list: {
151
+ backgroundColor: lib_1.colors.bkBeige,
152
+ borderRadius: 12,
153
+ marginBottom: 14,
154
+ },
155
+ row: {
156
+ flexDirection: "row",
74
157
  alignItems: "center",
75
- justifyContent: "center",
76
- height: 50,
158
+ paddingVertical: 9,
159
+ paddingLeft: 6,
160
+ paddingRight: 10,
77
161
  },
78
- questionBoxJ: {
79
- marginLeft: 5,
80
- width: "90%",
81
- height: "100%",
162
+ num: {
163
+ width: 20,
164
+ textAlign: "center",
165
+ marginRight: 2,
166
+ },
167
+ tag: {
168
+ width: 22,
169
+ height: 22,
170
+ },
171
+ border: {
172
+ height: 1,
173
+ backgroundColor: lib_1.colors.beige,
174
+ },
175
+ badge: {
176
+ width: 26,
177
+ height: 26,
178
+ borderRadius: 13,
179
+ alignItems: "center",
82
180
  justifyContent: "center",
181
+ marginRight: 10,
182
+ },
183
+ texts: {
184
+ flex: 1,
185
+ minWidth: 0,
186
+ marginRight: 6,
83
187
  },
84
- questionBox: {
85
- marginLeft: 5,
86
- width: "90%",
87
- height: "100%",
188
+ udl: {
189
+ textDecorationLine: "underline",
190
+ textDecorationColor: lib_1.colors.green,
88
191
  },
89
- question: {
90
- fontSize: 13,
192
+ drillText: {
193
+ margin: 0,
91
194
  },
92
195
  });
93
196
  exports.default = QuizFlatList;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Nav } from "@nakamura-123/types";
3
+ interface Props {
4
+ navigation: Nav.NavigationProp<"Result">;
5
+ }
6
+ declare const ResultActions: React.FC<Props>;
7
+ export default ResultActions;
@@ -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
+ const react_1 = __importDefault(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const common_1 = require("@nakamura-123/common");
9
+ const lib_1 = require("@nakamura-123/lib");
10
+ const resultHook_1 = require("../../hooks/resultHook");
11
+ // 大きいボタンは「×の問題だけ解く」と「次へ」(次の項目があるときだけ)。全問○なら左は「全問やり直す」になる。
12
+ // 下の薄い段に「全問やり直す」(×があるとき)と「成績を見る」。戻るは画面左上にあるので置かない
13
+ const ResultActions = ({ navigation }) => {
14
+ const { t } = (0, common_1.useDrillTranslation)();
15
+ const wrongCnt = (0, resultHook_1.useWrongCount)();
16
+ const retry = (0, resultHook_1.useRetryQuizAction)(navigation);
17
+ const next = (0, resultHook_1.useNextInResult)(navigation);
18
+ return (<react_native_1.View style={styles.container}>
19
+ <react_native_1.View style={styles.acts}>
20
+ <common_1.PressAnimatedWrap onPress={() => retry(wrongCnt > 0)} outerStyle={styles.actOuter} style={[styles.act, styles.ghost]}>
21
+ <common_1.Icon5 name="redo" size={13} color="text" style={styles.icon}/>
22
+ <common_1.MyText fsize="sm" weight={700}>
23
+ {wrongCnt > 0
24
+ ? t("quiz.result.retryWrong", { cnt: wrongCnt })
25
+ : t("quiz.result.retryAll")}
26
+ </common_1.MyText>
27
+ </common_1.PressAnimatedWrap>
28
+ {next && (<common_1.PressAnimatedWrap onPress={next.go} outerStyle={styles.actOuter} style={[styles.act, styles.fill]}>
29
+ <common_1.MyText fsize="sm" weight={700} color="white">
30
+ {t(next.kind === "article"
31
+ ? "quiz.result.nextLesson"
32
+ : "quiz.result.nextQuiz")}
33
+ </common_1.MyText>
34
+ <common_1.Icon5 name="arrow-right" size={13} color="white" style={styles.iconRight}/>
35
+ </common_1.PressAnimatedWrap>)}
36
+ </react_native_1.View>
37
+ <react_native_1.View style={styles.subacts}>
38
+ {wrongCnt > 0 && (<>
39
+ <react_native_1.Pressable style={styles.sub} onPress={() => retry(false)}>
40
+ <common_1.Icon5 name="redo" size={11} color="ltBlack" style={styles.icon}/>
41
+ <common_1.MyText fsize="xs" color="ltBlack">
42
+ {t("quiz.result.retryAll")}
43
+ </common_1.MyText>
44
+ </react_native_1.Pressable>
45
+ <react_native_1.View style={styles.sep}/>
46
+ </>)}
47
+ <react_native_1.Pressable style={styles.sub} onPress={() => navigation.navigate("Grade")}>
48
+ <common_1.Icon5 name="chart-line" size={11} color="ltBlack" style={styles.icon}/>
49
+ <common_1.MyText fsize="xs" color="ltBlack">
50
+ {t("quiz.result.seeGrade")}
51
+ </common_1.MyText>
52
+ </react_native_1.Pressable>
53
+ </react_native_1.View>
54
+ </react_native_1.View>);
55
+ };
56
+ const styles = react_native_1.StyleSheet.create({
57
+ container: {
58
+ width: "100%",
59
+ },
60
+ acts: {
61
+ flexDirection: "row",
62
+ gap: 8,
63
+ marginTop: 10,
64
+ },
65
+ actOuter: {
66
+ flex: 1,
67
+ },
68
+ act: {
69
+ height: 40,
70
+ borderRadius: 10,
71
+ flexDirection: "row",
72
+ alignItems: "center",
73
+ justifyContent: "center",
74
+ },
75
+ ghost: {
76
+ backgroundColor: lib_1.colors.bkBeige,
77
+ borderWidth: 1.5,
78
+ borderColor: lib_1.colors.blue,
79
+ },
80
+ fill: {
81
+ backgroundColor: lib_1.colors.green,
82
+ },
83
+ icon: {
84
+ marginRight: 6,
85
+ },
86
+ iconRight: {
87
+ marginLeft: 6,
88
+ },
89
+ subacts: {
90
+ flexDirection: "row",
91
+ justifyContent: "center",
92
+ alignItems: "center",
93
+ paddingTop: 9,
94
+ },
95
+ sub: {
96
+ flexDirection: "row",
97
+ alignItems: "center",
98
+ paddingHorizontal: 7,
99
+ },
100
+ sep: {
101
+ width: 1,
102
+ height: 12,
103
+ backgroundColor: lib_1.colors.ltBlack,
104
+ opacity: 0.5,
105
+ },
106
+ });
107
+ exports.default = ResultActions;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { ScoreInfo } from "../../hooks/quizHook";
3
+ interface Props {
4
+ scoreInfo: ScoreInfo;
5
+ }
6
+ declare const ResultHero: React.FC<Props>;
7
+ export default ResultHero;
@@ -0,0 +1,166 @@
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_redux_1 = require("react-redux");
9
+ const common_1 = require("@nakamura-123/common");
10
+ const lib_1 = require("@nakamura-123/lib");
11
+ // 結果画面の上のカード。キャラ・言葉・点数・はんこを1枚にまとめる(試作 lesson_flow.html の「はんこ」案)。
12
+ // はんこは画像を使わず、枠・内側の細い輪・回転で描く。色は点数の段階の色
13
+ const ResultHero = ({ scoreInfo }) => {
14
+ var _a, _b;
15
+ const { t } = (0, common_1.useDrillTranslation)();
16
+ const pawIcon = (0, common_1.usePawIcon)();
17
+ const imgs = (0, react_redux_1.useSelector)((state) => state.app.imgs);
18
+ const showCharactor = (0, react_redux_1.useSelector)((state) => { var _a, _b; return (_b = (_a = state.app.appSetting.setting) === null || _a === void 0 ? void 0 : _a.showCharactor) !== null && _b !== void 0 ? _b : false; });
19
+ const selected = (0, react_redux_1.useSelector)((state) => state.quiz.selected);
20
+ const isShuffle = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.option.isShuffle);
21
+ const first = (0, react_redux_1.useSelector)((state) => state.quiz.quizList[0]);
22
+ const isMeaning = (first === null || first === void 0 ? void 0 : first.system) === "grammar" && first.form === "meaning";
23
+ const { score, quizCnt, percent } = scoreInfo;
24
+ const level = (_a = lib_1.scoreLevels.find((L) => percent <= L.maxPercent)) !== null && _a !== void 0 ? _a : lib_1.scoreLevels[2];
25
+ const color = lib_1.colors[level.color];
26
+ // ミニテストの題名には「ミニテスト」が入っているので形式を足さない
27
+ const kind = selected.type === "miniTest"
28
+ ? null
29
+ : isMeaning
30
+ ? t("quiz.result.meaning")
31
+ : t(isShuffle ? "quiz.result.random" : "quiz.result.ordered");
32
+ return (<react_native_1.View style={styles.card}>
33
+ <react_native_1.View style={styles.chip}>
34
+ <common_1.MyText fsize="xs" color="gray" numberOfLines={1}>
35
+ {kind ? `${selected.lesson.title}・${kind}` : selected.lesson.title}
36
+ </common_1.MyText>
37
+ </react_native_1.View>
38
+ <react_native_1.View style={styles.row}>
39
+ {showCharactor && (<react_native_1.View style={styles.charaBox}>
40
+ <react_native_1.View style={[styles.blob, { backgroundColor: color }]}/>
41
+ <react_native_1.Image style={styles.chara} source={(_b = imgs.chara) === null || _b === void 0 ? void 0 : _b[level.level]}/>
42
+ </react_native_1.View>)}
43
+ <react_native_1.View style={styles.texts}>
44
+ <common_1.MyText style={styles.enTitle}>{level.enTitle}</common_1.MyText>
45
+ <common_1.MyText fsize="xs" color="gray">
46
+ {t(`quiz.result.level.${level.level}`)}
47
+ </common_1.MyText>
48
+ <react_native_1.View style={styles.scoreRow}>
49
+ <react_native_1.View>
50
+ <common_1.MyText fsize="xs" color="ltBlack">
51
+ {t(isMeaning ? "quiz.result.understood" : "quiz.result.correctCnt")}
52
+ </common_1.MyText>
53
+ <react_native_1.View style={styles.num}>
54
+ <common_1.MyText weight={700} style={styles.score}>
55
+ {score}
56
+ </common_1.MyText>
57
+ <common_1.MyText color="gray" style={styles.cnt}>
58
+ /{quizCnt}
59
+ </common_1.MyText>
60
+ </react_native_1.View>
61
+ </react_native_1.View>
62
+ <react_native_1.View style={[styles.hanko, { borderColor: color }]}>
63
+ <react_native_1.View style={[styles.hankoInner, { borderColor: color }]}/>
64
+ <common_1.Icon5 name={pawIcon} size={16} color={level.color}/>
65
+ <common_1.MyText weight={700} style={[styles.hankoText, { color }]}>
66
+ {percent}%
67
+ </common_1.MyText>
68
+ </react_native_1.View>
69
+ </react_native_1.View>
70
+ </react_native_1.View>
71
+ </react_native_1.View>
72
+ </react_native_1.View>);
73
+ };
74
+ const styles = react_native_1.StyleSheet.create({
75
+ card: {
76
+ width: "100%",
77
+ marginTop: 50,
78
+ backgroundColor: lib_1.colors.bkBeige,
79
+ borderRadius: 18,
80
+ paddingVertical: 12,
81
+ paddingHorizontal: 14,
82
+ overflow: "hidden",
83
+ },
84
+ chip: {
85
+ alignSelf: "flex-start",
86
+ maxWidth: "100%",
87
+ backgroundColor: lib_1.colors.beige,
88
+ borderRadius: 10,
89
+ paddingHorizontal: 9,
90
+ paddingVertical: 1,
91
+ },
92
+ row: {
93
+ flexDirection: "row",
94
+ alignItems: "center",
95
+ marginTop: 2,
96
+ },
97
+ charaBox: {
98
+ width: 100,
99
+ height: 100,
100
+ marginRight: 10,
101
+ alignItems: "center",
102
+ justifyContent: "center",
103
+ },
104
+ // キャラの後ろの丸は真ん中(2026-10-03に利用者が決めた)
105
+ blob: {
106
+ position: "absolute",
107
+ width: 106,
108
+ height: 106,
109
+ borderRadius: 53,
110
+ opacity: 0.22,
111
+ },
112
+ chara: {
113
+ width: 100,
114
+ height: 100,
115
+ resizeMode: "contain",
116
+ },
117
+ texts: {
118
+ flex: 1,
119
+ },
120
+ enTitle: {
121
+ fontSize: 21,
122
+ lineHeight: 26,
123
+ },
124
+ scoreRow: {
125
+ flexDirection: "row",
126
+ alignItems: "center",
127
+ marginTop: 4,
128
+ },
129
+ num: {
130
+ flexDirection: "row",
131
+ alignItems: "baseline",
132
+ },
133
+ score: {
134
+ fontSize: 36,
135
+ lineHeight: 40,
136
+ },
137
+ cnt: {
138
+ fontSize: 15,
139
+ marginLeft: 3,
140
+ },
141
+ hanko: {
142
+ marginLeft: "auto",
143
+ width: 54,
144
+ height: 54,
145
+ borderRadius: 27,
146
+ borderWidth: 3,
147
+ alignItems: "center",
148
+ justifyContent: "center",
149
+ backgroundColor: "rgba(255,255,255,0.35)",
150
+ transform: [{ rotate: "-14deg" }],
151
+ },
152
+ hankoInner: {
153
+ position: "absolute",
154
+ top: 2,
155
+ left: 2,
156
+ right: 2,
157
+ bottom: 2,
158
+ borderRadius: 22,
159
+ borderWidth: 1.5,
160
+ },
161
+ hankoText: {
162
+ fontSize: 11,
163
+ lineHeight: 13,
164
+ },
165
+ });
166
+ exports.default = ResultHero;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { Store } from "@nakamura-123/types";
3
+ export declare const LANGUAGE_NAMES: Record<Store.Language, string>;
4
+ type LanguageModalProps = {
5
+ visible: boolean;
6
+ onClose: () => void;
7
+ };
8
+ declare const LanguageModal: React.FC<LanguageModalProps>;
9
+ export default LanguageModal;
@@ -0,0 +1,103 @@
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
+ exports.LANGUAGE_NAMES = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const react_native_1 = require("react-native");
9
+ const react_redux_1 = require("react-redux");
10
+ const common_1 = require("@nakamura-123/common");
11
+ const lib_1 = require("@nakamura-123/lib");
12
+ const stores_1 = require("@nakamura-123/stores");
13
+ // 選ぶ人が読めるよう、それぞれの言語で書く
14
+ exports.LANGUAGE_NAMES = {
15
+ en: "English",
16
+ ja: "日本語",
17
+ ko: "한국어",
18
+ zhHans: "简体中文",
19
+ zhHant: "繁體中文",
20
+ };
21
+ // 言語を選ぶ画面。ホームの言語ボタンと設定画面から開く
22
+ const LanguageModal = ({ visible, onClose }) => {
23
+ var _a;
24
+ const dispatch = (0, react_redux_1.useDispatch)();
25
+ const { i18n } = (0, common_1.useDrillTranslation)();
26
+ const languages = (_a = (0, react_redux_1.useSelector)((state) => state.app.appSetting.setting.languages)) !== null && _a !== void 0 ? _a : ["en", "ja"];
27
+ const current = (0, react_redux_1.useSelector)((state) => state.setting.language);
28
+ const handleLanguageSelect = (language) => {
29
+ i18n === null || i18n === void 0 ? void 0 : i18n.changeLanguage(language); // 言語を切り替える
30
+ dispatch({ type: "setting/setLanguage", payload: language });
31
+ dispatch(stores_1.settingStorage.saveSetting());
32
+ onClose();
33
+ };
34
+ return (<react_native_1.Modal transparent={true} visible={visible} animationType="slide" onRequestClose={onClose}>
35
+ <react_native_1.View style={styles.modalContainer}>
36
+ <react_native_1.View style={styles.modalContent}>
37
+ <react_native_1.Text style={styles.modalTitle}>Select Language</react_native_1.Text>
38
+ {languages.map((language) => (<react_native_1.TouchableOpacity key={language} style={[
39
+ styles.modalButton,
40
+ language === current && styles.modalButtonCurrent,
41
+ ]} onPress={() => handleLanguageSelect(language)}>
42
+ <react_native_1.Text style={styles.modalButtonText}>
43
+ {exports.LANGUAGE_NAMES[language]}
44
+ </react_native_1.Text>
45
+ </react_native_1.TouchableOpacity>))}
46
+ <react_native_1.TouchableOpacity style={styles.modalCloseButton} onPress={onClose}>
47
+ <react_native_1.Text style={styles.modalCloseButtonText}>Close</react_native_1.Text>
48
+ </react_native_1.TouchableOpacity>
49
+ </react_native_1.View>
50
+ </react_native_1.View>
51
+ </react_native_1.Modal>);
52
+ };
53
+ const styles = react_native_1.StyleSheet.create({
54
+ modalContainer: {
55
+ flex: 1,
56
+ justifyContent: "center",
57
+ alignItems: "center",
58
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
59
+ },
60
+ modalContent: {
61
+ width: 300,
62
+ padding: 20,
63
+ backgroundColor: "#fff",
64
+ borderRadius: 10,
65
+ alignItems: "center",
66
+ },
67
+ modalTitle: {
68
+ fontSize: 18,
69
+ fontWeight: "bold",
70
+ marginBottom: 20,
71
+ },
72
+ modalButton: {
73
+ padding: 10,
74
+ backgroundColor: lib_1.colors.light,
75
+ borderRadius: 5,
76
+ marginVertical: 5,
77
+ width: "100%",
78
+ alignItems: "center",
79
+ // 選択中の枠で大きさが変わらないよう、ふだんも透明な枠を持つ
80
+ borderWidth: 2,
81
+ borderColor: "transparent",
82
+ },
83
+ modalButtonCurrent: {
84
+ borderColor: lib_1.colors.darkGray,
85
+ },
86
+ modalButtonText: {
87
+ color: "#000",
88
+ fontSize: 16,
89
+ },
90
+ modalCloseButton: {
91
+ marginTop: 10,
92
+ padding: 10,
93
+ backgroundColor: "#ccc",
94
+ borderRadius: 5,
95
+ width: "100%",
96
+ alignItems: "center",
97
+ },
98
+ modalCloseButtonText: {
99
+ color: "#000",
100
+ fontSize: 16,
101
+ },
102
+ });
103
+ exports.default = LanguageModal;