@nakamura-123/pages 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/Article/ArticleContentView.js +36 -43
- package/dist/component/Article/ArticleContents.js +5 -4
- package/dist/component/Article/Cloze.d.ts +1 -1
- package/dist/component/Article/Cloze.js +15 -5
- package/dist/component/Basic/BasicContents.js +5 -4
- package/dist/component/Basic/MiniTestCard.js +3 -2
- package/dist/component/Grade/GAllTags.js +3 -4
- package/dist/component/PointBox.d.ts +6 -0
- package/dist/component/PointBox.js +51 -0
- package/dist/component/Result/QuizFlatList.js +2 -1
- package/dist/functions/articleContentFnc.d.ts +0 -1
- package/dist/functions/articleContentFnc.js +18 -8
- package/dist/functions/joinTitleFnc.d.ts +1 -0
- package/dist/functions/joinTitleFnc.js +15 -0
- package/dist/page/ArticlePage.js +4 -1
- package/dist/page/BasicPage.js +4 -1
- package/dist/quiz/common/renderTransUdl.d.ts +3 -0
- package/dist/quiz/common/renderTransUdl.js +20 -0
- package/dist/quiz/explain/ExplainBox.js +9 -7
- package/dist/quiz/grammar/GQuestion.js +13 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -34,9 +34,11 @@ const common_1 = require("@nakamura-123/common");
|
|
|
34
34
|
const articleContentFnc_1 = require("../../functions/articleContentFnc");
|
|
35
35
|
const Cloze_1 = require("./Cloze");
|
|
36
36
|
const MyTextqqyy_1 = __importDefault(require("../../quiz/common/MyTextqqyy"));
|
|
37
|
+
const renderTransUdl_1 = require("../../quiz/common/renderTransUdl");
|
|
37
38
|
const ArticleTable_1 = __importDefault(require("./ArticleTable"));
|
|
38
39
|
const ArticleImage_1 = __importDefault(require("./ArticleImage"));
|
|
39
40
|
const FramesFigure_1 = __importDefault(require("./FramesFigure"));
|
|
41
|
+
const PointBox_1 = __importDefault(require("../PointBox"));
|
|
40
42
|
const isJudgmentBlock = (block) => (block === null || block === void 0 ? void 0 : block.type) === "incorrect" || (block === null || block === void 0 ? void 0 : block.type) === "correct";
|
|
41
43
|
const ArticleContentView = ({ content, articleId, navigation, exampleOffset = 0, isLesson = false, }) => {
|
|
42
44
|
let exampleCount = exampleOffset;
|
|
@@ -149,12 +151,12 @@ const ArticleBlockView = ({ block, blockIndex, exampleNumber, exampleImg, groupP
|
|
|
149
151
|
exampleImg !== undefined && styles.exampleTopWithImg,
|
|
150
152
|
]}>
|
|
151
153
|
{exampleImg === undefined && exampleLabel}
|
|
152
|
-
<Cloze_1.ExampleText text={block.japanese}
|
|
154
|
+
<Cloze_1.ExampleText text={block.japanese} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={styles.exampleText}/>
|
|
153
155
|
</react_native_1.View>
|
|
154
156
|
{block.translation && (<react_native_1.TouchableOpacity onPress={() => setIsRevealed(!isRevealed)} style={styles.exampleBottom}>
|
|
155
157
|
{/* 非表示時もopacity:0で全幅描画し、訳文の実際の高さ分の領域を最初から確保する(アイコンの有無で幅が変わって高さがずれないよう、アイコンは重ねて表示する別レイヤーにする) */}
|
|
156
158
|
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} color="text" style={!isRevealed && styles.invisibleText}>
|
|
157
|
-
{renderTransUdl(block.translation)}
|
|
159
|
+
{(0, renderTransUdl_1.renderTransUdl)(block.translation, styles.transUdl)}
|
|
158
160
|
</common_1.MyText>
|
|
159
161
|
{!isRevealed && (<react_native_1.View style={styles.exampleBottomOverlay}>
|
|
160
162
|
<common_1.Icon5 name="eye" size={14} color="ltBlack" style={styles.exampleBottomIcon}/>
|
|
@@ -200,33 +202,30 @@ const ArticleBlockView = ({ block, blockIndex, exampleNumber, exampleImg, groupP
|
|
|
200
202
|
lineHeight: (0, articleContentFnc_1.getScaledLineHeight)((0, articleContentFnc_1.getScaledFsize)("md", userFsize), 22),
|
|
201
203
|
}}/>
|
|
202
204
|
</react_native_1.View>);
|
|
203
|
-
//
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
<common_1.
|
|
209
|
-
|
|
210
|
-
|
|
205
|
+
// 意味の欄の注意(n2bの訳だけ。英語の「considering」は理由にも使えるが…のように、母語から来る取り違えを先に止める)。
|
|
206
|
+
// 伏せずに目立たせる(2026-11-18、本人)。札の名前は訳の側が持つ(Note・주의・注意・Lưu ý)
|
|
207
|
+
case "note":
|
|
208
|
+
return (<react_native_1.View style={styles.noteBox}>
|
|
209
|
+
<react_native_1.View style={styles.noteLabel}>
|
|
210
|
+
<common_1.Icon5 name="exclamation-triangle" size={11} color="red" style={styles.noteLabelIcon}/>
|
|
211
|
+
{block.label ? (<common_1.MyText fsize="xs" weight={700} style={styles.noteLabelText}>
|
|
212
|
+
{block.label}
|
|
213
|
+
</common_1.MyText>) : null}
|
|
211
214
|
</react_native_1.View>
|
|
215
|
+
<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={{
|
|
216
|
+
lineHeight: (0, articleContentFnc_1.getScaledLineHeight)((0, articleContentFnc_1.getScaledFsize)("md", userFsize), 22),
|
|
217
|
+
}}/>
|
|
218
|
+
</react_native_1.View>);
|
|
219
|
+
case "point":
|
|
220
|
+
return (<PointBox_1.default>
|
|
212
221
|
<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(700, userFWeight)} style={{
|
|
213
222
|
lineHeight: (0, articleContentFnc_1.getScaledLineHeight)((0, articleContentFnc_1.getScaledFsize)("md", userFsize), 24),
|
|
214
223
|
}}/>
|
|
215
|
-
</
|
|
224
|
+
</PointBox_1.default>);
|
|
216
225
|
default:
|
|
217
226
|
return null;
|
|
218
227
|
}
|
|
219
228
|
};
|
|
220
|
-
// 例文の訳の中の、空欄に当たる部分(udl[…])に下線を引く。外側の文字の大きさ・太さを受け継ぐので、中は色と線だけ持つ
|
|
221
|
-
const renderTransUdl = (text) => text
|
|
222
|
-
.split(/(udl\[[^\]]+\])/)
|
|
223
|
-
.filter((chunk) => chunk.length > 0)
|
|
224
|
-
.map((chunk, i) => {
|
|
225
|
-
const m = chunk.match(/^udl\[([^\]]+)\]$/);
|
|
226
|
-
return m ? (<react_native_1.Text key={i} style={styles.transUdl}>
|
|
227
|
-
{m[1]}
|
|
228
|
-
</react_native_1.Text>) : (chunk);
|
|
229
|
-
});
|
|
230
229
|
// 説明の文の【文法名】を太字・緑に、使い分けの決め手(udl[…])に下線を引く(n2bのunit。dk2の記事には【】もudl[]も無い)
|
|
231
230
|
// 太さはfontFamilyで決まるので、太字は700の書体に替える
|
|
232
231
|
const renderBodyMarks = (text) => text
|
|
@@ -430,33 +429,27 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
430
429
|
exampleNoteIcon: {
|
|
431
430
|
marginRight: 6,
|
|
432
431
|
},
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
borderColor: lib_1.colors.darkGray,
|
|
442
|
-
borderRadius: 14,
|
|
432
|
+
noteBox: {
|
|
433
|
+
marginTop: 4,
|
|
434
|
+
marginBottom: 12,
|
|
435
|
+
paddingVertical: 8,
|
|
436
|
+
paddingHorizontal: 12,
|
|
437
|
+
borderLeftWidth: 4,
|
|
438
|
+
borderLeftColor: lib_1.colors.yellow,
|
|
439
|
+
borderRadius: 6,
|
|
443
440
|
backgroundColor: lib_1.colors.white,
|
|
444
441
|
},
|
|
445
|
-
|
|
446
|
-
position: "absolute",
|
|
447
|
-
top: -12,
|
|
448
|
-
left: 12,
|
|
442
|
+
noteLabel: {
|
|
449
443
|
flexDirection: "row",
|
|
450
444
|
alignItems: "center",
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
borderWidth: 1.5,
|
|
455
|
-
borderColor: lib_1.colors.darkGray,
|
|
456
|
-
backgroundColor: lib_1.colors.yellow,
|
|
457
|
-
},
|
|
458
|
-
pointLabelIcon: {
|
|
445
|
+
marginBottom: 2,
|
|
446
|
+
},
|
|
447
|
+
noteLabelIcon: {
|
|
459
448
|
marginRight: 6,
|
|
460
449
|
},
|
|
450
|
+
// 共通の黄(#F7D44C)は白の上の文字には薄いので、同じ系統の濃い色にする
|
|
451
|
+
noteLabelText: {
|
|
452
|
+
color: "#A06A00",
|
|
453
|
+
},
|
|
461
454
|
});
|
|
462
455
|
exports.default = ArticleContentView;
|
|
@@ -32,6 +32,7 @@ const react_native_gesture_handler_1 = require("react-native-gesture-handler");
|
|
|
32
32
|
const react_redux_1 = require("react-redux");
|
|
33
33
|
const common_1 = require("@nakamura-123/common");
|
|
34
34
|
const stores_1 = require("@nakamura-123/stores");
|
|
35
|
+
const joinTitleFnc_1 = require("../../functions/joinTitleFnc");
|
|
35
36
|
const Badge5s_1 = __importDefault(require("../Basic/Badge5s"));
|
|
36
37
|
const TagBadge5s_1 = __importDefault(require("../TagBadge5s"));
|
|
37
38
|
const ArticleCategoryList_1 = __importDefault(require("./ArticleCategoryList"));
|
|
@@ -42,7 +43,7 @@ const SelectedExamCnt_1 = __importDefault(require("../Basic/SelectedExamCnt"));
|
|
|
42
43
|
const BasicProgressBar_1 = __importDefault(require("../Basic/BasicProgressBar"));
|
|
43
44
|
const ArticleContents = ({ navigation, subject, index }) => {
|
|
44
45
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
45
|
-
const { t } = (0, common_1.useDrillTranslation)();
|
|
46
|
+
const { t, i18n } = (0, common_1.useDrillTranslation)();
|
|
46
47
|
// // Reduxから必要なデータを一括取得
|
|
47
48
|
const categoryList = (0, react_redux_1.useSelector)((state) => state.app[subject.list]);
|
|
48
49
|
const activeIndex = (0, react_redux_1.useSelector)((state) => state.setting.viewSet[subject.name].activeIndex);
|
|
@@ -54,7 +55,7 @@ const ArticleContents = ({ navigation, subject, index }) => {
|
|
|
54
55
|
// カテゴリー名を計算
|
|
55
56
|
const categoryName = `${selectedList.label} ${selectedList.title}`.trim();
|
|
56
57
|
const selectKey = selectedList.key;
|
|
57
|
-
const categoryLabel = selectedList.label
|
|
58
|
+
const categoryLabel = (0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, selectedList.label, selectedList.title);
|
|
58
59
|
const initScrollY = (0, react_redux_1.useSelector)((state) => state.setting.viewSet[subject.name].scrollY);
|
|
59
60
|
const scrollViewRef = (0, react_1.useRef)(null);
|
|
60
61
|
// 移動を監視
|
|
@@ -88,7 +89,7 @@ const ArticleContents = ({ navigation, subject, index }) => {
|
|
|
88
89
|
tagName: subject.tag,
|
|
89
90
|
system: subject.system,
|
|
90
91
|
lesson: {
|
|
91
|
-
title:
|
|
92
|
+
title: categoryLabel,
|
|
92
93
|
key: ALL_NUM,
|
|
93
94
|
},
|
|
94
95
|
}));
|
|
@@ -112,7 +113,7 @@ const ArticleContents = ({ navigation, subject, index }) => {
|
|
|
112
113
|
<Badge5s_1.default badgeType="basic" subject={subject.name} category={selectKey}/>
|
|
113
114
|
<TagBadge5s_1.default subject={subject} index={index}/>
|
|
114
115
|
<common_1.HelpMark name="quizOption.allQuiz" top={0}/>
|
|
115
|
-
<common_1.RoundRectangleIcon title={categoryLabel
|
|
116
|
+
<common_1.RoundRectangleIcon title={(0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, categoryLabel, t("basic.allQuiz"))} icon={allQuizIcon} onPress={handleAllQuiz}/>
|
|
116
117
|
<BasicSetting_1.default navigation={navigation} subjectType={subject.type}/>
|
|
117
118
|
</react_native_gesture_handler_1.ScrollView>);
|
|
118
119
|
};
|
|
@@ -17,12 +17,12 @@ interface ClozeTextProps {
|
|
|
17
17
|
groupOf?: (hole: number) => string;
|
|
18
18
|
holeEm?: number;
|
|
19
19
|
ruby?: boolean;
|
|
20
|
+
underlineHoles?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare const RUBY_LINE_EM = 2.3;
|
|
22
23
|
export declare const ClozeText: React.FC<ClozeTextProps>;
|
|
23
24
|
interface ExampleTextProps {
|
|
24
25
|
text: string;
|
|
25
|
-
group: string;
|
|
26
26
|
fsize: FontSize;
|
|
27
27
|
weight: FontWeight;
|
|
28
28
|
style?: TextStyle;
|
|
@@ -111,7 +111,7 @@ const RubyWord = ({ base, ruby, fsize, weight }) => {
|
|
|
111
111
|
};
|
|
112
112
|
// 穴は文字の並びの中に置く箱で描く(数式の部品と同じやり方)。押すと箱が答えの幅まで広がり、後ろの文字は少しずつ押し出される
|
|
113
113
|
// (一度に答えを入れると、後ろの文字が一瞬で飛んで読みにくいため)
|
|
114
|
-
const ClozeText = ({ text, fsize, weight, style, groupOf, holeEm = 4.5, ruby = false, }) => {
|
|
114
|
+
const ClozeText = ({ text, fsize, weight, style, groupOf, holeEm = 4.5, ruby = false, underlineHoles = false, }) => {
|
|
115
115
|
const cloze = (0, react_1.useContext)(ClozeContext);
|
|
116
116
|
const figRef = (0, RefLink_1.useRefLink)();
|
|
117
117
|
const parts = (0, articleContentFnc_1.splitCloze)(text);
|
|
@@ -149,6 +149,10 @@ const ClozeText = ({ text, fsize, weight, style, groupOf, holeEm = 4.5, ruby = f
|
|
|
149
149
|
}
|
|
150
150
|
if (part.type === "math")
|
|
151
151
|
return (<MathView key={i} math={part.content} config={MyTextqqyy_1.mathConfigs[fsize]}/>);
|
|
152
|
+
if (underlineHoles)
|
|
153
|
+
return (<common_1.MyText key={i} fsize={fsize} weight={weight} color="red" style={styles.exampleUdl}>
|
|
154
|
+
{ruby ? (0, articleContentFnc_1.stripRuby)(part.content) : part.content}
|
|
155
|
+
</common_1.MyText>);
|
|
152
156
|
const g = groupOf ? groupOf(holeIndex[i]) : (0, articleContentFnc_1.holeGroup)(part.content);
|
|
153
157
|
return (<HoleBox key={i} answer={ruby ? (0, articleContentFnc_1.stripRuby)(part.content) : part.content} isOpen={(_b = cloze === null || cloze === void 0 ? void 0 : cloze.opened.has(g)) !== null && _b !== void 0 ? _b : true} onOpen={() => cloze === null || cloze === void 0 ? void 0 : cloze.open(g)} onSearch={part.search && (cloze === null || cloze === void 0 ? void 0 : cloze.searchEnabled)
|
|
154
158
|
? () => lib_1.utilFnc.handleSearch(part.content)
|
|
@@ -160,7 +164,7 @@ const ClozeText = ({ text, fsize, weight, style, groupOf, holeEm = 4.5, ruby = f
|
|
|
160
164
|
押しても素通りする箱に入れる */}
|
|
161
165
|
<react_native_1.View pointerEvents="none" style={react_native_1.StyleSheet.absoluteFill}>
|
|
162
166
|
{containerWidth > 0 &&
|
|
163
|
-
parts.map((part, i) => part.type === "hole" ? (<common_1.MyText key={`m${i}`} fsize={fsize} weight={700} style={[styles.measure, { width: containerWidth, lineHeight }]} onTextLayout={(e) => {
|
|
167
|
+
parts.map((part, i) => part.type === "hole" && !underlineHoles ? (<common_1.MyText key={`m${i}`} fsize={fsize} weight={700} style={[styles.measure, { width: containerWidth, lineHeight }]} onTextLayout={(e) => {
|
|
164
168
|
const lines = e.nativeEvent.lines;
|
|
165
169
|
const width = Math.max(0, ...lines.map((l) => l.width));
|
|
166
170
|
setSizes((prev) => {
|
|
@@ -176,15 +180,16 @@ const ClozeText = ({ text, fsize, weight, style, groupOf, holeEm = 4.5, ruby = f
|
|
|
176
180
|
</react_native_1.View>);
|
|
177
181
|
};
|
|
178
182
|
exports.ClozeText = ClozeText;
|
|
179
|
-
//
|
|
183
|
+
// 説明の例文。文法の部分(ana[])は穴にせず、訳の決め手と同じ赤い下線で出す(2026-11-18、本人。
|
|
184
|
+
// 穴は説明の文に置き、例文は答えを見せて形を覚える場にする)。
|
|
180
185
|
// ふりがな((漢字)ff(よみ))は、よみと漢字を縦に積んだ小さな箱を文字の並びに置いて描く
|
|
181
|
-
const ExampleText = ({ text,
|
|
186
|
+
const ExampleText = ({ text, fsize, weight, style, }) => {
|
|
182
187
|
const ruby = (0, articleContentFnc_1.hasRuby)(text);
|
|
183
188
|
if (ruby || (0, articleContentFnc_1.hasCloze)(text))
|
|
184
189
|
return (<exports.ClozeText text={text} fsize={fsize} weight={weight}
|
|
185
190
|
// ふりがなの箱が上の行に重ならないよう、行を高くそろえる(行ごとに高さが変わると読みにくい)
|
|
186
191
|
style={ruby
|
|
187
|
-
? Object.assign(Object.assign({}, style), { lineHeight: (0, articleContentFnc_1.fsizeToPx)(fsize) * exports.RUBY_LINE_EM }) : style}
|
|
192
|
+
? Object.assign(Object.assign({}, style), { lineHeight: (0, articleContentFnc_1.fsizeToPx)(fsize) * exports.RUBY_LINE_EM }) : style} ruby={ruby} underlineHoles/>);
|
|
188
193
|
return (<common_1.MyText fsize={fsize} weight={weight} color="text" style={style}>
|
|
189
194
|
{text}
|
|
190
195
|
</common_1.MyText>);
|
|
@@ -310,6 +315,11 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
310
315
|
mathLine: {
|
|
311
316
|
marginTop: 5,
|
|
312
317
|
},
|
|
318
|
+
// 下線だけだと細くて見えにくい(太さは変えられない)ので、例文の訳の決め手(transUdl)と同じく字も赤にする
|
|
319
|
+
exampleUdl: {
|
|
320
|
+
textDecorationLine: "underline",
|
|
321
|
+
textDecorationColor: lib_1.colors.red,
|
|
322
|
+
},
|
|
313
323
|
rubyText: {
|
|
314
324
|
position: "absolute",
|
|
315
325
|
top: 0,
|
|
@@ -32,6 +32,7 @@ const react_native_gesture_handler_1 = require("react-native-gesture-handler");
|
|
|
32
32
|
const react_redux_1 = require("react-redux");
|
|
33
33
|
const common_1 = require("@nakamura-123/common");
|
|
34
34
|
const stores_1 = require("@nakamura-123/stores");
|
|
35
|
+
const joinTitleFnc_1 = require("../../functions/joinTitleFnc");
|
|
35
36
|
const Badge5s_1 = __importDefault(require("./Badge5s"));
|
|
36
37
|
const TagBadge5s_1 = __importDefault(require("../TagBadge5s"));
|
|
37
38
|
const SubCategoryList_1 = __importDefault(require("./SubCategoryList"));
|
|
@@ -42,7 +43,7 @@ const SelectedExamCnt_1 = __importDefault(require("./SelectedExamCnt"));
|
|
|
42
43
|
const BasicProgressBar_1 = __importDefault(require("./BasicProgressBar"));
|
|
43
44
|
const BasicPage = ({ navigation, subject, index }) => {
|
|
44
45
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
45
|
-
const { t } = (0, common_1.useDrillTranslation)();
|
|
46
|
+
const { t, i18n } = (0, common_1.useDrillTranslation)();
|
|
46
47
|
// // Reduxから必要なデータを一括取得
|
|
47
48
|
const categoryList = (0, react_redux_1.useSelector)((state) => state.app[subject.list]);
|
|
48
49
|
const activeIndex = (0, react_redux_1.useSelector)((state) => state.setting.viewSet[subject.name].activeIndex);
|
|
@@ -54,7 +55,7 @@ const BasicPage = ({ navigation, subject, index }) => {
|
|
|
54
55
|
// カテゴリー名を計算
|
|
55
56
|
const categoryName = `${selectedList.label} ${selectedList.title}`.trim();
|
|
56
57
|
const selectKey = selectedList.key;
|
|
57
|
-
const categoryLabel = selectedList.label
|
|
58
|
+
const categoryLabel = (0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, selectedList.label, selectedList.title);
|
|
58
59
|
const initScrollY = (0, react_redux_1.useSelector)((state) => state.setting.viewSet[subject.name].scrollY);
|
|
59
60
|
const scrollViewRef = (0, react_1.useRef)(null);
|
|
60
61
|
// 移動を監視
|
|
@@ -88,7 +89,7 @@ const BasicPage = ({ navigation, subject, index }) => {
|
|
|
88
89
|
tagName: subject.tag,
|
|
89
90
|
system: subject.system,
|
|
90
91
|
lesson: {
|
|
91
|
-
title:
|
|
92
|
+
title: categoryLabel,
|
|
92
93
|
key: ALL_NUM,
|
|
93
94
|
},
|
|
94
95
|
}));
|
|
@@ -112,7 +113,7 @@ const BasicPage = ({ navigation, subject, index }) => {
|
|
|
112
113
|
<Badge5s_1.default badgeType="basic" subject={subject.name} category={selectKey}/>
|
|
113
114
|
<TagBadge5s_1.default subject={subject} index={index}/>
|
|
114
115
|
<common_1.HelpMark name="quizOption.allQuiz" top={0}/>
|
|
115
|
-
<common_1.RoundRectangleIcon title={categoryLabel
|
|
116
|
+
<common_1.RoundRectangleIcon title={(0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, categoryLabel, t("basic.allQuiz"))} icon={allQuizIcon} onPress={handleAllQuiz}/>
|
|
116
117
|
<BasicSetting_1.default navigation={navigation} subjectType={subject.type}/>
|
|
117
118
|
</react_native_gesture_handler_1.ScrollView>);
|
|
118
119
|
};
|
|
@@ -34,12 +34,13 @@ const react_redux_1 = require("react-redux");
|
|
|
34
34
|
const db_1 = require("@nakamura-123/db");
|
|
35
35
|
const stores_1 = require("@nakamura-123/stores");
|
|
36
36
|
const testFnc_1 = require("../../functions/testFnc");
|
|
37
|
+
const joinTitleFnc_1 = require("../../functions/joinTitleFnc");
|
|
37
38
|
const Paw5s_1 = __importDefault(require("./Paw5s"));
|
|
38
39
|
const basicHook_1 = require("../../hooks/basicHook");
|
|
39
40
|
const TestComponent = ({ navigation, subject, index, }) => {
|
|
40
41
|
var _a;
|
|
41
42
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
42
|
-
const { t } = (0, common_1.useDrillTranslation)();
|
|
43
|
+
const { t, i18n } = (0, common_1.useDrillTranslation)();
|
|
43
44
|
// topTabsのラベルを取得
|
|
44
45
|
const categoryList = (0, react_redux_1.useSelector)((state) => state.app[subject.list]);
|
|
45
46
|
const selectedCategory = categoryList[index];
|
|
@@ -47,7 +48,7 @@ const TestComponent = ({ navigation, subject, index, }) => {
|
|
|
47
48
|
const quizCnt = selectedCategory.miniTestCnt;
|
|
48
49
|
// ミニテストだけ別の形式で出す科目がある(文法:レッスンは意味を取る問題、ミニテストは穴埋め)
|
|
49
50
|
const miniTestTag = subject.type === "unit" ? (_a = subject.miniTestTag) !== null && _a !== void 0 ? _a : subject.tag : subject.tag;
|
|
50
|
-
const testTitle = selectedCategory.title
|
|
51
|
+
const testTitle = (0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, selectedCategory.title, t("basic.miniTest"));
|
|
51
52
|
const testDB = (0, react_2.useQuery)(db_1.MiniTestSchema);
|
|
52
53
|
const outOfYearRange = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.outOfYearRange);
|
|
53
54
|
// const QuestionDB = useQuery(DQuestionSchema);
|
|
@@ -6,17 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const react_native_1 = require("react-native");
|
|
8
8
|
const react_2 = require("@realm/react");
|
|
9
|
-
const react_redux_1 = require("react-redux");
|
|
10
9
|
const db_1 = require("@nakamura-123/db");
|
|
11
10
|
const common_1 = require("@nakamura-123/common");
|
|
12
11
|
const tagFncD_1 = require("../../functions/tagFncD");
|
|
13
12
|
// 文法(G系)の成績画面の全タグ。科目1=意味を取る問題、科目2=穴埋め
|
|
14
13
|
const GAllTags = () => {
|
|
15
14
|
const questions = (0, react_2.useQuery)(db_1.GQuestionSchema);
|
|
16
|
-
const {
|
|
15
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
17
16
|
const rows = [
|
|
18
|
-
{ title:
|
|
19
|
-
{ title:
|
|
17
|
+
{ title: t("grade.grammarTag.meaning"), levels: questions.map((q) => q.meaningTag.level) },
|
|
18
|
+
{ title: t("grade.grammarTag.blank"), levels: questions.map((q) => q.blankTag.level) },
|
|
20
19
|
];
|
|
21
20
|
return (<react_native_1.View style={styles.container}>
|
|
22
21
|
{rows.map(({ title, levels }) => (<react_native_1.View key={title}>
|
|
@@ -0,0 +1,51 @@
|
|
|
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 lib_1 = require("@nakamura-123/lib");
|
|
9
|
+
const common_1 = require("@nakamura-123/common");
|
|
10
|
+
// ポイントの枠。LESSONの記事と問題の解説で同じ形にする(2026-11-18、本人)。
|
|
11
|
+
// 題は札に入れず、使う側が枠の中の1行目に置く(長い題でも札が崩れないように)
|
|
12
|
+
const PointBox = ({ children }) => (<react_native_1.View style={styles.box}>
|
|
13
|
+
<react_native_1.View style={styles.label}>
|
|
14
|
+
<common_1.Icon5 name="lightbulb" size={11} color="black" solid style={styles.labelIcon}/>
|
|
15
|
+
<common_1.MyText fsize="xs" weight={700} color="black">
|
|
16
|
+
POINT
|
|
17
|
+
</common_1.MyText>
|
|
18
|
+
</react_native_1.View>
|
|
19
|
+
{children}
|
|
20
|
+
</react_native_1.View>);
|
|
21
|
+
const styles = react_native_1.StyleSheet.create({
|
|
22
|
+
// 札を枠の上の線に重ねるので、その分だけ上を空ける
|
|
23
|
+
box: {
|
|
24
|
+
marginTop: 22,
|
|
25
|
+
marginBottom: 14,
|
|
26
|
+
paddingTop: 20,
|
|
27
|
+
paddingBottom: 14,
|
|
28
|
+
paddingHorizontal: 14,
|
|
29
|
+
borderWidth: 1.5,
|
|
30
|
+
borderColor: lib_1.colors.darkGray,
|
|
31
|
+
borderRadius: 14,
|
|
32
|
+
backgroundColor: lib_1.colors.white,
|
|
33
|
+
},
|
|
34
|
+
label: {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
top: -12,
|
|
37
|
+
left: 12,
|
|
38
|
+
flexDirection: "row",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
paddingHorizontal: 11,
|
|
41
|
+
paddingVertical: 2,
|
|
42
|
+
borderRadius: 999,
|
|
43
|
+
borderWidth: 1.5,
|
|
44
|
+
borderColor: lib_1.colors.darkGray,
|
|
45
|
+
backgroundColor: lib_1.colors.yellow,
|
|
46
|
+
},
|
|
47
|
+
labelIcon: {
|
|
48
|
+
marginRight: 6,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
exports.default = PointBox;
|
|
@@ -33,6 +33,7 @@ const lib_1 = require("@nakamura-123/lib");
|
|
|
33
33
|
const common_1 = require("@nakamura-123/common");
|
|
34
34
|
const MyTextqqyy_1 = __importDefault(require("../../quiz/common/MyTextqqyy"));
|
|
35
35
|
const RubyText_1 = __importDefault(require("../../quiz/common/RubyText"));
|
|
36
|
+
const renderTransUdl_1 = require("../../quiz/common/renderTransUdl");
|
|
36
37
|
const JQuestionBottomText_1 = require("../../quiz/jQuestion/JQuestionBottomText");
|
|
37
38
|
const quizHook_1 = require("../../hooks/quizHook");
|
|
38
39
|
const resultHook_1 = require("../../hooks/resultHook");
|
|
@@ -70,7 +71,7 @@ const QuizFlatList = ({ navigation }) => {
|
|
|
70
71
|
<react_native_1.View style={styles.texts}>
|
|
71
72
|
<QuestionText item={item}/>
|
|
72
73
|
{item.sub && (<common_1.MyText fsize="sm" color="gray" numberOfLines={1}>
|
|
73
|
-
{item.sub}
|
|
74
|
+
{(0, renderTransUdl_1.renderTransUdl)(item.sub, styles.udl)}
|
|
74
75
|
</common_1.MyText>)}
|
|
75
76
|
</react_native_1.View>
|
|
76
77
|
<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}/>
|
|
@@ -35,7 +35,6 @@ export type RubyPart = {
|
|
|
35
35
|
export declare const hasRuby: (text: string) => boolean;
|
|
36
36
|
export declare const stripRuby: (text: string) => string;
|
|
37
37
|
export declare const splitRuby: (text: string) => RubyPart[];
|
|
38
|
-
export declare const exampleHoleGroup: (blockIndex: number) => string;
|
|
39
38
|
export declare const clozeGroups: (blocks: ArticleBlock[]) => string[];
|
|
40
39
|
export declare const parseArticleContent: (raw: string) => ArticleContent;
|
|
41
40
|
export interface ArticleSection {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectLessonAnchors = exports.findSectionIndex = exports.splitArticleSections = exports.parseArticleContent = exports.clozeGroups = exports.
|
|
3
|
+
exports.collectLessonAnchors = exports.findSectionIndex = exports.splitArticleSections = exports.parseArticleContent = exports.clozeGroups = exports.splitRuby = exports.stripRuby = exports.hasRuby = exports.tableHoleGroup = exports.holeGroup = exports.splitCloze = exports.usesClozeText = exports.hasFigref = exports.hasSearch = exports.hasCloze = exports.getScaledLineHeight = exports.fsizeToPx = exports.getScaledWeight = exports.getScaledFsize = void 0;
|
|
4
4
|
const lib_1 = require("@nakamura-123/lib");
|
|
5
5
|
const ExplainLogic_1 = require("../quiz/explain/ExplainLogic");
|
|
6
6
|
const REI_PATTERN = /^rei\d*$/;
|
|
@@ -88,10 +88,8 @@ const splitRuby = (text) => {
|
|
|
88
88
|
return parts;
|
|
89
89
|
};
|
|
90
90
|
exports.splitRuby = splitRuby;
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
exports.exampleHoleGroup = exampleHoleGroup;
|
|
94
|
-
// ページ(ArticleContentViewに渡すblocks)にある穴の組を、出てくる順に重ねずに並べる
|
|
91
|
+
// ページ(ArticleContentViewに渡すblocks)にある穴の組を、出てくる順に重ねずに並べる。
|
|
92
|
+
// 例文のana[]は下線で出す(穴にしない)ので数えない
|
|
95
93
|
const clozeGroups = (blocks) => {
|
|
96
94
|
const groups = new Set();
|
|
97
95
|
const addText = (text) => (0, exports.splitCloze)(text).forEach((part) => {
|
|
@@ -101,10 +99,9 @@ const clozeGroups = (blocks) => {
|
|
|
101
99
|
blocks.forEach((block, index) => {
|
|
102
100
|
if (block.type === "paragraph" ||
|
|
103
101
|
block.type === "point" ||
|
|
104
|
-
block.type === "exampleNote"
|
|
102
|
+
block.type === "exampleNote" ||
|
|
103
|
+
block.type === "note")
|
|
105
104
|
addText(block.text);
|
|
106
|
-
if (block.type === "example" && (0, exports.hasCloze)(block.japanese))
|
|
107
|
-
groups.add((0, exports.exampleHoleGroup)(index));
|
|
108
105
|
if (block.type === "table")
|
|
109
106
|
block.rows.forEach((cells, r) => cells.forEach((cell, c) => (0, exports.splitCloze)(cell)
|
|
110
107
|
.filter((part) => part.type === "hole")
|
|
@@ -208,6 +205,19 @@ const parseArticleContent = (raw) => {
|
|
|
208
205
|
lastExampleBlock = null;
|
|
209
206
|
return;
|
|
210
207
|
}
|
|
208
|
+
// 注意の札(n2bの訳の意味の欄の「Note: …」。書き出し(export_n2b_lessons.py)が「note 札の名前|本文」に替える)
|
|
209
|
+
if (token === "note") {
|
|
210
|
+
const bar = content.indexOf("|");
|
|
211
|
+
blocks.push(bar === -1
|
|
212
|
+
? { type: "note", label: "", text: content }
|
|
213
|
+
: {
|
|
214
|
+
type: "note",
|
|
215
|
+
label: content.slice(0, bar),
|
|
216
|
+
text: content.slice(bar + 1),
|
|
217
|
+
});
|
|
218
|
+
lastExampleBlock = null;
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
211
221
|
if (token === "img") {
|
|
212
222
|
blocks.push({ type: "image", name: content });
|
|
213
223
|
lastExampleBlock = null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const joinTitle: (language: string | undefined, ...parts: string[]) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.joinTitle = void 0;
|
|
4
|
+
// 章の名前と「ミニテスト」などをつなぐ。日本語・中国語は語の間に空白を置かないが、
|
|
5
|
+
// 英語・韓国語・ベトナム語でそのままつなぐと「Unit 1Mini-test」になる。
|
|
6
|
+
// n4tは章の名前の後ろに空白を付けて("Adjective ")この問題を避けていたので、境目にもう空白があれば足さない
|
|
7
|
+
const joinTitle = (language, ...parts) => {
|
|
8
|
+
const sep = !language || /^(ja|zh)/.test(language) ? "" : " ";
|
|
9
|
+
return parts
|
|
10
|
+
.filter((part) => part !== "")
|
|
11
|
+
.reduce((joined, part) => joined === "" || /\s$/.test(joined) || /^\s/.test(part)
|
|
12
|
+
? joined + part
|
|
13
|
+
: joined + sep + part, "");
|
|
14
|
+
};
|
|
15
|
+
exports.joinTitle = joinTitle;
|
package/dist/page/ArticlePage.js
CHANGED
|
@@ -31,18 +31,21 @@ const react_native_1 = require("react-native");
|
|
|
31
31
|
const react_redux_1 = require("react-redux");
|
|
32
32
|
const react_native_tab_view_1 = require("react-native-tab-view");
|
|
33
33
|
const lib_1 = require("@nakamura-123/lib");
|
|
34
|
+
const common_1 = require("@nakamura-123/common");
|
|
35
|
+
const joinTitleFnc_1 = require("../functions/joinTitleFnc");
|
|
34
36
|
const ArticleContents_1 = __importDefault(require("../component/Article/ArticleContents"));
|
|
35
37
|
const QuizSaveData_1 = __importDefault(require("../quiz/save/QuizSaveData"));
|
|
36
38
|
const TabAnimeView_1 = __importDefault(require("../component/TabAnimeView"));
|
|
37
39
|
const ArticlePage = react_1.default.memo(({ navigation, subject }) => {
|
|
38
40
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
41
|
+
const { i18n } = (0, common_1.useDrillTranslation)();
|
|
39
42
|
(0, react_1.useEffect)(() => {
|
|
40
43
|
dispatch({ type: "setting/setSelectedSubject", payload: subject.name });
|
|
41
44
|
}, []);
|
|
42
45
|
const categoryList = (0, react_redux_1.useSelector)((state) => state.app[subject.list]);
|
|
43
46
|
const activeIndex = (0, react_redux_1.useSelector)((state) => state.setting.viewSet[subject.name].activeIndex);
|
|
44
47
|
// ラベルを取得
|
|
45
|
-
const labels = categoryList.map((category) => category.label
|
|
48
|
+
const labels = categoryList.map((category) => (0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, category.label, category.title));
|
|
46
49
|
const routeLists = labels.map((label, index) => ({
|
|
47
50
|
key: index.toString(),
|
|
48
51
|
title: label,
|
package/dist/page/BasicPage.js
CHANGED
|
@@ -31,18 +31,21 @@ const react_native_1 = require("react-native");
|
|
|
31
31
|
const react_redux_1 = require("react-redux");
|
|
32
32
|
const react_native_tab_view_1 = require("react-native-tab-view");
|
|
33
33
|
const lib_1 = require("@nakamura-123/lib");
|
|
34
|
+
const common_1 = require("@nakamura-123/common");
|
|
35
|
+
const joinTitleFnc_1 = require("../functions/joinTitleFnc");
|
|
34
36
|
const BasicContents_1 = __importDefault(require("../component/Basic/BasicContents"));
|
|
35
37
|
const QuizSaveData_1 = __importDefault(require("../quiz/save/QuizSaveData"));
|
|
36
38
|
const TabAnimeView_1 = __importDefault(require("../component/TabAnimeView"));
|
|
37
39
|
const BasicPage = react_1.default.memo(({ navigation, subject }) => {
|
|
38
40
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
41
|
+
const { i18n } = (0, common_1.useDrillTranslation)();
|
|
39
42
|
(0, react_1.useEffect)(() => {
|
|
40
43
|
dispatch({ type: "setting/setSelectedSubject", payload: subject.name });
|
|
41
44
|
}, []);
|
|
42
45
|
const categoryList = (0, react_redux_1.useSelector)((state) => state.app[subject.list]);
|
|
43
46
|
const activeIndex = (0, react_redux_1.useSelector)((state) => state.setting.viewSet[subject.name].activeIndex);
|
|
44
47
|
// ラベルを取得
|
|
45
|
-
const labels = categoryList.map((category) => category.label
|
|
48
|
+
const labels = categoryList.map((category) => (0, joinTitleFnc_1.joinTitle)(i18n === null || i18n === void 0 ? void 0 : i18n.language, category.label, category.title));
|
|
46
49
|
const routeLists = labels.map((label, index) => ({
|
|
47
50
|
key: index.toString(),
|
|
48
51
|
title: label,
|
|
@@ -0,0 +1,20 @@
|
|
|
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.renderTransUdl = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
// 例文の訳の中の、文法の部分に当たる所(udl[…])に下線を引く。外側の文字の大きさ・太さを受け継ぐので、中は色と線だけ持つ。
|
|
10
|
+
// 当たる語が無い訳には udl[ ] が無く、そのまま返る
|
|
11
|
+
const renderTransUdl = (text, udlStyle) => text
|
|
12
|
+
.split(/(udl\[[^\]]+\])/)
|
|
13
|
+
.filter((chunk) => chunk.length > 0)
|
|
14
|
+
.map((chunk, i) => {
|
|
15
|
+
const m = chunk.match(/^udl\[([^\]]+)\]$/);
|
|
16
|
+
return m ? (<react_native_1.Text key={i} style={udlStyle}>
|
|
17
|
+
{m[1]}
|
|
18
|
+
</react_native_1.Text>) : (chunk);
|
|
19
|
+
});
|
|
20
|
+
exports.renderTransUdl = renderTransUdl;
|
|
@@ -32,19 +32,21 @@ const react_native_collapsible_1 = __importDefault(require("react-native-collaps
|
|
|
32
32
|
const react_redux_1 = require("react-redux");
|
|
33
33
|
const lib_1 = require("@nakamura-123/lib");
|
|
34
34
|
const common_1 = require("@nakamura-123/common");
|
|
35
|
+
const PointBox_1 = __importDefault(require("../../component/PointBox"));
|
|
35
36
|
// ポイントは開いたまま、用語の説明は閉じて置く(知っている人は飛ばせるように)
|
|
36
37
|
const ExplainBox = ({ type, title, children }) => {
|
|
37
38
|
const [collapsed, setCollapsed] = (0, react_1.useState)(type === "term");
|
|
38
39
|
const fsize = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fsize);
|
|
39
40
|
// 題は押して開くための見出しなので、検索語の印(yy)は外して出す
|
|
40
41
|
const label = title.replace(/yy/g, "");
|
|
42
|
+
// 札が「POINT」と示すので、題の無い枠には題の行を出さない
|
|
41
43
|
if (type === "point")
|
|
42
|
-
return (<
|
|
43
|
-
<common_1.MyText fsize=
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
return (<PointBox_1.default>
|
|
45
|
+
{label ? (<common_1.MyText fsize={fsize} weight={700} style={styles.pointTitle}>
|
|
46
|
+
{label}
|
|
47
|
+
</common_1.MyText>) : null}
|
|
46
48
|
{children}
|
|
47
|
-
</
|
|
49
|
+
</PointBox_1.default>);
|
|
48
50
|
return (<react_native_1.View style={styles.box}>
|
|
49
51
|
<react_native_1.TouchableOpacity style={styles.termHead} onPress={() => setCollapsed(!collapsed)}>
|
|
50
52
|
<common_1.MyText fsize={fsize} weight={700} style={styles.termTitle}>
|
|
@@ -65,8 +67,8 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
65
67
|
padding: 6,
|
|
66
68
|
marginVertical: 8,
|
|
67
69
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
pointTitle: {
|
|
71
|
+
marginBottom: 8,
|
|
70
72
|
},
|
|
71
73
|
termHead: {
|
|
72
74
|
flexDirection: "row",
|