@nakamura-123/pages 1.4.4 → 1.4.6

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.
@@ -29,11 +29,11 @@ const ArticleRow = ({ title, kind, isContinued, isRead, flagColor, borderColor,
29
29
  isContinued && styles.continued,
30
30
  borderColor && { borderColor: lib_1.colors[borderColor], borderWidth: 2 },
31
31
  ]}>
32
- {!isRead && (<react_native_1.View style={styles.ribbon} pointerEvents="none">
33
- <react_native_1.Text style={styles.ribbonText}>{t("article.unread")}</react_native_1.Text>
34
- </react_native_1.View>)}
35
32
  <react_native_1.View style={styles.leftIconWrap}>
36
33
  <common_1.Icon5 name="file-alt" size={18} color="darkGray"/>
34
+ {/* 未読は書類のアイコンの右上の赤い点。前は角の斜めの帯に「未読」と書いたが、
35
+ ほかの言語では帯に入りきらず読めなかった(2026-11-18、本人) */}
36
+ {!isRead && (<react_native_1.View style={styles.unreadDot} pointerEvents="none" accessibilityLabel={t("article.unread")}/>)}
37
37
  </react_native_1.View>
38
38
  <common_1.MyText fsize="sm" color="text" style={styles.title}>
39
39
  {title}
@@ -50,7 +50,6 @@ const styles = react_native_1.StyleSheet.create({
50
50
  width: "100%",
51
51
  flexDirection: "row",
52
52
  alignItems: "center",
53
- // 左は未読の帯の分あけておく(既読でも位置がそろうように常にあける)
54
53
  paddingLeft: 30,
55
54
  paddingRight: 15,
56
55
  borderWidth: 1,
@@ -65,23 +64,17 @@ const styles = react_native_1.StyleSheet.create({
65
64
  leftIconWrap: {
66
65
  marginRight: 8,
67
66
  },
68
- // 未読:左上の角に斜めの帯。行の高さが変わっても角に収まるよう上からの位置で決める。
69
- // アイコンから8pt以上離れる位置
70
- ribbon: {
67
+ // アイコンの右上に少し重ねる。地の色の縁で、アイコンの線と混ざらないようにする
68
+ unreadDot: {
71
69
  position: "absolute",
72
- top: 4,
73
- left: -22,
74
- width: 64,
75
- paddingVertical: 1,
76
- alignItems: "center",
70
+ top: -3,
71
+ right: -5,
72
+ width: 10,
73
+ height: 10,
74
+ borderRadius: 5,
77
75
  backgroundColor: lib_1.colors.red,
78
- transform: [{ rotate: "-45deg" }],
79
- },
80
- ribbonText: {
81
- color: lib_1.colors.white,
82
- fontSize: 10,
83
- fontWeight: "700",
84
- letterSpacing: 0.5,
76
+ borderWidth: 1.5,
77
+ borderColor: lib_1.colors.bkBeige,
85
78
  },
86
79
  title: {
87
80
  flex: 1,
@@ -26,40 +26,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ExampleText = exports.ClozeText = exports.RUBY_LINE_EM = exports.ClozeBar = exports.useLessonSearch = exports.ClozeProvider = void 0;
27
27
  const react_1 = __importStar(require("react"));
28
28
  const react_native_1 = require("react-native");
29
+ const react_redux_1 = require("react-redux");
29
30
  const lib_1 = require("@nakamura-123/lib");
30
31
  const common_1 = require("@nakamura-123/common");
32
+ const stores_1 = require("@nakamura-123/stores");
31
33
  const MyTextqqyy_1 = require("../../quiz/common/MyTextqqyy");
32
34
  const RefLink_1 = require("./RefLink");
33
35
  const articleContentFnc_1 = require("../../functions/articleContentFnc");
34
36
  const MathView = require("react-native-math-view").default;
35
37
  const ClozeContext = (0, react_1.createContext)(null);
36
38
  // 開いたかどうかは保存しない(10/24の決定)。LESSONではページごと、名札の無い記事では記事全体で1つ持つ。
37
- // 開いた答えは押しても閉じない(押すのは検索に使う)。隠し直すのはページの上の「全部隠す」で行う
39
+ // 開いた答えは押しても閉じない(押すのは検索に使う)。隠し直すのはページの上の「全部隠す」で行う。
40
+ // 「常に表示」にチェックがあれば、どのページ・記事でも全部開いた形で出す(設定に保存する。2026-11-18、本人)
38
41
  const ClozeProvider = ({ blocks, searchEnabled, children }) => {
39
42
  const groups = (0, react_1.useMemo)(() => (0, articleContentFnc_1.clozeGroups)(blocks), [blocks]);
40
43
  const pageImages = (0, react_1.useMemo)(() => blocks.flatMap((b) => (b.type === "image" ? [b.name] : [])), [blocks]);
41
44
  const [opened, setOpened] = (0, react_1.useState)(new Set());
45
+ const isLocked = (0, react_redux_1.useSelector)((state) => { var _a; return (_a = state.quizCfg.inQuizOption.isClozeOpenLock) !== null && _a !== void 0 ? _a : false; });
42
46
  const value = (0, react_1.useMemo)(() => ({
43
47
  groups,
44
- opened,
48
+ opened: isLocked ? new Set(groups) : opened,
45
49
  open: (group) => setOpened((prev) => prev.has(group) ? prev : new Set(prev).add(group)),
46
50
  setAll: (open) => setOpened(open ? new Set(groups) : new Set()),
47
51
  searchEnabled,
48
52
  pageImages,
49
- }), [groups, opened, searchEnabled, pageImages]);
53
+ isLocked,
54
+ }), [groups, opened, searchEnabled, pageImages, isLocked]);
50
55
  return (<ClozeContext.Provider value={value}>{children}</ClozeContext.Provider>);
51
56
  };
52
57
  exports.ClozeProvider = ClozeProvider;
53
58
  const useLessonSearch = () => { var _a, _b; return (_b = (_a = (0, react_1.useContext)(ClozeContext)) === null || _a === void 0 ? void 0 : _a.searchEnabled) !== null && _b !== void 0 ? _b : false; };
54
59
  exports.useLessonSearch = useLessonSearch;
55
60
  // 穴の数と、全部を開ける・隠すボタン。穴の無いページには出さない。
56
- // 1つでも閉じていれば「全部見る」、1つでも開いていれば「全部隠す」を出す(途中までは両方)
61
+ // 1つでも閉じていれば「全部見る」、1つでも開いていれば「全部隠す」を出す(途中までは両方)。
62
+ // 「常に表示」にチェックがある間は全部開いているので、開ける・隠すボタンは出さない
57
63
  const ClozeBar = () => {
58
64
  const cloze = (0, react_1.useContext)(ClozeContext);
59
65
  const { t } = (0, common_1.useDrillTranslation)();
66
+ const dispatch = (0, react_redux_1.useDispatch)();
60
67
  if (!cloze || cloze.groups.length === 0)
61
68
  return null;
62
69
  const openCount = cloze.groups.filter((g) => cloze.opened.has(g)).length;
70
+ const toggleLock = () => {
71
+ dispatch(stores_1.cfgAction.selectInQuizOption({
72
+ key: "isClozeOpenLock",
73
+ value: !cloze.isLocked,
74
+ }));
75
+ dispatch(stores_1.cfgStorage.saveCfgOption());
76
+ };
63
77
  return (<react_native_1.View style={styles.bar}>
64
78
  <common_1.MyText fsize="xs" weight={700} color="ltBlack">
65
79
  {t("article.clozeCount", {
@@ -68,12 +82,18 @@ const ClozeBar = () => {
68
82
  })}
69
83
  </common_1.MyText>
70
84
  <react_native_1.View style={styles.barButtons}>
71
- {openCount > 0 && (<common_1.PressAnimatedWrap onPress={() => cloze.setAll(false)} style={styles.barButton}>
85
+ <common_1.PressAnimatedWrap onPress={toggleLock} style={styles.lockButton}>
86
+ <common_1.Icon5 name={cloze.isLocked ? "check-square" : "square"} size={14} color={cloze.isLocked ? "red" : "ltBlack"} solid={cloze.isLocked} style={styles.lockIcon}/>
87
+ <common_1.MyText fsize="xs" weight={700} color="text">
88
+ {t("article.keepAnswersShown")}
89
+ </common_1.MyText>
90
+ </common_1.PressAnimatedWrap>
91
+ {!cloze.isLocked && openCount > 0 && (<common_1.PressAnimatedWrap onPress={() => cloze.setAll(false)} style={styles.barButton}>
72
92
  <common_1.MyText fsize="xs" weight={700} color="text">
73
93
  {t("article.hideAllAnswers")}
74
94
  </common_1.MyText>
75
95
  </common_1.PressAnimatedWrap>)}
76
- {openCount < cloze.groups.length && (<common_1.PressAnimatedWrap onPress={() => cloze.setAll(true)} style={styles.barButton}>
96
+ {!cloze.isLocked && openCount < cloze.groups.length && (<common_1.PressAnimatedWrap onPress={() => cloze.setAll(true)} style={styles.barButton}>
77
97
  <common_1.MyText fsize="xs" weight={700} color="text">
78
98
  {t("article.showAllAnswers")}
79
99
  </common_1.MyText>
@@ -285,8 +305,14 @@ const styles = react_native_1.StyleSheet.create({
285
305
  justifyContent: "space-between",
286
306
  marginBottom: 10,
287
307
  },
308
+ // 途中まで開くと「常に表示」と2つのボタンが並ぶ。狭い画面や長い訳では折り返す
288
309
  barButtons: {
289
310
  flexDirection: "row",
311
+ flexWrap: "wrap",
312
+ justifyContent: "flex-end",
313
+ alignItems: "center",
314
+ flexShrink: 1,
315
+ marginLeft: 8,
290
316
  gap: 6,
291
317
  },
292
318
  barButton: {
@@ -297,6 +323,16 @@ const styles = react_native_1.StyleSheet.create({
297
323
  borderColor: lib_1.colors.light,
298
324
  backgroundColor: lib_1.colors.white,
299
325
  },
326
+ // ボタンと違って押しても消えない切り替えなので、枠を付けずにチェックの印と文字だけにする
327
+ lockButton: {
328
+ flexDirection: "row",
329
+ alignItems: "center",
330
+ paddingHorizontal: 4,
331
+ paddingVertical: 4,
332
+ },
333
+ lockIcon: {
334
+ marginRight: 5,
335
+ },
300
336
  hole: {
301
337
  borderRadius: 4,
302
338
  backgroundColor: lib_1.colors.beige,
@@ -47,12 +47,19 @@ const GAnswer = ({ navigation }) => {
47
47
  }
48
48
  // 意味を取る問題:わかった/わからなかった。今解いている問題なら、答えたあとも押し直せる
49
49
  const canAnswer = mode === "quiz" || (mode === "check" && turn === activeTurn);
50
+ // 否定を左・肯定を右に置く(「いいえ・はい」と同じ並び)。字だけでなく?と✓の形でも分かるようにする(2026-11-18、本人)
50
51
  const cards = [
51
- { ok: true, label: t("quiz.result.understood"), color: "red" },
52
52
  {
53
53
  ok: false,
54
54
  label: t("quiz.grammar.notUnderstood"),
55
55
  color: "blue",
56
+ icon: "question-circle",
57
+ },
58
+ {
59
+ ok: true,
60
+ label: t("quiz.result.understood"),
61
+ color: "red",
62
+ icon: "check-circle",
56
63
  },
57
64
  ];
58
65
  return (<react_native_1.View>
@@ -60,7 +67,7 @@ const GAnswer = ({ navigation }) => {
60
67
  <GGuideBtn_1.default navigation={navigation}/>
61
68
  </react_native_1.View>
62
69
  <react_native_1.View style={styles.container}>
63
- {cards.map(({ ok, label, color }) => {
70
+ {cards.map(({ ok, label, color, icon }) => {
64
71
  const isOn = mode !== "quiz" && question.isCorrected === ok;
65
72
  return (<common_1.DoubleTapWrapper key={label} onPress={() => canAnswer && handleAnswer(ok)} isDoublePress={isDoublePress}>
66
73
  <react_native_1.View style={Object.assign(Object.assign({}, styles.choice), { borderColor: isOn ? lib_1.colors[color] : lib_1.colors.light })}>
@@ -71,7 +78,10 @@ const GAnswer = ({ navigation }) => {
71
78
  {ok ? t("quiz.result.understood") : t("quiz.grammar.again")}
72
79
  <common_1.Icon5 name={pawIcon} size={15} color={color}/>
73
80
  </common_1.BoundText>)}
74
- <common_1.MyText>{label}</common_1.MyText>
81
+ <react_native_1.View style={styles.labelRow}>
82
+ <common_1.Icon5 name={icon} size={18} color={color} solid style={styles.labelIcon}/>
83
+ <common_1.MyText>{label}</common_1.MyText>
84
+ </react_native_1.View>
75
85
  </react_native_1.View>
76
86
  </common_1.DoubleTapWrapper>);
77
87
  })}
@@ -80,10 +90,19 @@ const GAnswer = ({ navigation }) => {
80
90
  };
81
91
  const styles = react_native_1.StyleSheet.create({
82
92
  // 単語の問題画面の Repeat・Search・Guide の段と同じ位置。音声(Repeat)は段7で足す
93
+ // ガイドのボタンが出たときに選択肢の枠とくっつかないよう、下を空ける(2026-11-18、本人)
83
94
  btnRow: {
84
95
  flexDirection: "row",
85
96
  marginHorizontal: 10,
86
97
  minHeight: 40,
98
+ marginBottom: 10,
99
+ },
100
+ labelRow: {
101
+ flexDirection: "row",
102
+ alignItems: "center",
103
+ },
104
+ labelIcon: {
105
+ marginRight: 6,
87
106
  },
88
107
  container: {
89
108
  justifyContent: "space-between",
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importStar(require("react"));
30
30
  const react_native_1 = require("react-native");
31
+ const react_redux_1 = require("react-redux");
31
32
  const lib_1 = require("@nakamura-123/lib");
32
33
  const common_1 = require("@nakamura-123/common");
33
34
  const QuizCnt_1 = __importDefault(require("../jQuestion/QuizCnt"));
@@ -42,6 +43,9 @@ const GQuestion = ({ navigation }) => {
42
43
  const question = (0, quizHook_1.useQuestionDataG)();
43
44
  const mode = (0, quizHook_1.useGetMode)();
44
45
  const trans = (0, quizHook_1.useGrammarTrans)(question === null || question === void 0 ? void 0 : question.quizId);
46
+ // 訳は例文と同じ大きさ(設定の文字の大きさ)にする。前はsm(13)で固定で、
47
+ // 日本語の字体ではローマ字が一回り小さく見えるので、英語などは小さすぎた(2026-11-18、本人)
48
+ const fsize = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fsize);
45
49
  // 訳を見た問題。問題が替わったら閉じる
46
50
  const [peekId, setPeekId] = (0, react_1.useState)(null);
47
51
  if (!question)
@@ -59,7 +63,7 @@ const GQuestion = ({ navigation }) => {
59
63
  </RubyText_1.default>
60
64
  </react_native_1.View>
61
65
  <react_native_1.View style={styles.bottom}>
62
- {showTrans && trans && (<common_1.MyText fsize="sm" style={styles.trans}>
66
+ {showTrans && trans && (<common_1.MyText fsize={fsize} style={styles.trans}>
63
67
  {(0, renderTransUdl_1.renderTransUdl)(trans, isBlank ? styles.udlRed : styles.udlBlue)}
64
68
  </common_1.MyText>)}
65
69
  {isQuiz && !isBlank && !isPeek && (<react_native_1.Pressable style={styles.peek} onPress={() => setPeekId(question.quizId)}>