@nakamura-123/pages 1.4.1 → 1.4.3
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.d.ts +5 -1
- package/dist/component/Article/ArticleContentView.js +199 -34
- package/dist/component/Article/ArticleContents.js +5 -4
- package/dist/component/Article/ArticleImage.d.ts +9 -0
- package/dist/component/Article/ArticleImage.js +46 -0
- package/dist/component/Article/ArticleSectionPager.d.ts +17 -0
- package/dist/component/Article/ArticleSectionPager.js +193 -0
- package/dist/component/Article/ArticleTable.d.ts +10 -0
- package/dist/component/Article/ArticleTable.js +74 -0
- package/dist/component/Article/ChipStrip.d.ts +10 -0
- package/dist/component/Article/ChipStrip.js +82 -0
- package/dist/component/Article/Cloze.d.ts +31 -0
- package/dist/component/Article/Cloze.js +338 -0
- package/dist/component/Article/FramesFigure.d.ts +27 -0
- package/dist/component/Article/FramesFigure.js +438 -0
- package/dist/component/Article/RefLink.d.ts +42 -0
- package/dist/component/Article/RefLink.js +184 -0
- 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/Rating/RatingBar.d.ts +9 -0
- package/dist/component/Rating/RatingBar.js +358 -0
- package/dist/component/Rating/keyboardScroll.d.ts +7 -0
- package/dist/component/Rating/keyboardScroll.js +37 -0
- package/dist/component/Result/QuizFlatList.js +11 -10
- package/dist/component/Result/ResultActions.js +151 -58
- package/dist/component/Result/ResultHero.js +19 -18
- package/dist/component/SettingBtns/LanguageModal.js +1 -0
- package/dist/functions/articleContentFnc.d.ts +49 -1
- package/dist/functions/articleContentFnc.js +191 -2
- package/dist/functions/joinTitleFnc.d.ts +1 -0
- package/dist/functions/joinTitleFnc.js +15 -0
- package/dist/functions/ratingFnc.d.ts +4 -0
- package/dist/functions/ratingFnc.js +30 -0
- package/dist/hooks/resultHook.d.ts +2 -1
- package/dist/hooks/resultHook.js +13 -1
- package/dist/page/ArticleDetail.js +58 -15
- package/dist/page/ArticlePage.js +4 -1
- package/dist/page/BasicPage.js +4 -1
- package/dist/page/ImgZoom.d.ts +4 -3
- package/dist/page/ImgZoom.js +16 -2
- package/dist/page/QuizPage.js +23 -11
- package/dist/page/ReportPage.js +3 -2
- package/dist/quiz/QuizContentsDrill.js +26 -16
- package/dist/quiz/common/MyTextqqyy.d.ts +4 -0
- package/dist/quiz/common/MyTextqqyy.js +14 -4
- package/dist/quiz/common/renderTransUdl.d.ts +3 -0
- package/dist/quiz/common/renderTransUdl.js +20 -0
- package/dist/quiz/explain/ExplainLogic.d.ts +1 -0
- package/dist/quiz/explain/ExplainLogic.js +3 -2
- package/dist/quiz/explain/NormalExplain.js +3 -0
- package/dist/quiz/grammar/GQuestion.js +13 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StackNavigationProp } from "@react-navigation/stack";
|
|
3
|
+
import { ArticleContent, Nav } from "@nakamura-123/types";
|
|
3
4
|
interface ArticleContentViewProps {
|
|
4
5
|
content: ArticleContent;
|
|
5
6
|
articleId: string;
|
|
7
|
+
navigation: StackNavigationProp<Nav.RootStackParamList>;
|
|
8
|
+
exampleOffset?: number;
|
|
9
|
+
isLesson?: boolean;
|
|
6
10
|
}
|
|
7
11
|
declare const ArticleContentView: React.FC<ArticleContentViewProps>;
|
|
8
12
|
export default ArticleContentView;
|
|
@@ -32,24 +32,56 @@ const react_redux_1 = require("react-redux");
|
|
|
32
32
|
const lib_1 = require("@nakamura-123/lib");
|
|
33
33
|
const common_1 = require("@nakamura-123/common");
|
|
34
34
|
const articleContentFnc_1 = require("../../functions/articleContentFnc");
|
|
35
|
+
const Cloze_1 = require("./Cloze");
|
|
35
36
|
const MyTextqqyy_1 = __importDefault(require("../../quiz/common/MyTextqqyy"));
|
|
37
|
+
const renderTransUdl_1 = require("../../quiz/common/renderTransUdl");
|
|
38
|
+
const ArticleTable_1 = __importDefault(require("./ArticleTable"));
|
|
39
|
+
const ArticleImage_1 = __importDefault(require("./ArticleImage"));
|
|
40
|
+
const FramesFigure_1 = __importDefault(require("./FramesFigure"));
|
|
36
41
|
const isJudgmentBlock = (block) => (block === null || block === void 0 ? void 0 : block.type) === "incorrect" || (block === null || block === void 0 ? void 0 : block.type) === "correct";
|
|
37
|
-
const ArticleContentView = ({ content, articleId, }) => {
|
|
38
|
-
let exampleCount =
|
|
42
|
+
const ArticleContentView = ({ content, articleId, navigation, exampleOffset = 0, isLesson = false, }) => {
|
|
43
|
+
let exampleCount = exampleOffset;
|
|
44
|
+
const rImgs = (0, react_redux_1.useSelector)((state) => state.app.imgs.rImgs);
|
|
45
|
+
// コマ送りの図のデータ(図の名前 → データ)。ある図はコマ送りで、無い図はJPGで描く
|
|
46
|
+
const rFrames = (0, react_redux_1.useSelector)((state) => state.app.imgs.rFrames);
|
|
39
47
|
// 例文の絵。keyは「説明のkey-例文の番号」("2-1")。絵の無い例文・アプリは絵なしの形で出す
|
|
40
48
|
const exImgs = (0, react_redux_1.useSelector)((state) => state.app.imgs.exImgs);
|
|
41
49
|
const userFsize = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fsize);
|
|
42
50
|
const userFWeight = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fWeight);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
// 穴の数とボタンは、最初の#の見出しのすぐ下に置く(#が無ければ本文の頭)
|
|
52
|
+
const clozeBarAfter = content.blocks.findIndex((b) => b.type === "heading" && b.style === "bar");
|
|
53
|
+
return (<Cloze_1.ClozeProvider blocks={content.blocks} searchEnabled={isLesson}>
|
|
54
|
+
<react_native_1.View style={styles.container}>
|
|
55
|
+
{/* LESSONの2ページ目からはタイトルを出さない(ArticleSectionPagerが空で渡す) */}
|
|
56
|
+
{content.title ? (<react_native_1.View style={styles.titleWrap}>
|
|
57
|
+
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("xxxl", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(700, userFWeight)} color="black">
|
|
58
|
+
{content.title}
|
|
59
|
+
</common_1.MyText>
|
|
60
|
+
</react_native_1.View>) : null}
|
|
61
|
+
<react_native_1.View style={styles.bodyWrap}>
|
|
62
|
+
{clozeBarAfter === -1 && <Cloze_1.ClozeBar />}
|
|
63
|
+
{content.blocks.map((block, index) => {
|
|
51
64
|
if (block.type === "example")
|
|
52
65
|
exampleCount += 1;
|
|
66
|
+
if (block.type === "image") {
|
|
67
|
+
const path = rImgs
|
|
68
|
+
? lib_1.utilFnc.getrImgPath(rImgs, block.name)
|
|
69
|
+
: undefined;
|
|
70
|
+
const frames = rFrames === null || rFrames === void 0 ? void 0 : rFrames[block.name];
|
|
71
|
+
// コマ送りの図。最初は完成図を出し、押すと1コマ目から動く。拡大の印からは完成図のJPGを開く
|
|
72
|
+
if (frames)
|
|
73
|
+
return (<react_native_1.View key={index} style={styles.imageWrap}>
|
|
74
|
+
<FramesFigure_1.default name={block.name} data={frames} startAt="last" navigation={navigation} zoomPath={path}/>
|
|
75
|
+
</react_native_1.View>);
|
|
76
|
+
if (path === undefined) {
|
|
77
|
+
if (__DEV__)
|
|
78
|
+
console.warn(`[articleContent] 図がrImgsにありません: "${block.name}"`);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return (<react_native_1.View key={index} style={styles.imageWrap}>
|
|
82
|
+
<ArticleImage_1.default path={path} navigation={navigation}/>
|
|
83
|
+
</react_native_1.View>);
|
|
84
|
+
}
|
|
53
85
|
let groupPosition;
|
|
54
86
|
if (isJudgmentBlock(block)) {
|
|
55
87
|
const hasPrev = isJudgmentBlock(content.blocks[index - 1]);
|
|
@@ -63,22 +95,28 @@ const ArticleContentView = ({ content, articleId, }) => {
|
|
|
63
95
|
? "top"
|
|
64
96
|
: "only";
|
|
65
97
|
}
|
|
66
|
-
return (<
|
|
98
|
+
return (<react_1.default.Fragment key={index}>
|
|
99
|
+
<ArticleBlockView block={block} blockIndex={index} exampleNumber={exampleCount} exampleImg={block.type === "example"
|
|
67
100
|
? exImgs === null || exImgs === void 0 ? void 0 : exImgs[`${articleId}-${exampleCount}`]
|
|
68
|
-
: undefined} groupPosition={groupPosition}
|
|
101
|
+
: undefined} groupPosition={groupPosition}
|
|
102
|
+
// タイトルの無いページ(LESSONの2ページ目から)は#で始まるので、上の空きを詰める
|
|
103
|
+
isPageTop={index === 0 && !content.title} userFsize={userFsize} userFWeight={userFWeight}/>
|
|
104
|
+
{index === clozeBarAfter && <Cloze_1.ClozeBar />}
|
|
105
|
+
</react_1.default.Fragment>);
|
|
69
106
|
})}
|
|
107
|
+
</react_native_1.View>
|
|
70
108
|
</react_native_1.View>
|
|
71
|
-
</
|
|
109
|
+
</Cloze_1.ClozeProvider>);
|
|
72
110
|
};
|
|
73
|
-
const ArticleBlockView = ({ block, exampleNumber, exampleImg, groupPosition, userFsize, userFWeight, }) => {
|
|
111
|
+
const ArticleBlockView = ({ block, blockIndex, exampleNumber, exampleImg, groupPosition, isPageTop, userFsize, userFWeight, }) => {
|
|
74
112
|
const { t } = (0, common_1.useDrillTranslation)();
|
|
75
113
|
const [isRevealed, setIsRevealed] = (0, react_1.useState)(false);
|
|
76
114
|
switch (block.type) {
|
|
77
115
|
case "heading":
|
|
78
116
|
if (block.style === "bar") {
|
|
79
|
-
return (<react_native_1.View style={styles.headingBarRow}>
|
|
117
|
+
return (<react_native_1.View style={[styles.headingBarRow, isPageTop && styles.pageTop]}>
|
|
80
118
|
<react_native_1.View style={styles.headingBar}/>
|
|
81
|
-
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("
|
|
119
|
+
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("xl", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(700, userFWeight)} color="darkGray" style={styles.headingBarText}>
|
|
82
120
|
{block.text}
|
|
83
121
|
</common_1.MyText>
|
|
84
122
|
</react_native_1.View>);
|
|
@@ -90,11 +128,13 @@ const ArticleBlockView = ({ block, exampleNumber, exampleImg, groupPosition, use
|
|
|
90
128
|
</common_1.MyText>
|
|
91
129
|
</react_native_1.View>);
|
|
92
130
|
}
|
|
93
|
-
return (<
|
|
94
|
-
{
|
|
95
|
-
|
|
131
|
+
return (<react_native_1.View style={styles.headingBold}>
|
|
132
|
+
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("lg", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(700, userFWeight)} color="black">
|
|
133
|
+
{block.text}
|
|
134
|
+
</common_1.MyText>
|
|
135
|
+
</react_native_1.View>);
|
|
96
136
|
case "paragraph":
|
|
97
|
-
return (<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={styles.paragraph}/>);
|
|
137
|
+
return (<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={Object.assign(Object.assign({}, styles.paragraph), { lineHeight: (0, articleContentFnc_1.getScaledLineHeight)((0, articleContentFnc_1.getScaledFsize)("md", userFsize), 22) })}/>);
|
|
98
138
|
case "example": {
|
|
99
139
|
const exampleLabel = (<common_1.MyText fsize="sm" weight={700} color="green">
|
|
100
140
|
{String(exampleNumber).padStart(2, "0")}
|
|
@@ -110,14 +150,12 @@ const ArticleBlockView = ({ block, exampleNumber, exampleImg, groupPosition, use
|
|
|
110
150
|
exampleImg !== undefined && styles.exampleTopWithImg,
|
|
111
151
|
]}>
|
|
112
152
|
{exampleImg === undefined && exampleLabel}
|
|
113
|
-
<
|
|
114
|
-
{block.japanese}
|
|
115
|
-
</common_1.MyText>
|
|
153
|
+
<Cloze_1.ExampleText text={block.japanese} group={(0, articleContentFnc_1.exampleHoleGroup)(blockIndex)} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={styles.exampleText}/>
|
|
116
154
|
</react_native_1.View>
|
|
117
155
|
{block.translation && (<react_native_1.TouchableOpacity onPress={() => setIsRevealed(!isRevealed)} style={styles.exampleBottom}>
|
|
118
156
|
{/* 非表示時もopacity:0で全幅描画し、訳文の実際の高さ分の領域を最初から確保する(アイコンの有無で幅が変わって高さがずれないよう、アイコンは重ねて表示する別レイヤーにする) */}
|
|
119
157
|
<common_1.MyText fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} color="text" style={!isRevealed && styles.invisibleText}>
|
|
120
|
-
{block.translation}
|
|
158
|
+
{(0, renderTransUdl_1.renderTransUdl)(block.translation, styles.transUdl)}
|
|
121
159
|
</common_1.MyText>
|
|
122
160
|
{!isRevealed && (<react_native_1.View style={styles.exampleBottomOverlay}>
|
|
123
161
|
<common_1.Icon5 name="eye" size={14} color="ltBlack" style={styles.exampleBottomIcon}/>
|
|
@@ -148,17 +186,66 @@ const ArticleBlockView = ({ block, exampleNumber, exampleImg, groupPosition, use
|
|
|
148
186
|
<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={styles.judgmentText}/>
|
|
149
187
|
</react_native_1.View>);
|
|
150
188
|
}
|
|
189
|
+
case "table":
|
|
190
|
+
return (<ArticleTable_1.default rows={block.rows} blockIndex={blockIndex} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)}/>);
|
|
191
|
+
// 上の例文の補足。例文の枠の下に縦線でつなぎ、どの話の続きかを頭の札で示す
|
|
192
|
+
case "exampleNote":
|
|
193
|
+
return (<react_native_1.View style={styles.exampleNote}>
|
|
194
|
+
<react_native_1.View style={styles.exampleNoteLabel}>
|
|
195
|
+
<common_1.Icon5 name="level-up-alt" size={11} color="ltBlack" style={styles.exampleNoteIcon}/>
|
|
196
|
+
<common_1.MyText fsize="xs" weight={700} color="ltBlack">
|
|
197
|
+
{t("article.exampleNote")}
|
|
198
|
+
</common_1.MyText>
|
|
199
|
+
</react_native_1.View>
|
|
200
|
+
<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(500, userFWeight)} style={{
|
|
201
|
+
lineHeight: (0, articleContentFnc_1.getScaledLineHeight)((0, articleContentFnc_1.getScaledFsize)("md", userFsize), 22),
|
|
202
|
+
}}/>
|
|
203
|
+
</react_native_1.View>);
|
|
204
|
+
// 解説のポイント枠(ExplainBox)は全アプリの解説で使っているので変えず、記事は別の形にする
|
|
205
|
+
case "point":
|
|
206
|
+
return (<react_native_1.View style={styles.pointBox}>
|
|
207
|
+
<react_native_1.View style={styles.pointLabel}>
|
|
208
|
+
<common_1.Icon5 name="lightbulb" size={11} color="black" solid style={styles.pointLabelIcon}/>
|
|
209
|
+
<common_1.MyText fsize="xs" weight={700} color="black">
|
|
210
|
+
POINT
|
|
211
|
+
</common_1.MyText>
|
|
212
|
+
</react_native_1.View>
|
|
213
|
+
<BodyText text={block.text} fsize={(0, articleContentFnc_1.getScaledFsize)("md", userFsize)} weight={(0, articleContentFnc_1.getScaledWeight)(700, userFWeight)} style={{
|
|
214
|
+
lineHeight: (0, articleContentFnc_1.getScaledLineHeight)((0, articleContentFnc_1.getScaledFsize)("md", userFsize), 24),
|
|
215
|
+
}}/>
|
|
216
|
+
</react_native_1.View>);
|
|
151
217
|
default:
|
|
152
218
|
return null;
|
|
153
219
|
}
|
|
154
220
|
};
|
|
221
|
+
// 説明の文の【文法名】を太字・緑に、使い分けの決め手(udl[…])に下線を引く(n2bのunit。dk2の記事には【】もudl[]も無い)
|
|
222
|
+
// 太さはfontFamilyで決まるので、太字は700の書体に替える
|
|
223
|
+
const renderBodyMarks = (text) => text
|
|
224
|
+
.split(/(【[^】]*】|udl\[[^\]]+\])/)
|
|
225
|
+
.filter((chunk) => chunk.length > 0)
|
|
226
|
+
.map((chunk, i) => {
|
|
227
|
+
const m = chunk.match(/^udl\[([^\]]+)\]$/);
|
|
228
|
+
if (m) {
|
|
229
|
+
return (<react_native_1.Text key={i} style={styles.bodyUdl}>
|
|
230
|
+
{m[1]}
|
|
231
|
+
</react_native_1.Text>);
|
|
232
|
+
}
|
|
233
|
+
return chunk.startsWith("【") ? (<react_native_1.Text key={i} style={styles.bodyGrammar}>
|
|
234
|
+
{chunk}
|
|
235
|
+
</react_native_1.Text>) : (chunk);
|
|
236
|
+
});
|
|
155
237
|
// 数式(qq…qq)がある文だけ、解説と同じ部品で描く。ない文を今までどおりにするのは、
|
|
156
238
|
// 解説の部品がyy(検索語)やudl[]も読み替えるため(記事の文はその記法を前提に書かれていない)
|
|
157
|
-
|
|
239
|
+
// 解説の部品はmargin: 5を持つので、数式の無い文と左がそろうよう左右だけ0に戻す(上は式の行の間隔として残す)
|
|
240
|
+
// 穴(ana[])のある文と、LESSONの検索語(yy…yy)のある文は穴埋めの部品で描く(数式も一緒に描ける)
|
|
241
|
+
const BodyText = ({ text, fsize, weight, style }) => {
|
|
242
|
+
const searchEnabled = (0, Cloze_1.useLessonSearch)();
|
|
243
|
+
return (0, articleContentFnc_1.usesClozeText)(text, searchEnabled) ? (<Cloze_1.ClozeText text={text} fsize={fsize} weight={weight} style={style}/>) : text.includes("qq") ? (<MyTextqqyy_1.default fsize={fsize} weight={weight} style={Object.assign(Object.assign({}, styles.qqReset), style)} isNotSearch>
|
|
158
244
|
{text}
|
|
159
245
|
</MyTextqqyy_1.default>) : (<common_1.MyText fsize={fsize} weight={weight} color="text" style={style}>
|
|
160
|
-
{text}
|
|
246
|
+
{renderBodyMarks(text)}
|
|
161
247
|
</common_1.MyText>);
|
|
248
|
+
};
|
|
162
249
|
const styles = react_native_1.StyleSheet.create({
|
|
163
250
|
container: {
|
|
164
251
|
// marginHorizontal: -20,
|
|
@@ -175,17 +262,25 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
175
262
|
paddingTop: 16,
|
|
176
263
|
paddingBottom: 20,
|
|
177
264
|
},
|
|
265
|
+
pageTop: {
|
|
266
|
+
marginTop: 4,
|
|
267
|
+
},
|
|
178
268
|
headingBarRow: {
|
|
179
269
|
flexDirection: "row",
|
|
180
270
|
alignItems: "center",
|
|
181
|
-
marginTop:
|
|
271
|
+
marginTop: 28,
|
|
182
272
|
marginBottom: 12,
|
|
183
273
|
},
|
|
184
274
|
headingBar: {
|
|
185
|
-
width:
|
|
186
|
-
height:
|
|
187
|
-
|
|
188
|
-
|
|
275
|
+
width: 5,
|
|
276
|
+
height: 22,
|
|
277
|
+
borderRadius: 3,
|
|
278
|
+
backgroundColor: lib_1.colors.darkGray,
|
|
279
|
+
marginRight: 10,
|
|
280
|
+
},
|
|
281
|
+
// 長い見出しは線の右で折り返す
|
|
282
|
+
headingBarText: {
|
|
283
|
+
flexShrink: 1,
|
|
189
284
|
},
|
|
190
285
|
headingUnderline: {
|
|
191
286
|
alignSelf: "flex-start",
|
|
@@ -196,12 +291,15 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
196
291
|
borderBottomColor: lib_1.colors.text,
|
|
197
292
|
},
|
|
198
293
|
headingBold: {
|
|
199
|
-
|
|
200
|
-
|
|
294
|
+
alignSelf: "flex-start",
|
|
295
|
+
marginTop: 20,
|
|
296
|
+
marginBottom: 8,
|
|
297
|
+
paddingBottom: 3,
|
|
298
|
+
borderBottomWidth: 2,
|
|
299
|
+
borderBottomColor: lib_1.colors.darkGray,
|
|
201
300
|
},
|
|
202
301
|
paragraph: {
|
|
203
302
|
marginBottom: 10,
|
|
204
|
-
lineHeight: 22,
|
|
205
303
|
},
|
|
206
304
|
exampleBox: {
|
|
207
305
|
borderRadius: 8,
|
|
@@ -245,6 +343,21 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
245
343
|
invisibleText: {
|
|
246
344
|
opacity: 0,
|
|
247
345
|
},
|
|
346
|
+
// 下線だけだと細くて見えにくい(太さは変えられない)ので、空欄の答えと同じ色にもする
|
|
347
|
+
transUdl: {
|
|
348
|
+
color: lib_1.colors.red,
|
|
349
|
+
textDecorationLine: "underline",
|
|
350
|
+
textDecorationColor: lib_1.colors.red,
|
|
351
|
+
},
|
|
352
|
+
// 共通の緑(#8ACBB7)は地のベージュの上の文字には薄いので、同じ系統の濃い緑にする
|
|
353
|
+
bodyGrammar: {
|
|
354
|
+
color: "#2F8A6E",
|
|
355
|
+
fontFamily: "ZenKakuGothicNew_700Bold",
|
|
356
|
+
},
|
|
357
|
+
bodyUdl: {
|
|
358
|
+
textDecorationLine: "underline",
|
|
359
|
+
textDecorationColor: lib_1.colors.red,
|
|
360
|
+
},
|
|
248
361
|
exampleBottomOverlay: {
|
|
249
362
|
position: "absolute",
|
|
250
363
|
top: 12,
|
|
@@ -284,5 +397,57 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
284
397
|
judgmentText: {
|
|
285
398
|
flex: 1,
|
|
286
399
|
},
|
|
400
|
+
imageWrap: {
|
|
401
|
+
marginVertical: 8,
|
|
402
|
+
},
|
|
403
|
+
qqReset: {
|
|
404
|
+
marginHorizontal: 0,
|
|
405
|
+
},
|
|
406
|
+
// 例文の枠(marginBottom: 10)の真下から線を始めて、例文とつながって見えるようにする
|
|
407
|
+
exampleNote: {
|
|
408
|
+
marginTop: -10,
|
|
409
|
+
marginBottom: 12,
|
|
410
|
+
marginLeft: 14,
|
|
411
|
+
paddingTop: 8,
|
|
412
|
+
paddingLeft: 12,
|
|
413
|
+
borderLeftWidth: 3,
|
|
414
|
+
borderLeftColor: lib_1.colors.beige,
|
|
415
|
+
},
|
|
416
|
+
exampleNoteLabel: {
|
|
417
|
+
flexDirection: "row",
|
|
418
|
+
alignItems: "center",
|
|
419
|
+
marginBottom: 2,
|
|
420
|
+
},
|
|
421
|
+
exampleNoteIcon: {
|
|
422
|
+
marginRight: 6,
|
|
423
|
+
},
|
|
424
|
+
// 札を枠の上の線に重ねるので、その分だけ上を空ける
|
|
425
|
+
pointBox: {
|
|
426
|
+
marginTop: 22,
|
|
427
|
+
marginBottom: 14,
|
|
428
|
+
paddingTop: 20,
|
|
429
|
+
paddingBottom: 14,
|
|
430
|
+
paddingHorizontal: 14,
|
|
431
|
+
borderWidth: 1.5,
|
|
432
|
+
borderColor: lib_1.colors.darkGray,
|
|
433
|
+
borderRadius: 14,
|
|
434
|
+
backgroundColor: lib_1.colors.white,
|
|
435
|
+
},
|
|
436
|
+
pointLabel: {
|
|
437
|
+
position: "absolute",
|
|
438
|
+
top: -12,
|
|
439
|
+
left: 12,
|
|
440
|
+
flexDirection: "row",
|
|
441
|
+
alignItems: "center",
|
|
442
|
+
paddingHorizontal: 11,
|
|
443
|
+
paddingVertical: 2,
|
|
444
|
+
borderRadius: 999,
|
|
445
|
+
borderWidth: 1.5,
|
|
446
|
+
borderColor: lib_1.colors.darkGray,
|
|
447
|
+
backgroundColor: lib_1.colors.yellow,
|
|
448
|
+
},
|
|
449
|
+
pointLabelIcon: {
|
|
450
|
+
marginRight: 6,
|
|
451
|
+
},
|
|
287
452
|
});
|
|
288
453
|
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
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StackNavigationProp } from "@react-navigation/stack";
|
|
3
|
+
import { Nav } from "@nakamura-123/types";
|
|
4
|
+
interface Props {
|
|
5
|
+
path: number;
|
|
6
|
+
navigation: StackNavigationProp<Nav.RootStackParamList>;
|
|
7
|
+
}
|
|
8
|
+
declare const ArticleImage: React.FC<Props>;
|
|
9
|
+
export default ArticleImage;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
const MAX_HEIGHT = 1000;
|
|
29
|
+
// 記事の図。枠の幅が決まったらすぐ図の高さの場所を取り、読み込みが遅れても下の文章が押し下げられないようにする(11/08、本人)。
|
|
30
|
+
// 共通のMyImageは幅を測ったあと、もう一度描き直してから図を置くので、図が後から出て下の文章が動く。
|
|
31
|
+
// MyImageは全アプリの問題の解説でも使うので、記事だけこの部品にした。
|
|
32
|
+
// 幅を"100%"と縦横の比だけで決めると、Androidで図が画面より大きく出た(2026-11-08、Pixel 8a)ので、幅を測って数字で決める
|
|
33
|
+
const ArticleImage = ({ path, navigation }) => {
|
|
34
|
+
const [boxWidth, setBoxWidth] = (0, react_1.useState)(0);
|
|
35
|
+
// 縦横の大きさは、読み込む前から同期で分かる
|
|
36
|
+
const source = react_native_1.Image.resolveAssetSource(path);
|
|
37
|
+
// 元の大きさより広げない(MyImageと同じ)
|
|
38
|
+
const width = Math.min(boxWidth, source.width);
|
|
39
|
+
const height = Math.min((width * source.height) / source.width, MAX_HEIGHT);
|
|
40
|
+
return (<react_native_1.View style={{ alignItems: "center" }} onLayout={(e) => setBoxWidth(e.nativeEvent.layout.width)}>
|
|
41
|
+
{boxWidth > 0 && (<react_native_1.TouchableOpacity onPress={() => navigation.navigate("ImgZoom", { path })} activeOpacity={0.7}>
|
|
42
|
+
<react_native_1.Image source={path} resizeMode="contain" style={{ width, height }}/>
|
|
43
|
+
</react_native_1.TouchableOpacity>)}
|
|
44
|
+
</react_native_1.View>);
|
|
45
|
+
};
|
|
46
|
+
exports.default = ArticleImage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StackNavigationProp } from "@react-navigation/stack";
|
|
3
|
+
import { Nav } from "@nakamura-123/types";
|
|
4
|
+
import { ArticleSection } from "../../functions/articleContentFnc";
|
|
5
|
+
type Navigation = StackNavigationProp<Nav.RootStackParamList>;
|
|
6
|
+
interface Props {
|
|
7
|
+
title: string;
|
|
8
|
+
sections: ArticleSection[];
|
|
9
|
+
articleId: string;
|
|
10
|
+
navigation: Navigation;
|
|
11
|
+
footer: React.ReactNode;
|
|
12
|
+
startId?: string;
|
|
13
|
+
restorePosition?: boolean;
|
|
14
|
+
onReportWrong: () => void;
|
|
15
|
+
}
|
|
16
|
+
declare const ArticleSectionPager: React.FC<Props>;
|
|
17
|
+
export default ArticleSectionPager;
|