@celljs/ta-edu 4.27.0 → 4.29.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.
- package/README.en.md +2 -1
- package/README.md +3 -2
- package/host/index.mjs +1972 -0
- package/package.json +13 -6
- package/skills/edu-quiz/SKILL.md +1 -0
- package/web/index.js +2320 -1819
package/web/index.js
CHANGED
|
@@ -173,6 +173,40 @@ var TaAgentSummary;
|
|
|
173
173
|
}
|
|
174
174
|
TaAgentSummary2.strip = strip;
|
|
175
175
|
})(TaAgentSummary || (TaAgentSummary = {}));
|
|
176
|
+
var TaPictureNote;
|
|
177
|
+
(function(TaPictureNote2) {
|
|
178
|
+
TaPictureNote2.OPEN = "<pictures>";
|
|
179
|
+
TaPictureNote2.CLOSE = "</pictures>";
|
|
180
|
+
const BLOCK = /[ \t]*<pictures>([\s\S]*?)(?:<\/pictures>|$)|<p(?:i(?:c(?:t(?:u(?:r(?:es?)?)?)?)?)?)?$/gi;
|
|
181
|
+
const ROW = /(?:^|\s)[-*]?\s*p(\d+)\s*[::]\s*/gi;
|
|
182
|
+
function take(text) {
|
|
183
|
+
const told = new Map;
|
|
184
|
+
if (!/<p/i.test(text)) {
|
|
185
|
+
return { said: text, told };
|
|
186
|
+
}
|
|
187
|
+
const said = text.replace(BLOCK, (_all, body) => {
|
|
188
|
+
const rows = [...(body !== null && body !== undefined ? body : "").matchAll(ROW)];
|
|
189
|
+
rows.forEach((row, index) => {
|
|
190
|
+
var _a;
|
|
191
|
+
var _b, _c;
|
|
192
|
+
const end = (_b = (_a = rows[index + 1]) === null || _a === undefined ? undefined : _a.index) !== null && _b !== undefined ? _b : body === null || body === undefined ? undefined : body.length;
|
|
193
|
+
const what = body === null || body === undefined ? undefined : body.slice(((_c = row.index) !== null && _c !== undefined ? _c : 0) + row[0].length, end).trim();
|
|
194
|
+
if (what) {
|
|
195
|
+
told.set(Number(row[1]), what);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return "";
|
|
199
|
+
});
|
|
200
|
+
return { said: said === text ? text : said.replace(/\n{3,}/g, `
|
|
201
|
+
|
|
202
|
+
`).trim(), told };
|
|
203
|
+
}
|
|
204
|
+
TaPictureNote2.take = take;
|
|
205
|
+
function strip(text) {
|
|
206
|
+
return take(text).said;
|
|
207
|
+
}
|
|
208
|
+
TaPictureNote2.strip = strip;
|
|
209
|
+
})(TaPictureNote || (TaPictureNote = {}));
|
|
176
210
|
var TaSkillUse;
|
|
177
211
|
(function(TaSkillUse2) {
|
|
178
212
|
const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
|
|
@@ -282,6 +316,7 @@ var PAGE = `${NAME}/home`;
|
|
|
282
316
|
var MARK = "[ta:edu]";
|
|
283
317
|
var QUIZ = "ta-quiz";
|
|
284
318
|
var LEARNING = "ta-learning";
|
|
319
|
+
var CONSENT = "ta-edu-consent";
|
|
285
320
|
var GROUP_KIND = "ta-rooms";
|
|
286
321
|
var DIRECT_KIND = "ta-direct";
|
|
287
322
|
var STATE = "edu:";
|
|
@@ -296,8 +331,97 @@ var Keys;
|
|
|
296
331
|
Keys.DAYS = "days";
|
|
297
332
|
Keys.POSTED = "posted";
|
|
298
333
|
Keys.TEACHER_KEY = "teacherKey";
|
|
334
|
+
Keys.CONSENT = "consent";
|
|
335
|
+
Keys.REPORTED = "reported";
|
|
336
|
+
Keys.TASKS = "tasks";
|
|
299
337
|
})(Keys ||= {});
|
|
300
338
|
|
|
339
|
+
// web-src/edu-seal.ts
|
|
340
|
+
var CURVE = { name: "ECDH", namedCurve: "P-256" };
|
|
341
|
+
function base64(bytes) {
|
|
342
|
+
let text = "";
|
|
343
|
+
for (const byte of new Uint8Array(bytes)) {
|
|
344
|
+
text += String.fromCharCode(byte);
|
|
345
|
+
}
|
|
346
|
+
return btoa(text);
|
|
347
|
+
}
|
|
348
|
+
function bytes(text) {
|
|
349
|
+
const binary = atob(text);
|
|
350
|
+
const out = new Uint8Array(binary.length);
|
|
351
|
+
for (let i = 0;i < binary.length; i++) {
|
|
352
|
+
out[i] = binary.charCodeAt(i);
|
|
353
|
+
}
|
|
354
|
+
return out;
|
|
355
|
+
}
|
|
356
|
+
async function secret(privateKey, publicKey) {
|
|
357
|
+
const other = await crypto.subtle.importKey("jwk", publicKey, CURVE, false, []);
|
|
358
|
+
return crypto.subtle.deriveKey({ name: "ECDH", public: other }, privateKey, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
|
|
359
|
+
}
|
|
360
|
+
var EduSeal;
|
|
361
|
+
((EduSeal) => {
|
|
362
|
+
async function keys() {
|
|
363
|
+
const pair = await crypto.subtle.generateKey(CURVE, true, ["deriveKey"]);
|
|
364
|
+
return { publicKey: await crypto.subtle.exportKey("jwk", pair.publicKey), privateKey: await crypto.subtle.exportKey("jwk", pair.privateKey) };
|
|
365
|
+
}
|
|
366
|
+
EduSeal.keys = keys;
|
|
367
|
+
function isKeys(value) {
|
|
368
|
+
const keys2 = value;
|
|
369
|
+
return !!keys2 && typeof keys2.publicKey?.x === "string" && typeof keys2.privateKey?.d === "string";
|
|
370
|
+
}
|
|
371
|
+
EduSeal.isKeys = isKeys;
|
|
372
|
+
function isPublic(value) {
|
|
373
|
+
const key = value;
|
|
374
|
+
return !!key && key.kty === "EC" && typeof key.x === "string" && typeof key.y === "string" && !("d" in key);
|
|
375
|
+
}
|
|
376
|
+
EduSeal.isPublic = isPublic;
|
|
377
|
+
async function seal(value, publicKey) {
|
|
378
|
+
const pair = await crypto.subtle.generateKey(CURVE, true, ["deriveKey"]);
|
|
379
|
+
const key = await secret(pair.privateKey, publicKey);
|
|
380
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
381
|
+
const data = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, key, new TextEncoder().encode(JSON.stringify(value)));
|
|
382
|
+
const e = await crypto.subtle.exportKey("jwk", pair.publicKey);
|
|
383
|
+
return { e: { kty: e.kty, crv: e.crv, x: e.x, y: e.y }, iv: base64(iv), d: base64(data) };
|
|
384
|
+
}
|
|
385
|
+
EduSeal.seal = seal;
|
|
386
|
+
async function open(sealed, keys2) {
|
|
387
|
+
const value = sealed;
|
|
388
|
+
if (!value || !isPublic(value.e) || typeof value.iv !== "string" || typeof value.d !== "string") {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
try {
|
|
392
|
+
const mine = await crypto.subtle.importKey("jwk", keys2.privateKey, CURVE, false, ["deriveKey"]);
|
|
393
|
+
const key = await secret(mine, value.e);
|
|
394
|
+
const data = await crypto.subtle.decrypt({ name: "AES-GCM", iv: bytes(value.iv) }, key, bytes(value.d));
|
|
395
|
+
return JSON.parse(new TextDecoder().decode(data));
|
|
396
|
+
} catch {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
EduSeal.open = open;
|
|
401
|
+
})(EduSeal ||= {});
|
|
402
|
+
|
|
403
|
+
// ../ta-protocol/esm/common/figure-protocol.js
|
|
404
|
+
var TaFigure;
|
|
405
|
+
(function(TaFigure2) {
|
|
406
|
+
TaFigure2.DEFAULT_LANGUAGE = "ta-plot";
|
|
407
|
+
function markdown(value) {
|
|
408
|
+
if (typeof value === "string") {
|
|
409
|
+
return value.trim() || undefined;
|
|
410
|
+
}
|
|
411
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const keys = Object.keys(value);
|
|
415
|
+
const wrapped = keys.length === 1 && /^ta-[a-z0-9-]+$/.test(keys[0]);
|
|
416
|
+
const language = wrapped ? keys[0] : TaFigure2.DEFAULT_LANGUAGE;
|
|
417
|
+
const spec = wrapped ? value[language] : value;
|
|
418
|
+
return spec && typeof spec === "object" && Object.keys(spec).length ? `\`\`\`${language}
|
|
419
|
+
${JSON.stringify(spec)}
|
|
420
|
+
\`\`\`` : undefined;
|
|
421
|
+
}
|
|
422
|
+
TaFigure2.markdown = markdown;
|
|
423
|
+
})(TaFigure || (TaFigure = {}));
|
|
424
|
+
|
|
301
425
|
// web-src/edu-util.ts
|
|
302
426
|
var DAY = 86400000;
|
|
303
427
|
var INTERVALS = [1, 3, 7, 14, 30];
|
|
@@ -314,12 +438,10 @@ var EduUtil;
|
|
|
314
438
|
stage: STAGES.includes(stored.stage) ? stored.stage : undefined,
|
|
315
439
|
subject: typeof stored.subject === "string" ? stored.subject : "",
|
|
316
440
|
textbook: typeof stored.textbook === "string" ? stored.textbook : "",
|
|
317
|
-
consent: stored.consent === true,
|
|
318
441
|
current: IDENTITIES.includes(stored.current) && identities.includes(stored.current) ? stored.current : undefined,
|
|
319
442
|
classes: Array.isArray(stored.classes) ? stored.classes.filter((one) => typeof one === "string") : [],
|
|
320
443
|
klass: typeof stored.klass === "string" ? stored.klass : undefined,
|
|
321
|
-
reportTo: typeof stored.reportTo === "string" ? stored.reportTo : undefined
|
|
322
|
-
reportAt: typeof stored.reportAt === "number" ? stored.reportAt : undefined
|
|
444
|
+
reportTo: typeof stored.reportTo === "string" ? stored.reportTo : undefined
|
|
323
445
|
};
|
|
324
446
|
}
|
|
325
447
|
EduUtil.settings = settings;
|
|
@@ -438,10 +560,23 @@ var EduUtil;
|
|
|
438
560
|
return best;
|
|
439
561
|
}
|
|
440
562
|
EduUtil.hardest = hardest;
|
|
441
|
-
function locked(settings2, identity) {
|
|
442
|
-
return identity === "student" && settings2.stage === "primary" && !
|
|
563
|
+
function locked(settings2, identity, consent2) {
|
|
564
|
+
return identity === "student" && settings2.stage === "primary" && !consent2?.granted;
|
|
443
565
|
}
|
|
444
566
|
EduUtil.locked = locked;
|
|
567
|
+
function reportedAt(value) {
|
|
568
|
+
const at = value?.at;
|
|
569
|
+
return typeof at === "number" ? at : undefined;
|
|
570
|
+
}
|
|
571
|
+
EduUtil.reportedAt = reportedAt;
|
|
572
|
+
function consent(value) {
|
|
573
|
+
const raw = value && typeof value === "object" ? value : {};
|
|
574
|
+
const one = (part, id) => part && typeof part[id] === "string" && typeof part.name === "string" && typeof part.at === "number" ? { [id]: part[id], name: part.name, at: part.at } : undefined;
|
|
575
|
+
const granted = one(raw.granted, "by");
|
|
576
|
+
const asked = one(raw.asked, "to");
|
|
577
|
+
return { ...granted ? { granted } : {}, ...asked ? { asked } : {} };
|
|
578
|
+
}
|
|
579
|
+
EduUtil.consent = consent;
|
|
445
580
|
function hash(text2) {
|
|
446
581
|
let h = 2166136261;
|
|
447
582
|
for (let i = 0;i < text2.length; i++) {
|
|
@@ -471,7 +606,9 @@ var EduUtil;
|
|
|
471
606
|
}
|
|
472
607
|
const mistake = {
|
|
473
608
|
id,
|
|
474
|
-
question: known?.question ?? question2.q
|
|
609
|
+
question: known?.question ?? (question2.figure ? `${question2.q}
|
|
610
|
+
|
|
611
|
+
${question2.figure}` : question2.q),
|
|
475
612
|
answer: answerText(question2),
|
|
476
613
|
given,
|
|
477
614
|
subject: question2.subject ?? known?.subject,
|
|
@@ -530,7 +667,14 @@ var EduUtil;
|
|
|
530
667
|
return;
|
|
531
668
|
}
|
|
532
669
|
const options = strings(raw.options);
|
|
533
|
-
const base = {
|
|
670
|
+
const base = {
|
|
671
|
+
q,
|
|
672
|
+
explain: text(raw.explain),
|
|
673
|
+
figure: TaFigure.markdown(raw.figure),
|
|
674
|
+
subject: text(raw.subject),
|
|
675
|
+
topic: text(raw.topic),
|
|
676
|
+
review: text(raw.review)
|
|
677
|
+
};
|
|
534
678
|
const answer = raw.answer;
|
|
535
679
|
if (options.length >= 2) {
|
|
536
680
|
const byText = options.indexOf(text(answer) ?? "");
|
|
@@ -582,89 +726,6 @@ var EduUtil;
|
|
|
582
726
|
}
|
|
583
727
|
})(EduUtil ||= {});
|
|
584
728
|
|
|
585
|
-
// web-src/edu-roles.ts
|
|
586
|
-
var QUIZ_FORMAT = `To give questions to answer, write a fenced block of language ${QUIZ} holding JSON, which Ta draws as a card the user answers in, checked at once: {"title"?: string, "reveal"?: boolean, "questions": [{"q": string, "options"?: [string] (a choice question; "answer" the letter), "answer": "B" | true | false (true or false question) | ["answers", "taken as right"] (fill in the blank), "explain": string, "subject": the school subject, "topic": the point it tests, "review"?: id of the mistake it reviews}]}. Mistakes the user makes in it are kept for review. To show how someone is learning, a ${LEARNING} block: {"title"?: string, "items": [{"label": topic, "value": 0-100 mastery, "note"?: string}], "weak"?: [string], "next"?: [what to do next]}.`;
|
|
587
|
-
var ROLES = {
|
|
588
|
-
student: {
|
|
589
|
-
assistant: "assistantStudent",
|
|
590
|
-
tagline: "taglineStudent",
|
|
591
|
-
icon: "BookOpen",
|
|
592
|
-
skills: ["edu-tutor", "edu-quiz"],
|
|
593
|
-
actions: [
|
|
594
|
-
{ key: "explain", icon: "Image" },
|
|
595
|
-
{ key: "quizMe", icon: "ListChecks", send: true },
|
|
596
|
-
{ key: "review", icon: "RotateCcw", send: true },
|
|
597
|
-
{ key: "recite", icon: "Mic" }
|
|
598
|
-
],
|
|
599
|
-
rules: "You tutor a student. Never give the final answer or a whole solution before the student has tried: ask what they know, give one hint at a time, let them do each step, and show the full solution only once they reached it or asked twice after trying. Check understanding with a question in another form. Never write their essays or homework for them: outlines, questions and comments on what they wrote. Encourage effort, not talent. If they speak of distress, listen, and tell them to talk to a parent or a teacher they trust."
|
|
600
|
-
},
|
|
601
|
-
parent: {
|
|
602
|
-
assistant: "assistantParent",
|
|
603
|
-
tagline: "taglineParent",
|
|
604
|
-
icon: "House",
|
|
605
|
-
skills: ["edu-parent", "edu-quiz"],
|
|
606
|
-
actions: [
|
|
607
|
-
{ key: "check", icon: "Image" },
|
|
608
|
-
{ key: "talk", icon: "MessageCircle" },
|
|
609
|
-
{ key: "toTeacher", icon: "Send" },
|
|
610
|
-
{ key: "plan", icon: "Calendar" }
|
|
611
|
-
],
|
|
612
|
-
rules: "You help a parent help their child. Tell the parent where and why the child went wrong, the words to explain it to the child at their age, and one practice question; do not do the homework for the child. Help them keep calm and kind; on messages to teachers, help them be clear, specific and respectful. Their child is theirs to judge: no labels, no diagnosis."
|
|
613
|
-
},
|
|
614
|
-
teacher: {
|
|
615
|
-
assistant: "assistantTeacher",
|
|
616
|
-
tagline: "taglineTeacher",
|
|
617
|
-
icon: "Pencil",
|
|
618
|
-
skills: ["edu-grading", "edu-quiz", "edu-lesson"],
|
|
619
|
-
actions: [
|
|
620
|
-
{ key: "grade", icon: "ListChecks" },
|
|
621
|
-
{ key: "makeQuiz", icon: "FilePlus" },
|
|
622
|
-
{ key: "lesson", icon: "FileText" },
|
|
623
|
-
{ key: "exam", icon: "ChartSpline" },
|
|
624
|
-
{ key: "weekly", icon: "Calendar", send: true }
|
|
625
|
-
],
|
|
626
|
-
rules: 'You assist a teacher. Marking: right or wrong for each question, the causes of the mistakes grouped, what the class shares, and an outline to go over it; what you are unsure of you say. Questions: in three levels (basic, better, stretch) with answers and explanations, "reveal": true. Score sheets and records in the working directory you read yourself; you count, the teacher decides. Names of students stay on this computer.'
|
|
627
|
-
},
|
|
628
|
-
homeroom: {
|
|
629
|
-
assistant: "assistantHomeroom",
|
|
630
|
-
tagline: "taglineHomeroom",
|
|
631
|
-
icon: "Users",
|
|
632
|
-
skills: ["edu-homeroom"],
|
|
633
|
-
actions: [
|
|
634
|
-
{ key: "reply", icon: "MessageCircle" },
|
|
635
|
-
{ key: "comments", icon: "Pencil" },
|
|
636
|
-
{ key: "meeting", icon: "Users" },
|
|
637
|
-
{ key: "notice", icon: "Megaphone" }
|
|
638
|
-
],
|
|
639
|
-
rules: "You assist a class teacher. Replies to parents are drafts the teacher sends: warm, clear, within what the school decides, never promising what is not theirs. Report comments come from what the teacher told of each student, specific and kind, no stock phrases. A student at risk (self-harm, abuse, bullying): tell the teacher to bring in the school counsellor, the school leaders and the parents at once; do not handle it alone."
|
|
640
|
-
}
|
|
641
|
-
};
|
|
642
|
-
var STAGE_NAMES = { primary: "primary school", junior: "middle school", senior: "high school" };
|
|
643
|
-
var EduRoles;
|
|
644
|
-
((EduRoles) => {
|
|
645
|
-
function prompt(identity, settings) {
|
|
646
|
-
const role = ROLES[identity];
|
|
647
|
-
const about = [
|
|
648
|
-
settings.stage && `stage: ${STAGE_NAMES[settings.stage]}`,
|
|
649
|
-
settings.subject && `subjects: ${settings.subject}`,
|
|
650
|
-
settings.textbook && `textbooks: ${settings.textbook}`
|
|
651
|
-
].filter(Boolean);
|
|
652
|
-
return [
|
|
653
|
-
`${MARK} You are Ta for a ${identity === "homeroom" ? "class teacher" : identity} in school education in China${about.length ? ` (${about.join("; ")})` : ""}.`,
|
|
654
|
-
role.rules,
|
|
655
|
-
`Skills for this: ${role.skills.join(", ")}.`,
|
|
656
|
-
"What students, scores and families are is private: keep it on this computer, and leave names out of what is shared unless the user asks.",
|
|
657
|
-
QUIZ_FORMAT
|
|
658
|
-
].join(`
|
|
659
|
-
`);
|
|
660
|
-
}
|
|
661
|
-
EduRoles.prompt = prompt;
|
|
662
|
-
function action(words, key) {
|
|
663
|
-
return words[key];
|
|
664
|
-
}
|
|
665
|
-
EduRoles.action = action;
|
|
666
|
-
})(EduRoles ||= {});
|
|
667
|
-
|
|
668
729
|
// ../ta-protocol/esm/common/language.js
|
|
669
730
|
var TaLanguageUtil;
|
|
670
731
|
(function(TaLanguageUtil2) {
|
|
@@ -704,943 +765,1458 @@ var TaLanguageUtil;
|
|
|
704
765
|
TaLanguageUtil2.list = list;
|
|
705
766
|
})(TaLanguageUtil || (TaLanguageUtil = {}));
|
|
706
767
|
|
|
707
|
-
// web-src/i18n.ts
|
|
768
|
+
// web-src/i18n-home.ts
|
|
708
769
|
var EN = {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
},
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
primary: "小學",
|
|
862
|
-
junior: "國中",
|
|
863
|
-
senior: "高中",
|
|
864
|
-
consentTitle: "讓孩子使用學習夥伴?",
|
|
865
|
-
consentMessage: "依照中小學生成式人工智慧使用指南,小學生不獨自使用開放式生成。請家長或老師確認後開啟,平時盡量陪著用。",
|
|
866
|
-
consentConfirm: "我是家長或老師,開啟",
|
|
867
|
-
explain: { label: "拍題講解", text: "這道題我不會,先別告訴我答案,帶我一步步想:" },
|
|
868
|
-
quizMe: { label: "考考我", text: "依我最近學的內容出幾道題考考我" },
|
|
869
|
-
review: { label: "複習錯題", text: "複習今天該複習的 {count} 道錯題" },
|
|
870
|
-
recite: { label: "背誦默寫", text: "幫我背這一段,先讓我自己背,再告訴我哪裡錯了:" },
|
|
871
|
-
check: { label: "看作業對錯", text: "幫我看看孩子這份作業哪裡錯了,告訴我怎麼講給孩子聽:" },
|
|
872
|
-
talk: { label: "怎麼跟孩子講", text: "孩子遇到這個情況,我該怎麼跟他說:" },
|
|
873
|
-
toTeacher: { label: "給老師寫訊息", text: "幫我寫一段給老師的話,說清楚、有分寸:" },
|
|
874
|
-
plan: { label: "安排學習計畫", text: "幫孩子安排這週的學習計畫,情況是:" },
|
|
875
|
-
grade: { label: "批改作業", text: "批改這些作業(照片在下面),逐題判對錯,歸類錯因,最後給講評提綱:" },
|
|
876
|
-
makeQuiz: { label: "出一套題", text: "出一套題,分基礎、提升、拓展三層,主題是:" },
|
|
877
|
-
lesson: { label: "寫教學設計", text: "寫一份教學設計,課題是:" },
|
|
878
|
-
exam: { label: "試卷分析", text: "分析這份成績表(檔案在下面),找出共同的薄弱點和需要關注的學生:" },
|
|
879
|
-
weekly: { label: "每週學習小結", text: "每週五下午 4 點,讀本目錄裡這一週的成績和作業紀錄,寫一份學習小結給我" },
|
|
880
|
-
reply: { label: "回家長訊息", text: `家長傳來:
|
|
881
|
-
|
|
882
|
-
幫我擬一段回覆,我看過再傳:` },
|
|
883
|
-
comments: { label: "寫評語", text: `依下面每個學生的表現寫評語,不寫套話:
|
|
884
|
-
` },
|
|
885
|
-
meeting: { label: "班會方案", text: "設計一次班會,主題是:" },
|
|
886
|
-
notice: { label: "寫通知", text: "寫一則給家長的通知,內容是:" },
|
|
887
|
-
settingsTitle: "教育",
|
|
888
|
-
identitiesLabel: "身分",
|
|
889
|
-
identitiesHint: "選了哪個,列表裡就有對應的助手",
|
|
890
|
-
stageLabel: "學段",
|
|
891
|
-
subjectLabel: "學科",
|
|
892
|
-
subjectHint: "如 數學、英語",
|
|
893
|
-
textbookLabel: "教材版本",
|
|
894
|
-
textbookHint: "學校用的教材版本",
|
|
895
|
-
consentLabel: "允許小學生使用學習夥伴",
|
|
896
|
-
consentHint: "由家長或老師開啟",
|
|
897
|
-
quiz: "練習",
|
|
898
|
-
submit: "送出",
|
|
899
|
-
right: "答對了",
|
|
900
|
-
wrongAnswer: "正確答案:{answer}",
|
|
901
|
-
score: "答對 {right}/{total}",
|
|
902
|
-
explainWrong: "講講我錯的",
|
|
903
|
-
explainWrongText: "講講這幾道我做錯的題",
|
|
904
|
-
judgeTrue: "對",
|
|
905
|
-
judgeFalse: "錯",
|
|
906
|
-
blank: "寫下答案",
|
|
907
|
-
revealAnswer: "答案:{answer}",
|
|
908
|
-
learning: "學習情況",
|
|
909
|
-
weak: "薄弱點",
|
|
910
|
-
next: "接下來"
|
|
770
|
+
eduTitle: "Education",
|
|
771
|
+
pickTitle: "I am…",
|
|
772
|
+
pickHint: "Pick all that fit; switch between them at the top",
|
|
773
|
+
pickStage: "Stage",
|
|
774
|
+
done: "Done",
|
|
775
|
+
roles: "Roles",
|
|
776
|
+
homeDetailPick: "Pick who you are to start",
|
|
777
|
+
streak: "{count} days in a row",
|
|
778
|
+
noStreak: "Start a streak today",
|
|
779
|
+
dueHead: "{count} questions to review",
|
|
780
|
+
dueNone: "Nothing to review today",
|
|
781
|
+
reviewOf: "{subject} · review {n}",
|
|
782
|
+
lastWrong: "Last time you wrote {given}",
|
|
783
|
+
startReview: "Start review",
|
|
784
|
+
noDueHint: "What you get wrong goes into your mistakes and comes back just before you would forget it",
|
|
785
|
+
tilePhoto: "Snap a question",
|
|
786
|
+
tileQuiz: "Quiz me",
|
|
787
|
+
tileRecite: "Recite",
|
|
788
|
+
tileSpeak: "Speaking",
|
|
789
|
+
speakText: "Let's practise speaking: talk with me in simple English about my day, one question at a time, and correct my mistakes gently",
|
|
790
|
+
mistakesBook: "Mistakes",
|
|
791
|
+
bookCount: "{count} in all · {due} due",
|
|
792
|
+
subjectLine: "{count} · {due} due",
|
|
793
|
+
otherSubject: "Other",
|
|
794
|
+
thisWeek: "This week",
|
|
795
|
+
statQuestions: "questions",
|
|
796
|
+
statRight: "right",
|
|
797
|
+
statDays: "days studied",
|
|
798
|
+
weekdays: "MTWTFSS",
|
|
799
|
+
toParent: "Send my week to a parent",
|
|
800
|
+
toParentOn: "Sundays to {name}",
|
|
801
|
+
pickParent: "Send it to",
|
|
802
|
+
noFriends: "Add your parent as a friend in Ta first",
|
|
803
|
+
reportPrivacy: "Only counts, how many were right and weak points go, never what you said",
|
|
804
|
+
stopSending: "Stop sending",
|
|
805
|
+
sendNow: "Send now",
|
|
806
|
+
reportSent: "Sent to {name}",
|
|
807
|
+
reportFailed: "Not sent: say hello to them in Ta first",
|
|
808
|
+
reportTitle: "{name}'s week",
|
|
809
|
+
reportIntro: "How {name}'s week went",
|
|
810
|
+
reportNote: "{count} mistakes",
|
|
811
|
+
bookTitle: "{subject}",
|
|
812
|
+
yourAnswer: "Yours",
|
|
813
|
+
rightAnswer: "Answer",
|
|
814
|
+
dueNow: "Due now",
|
|
815
|
+
dueIn: "In {days} days",
|
|
816
|
+
reviewThese: "Review these",
|
|
817
|
+
childWeek: "{name}'s week",
|
|
818
|
+
fromChild: "From {name}'s Ta, {time}",
|
|
819
|
+
noReport: "No week from your child yet",
|
|
820
|
+
noReportHint: "Your child turns on Send my week to a parent under Education, Student, and picks you",
|
|
821
|
+
howToHelp: "How to help",
|
|
822
|
+
askTeacher: "Ask the teacher",
|
|
823
|
+
tileCheck: "Explain a question",
|
|
824
|
+
tileTalk: "Talk with my child",
|
|
825
|
+
tileTeacher: "Write to the teacher",
|
|
826
|
+
tilePlan: "Weekend plan",
|
|
827
|
+
notices: "From the teachers",
|
|
828
|
+
count: "{count}",
|
|
829
|
+
linkClassHint: "Link your child's class group, and the teachers' notices show here",
|
|
830
|
+
linkClass: "Link a class group",
|
|
831
|
+
parentPrivacy: "Your child chooses to send it, and sees what is sent",
|
|
832
|
+
noClass: "No class group linked",
|
|
833
|
+
noClassHint: "Make a group chat in Ta with your students and parents, then link it here. Practice sent to it is answered right in the chat, the answers going to you alone",
|
|
834
|
+
latestQuiz: "Latest practice",
|
|
835
|
+
submitted: "{count} of {total} handed in",
|
|
836
|
+
average: "{score}% right on average",
|
|
837
|
+
hardest: "Question {no}: {pct}% wrong",
|
|
838
|
+
hardestWho: "{count} students",
|
|
839
|
+
goOver: "Plan going over it",
|
|
840
|
+
followUp: "More practice for them",
|
|
841
|
+
noQuiz: "No practice sent yet",
|
|
842
|
+
noQuizHint: "Set questions with the teaching assistant, then tap Send to class on them",
|
|
843
|
+
tileMake: "Set questions",
|
|
844
|
+
tileLesson: "Prepare a lesson",
|
|
845
|
+
tileScores: "Analyse scores",
|
|
846
|
+
tileMark: "Mark homework",
|
|
847
|
+
askTopic: "Questions on",
|
|
848
|
+
askTopicHint: "Linear equations, 10 questions",
|
|
849
|
+
askLesson: "Lesson on",
|
|
850
|
+
askLessonHint: "What a fraction means",
|
|
851
|
+
askRecite: "Which passage?",
|
|
852
|
+
askRecitePrefill: `Help me learn it by heart: let me try first, then tell me what I got wrong.
|
|
853
|
+
`,
|
|
854
|
+
sendToClass: "Send to class",
|
|
855
|
+
sentToClass: "Sent to {klass}",
|
|
856
|
+
pickClass: "Send to which class?",
|
|
857
|
+
quizIntro: "{title} · {count} questions, handed to the teacher when done",
|
|
858
|
+
handedIn: "Handed to the teacher",
|
|
859
|
+
handIn: "Hand to the teacher",
|
|
860
|
+
noTeacherKey: "The teacher has not opened Education in Ta yet: hand it in again later",
|
|
861
|
+
handedCount: "{count} handed in",
|
|
862
|
+
results: "See results",
|
|
863
|
+
parentAsks: "Parents asking you",
|
|
864
|
+
waiting: "{count} waiting",
|
|
865
|
+
noAsks: "No parent asked you this week",
|
|
866
|
+
draftReply: "Draft a reply",
|
|
867
|
+
tileReply: "Reply to a parent",
|
|
868
|
+
tileComments: "Report comments",
|
|
869
|
+
tileMeeting: "Class meeting",
|
|
870
|
+
tileNotice: "Send a notice",
|
|
871
|
+
noticeTitle: "Notice to {klass}",
|
|
872
|
+
noticePrefix: "[Class notice] ",
|
|
873
|
+
recentNotices: "Recent notices",
|
|
874
|
+
classesTitle: "Class groups",
|
|
875
|
+
classesHint: "The group chats that are your classes",
|
|
876
|
+
noGroups: "No group chats yet: make one in Partners, then link it here",
|
|
877
|
+
manageClasses: "Class groups",
|
|
878
|
+
chipPhoto: "Snap a question",
|
|
879
|
+
chipHint: "A hint",
|
|
880
|
+
chipHintText: "One more hint, please, not the answer",
|
|
881
|
+
chipAgain: "Explain it differently",
|
|
882
|
+
chipAgainText: "Explain that another way",
|
|
883
|
+
chipGot: "I get it",
|
|
884
|
+
chipGotText: "I get it: give me one like it to try",
|
|
885
|
+
photoStudent: "I can't do this one. Don't tell me the answer yet, help me think it through",
|
|
886
|
+
photoParent: "My child got this wrong: where, and how do I explain it to them?",
|
|
887
|
+
photoTeacher: "Mark these: right or wrong for each question, the causes of the mistakes grouped, and an outline for going over them",
|
|
888
|
+
scoresText: "Analyse the score sheet {file}: the weak points the class shares, and the students to look after",
|
|
889
|
+
goOverText: 'Plan how to go over the practice "{title}" in class',
|
|
890
|
+
followUpText: 'Set more practice on question {no} of "{title}" for those who got it wrong',
|
|
891
|
+
noticeHelp: "A notice from the teacher: what do I need to do, and when?",
|
|
892
|
+
askHelp: "A parent wrote to me in the class group. Draft me a reply; I will read it before I send it",
|
|
893
|
+
consentNeeded: "Ask a parent first",
|
|
894
|
+
consentNeededHint: "At primary school the study buddy is used with a parent’s yes, given in their own Ta",
|
|
895
|
+
consentAsk: "Ask a parent",
|
|
896
|
+
consentAsked: "Asked {name} · waiting for their yes",
|
|
897
|
+
consentAskOther: "Ask again or ask someone else",
|
|
898
|
+
consentAskIntro: "{name} would like to use the study buddy of Ta. Say yes under Education → Parent in your Ta",
|
|
899
|
+
consentGrantIntro: "Yes, you may use the study buddy",
|
|
900
|
+
consentRevokeIntro: "Not the study buddy for now",
|
|
901
|
+
consentAskTitle: "{name} would like to use the study buddy",
|
|
902
|
+
consentAskBody: "It guides them to work things out and never writes their homework. Best used with you around.",
|
|
903
|
+
consentYes: "Say yes",
|
|
904
|
+
consentNo: "Not now",
|
|
905
|
+
consentTakeBack: "Take it back",
|
|
906
|
+
consentYouGranted: "You said yes to {name}",
|
|
907
|
+
consentYouRevoked: "You said not now to {name}",
|
|
908
|
+
consentGrantedChild: "{name} said yes: the study buddy is yours",
|
|
909
|
+
consentRevokedChild: "{name} said not now",
|
|
910
|
+
consentWaitingChild: "Asked for a yes",
|
|
911
|
+
consentAsks: "Your child asks",
|
|
912
|
+
consentLocked: "Ask a parent first: they say yes in their own Ta",
|
|
913
|
+
consentBy: "{name} said yes on {date}",
|
|
914
|
+
consentNone: "No parent said yes yet",
|
|
915
|
+
taskStudent: "Mistakes to review tonight",
|
|
916
|
+
taskParent: "Your child’s week",
|
|
917
|
+
taskTeacher: "The week of practice",
|
|
918
|
+
taskHomeroom: "Parents’ messages today",
|
|
919
|
+
failed: "It did not work: {error}",
|
|
920
|
+
today: "Today",
|
|
921
|
+
yesterday: "Yesterday"
|
|
911
922
|
};
|
|
912
|
-
var
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
923
|
+
var ZH = {
|
|
924
|
+
eduTitle: "教育",
|
|
925
|
+
pickTitle: "我是…",
|
|
926
|
+
pickHint: "可以多选,在顶上切换",
|
|
927
|
+
pickStage: "学段",
|
|
928
|
+
done: "完成",
|
|
929
|
+
roles: "身份",
|
|
930
|
+
homeDetailPick: "选好身份就能开始",
|
|
931
|
+
streak: "已连续学习 {count} 天",
|
|
932
|
+
noStreak: "今天开始连续学习",
|
|
933
|
+
dueHead: "还有 {count} 道题该复习了",
|
|
934
|
+
dueNone: "今天没有要复习的题",
|
|
935
|
+
reviewOf: "{subject} · 第 {n} 次复习",
|
|
936
|
+
lastWrong: "上次答成 {given}",
|
|
937
|
+
startReview: "开始复习",
|
|
938
|
+
noDueHint: "做错的题会记进错题本,在你快忘的时候再考你",
|
|
939
|
+
tilePhoto: "拍题问",
|
|
940
|
+
tileQuiz: "考考我",
|
|
941
|
+
tileRecite: "背诵默写",
|
|
942
|
+
tileSpeak: "口语练习",
|
|
943
|
+
speakText: "陪我练英语口语:用简单的英语聊我今天的事,一次问一个问题,温和地纠正我的错",
|
|
944
|
+
mistakesBook: "错题本",
|
|
945
|
+
bookCount: "共 {count} 道 · 到期 {due}",
|
|
946
|
+
subjectLine: "{count} 道 · 到期 {due}",
|
|
947
|
+
otherSubject: "其他",
|
|
948
|
+
thisWeek: "这周",
|
|
949
|
+
statQuestions: "题",
|
|
950
|
+
statRight: "正确率",
|
|
951
|
+
statDays: "天在学",
|
|
952
|
+
weekdays: "一二三四五六日",
|
|
953
|
+
toParent: "每周把学情发给家长",
|
|
954
|
+
toParentOn: "每周日发给 {name}",
|
|
955
|
+
pickParent: "发给谁",
|
|
956
|
+
noFriends: "先在 Ta 里加家长为好友",
|
|
957
|
+
reportPrivacy: "只发做题数、正确率和薄弱点,不发对话内容",
|
|
958
|
+
stopSending: "不再发送",
|
|
959
|
+
sendNow: "现在发一次",
|
|
960
|
+
reportSent: "已发给 {name}",
|
|
961
|
+
reportFailed: "没发出去:先在 Ta 里和对方说一句话",
|
|
962
|
+
reportTitle: "{name}这周",
|
|
963
|
+
reportIntro: "{name}这周的学习情况",
|
|
964
|
+
reportNote: "{count} 道错题",
|
|
965
|
+
bookTitle: "{subject}错题",
|
|
966
|
+
yourAnswer: "你的答案",
|
|
967
|
+
rightAnswer: "正确答案",
|
|
968
|
+
dueNow: "该复习了",
|
|
969
|
+
dueIn: "{days} 天后复习",
|
|
970
|
+
reviewThese: "复习这些",
|
|
971
|
+
childWeek: "{name}这周",
|
|
972
|
+
fromChild: "{time} 由{name}的 Ta 发来",
|
|
973
|
+
noReport: "还没收到孩子的学情",
|
|
974
|
+
noReportHint: "请孩子在「教育 · 学生」里打开「每周把学情发给家长」,选你",
|
|
975
|
+
howToHelp: "怎么陪孩子练",
|
|
976
|
+
askTeacher: "问问老师",
|
|
977
|
+
tileCheck: "辅导这道题",
|
|
978
|
+
tileTalk: "和孩子聊聊",
|
|
979
|
+
tileTeacher: "给老师留言",
|
|
980
|
+
tilePlan: "周末计划",
|
|
981
|
+
notices: "老师的通知",
|
|
982
|
+
count: "{count} 条",
|
|
983
|
+
linkClassHint: "关联孩子的班级群,老师的通知会出现在这里",
|
|
984
|
+
linkClass: "关联班级群",
|
|
985
|
+
parentPrivacy: "孩子自己决定发不发,发了什么他看得到",
|
|
986
|
+
noClass: "还没关联班级群",
|
|
987
|
+
noClassHint: "在 Ta 里建一个群,邀请学生和家长,再在这里关联。发到班级的练习,学生在群里直接作答,答案只交给你",
|
|
988
|
+
latestQuiz: "最近的练习",
|
|
989
|
+
submitted: "{count} / {total} 已交",
|
|
990
|
+
average: "平均正确率 {score}%",
|
|
991
|
+
hardest: "第 {no} 题错了 {pct}%",
|
|
992
|
+
hardestWho: "{count} 人",
|
|
993
|
+
goOver: "生成讲评",
|
|
994
|
+
followUp: "给他们补一套",
|
|
995
|
+
noQuiz: "还没发过练习",
|
|
996
|
+
noQuizHint: "在教学助手里出一套题,点题卡上的「发到班级」",
|
|
997
|
+
tileMake: "出练习",
|
|
998
|
+
tileLesson: "备课",
|
|
999
|
+
tileScores: "成绩分析",
|
|
1000
|
+
tileMark: "批改作业",
|
|
1001
|
+
askTopic: "练习什么内容",
|
|
1002
|
+
askTopicHint: "如 一元一次方程,10 道",
|
|
1003
|
+
askLesson: "课题",
|
|
1004
|
+
askLessonHint: "如 分数的意义",
|
|
1005
|
+
askRecite: "背哪一段",
|
|
1006
|
+
askRecitePrefill: `帮我背这一段,先让我自己背,再告诉我哪里错了:
|
|
1007
|
+
`,
|
|
1008
|
+
sendToClass: "发到班级",
|
|
1009
|
+
sentToClass: "已发到 {klass}",
|
|
1010
|
+
pickClass: "发到哪个班",
|
|
1011
|
+
quizIntro: "{title} · {count} 题,做完自动交给老师",
|
|
1012
|
+
handedIn: "已交给老师",
|
|
1013
|
+
handIn: "交给老师",
|
|
1014
|
+
noTeacherKey: "老师还没打开 Ta 的教育,稍后再交",
|
|
1015
|
+
handedCount: "已交 {count} 人",
|
|
1016
|
+
results: "看结果",
|
|
1017
|
+
parentAsks: "家长找你",
|
|
1018
|
+
waiting: "{count} 条待回",
|
|
1019
|
+
noAsks: "这周没有家长 @ 你",
|
|
1020
|
+
draftReply: "拟回复",
|
|
1021
|
+
tileReply: "回家长",
|
|
1022
|
+
tileComments: "写评语",
|
|
1023
|
+
tileMeeting: "班会方案",
|
|
1024
|
+
tileNotice: "发通知",
|
|
1025
|
+
noticeTitle: "发到 {klass} 的通知",
|
|
1026
|
+
noticePrefix: "【班级通知】",
|
|
1027
|
+
recentNotices: "最近的通知",
|
|
1028
|
+
classesTitle: "班级群",
|
|
1029
|
+
classesHint: "哪些群聊是你的班级",
|
|
1030
|
+
noGroups: "还没有群聊:先在伙伴里建一个,再回来关联",
|
|
1031
|
+
manageClasses: "班级群",
|
|
1032
|
+
chipPhoto: "拍题",
|
|
1033
|
+
chipHint: "给点提示",
|
|
1034
|
+
chipHintText: "再给我一点提示,别直接说答案",
|
|
1035
|
+
chipAgain: "换个讲法",
|
|
1036
|
+
chipAgainText: "换个讲法再讲一遍",
|
|
1037
|
+
chipGot: "我会了",
|
|
1038
|
+
chipGotText: "我会了,出一道同类题让我试试",
|
|
1039
|
+
photoStudent: "这道题我不会,先别告诉我答案,带我一步步想",
|
|
1040
|
+
photoParent: "孩子这道题做错了,错在哪,我该怎么讲给他听?",
|
|
1041
|
+
photoTeacher: "批改这些作业:逐题判对错,归类错因,最后给讲评提纲",
|
|
1042
|
+
scoresText: "分析成绩表 {file}:找出全班共性的薄弱点和需要关注的学生",
|
|
1043
|
+
goOverText: "为练习「{title}」设计课上讲评",
|
|
1044
|
+
followUpText: "给做错练习「{title}」第 {no} 题的同学补一套同类题",
|
|
1045
|
+
noticeHelp: "这是老师发的通知:我需要做什么、什么时候做?",
|
|
1046
|
+
askHelp: "家长在班级群里找我,帮我拟一段回复,我看过再发",
|
|
1047
|
+
consentNeeded: "先请家长同意",
|
|
1048
|
+
consentNeededHint: "小学段要家长在他自己的 Ta 里同意,才能用学习伙伴",
|
|
1049
|
+
consentAsk: "请家长同意",
|
|
1050
|
+
consentAsked: "已请 {name} 同意,等他回复",
|
|
1051
|
+
consentAskOther: "再请一次或换个人",
|
|
1052
|
+
consentAskIntro: "{name}想用 Ta 的学习伙伴,请在你的 Ta「教育 · 家长」里同意",
|
|
1053
|
+
consentGrantIntro: "我同意你用学习伙伴",
|
|
1054
|
+
consentRevokeIntro: "学习伙伴先不用了",
|
|
1055
|
+
consentAskTitle: "{name}想用学习伙伴",
|
|
1056
|
+
consentAskBody: "它只引导孩子自己想出来,不给答案、不代写作业。平时尽量陪着用。",
|
|
1057
|
+
consentYes: "同意",
|
|
1058
|
+
consentNo: "先不",
|
|
1059
|
+
consentTakeBack: "收回同意",
|
|
1060
|
+
consentYouGranted: "你已同意{name}用学习伙伴",
|
|
1061
|
+
consentYouRevoked: "你暂不让{name}用学习伙伴",
|
|
1062
|
+
consentGrantedChild: "{name}同意了,可以用学习伙伴了",
|
|
1063
|
+
consentRevokedChild: "{name}说先不用",
|
|
1064
|
+
consentWaitingChild: "已请家长同意",
|
|
1065
|
+
consentAsks: "孩子请你同意",
|
|
1066
|
+
consentLocked: "先请家长同意:家长在他自己的 Ta 里点同意",
|
|
1067
|
+
consentBy: "{name} 于 {date} 同意",
|
|
1068
|
+
consentNone: "还没有家长同意",
|
|
1069
|
+
taskStudent: "今晚错题复习",
|
|
1070
|
+
taskParent: "孩子这周学习简报",
|
|
1071
|
+
taskTeacher: "本周学情小结",
|
|
1072
|
+
taskHomeroom: "今天的家长消息",
|
|
1073
|
+
failed: "没做成:{error}",
|
|
1074
|
+
today: "今天",
|
|
1075
|
+
yesterday: "昨天"
|
|
977
1076
|
};
|
|
978
|
-
var
|
|
979
|
-
var EduWords;
|
|
980
|
-
((EduWords) => {
|
|
981
|
-
function of(language) {
|
|
982
|
-
return TaLanguageUtil.pick(language, WORDS);
|
|
983
|
-
}
|
|
984
|
-
EduWords.of = of;
|
|
985
|
-
function format(text, values) {
|
|
986
|
-
return text.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
|
|
987
|
-
}
|
|
988
|
-
EduWords.format = format;
|
|
989
|
-
})(EduWords ||= {});
|
|
990
|
-
|
|
991
|
-
// web-src/edu-chats.ts
|
|
992
|
-
var EduChats;
|
|
993
|
-
((EduChats) => {
|
|
994
|
-
function identityOf(store, sessionFile) {
|
|
995
|
-
const { chats } = store.state;
|
|
996
|
-
return sessionFile ? Object.keys(chats).find((one) => chats[one] === sessionFile) : undefined;
|
|
997
|
-
}
|
|
998
|
-
EduChats.identityOf = identityOf;
|
|
999
|
-
async function open(pi, store, identity) {
|
|
1000
|
-
const words = EduWords.of(pi.ui.language);
|
|
1001
|
-
const { settings, chats } = store.state;
|
|
1002
|
-
if (EduUtil.locked(settings, identity)) {
|
|
1003
|
-
const yes = await pi.ui.confirm(words.consentTitle, words.consentMessage, { confirmLabel: words.consentConfirm });
|
|
1004
|
-
if (!yes) {
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
await store.setSettings({ consent: true });
|
|
1008
|
-
}
|
|
1009
|
-
const role = EduRoles.prompt(identity, store.state.settings);
|
|
1010
|
-
const title = words[ROLES[identity].assistant];
|
|
1011
|
-
const file = chats[identity];
|
|
1012
|
-
if (file) {
|
|
1013
|
-
const open2 = (await pi.server.listSessions()).find((session) => session.sessionFile === file);
|
|
1014
|
-
if (open2) {
|
|
1015
|
-
await pi.switchSession(open2.sessionId);
|
|
1016
|
-
pi.ui.showView("");
|
|
1017
|
-
return open2.sessionId;
|
|
1018
|
-
}
|
|
1019
|
-
const saved = (await pi.server.listSavedSessions()).find((session) => session.sessionFile === file);
|
|
1020
|
-
if (saved) {
|
|
1021
|
-
const opened2 = pi.server.openSession({ cwd: saved.cwd, sessionFile: file, group: NAME, appendSystemPrompt: role });
|
|
1022
|
-
const id2 = opened2.then((session) => session.sessionId);
|
|
1023
|
-
await pi.switchSession(id2, { title, cwd: saved.cwd, sessionFile: file });
|
|
1024
|
-
pi.ui.showView("");
|
|
1025
|
-
return id2;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
const { cwd } = await pi.server.getServerInfo();
|
|
1029
|
-
const opened = pi.server.openSession({ cwd, group: NAME, appendSystemPrompt: role });
|
|
1030
|
-
const named = opened.then(async (session) => {
|
|
1031
|
-
if (session.sessionFile) {
|
|
1032
|
-
await store.setChat(identity, session.sessionFile);
|
|
1033
|
-
}
|
|
1034
|
-
await pi.server.setSessionName(session.sessionId, title);
|
|
1035
|
-
});
|
|
1036
|
-
const id = opened.then((session) => session.sessionId);
|
|
1037
|
-
await pi.switchSession(id, { title, cwd });
|
|
1038
|
-
pi.ui.showView("");
|
|
1039
|
-
await named;
|
|
1040
|
-
return id;
|
|
1041
|
-
}
|
|
1042
|
-
EduChats.open = open;
|
|
1043
|
-
async function say(pi, store, identity, message, images) {
|
|
1044
|
-
const id = await open(pi, store, identity);
|
|
1045
|
-
if (id) {
|
|
1046
|
-
await send(pi, id, message, images);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
EduChats.say = say;
|
|
1050
|
-
async function send(pi, sessionId, message, images) {
|
|
1051
|
-
await pi.server.prompt(sessionId, { message, ...images?.length ? { images } : {}, clientMessageId: crypto.randomUUID() });
|
|
1052
|
-
}
|
|
1053
|
-
EduChats.send = send;
|
|
1054
|
-
})(EduChats ||= {});
|
|
1055
|
-
var EduPhotos;
|
|
1056
|
-
((EduPhotos) => {
|
|
1057
|
-
function pick() {
|
|
1058
|
-
return new Promise((resolve) => {
|
|
1059
|
-
const input = document.createElement("input");
|
|
1060
|
-
input.type = "file";
|
|
1061
|
-
input.accept = "image/*";
|
|
1062
|
-
input.multiple = true;
|
|
1063
|
-
input.style.display = "none";
|
|
1064
|
-
input.addEventListener("change", () => {
|
|
1065
|
-
const files = [...input.files ?? []].slice(0, 6);
|
|
1066
|
-
input.remove();
|
|
1067
|
-
Promise.all(files.map(shrink)).then(resolve, () => resolve([]));
|
|
1068
|
-
});
|
|
1069
|
-
input.addEventListener("cancel", () => {
|
|
1070
|
-
input.remove();
|
|
1071
|
-
resolve([]);
|
|
1072
|
-
});
|
|
1073
|
-
document.body.appendChild(input);
|
|
1074
|
-
input.click();
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
EduPhotos.pick = pick;
|
|
1078
|
-
async function shrink(file) {
|
|
1079
|
-
const bitmap = await createImageBitmap(file);
|
|
1080
|
-
const scale = Math.min(1, 1600 / Math.max(bitmap.width, bitmap.height));
|
|
1081
|
-
const canvas = document.createElement("canvas");
|
|
1082
|
-
canvas.width = Math.round(bitmap.width * scale);
|
|
1083
|
-
canvas.height = Math.round(bitmap.height * scale);
|
|
1084
|
-
canvas.getContext("2d")?.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
|
|
1085
|
-
bitmap.close();
|
|
1086
|
-
const url = canvas.toDataURL("image/jpeg", 0.85);
|
|
1087
|
-
return { type: "image", data: url.slice(url.indexOf(",") + 1), mimeType: "image/jpeg" };
|
|
1088
|
-
}
|
|
1089
|
-
function upload(pi, accept) {
|
|
1090
|
-
return new Promise((resolve) => {
|
|
1091
|
-
const input = document.createElement("input");
|
|
1092
|
-
input.type = "file";
|
|
1093
|
-
input.accept = accept;
|
|
1094
|
-
input.style.display = "none";
|
|
1095
|
-
input.addEventListener("change", () => {
|
|
1096
|
-
const file = input.files?.[0];
|
|
1097
|
-
input.remove();
|
|
1098
|
-
if (!file) {
|
|
1099
|
-
resolve(undefined);
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
const reader = new FileReader;
|
|
1103
|
-
reader.onload = () => {
|
|
1104
|
-
const url = String(reader.result);
|
|
1105
|
-
const path = `edu/${file.name.replace(/[\\/]/g, "_")}`;
|
|
1106
|
-
pi.workspace.uploadFile(path, url.slice(url.indexOf(",") + 1)).then(() => resolve(path), () => resolve(undefined));
|
|
1107
|
-
};
|
|
1108
|
-
reader.onerror = () => resolve(undefined);
|
|
1109
|
-
reader.readAsDataURL(file);
|
|
1110
|
-
});
|
|
1111
|
-
input.addEventListener("cancel", () => {
|
|
1112
|
-
input.remove();
|
|
1113
|
-
resolve(undefined);
|
|
1114
|
-
});
|
|
1115
|
-
document.body.appendChild(input);
|
|
1116
|
-
input.click();
|
|
1117
|
-
});
|
|
1118
|
-
}
|
|
1119
|
-
EduPhotos.upload = upload;
|
|
1120
|
-
})(EduPhotos ||= {});
|
|
1121
|
-
|
|
1122
|
-
// web-src/i18n-home.ts
|
|
1123
|
-
var EN2 = {
|
|
1124
|
-
eduTitle: "Education",
|
|
1125
|
-
pickTitle: "I am…",
|
|
1126
|
-
pickHint: "Pick all that fit; switch between them at the top",
|
|
1127
|
-
pickStage: "Stage",
|
|
1128
|
-
done: "Done",
|
|
1129
|
-
roles: "Roles",
|
|
1130
|
-
homeDetailPick: "Pick who you are to start",
|
|
1131
|
-
streak: "{count} days in a row",
|
|
1132
|
-
noStreak: "Start a streak today",
|
|
1133
|
-
dueHead: "{count} questions to review",
|
|
1134
|
-
dueNone: "Nothing to review today",
|
|
1135
|
-
reviewOf: "{subject} · review {n}",
|
|
1136
|
-
lastWrong: "Last time you wrote {given}",
|
|
1137
|
-
startReview: "Start review",
|
|
1138
|
-
noDueHint: "What you get wrong goes into your mistakes and comes back just before you would forget it",
|
|
1139
|
-
tilePhoto: "Snap a question",
|
|
1140
|
-
tileQuiz: "Quiz me",
|
|
1141
|
-
tileRecite: "Recite",
|
|
1142
|
-
tileSpeak: "Speaking",
|
|
1143
|
-
speakText: "Let's practise speaking: talk with me in simple English about my day, one question at a time, and correct my mistakes gently",
|
|
1144
|
-
mistakesBook: "Mistakes",
|
|
1145
|
-
bookCount: "{count} in all · {due} due",
|
|
1146
|
-
subjectLine: "{count} · {due} due",
|
|
1147
|
-
otherSubject: "Other",
|
|
1148
|
-
thisWeek: "This week",
|
|
1149
|
-
statQuestions: "questions",
|
|
1150
|
-
statRight: "right",
|
|
1151
|
-
statDays: "days studied",
|
|
1152
|
-
weekdays: "MTWTFSS",
|
|
1153
|
-
toParent: "Send my week to a parent",
|
|
1154
|
-
toParentOn: "Each week to {name}",
|
|
1155
|
-
pickParent: "Send it to",
|
|
1156
|
-
noFriends: "Add your parent as a friend in Ta first",
|
|
1157
|
-
reportPrivacy: "Only counts, how many were right and weak points go, never what you said",
|
|
1158
|
-
stopSending: "Stop sending",
|
|
1159
|
-
sendNow: "Send now",
|
|
1160
|
-
reportSent: "Sent to {name}",
|
|
1161
|
-
reportFailed: "Not sent: say hello to them in Ta first",
|
|
1162
|
-
reportTitle: "{name}'s week",
|
|
1163
|
-
reportIntro: "How {name}'s week went",
|
|
1164
|
-
reportNote: "{count} mistakes",
|
|
1165
|
-
bookTitle: "{subject}",
|
|
1166
|
-
yourAnswer: "Yours",
|
|
1167
|
-
rightAnswer: "Answer",
|
|
1168
|
-
dueNow: "Due now",
|
|
1169
|
-
dueIn: "In {days} days",
|
|
1170
|
-
reviewThese: "Review these",
|
|
1171
|
-
childWeek: "{name}'s week",
|
|
1172
|
-
fromChild: "From {name}'s Ta, {time}",
|
|
1173
|
-
noReport: "No week from your child yet",
|
|
1174
|
-
noReportHint: "Your child turns on Send my week to a parent under Education, Student, and picks you",
|
|
1175
|
-
howToHelp: "How to help",
|
|
1176
|
-
askTeacher: "Ask the teacher",
|
|
1177
|
-
tileCheck: "Explain a question",
|
|
1178
|
-
tileTalk: "Talk with my child",
|
|
1179
|
-
tileTeacher: "Write to the teacher",
|
|
1180
|
-
tilePlan: "Weekend plan",
|
|
1181
|
-
notices: "From the teachers",
|
|
1182
|
-
count: "{count}",
|
|
1183
|
-
linkClassHint: "Link your child's class group, and the teachers' notices show here",
|
|
1184
|
-
linkClass: "Link a class group",
|
|
1185
|
-
parentPrivacy: "Your child chooses to send it, and sees what is sent",
|
|
1186
|
-
noClass: "No class group linked",
|
|
1187
|
-
noClassHint: "Make a group chat in Ta with your students and parents, then link it here. Practice sent to it is answered right in the chat, the answers going to you alone",
|
|
1188
|
-
latestQuiz: "Latest practice",
|
|
1189
|
-
submitted: "{count} of {total} handed in",
|
|
1190
|
-
average: "{score}% right on average",
|
|
1191
|
-
hardest: "Question {no}: {pct}% wrong",
|
|
1192
|
-
hardestWho: "{count} students",
|
|
1193
|
-
goOver: "Plan going over it",
|
|
1194
|
-
followUp: "More practice for them",
|
|
1195
|
-
noQuiz: "No practice sent yet",
|
|
1196
|
-
noQuizHint: "Set questions with the teaching assistant, then tap Send to class on them",
|
|
1197
|
-
tileMake: "Set questions",
|
|
1198
|
-
tileLesson: "Prepare a lesson",
|
|
1199
|
-
tileScores: "Analyse scores",
|
|
1200
|
-
tileMark: "Mark homework",
|
|
1201
|
-
askTopic: "Questions on",
|
|
1202
|
-
askTopicHint: "Linear equations, 10 questions",
|
|
1203
|
-
askLesson: "Lesson on",
|
|
1204
|
-
askLessonHint: "What a fraction means",
|
|
1205
|
-
askRecite: "Which passage?",
|
|
1206
|
-
askRecitePrefill: `Help me learn it by heart: let me try first, then tell me what I got wrong.
|
|
1207
|
-
`,
|
|
1208
|
-
sendToClass: "Send to class",
|
|
1209
|
-
sentToClass: "Sent to {klass}",
|
|
1210
|
-
pickClass: "Send to which class?",
|
|
1211
|
-
quizIntro: "{title} · {count} questions, handed to the teacher when done",
|
|
1212
|
-
handedIn: "Handed to the teacher",
|
|
1213
|
-
handIn: "Hand to the teacher",
|
|
1214
|
-
noTeacherKey: "The teacher has not opened Education in Ta yet: hand it in again later",
|
|
1215
|
-
handedCount: "{count} handed in",
|
|
1216
|
-
results: "See results",
|
|
1217
|
-
parentAsks: "Parents asking you",
|
|
1218
|
-
waiting: "{count} waiting",
|
|
1219
|
-
noAsks: "No parent asked you this week",
|
|
1220
|
-
draftReply: "Draft a reply",
|
|
1221
|
-
tileReply: "Reply to a parent",
|
|
1222
|
-
tileComments: "Report comments",
|
|
1223
|
-
tileMeeting: "Class meeting",
|
|
1224
|
-
tileNotice: "Send a notice",
|
|
1225
|
-
noticeTitle: "Notice to {klass}",
|
|
1226
|
-
noticePrefix: "[Class notice] ",
|
|
1227
|
-
recentNotices: "Recent notices",
|
|
1228
|
-
classesTitle: "Class groups",
|
|
1229
|
-
classesHint: "The group chats that are your classes",
|
|
1230
|
-
noGroups: "No group chats yet: make one in Partners, then link it here",
|
|
1231
|
-
manageClasses: "Class groups",
|
|
1232
|
-
chipPhoto: "Snap a question",
|
|
1233
|
-
chipHint: "A hint",
|
|
1234
|
-
chipHintText: "One more hint, please, not the answer",
|
|
1235
|
-
chipAgain: "Explain it differently",
|
|
1236
|
-
chipAgainText: "Explain that another way",
|
|
1237
|
-
chipGot: "I get it",
|
|
1238
|
-
chipGotText: "I get it: give me one like it to try",
|
|
1239
|
-
photoStudent: "I can't do this one. Don't tell me the answer yet, help me think it through",
|
|
1240
|
-
photoParent: "My child got this wrong: where, and how do I explain it to them?",
|
|
1241
|
-
photoTeacher: "Mark these: right or wrong for each question, the causes of the mistakes grouped, and an outline for going over them",
|
|
1242
|
-
scoresText: "Analyse the score sheet {file}: the weak points the class shares, and the students to look after",
|
|
1243
|
-
goOverText: 'Plan how to go over the practice "{title}" in class',
|
|
1244
|
-
followUpText: 'Set more practice on question {no} of "{title}" for those who got it wrong',
|
|
1245
|
-
noticeHelp: "A notice from the teacher: what do I need to do, and when?",
|
|
1246
|
-
askHelp: "A parent wrote to me in the class group. Draft me a reply; I will read it before I send it",
|
|
1247
|
-
failed: "It did not work: {error}",
|
|
1248
|
-
today: "Today",
|
|
1249
|
-
yesterday: "Yesterday"
|
|
1250
|
-
};
|
|
1251
|
-
var ZH2 = {
|
|
1077
|
+
var ZH_TW = {
|
|
1252
1078
|
eduTitle: "教育",
|
|
1253
1079
|
pickTitle: "我是…",
|
|
1254
|
-
pickHint: "
|
|
1255
|
-
pickStage: "
|
|
1080
|
+
pickHint: "可以複選,在頂端切換",
|
|
1081
|
+
pickStage: "學段",
|
|
1256
1082
|
done: "完成",
|
|
1257
|
-
roles: "
|
|
1258
|
-
homeDetailPick: "
|
|
1259
|
-
streak: "
|
|
1260
|
-
noStreak: "
|
|
1261
|
-
dueHead: "
|
|
1262
|
-
dueNone: "
|
|
1263
|
-
reviewOf: "{subject} · 第 {n}
|
|
1083
|
+
roles: "身分",
|
|
1084
|
+
homeDetailPick: "選好身分就能開始",
|
|
1085
|
+
streak: "已連續學習 {count} 天",
|
|
1086
|
+
noStreak: "今天開始連續學習",
|
|
1087
|
+
dueHead: "還有 {count} 道題該複習了",
|
|
1088
|
+
dueNone: "今天沒有要複習的題",
|
|
1089
|
+
reviewOf: "{subject} · 第 {n} 次複習",
|
|
1264
1090
|
lastWrong: "上次答成 {given}",
|
|
1265
|
-
startReview: "
|
|
1266
|
-
noDueHint: "
|
|
1267
|
-
tilePhoto: "
|
|
1091
|
+
startReview: "開始複習",
|
|
1092
|
+
noDueHint: "做錯的題會記進錯題本,在你快忘的時候再考你",
|
|
1093
|
+
tilePhoto: "拍題問",
|
|
1268
1094
|
tileQuiz: "考考我",
|
|
1269
|
-
tileRecite: "
|
|
1270
|
-
tileSpeak: "
|
|
1271
|
-
speakText: "
|
|
1272
|
-
mistakesBook: "
|
|
1095
|
+
tileRecite: "背誦默寫",
|
|
1096
|
+
tileSpeak: "口說練習",
|
|
1097
|
+
speakText: "陪我練英語口說:用簡單的英語聊我今天的事,一次問一個問題,溫和地糾正我的錯",
|
|
1098
|
+
mistakesBook: "錯題本",
|
|
1273
1099
|
bookCount: "共 {count} 道 · 到期 {due}",
|
|
1274
1100
|
subjectLine: "{count} 道 · 到期 {due}",
|
|
1275
1101
|
otherSubject: "其他",
|
|
1276
|
-
thisWeek: "
|
|
1277
|
-
statQuestions: "
|
|
1278
|
-
statRight: "
|
|
1279
|
-
statDays: "
|
|
1102
|
+
thisWeek: "這週",
|
|
1103
|
+
statQuestions: "題",
|
|
1104
|
+
statRight: "正確率",
|
|
1105
|
+
statDays: "天在學",
|
|
1280
1106
|
weekdays: "一二三四五六日",
|
|
1281
|
-
toParent: "
|
|
1282
|
-
toParentOn: "
|
|
1283
|
-
pickParent: "
|
|
1284
|
-
noFriends: "先在 Ta
|
|
1285
|
-
reportPrivacy: "
|
|
1286
|
-
stopSending: "
|
|
1287
|
-
sendNow: "
|
|
1288
|
-
reportSent: "
|
|
1289
|
-
reportFailed: "
|
|
1290
|
-
reportTitle: "{name}
|
|
1291
|
-
reportIntro: "{name}
|
|
1292
|
-
reportNote: "{count}
|
|
1293
|
-
bookTitle: "{subject}
|
|
1107
|
+
toParent: "每週把學習狀況傳給家長",
|
|
1108
|
+
toParentOn: "每週日傳給 {name}",
|
|
1109
|
+
pickParent: "傳給誰",
|
|
1110
|
+
noFriends: "先在 Ta 裡加家長為好友",
|
|
1111
|
+
reportPrivacy: "只傳做題數、正確率和弱點,不傳對話內容",
|
|
1112
|
+
stopSending: "不再傳送",
|
|
1113
|
+
sendNow: "現在傳一次",
|
|
1114
|
+
reportSent: "已傳給 {name}",
|
|
1115
|
+
reportFailed: "沒傳出去:先在 Ta 裡和對方說一句話",
|
|
1116
|
+
reportTitle: "{name}這週",
|
|
1117
|
+
reportIntro: "{name}這週的學習狀況",
|
|
1118
|
+
reportNote: "{count} 道錯題",
|
|
1119
|
+
bookTitle: "{subject}錯題",
|
|
1294
1120
|
yourAnswer: "你的答案",
|
|
1295
|
-
rightAnswer: "
|
|
1296
|
-
dueNow: "
|
|
1297
|
-
dueIn: "{days}
|
|
1298
|
-
reviewThese: "
|
|
1299
|
-
childWeek: "{name}
|
|
1300
|
-
fromChild: "{time} 由{name}的 Ta
|
|
1301
|
-
noReport: "
|
|
1302
|
-
noReportHint: "
|
|
1303
|
-
howToHelp: "
|
|
1304
|
-
askTeacher: "
|
|
1305
|
-
tileCheck: "
|
|
1121
|
+
rightAnswer: "正確答案",
|
|
1122
|
+
dueNow: "該複習了",
|
|
1123
|
+
dueIn: "{days} 天後複習",
|
|
1124
|
+
reviewThese: "複習這些",
|
|
1125
|
+
childWeek: "{name}這週",
|
|
1126
|
+
fromChild: "{time} 由{name}的 Ta 傳來",
|
|
1127
|
+
noReport: "還沒收到孩子的學習狀況",
|
|
1128
|
+
noReportHint: "請孩子在「教育 · 學生」裡開啟「每週把學習狀況傳給家長」,選你",
|
|
1129
|
+
howToHelp: "怎麼陪孩子練",
|
|
1130
|
+
askTeacher: "問問老師",
|
|
1131
|
+
tileCheck: "輔導這道題",
|
|
1306
1132
|
tileTalk: "和孩子聊聊",
|
|
1307
|
-
tileTeacher: "
|
|
1308
|
-
tilePlan: "
|
|
1309
|
-
notices: "
|
|
1310
|
-
count: "{count}
|
|
1311
|
-
linkClassHint: "
|
|
1312
|
-
linkClass: "
|
|
1313
|
-
parentPrivacy: "
|
|
1314
|
-
noClass: "
|
|
1315
|
-
noClassHint: "在 Ta
|
|
1316
|
-
latestQuiz: "
|
|
1133
|
+
tileTeacher: "給老師留言",
|
|
1134
|
+
tilePlan: "週末計畫",
|
|
1135
|
+
notices: "老師的通知",
|
|
1136
|
+
count: "{count} 則",
|
|
1137
|
+
linkClassHint: "連結孩子的班級群組,老師的通知會出現在這裡",
|
|
1138
|
+
linkClass: "連結班級群組",
|
|
1139
|
+
parentPrivacy: "孩子自己決定傳不傳,傳了什麼他看得到",
|
|
1140
|
+
noClass: "還沒連結班級群組",
|
|
1141
|
+
noClassHint: "在 Ta 裡建一個群組,邀請學生和家長,再在這裡連結。傳到班級的練習,學生在群組裡直接作答,答案只交給你",
|
|
1142
|
+
latestQuiz: "最近的練習",
|
|
1317
1143
|
submitted: "{count} / {total} 已交",
|
|
1318
|
-
average: "
|
|
1319
|
-
hardest: "第 {no}
|
|
1144
|
+
average: "平均正確率 {score}%",
|
|
1145
|
+
hardest: "第 {no} 題錯了 {pct}%",
|
|
1320
1146
|
hardestWho: "{count} 人",
|
|
1321
|
-
goOver: "
|
|
1322
|
-
followUp: "
|
|
1323
|
-
noQuiz: "
|
|
1324
|
-
noQuizHint: "
|
|
1325
|
-
tileMake: "
|
|
1326
|
-
tileLesson: "
|
|
1327
|
-
tileScores: "
|
|
1328
|
-
tileMark: "
|
|
1329
|
-
askTopic: "
|
|
1330
|
-
askTopicHint: "如
|
|
1331
|
-
askLesson: "
|
|
1332
|
-
askLessonHint: "如
|
|
1147
|
+
goOver: "產生講評",
|
|
1148
|
+
followUp: "給他們補一套",
|
|
1149
|
+
noQuiz: "還沒傳過練習",
|
|
1150
|
+
noQuizHint: "在教學助手裡出一套題,點題卡上的「傳到班級」",
|
|
1151
|
+
tileMake: "出練習",
|
|
1152
|
+
tileLesson: "備課",
|
|
1153
|
+
tileScores: "成績分析",
|
|
1154
|
+
tileMark: "批改作業",
|
|
1155
|
+
askTopic: "練習什麼內容",
|
|
1156
|
+
askTopicHint: "如 一元一次方程式,10 題",
|
|
1157
|
+
askLesson: "課題",
|
|
1158
|
+
askLessonHint: "如 分數的意義",
|
|
1333
1159
|
askRecite: "背哪一段",
|
|
1334
|
-
askRecitePrefill:
|
|
1160
|
+
askRecitePrefill: `幫我背這一段,先讓我自己背,再告訴我哪裡錯了:
|
|
1335
1161
|
`,
|
|
1336
|
-
sendToClass: "
|
|
1337
|
-
sentToClass: "
|
|
1338
|
-
pickClass: "
|
|
1339
|
-
quizIntro: "{title} · {count}
|
|
1340
|
-
handedIn: "
|
|
1341
|
-
handIn: "
|
|
1342
|
-
noTeacherKey: "
|
|
1162
|
+
sendToClass: "傳到班級",
|
|
1163
|
+
sentToClass: "已傳到 {klass}",
|
|
1164
|
+
pickClass: "傳到哪個班",
|
|
1165
|
+
quizIntro: "{title} · {count} 題,做完自動交給老師",
|
|
1166
|
+
handedIn: "已交給老師",
|
|
1167
|
+
handIn: "交給老師",
|
|
1168
|
+
noTeacherKey: "老師還沒開啟 Ta 的教育,稍後再交",
|
|
1343
1169
|
handedCount: "已交 {count} 人",
|
|
1344
|
-
results: "
|
|
1345
|
-
parentAsks: "
|
|
1346
|
-
waiting: "{count}
|
|
1347
|
-
noAsks: "
|
|
1348
|
-
draftReply: "
|
|
1349
|
-
tileReply: "
|
|
1350
|
-
tileComments: "
|
|
1351
|
-
tileMeeting: "
|
|
1352
|
-
tileNotice: "
|
|
1353
|
-
noticeTitle: "
|
|
1354
|
-
noticePrefix: "
|
|
1170
|
+
results: "看結果",
|
|
1171
|
+
parentAsks: "家長找你",
|
|
1172
|
+
waiting: "{count} 則待回",
|
|
1173
|
+
noAsks: "這週沒有家長 @ 你",
|
|
1174
|
+
draftReply: "擬回覆",
|
|
1175
|
+
tileReply: "回家長",
|
|
1176
|
+
tileComments: "寫評語",
|
|
1177
|
+
tileMeeting: "班會方案",
|
|
1178
|
+
tileNotice: "發通知",
|
|
1179
|
+
noticeTitle: "傳到 {klass} 的通知",
|
|
1180
|
+
noticePrefix: "【班級通知】",
|
|
1355
1181
|
recentNotices: "最近的通知",
|
|
1356
|
-
classesTitle: "
|
|
1357
|
-
classesHint: "
|
|
1358
|
-
noGroups: "
|
|
1359
|
-
manageClasses: "
|
|
1360
|
-
chipPhoto: "
|
|
1361
|
-
chipHint: "
|
|
1362
|
-
chipHintText: "
|
|
1363
|
-
chipAgain: "
|
|
1364
|
-
chipAgainText: "
|
|
1365
|
-
chipGot: "
|
|
1366
|
-
chipGotText: "
|
|
1367
|
-
photoStudent: "
|
|
1368
|
-
photoParent: "
|
|
1369
|
-
photoTeacher: "
|
|
1370
|
-
scoresText: "
|
|
1371
|
-
goOverText: "
|
|
1372
|
-
followUpText: "
|
|
1373
|
-
noticeHelp: "
|
|
1374
|
-
askHelp: "
|
|
1375
|
-
|
|
1182
|
+
classesTitle: "班級群組",
|
|
1183
|
+
classesHint: "哪些群組是你的班級",
|
|
1184
|
+
noGroups: "還沒有群組:先在夥伴裡建一個,再回來連結",
|
|
1185
|
+
manageClasses: "班級群組",
|
|
1186
|
+
chipPhoto: "拍題",
|
|
1187
|
+
chipHint: "給點提示",
|
|
1188
|
+
chipHintText: "再給我一點提示,別直接說答案",
|
|
1189
|
+
chipAgain: "換個講法",
|
|
1190
|
+
chipAgainText: "換個講法再講一遍",
|
|
1191
|
+
chipGot: "我會了",
|
|
1192
|
+
chipGotText: "我會了,出一道同類題讓我試試",
|
|
1193
|
+
photoStudent: "這道題我不會,先別告訴我答案,帶我一步步想",
|
|
1194
|
+
photoParent: "孩子這道題做錯了,錯在哪,我該怎麼講給他聽?",
|
|
1195
|
+
photoTeacher: "批改這些作業:逐題判對錯,歸類錯因,最後給講評提綱",
|
|
1196
|
+
scoresText: "分析成績表 {file}:找出全班共同的弱點和需要關注的學生",
|
|
1197
|
+
goOverText: "為練習「{title}」設計課堂講評",
|
|
1198
|
+
followUpText: "給做錯練習「{title}」第 {no} 題的同學補一套同類題",
|
|
1199
|
+
noticeHelp: "這是老師傳的通知:我需要做什麼、什麼時候做?",
|
|
1200
|
+
askHelp: "家長在班級群組裡找我,幫我擬一段回覆,我看過再傳",
|
|
1201
|
+
consentNeeded: "先請家長同意",
|
|
1202
|
+
consentNeededHint: "小學階段要家長在他自己的 Ta 裡同意,才能用學習夥伴",
|
|
1203
|
+
consentAsk: "請家長同意",
|
|
1204
|
+
consentAsked: "已請 {name} 同意,等他回覆",
|
|
1205
|
+
consentAskOther: "再請一次或換個人",
|
|
1206
|
+
consentAskIntro: "{name}想用 Ta 的學習夥伴,請在你的 Ta「教育 · 家長」裡同意",
|
|
1207
|
+
consentGrantIntro: "我同意你用學習夥伴",
|
|
1208
|
+
consentRevokeIntro: "學習夥伴先不用了",
|
|
1209
|
+
consentAskTitle: "{name}想用學習夥伴",
|
|
1210
|
+
consentAskBody: "它只引導孩子自己想出來,不給答案、不代寫作業。平時盡量陪著用。",
|
|
1211
|
+
consentYes: "同意",
|
|
1212
|
+
consentNo: "先不",
|
|
1213
|
+
consentTakeBack: "收回同意",
|
|
1214
|
+
consentYouGranted: "你已同意{name}用學習夥伴",
|
|
1215
|
+
consentYouRevoked: "你暫不讓{name}用學習夥伴",
|
|
1216
|
+
consentGrantedChild: "{name}同意了,可以用學習夥伴了",
|
|
1217
|
+
consentRevokedChild: "{name}說先不用",
|
|
1218
|
+
consentWaitingChild: "已請家長同意",
|
|
1219
|
+
consentAsks: "孩子請你同意",
|
|
1220
|
+
consentLocked: "先請家長同意:家長在他自己的 Ta 裡點同意",
|
|
1221
|
+
consentBy: "{name} 於 {date} 同意",
|
|
1222
|
+
consentNone: "還沒有家長同意",
|
|
1223
|
+
taskStudent: "今晚錯題複習",
|
|
1224
|
+
taskParent: "孩子這週學習簡報",
|
|
1225
|
+
taskTeacher: "本週學情小結",
|
|
1226
|
+
taskHomeroom: "今天的家長訊息",
|
|
1227
|
+
failed: "沒做成:{error}",
|
|
1376
1228
|
today: "今天",
|
|
1377
1229
|
yesterday: "昨天"
|
|
1378
1230
|
};
|
|
1379
|
-
var
|
|
1380
|
-
eduTitle: "教育",
|
|
1381
|
-
pickTitle: "
|
|
1382
|
-
pickHint: "
|
|
1383
|
-
pickStage: "
|
|
1384
|
-
done: "
|
|
1385
|
-
roles: "
|
|
1386
|
-
homeDetailPick: "
|
|
1387
|
-
streak: "
|
|
1388
|
-
noStreak: "
|
|
1389
|
-
dueHead: "
|
|
1390
|
-
dueNone: "
|
|
1391
|
-
reviewOf: "{subject} ·
|
|
1392
|
-
lastWrong: "
|
|
1393
|
-
startReview: "
|
|
1394
|
-
noDueHint: "
|
|
1395
|
-
tilePhoto: "
|
|
1396
|
-
tileQuiz: "
|
|
1397
|
-
tileRecite: "
|
|
1398
|
-
tileSpeak: "
|
|
1399
|
-
speakText: "
|
|
1400
|
-
mistakesBook: "
|
|
1401
|
-
bookCount: "
|
|
1402
|
-
subjectLine: "{count}
|
|
1403
|
-
otherSubject: "
|
|
1404
|
-
thisWeek: "
|
|
1405
|
-
statQuestions: "
|
|
1406
|
-
statRight: "
|
|
1407
|
-
statDays: "
|
|
1408
|
-
weekdays: "
|
|
1409
|
-
toParent: "
|
|
1410
|
-
toParentOn: "
|
|
1411
|
-
pickParent: "
|
|
1412
|
-
noFriends: "
|
|
1413
|
-
reportPrivacy: "
|
|
1414
|
-
stopSending: "
|
|
1415
|
-
sendNow: "
|
|
1416
|
-
reportSent: "
|
|
1417
|
-
reportFailed: "
|
|
1418
|
-
reportTitle: "{name}
|
|
1419
|
-
reportIntro: "{name}
|
|
1420
|
-
reportNote: "{count}
|
|
1421
|
-
bookTitle: "{subject}
|
|
1422
|
-
yourAnswer: "
|
|
1423
|
-
rightAnswer: "
|
|
1424
|
-
dueNow: "
|
|
1425
|
-
dueIn: "{days}
|
|
1426
|
-
reviewThese: "
|
|
1427
|
-
childWeek: "{name}
|
|
1428
|
-
fromChild: "{time}
|
|
1429
|
-
noReport: "
|
|
1430
|
-
noReportHint: "
|
|
1431
|
-
howToHelp: "
|
|
1432
|
-
askTeacher: "
|
|
1433
|
-
tileCheck: "
|
|
1434
|
-
tileTalk: "
|
|
1435
|
-
tileTeacher: "
|
|
1436
|
-
tilePlan: "
|
|
1437
|
-
notices: "
|
|
1438
|
-
count: "{count}
|
|
1439
|
-
linkClassHint: "
|
|
1440
|
-
linkClass: "
|
|
1441
|
-
parentPrivacy: "
|
|
1442
|
-
noClass: "
|
|
1443
|
-
noClassHint: "
|
|
1444
|
-
latestQuiz: "
|
|
1445
|
-
submitted: "{count} / {total}
|
|
1446
|
-
average: "
|
|
1447
|
-
hardest: "第 {no}
|
|
1448
|
-
hardestWho: "{count} 人",
|
|
1449
|
-
goOver: "
|
|
1450
|
-
followUp: "
|
|
1451
|
-
noQuiz: "
|
|
1452
|
-
noQuizHint: "
|
|
1453
|
-
tileMake: "
|
|
1454
|
-
tileLesson: "
|
|
1455
|
-
tileScores: "成績分析",
|
|
1456
|
-
tileMark: "
|
|
1457
|
-
askTopic: "
|
|
1458
|
-
askTopicHint: "
|
|
1459
|
-
askLesson: "
|
|
1460
|
-
askLessonHint: "
|
|
1461
|
-
askRecite: "
|
|
1462
|
-
askRecitePrefill:
|
|
1463
|
-
`,
|
|
1464
|
-
sendToClass: "
|
|
1465
|
-
sentToClass: "
|
|
1466
|
-
pickClass: "
|
|
1467
|
-
quizIntro: "{title} · {count}
|
|
1468
|
-
handedIn: "
|
|
1469
|
-
handIn: "
|
|
1470
|
-
noTeacherKey: "
|
|
1471
|
-
handedCount: "
|
|
1472
|
-
results: "
|
|
1473
|
-
parentAsks: "
|
|
1474
|
-
waiting: "{count}
|
|
1475
|
-
noAsks: "
|
|
1476
|
-
draftReply: "
|
|
1477
|
-
tileReply: "
|
|
1478
|
-
tileComments: "
|
|
1479
|
-
tileMeeting: "
|
|
1480
|
-
tileNotice: "
|
|
1481
|
-
noticeTitle: "
|
|
1482
|
-
noticePrefix: "
|
|
1483
|
-
recentNotices: "
|
|
1484
|
-
classesTitle: "
|
|
1485
|
-
classesHint: "
|
|
1486
|
-
noGroups: "
|
|
1487
|
-
manageClasses: "
|
|
1488
|
-
chipPhoto: "
|
|
1489
|
-
chipHint: "
|
|
1490
|
-
chipHintText: "
|
|
1491
|
-
chipAgain: "
|
|
1492
|
-
chipAgainText: "
|
|
1493
|
-
chipGot: "
|
|
1494
|
-
chipGotText: "
|
|
1495
|
-
photoStudent: "
|
|
1496
|
-
photoParent: "
|
|
1497
|
-
photoTeacher: "
|
|
1498
|
-
scoresText: "
|
|
1499
|
-
goOverText: "
|
|
1500
|
-
followUpText: "
|
|
1501
|
-
noticeHelp: "
|
|
1502
|
-
askHelp: "
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1231
|
+
var JA = {
|
|
1232
|
+
eduTitle: "教育",
|
|
1233
|
+
pickTitle: "わたしは…",
|
|
1234
|
+
pickHint: "複数選べます。上で切り替えます",
|
|
1235
|
+
pickStage: "学校段階",
|
|
1236
|
+
done: "完了",
|
|
1237
|
+
roles: "立場",
|
|
1238
|
+
homeDetailPick: "立場を選ぶと始まります",
|
|
1239
|
+
streak: "{count} 日連続で学習中",
|
|
1240
|
+
noStreak: "今日から連続学習を始めよう",
|
|
1241
|
+
dueHead: "復習する問題があと {count} 問",
|
|
1242
|
+
dueNone: "今日復習する問題はありません",
|
|
1243
|
+
reviewOf: "{subject} · {n} 回目の復習",
|
|
1244
|
+
lastWrong: "前回の答え:{given}",
|
|
1245
|
+
startReview: "復習を始める",
|
|
1246
|
+
noDueHint: "間違えた問題は間違いノートに入り、忘れかけたころにもう一度出ます",
|
|
1247
|
+
tilePhoto: "写真で質問",
|
|
1248
|
+
tileQuiz: "問題を出して",
|
|
1249
|
+
tileRecite: "暗記・暗唱",
|
|
1250
|
+
tileSpeak: "会話練習",
|
|
1251
|
+
speakText: "英会話の練習相手になってください:今日のことを簡単な英語で一問ずつ聞いて、間違いはやさしく直してください",
|
|
1252
|
+
mistakesBook: "間違いノート",
|
|
1253
|
+
bookCount: "全 {count} 問 · 期限 {due}",
|
|
1254
|
+
subjectLine: "{count} 問 · 期限 {due}",
|
|
1255
|
+
otherSubject: "その他",
|
|
1256
|
+
thisWeek: "今週",
|
|
1257
|
+
statQuestions: "問",
|
|
1258
|
+
statRight: "正答率",
|
|
1259
|
+
statDays: "日学習",
|
|
1260
|
+
weekdays: "月火水木金土日",
|
|
1261
|
+
toParent: "毎週の学習状況を保護者に送る",
|
|
1262
|
+
toParentOn: "毎週日曜に {name} へ",
|
|
1263
|
+
pickParent: "送り先",
|
|
1264
|
+
noFriends: "先に Ta で保護者を友だちに追加してください",
|
|
1265
|
+
reportPrivacy: "送るのは問題数・正答率・弱点だけで、会話の内容は送りません",
|
|
1266
|
+
stopSending: "送るのをやめる",
|
|
1267
|
+
sendNow: "今すぐ送る",
|
|
1268
|
+
reportSent: "{name} に送りました",
|
|
1269
|
+
reportFailed: "送れませんでした:先に Ta で相手にひとこと送ってください",
|
|
1270
|
+
reportTitle: "{name}の今週",
|
|
1271
|
+
reportIntro: "{name}の今週の学習状況",
|
|
1272
|
+
reportNote: "間違い {count} 問",
|
|
1273
|
+
bookTitle: "{subject}の間違い",
|
|
1274
|
+
yourAnswer: "あなたの答え",
|
|
1275
|
+
rightAnswer: "正解",
|
|
1276
|
+
dueNow: "復習の時期",
|
|
1277
|
+
dueIn: "{days} 日後に復習",
|
|
1278
|
+
reviewThese: "これを復習",
|
|
1279
|
+
childWeek: "{name}の今週",
|
|
1280
|
+
fromChild: "{time} {name}の Ta から",
|
|
1281
|
+
noReport: "お子さんの学習状況はまだ届いていません",
|
|
1282
|
+
noReportHint: "お子さんが「教育 · 生徒」で「毎週の学習状況を保護者に送る」をオンにし、あなたを選びます",
|
|
1283
|
+
howToHelp: "どう手伝うか",
|
|
1284
|
+
askTeacher: "先生に聞く",
|
|
1285
|
+
tileCheck: "この問題を教える",
|
|
1286
|
+
tileTalk: "子どもと話す",
|
|
1287
|
+
tileTeacher: "先生に連絡",
|
|
1288
|
+
tilePlan: "週末の計画",
|
|
1289
|
+
notices: "先生からのお知らせ",
|
|
1290
|
+
count: "{count} 件",
|
|
1291
|
+
linkClassHint: "お子さんのクラスのグループをつなぐと、先生のお知らせがここに出ます",
|
|
1292
|
+
linkClass: "クラスのグループをつなぐ",
|
|
1293
|
+
parentPrivacy: "送るかどうかはお子さんが決め、送った内容はお子さんにも見えます",
|
|
1294
|
+
noClass: "クラスのグループがまだありません",
|
|
1295
|
+
noClassHint: "Ta で生徒と保護者のグループを作り、ここでつなぎます。クラスに送った練習はグループの中で答えられ、答えはあなただけに届きます",
|
|
1296
|
+
latestQuiz: "最近の練習",
|
|
1297
|
+
submitted: "{count} / {total} 提出",
|
|
1298
|
+
average: "平均正答率 {score}%",
|
|
1299
|
+
hardest: "第 {no} 問は {pct}% が間違い",
|
|
1300
|
+
hardestWho: "{count} 人",
|
|
1301
|
+
goOver: "解説の案を作る",
|
|
1302
|
+
followUp: "その生徒に追加練習",
|
|
1303
|
+
noQuiz: "まだ練習を送っていません",
|
|
1304
|
+
noQuizHint: "授業アシスタントで問題を作り、カードの「クラスに送る」を押します",
|
|
1305
|
+
tileMake: "問題を作る",
|
|
1306
|
+
tileLesson: "授業準備",
|
|
1307
|
+
tileScores: "成績分析",
|
|
1308
|
+
tileMark: "宿題を採点",
|
|
1309
|
+
askTopic: "練習の内容",
|
|
1310
|
+
askTopicHint: "例:一次方程式、10 問",
|
|
1311
|
+
askLesson: "単元",
|
|
1312
|
+
askLessonHint: "例:分数の意味",
|
|
1313
|
+
askRecite: "どの部分を覚えますか",
|
|
1314
|
+
askRecitePrefill: `この部分を覚えたいです。まず自分で言ってみるので、違うところを教えてください:
|
|
1315
|
+
`,
|
|
1316
|
+
sendToClass: "クラスに送る",
|
|
1317
|
+
sentToClass: "{klass} に送りました",
|
|
1318
|
+
pickClass: "どのクラスに送りますか",
|
|
1319
|
+
quizIntro: "{title} · {count} 問、終わると先生に提出されます",
|
|
1320
|
+
handedIn: "先生に提出しました",
|
|
1321
|
+
handIn: "先生に提出",
|
|
1322
|
+
noTeacherKey: "先生がまだ Ta の教育を開いていません。あとで提出してください",
|
|
1323
|
+
handedCount: "{count} 人提出",
|
|
1324
|
+
results: "結果を見る",
|
|
1325
|
+
parentAsks: "保護者からの連絡",
|
|
1326
|
+
waiting: "未返信 {count} 件",
|
|
1327
|
+
noAsks: "今週は保護者からの @ はありません",
|
|
1328
|
+
draftReply: "返信の下書き",
|
|
1329
|
+
tileReply: "保護者に返信",
|
|
1330
|
+
tileComments: "所見を書く",
|
|
1331
|
+
tileMeeting: "学級活動",
|
|
1332
|
+
tileNotice: "お知らせを送る",
|
|
1333
|
+
noticeTitle: "{klass} へのお知らせ",
|
|
1334
|
+
noticePrefix: "【クラスのお知らせ】",
|
|
1335
|
+
recentNotices: "最近のお知らせ",
|
|
1336
|
+
classesTitle: "クラスのグループ",
|
|
1337
|
+
classesHint: "どのグループがあなたのクラスか",
|
|
1338
|
+
noGroups: "グループがまだありません:パートナーで作ってから、ここでつなぎます",
|
|
1339
|
+
manageClasses: "クラスのグループ",
|
|
1340
|
+
chipPhoto: "写真で質問",
|
|
1341
|
+
chipHint: "ヒント",
|
|
1342
|
+
chipHintText: "もう少しヒントをください。答えはまだ言わないで",
|
|
1343
|
+
chipAgain: "別の説明",
|
|
1344
|
+
chipAgainText: "別の言い方でもう一度説明して",
|
|
1345
|
+
chipGot: "わかった",
|
|
1346
|
+
chipGotText: "わかりました。同じような問題を一問出して",
|
|
1347
|
+
photoStudent: "この問題がわかりません。答えはまだ言わずに、一歩ずつ考えさせてください",
|
|
1348
|
+
photoParent: "子どもがこの問題を間違えました。どこが違うか、どう説明すればいいですか",
|
|
1349
|
+
photoTeacher: "これを採点してください。一問ずつ正誤、間違いの原因の分類、最後に解説の要点を",
|
|
1350
|
+
scoresText: "成績表 {file} を分析して、クラス共通の弱点と気にかけるべき生徒を挙げてください",
|
|
1351
|
+
goOverText: "練習「{title}」の授業での解説を考えてください",
|
|
1352
|
+
followUpText: "練習「{title}」の第 {no} 問を間違えた生徒に、同じような問題を作ってください",
|
|
1353
|
+
noticeHelp: "先生からのお知らせです。何をいつまでにすればいいですか",
|
|
1354
|
+
askHelp: "保護者がクラスのグループで連絡をくれました。返信の下書きをお願いします。読んでから送ります",
|
|
1355
|
+
consentNeeded: "まず保護者の同意を",
|
|
1356
|
+
consentNeededHint: "小学生は、保護者が自分の Ta で同意してから学習パートナーを使います",
|
|
1357
|
+
consentAsk: "保護者に頼む",
|
|
1358
|
+
consentAsked: "{name} に頼みました · 返事待ち",
|
|
1359
|
+
consentAskOther: "もう一度、または別の人に",
|
|
1360
|
+
consentAskIntro: "{name} が Ta の学習パートナーを使いたがっています。あなたの Ta の「教育 · 保護者」で同意してください",
|
|
1361
|
+
consentGrantIntro: "学習パートナーを使っていいよ",
|
|
1362
|
+
consentRevokeIntro: "学習パートナーはしばらくお休み",
|
|
1363
|
+
consentAskTitle: "{name} が学習パートナーを使いたがっています",
|
|
1364
|
+
consentAskBody: "答えを教えず、自分で考えられるように導きます。宿題の代筆はしません。できるだけそばで使ってください。",
|
|
1365
|
+
consentYes: "同意する",
|
|
1366
|
+
consentNo: "今はやめる",
|
|
1367
|
+
consentTakeBack: "同意を取り消す",
|
|
1368
|
+
consentYouGranted: "{name} に同意しました",
|
|
1369
|
+
consentYouRevoked: "{name} にはまだ使わせません",
|
|
1370
|
+
consentGrantedChild: "{name} が同意しました。学習パートナーを使えます",
|
|
1371
|
+
consentRevokedChild: "{name}:今はやめておこう",
|
|
1372
|
+
consentWaitingChild: "保護者に同意を頼みました",
|
|
1373
|
+
consentAsks: "お子さんからのお願い",
|
|
1374
|
+
consentLocked: "まず保護者の同意を:保護者が自分の Ta で同意します",
|
|
1375
|
+
consentBy: "{name} が {date} に同意",
|
|
1376
|
+
consentNone: "まだ保護者の同意がありません",
|
|
1377
|
+
taskStudent: "今夜の間違い直し",
|
|
1378
|
+
taskParent: "お子さんの今週",
|
|
1379
|
+
taskTeacher: "今週の学習まとめ",
|
|
1380
|
+
taskHomeroom: "今日の保護者メッセージ",
|
|
1381
|
+
failed: "うまくいきませんでした:{error}",
|
|
1382
|
+
today: "今日",
|
|
1383
|
+
yesterday: "昨日"
|
|
1384
|
+
};
|
|
1385
|
+
var HOME_WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
|
|
1386
|
+
var NOTICE_PREFIXES = [...new Set(Object.values(HOME_WORDS).map((words) => words.noticePrefix))];
|
|
1387
|
+
var HomeWordsUtil;
|
|
1388
|
+
((HomeWordsUtil) => {
|
|
1389
|
+
function of(language) {
|
|
1390
|
+
return TaLanguageUtil.pick(language, HOME_WORDS);
|
|
1391
|
+
}
|
|
1392
|
+
HomeWordsUtil.of = of;
|
|
1393
|
+
})(HomeWordsUtil ||= {});
|
|
1394
|
+
|
|
1395
|
+
// web-src/edu-rooms.ts
|
|
1396
|
+
var DAY2 = 86400000;
|
|
1397
|
+
var EduRoomUtil;
|
|
1398
|
+
((EduRoomUtil) => {
|
|
1399
|
+
function keyOf(member) {
|
|
1400
|
+
return `${STATE}key:${member}`;
|
|
1401
|
+
}
|
|
1402
|
+
EduRoomUtil.keyOf = keyOf;
|
|
1403
|
+
function submissionOf(quiz, member) {
|
|
1404
|
+
return `${STATE}sub:${quiz}:${member}`;
|
|
1405
|
+
}
|
|
1406
|
+
EduRoomUtil.submissionOf = submissionOf;
|
|
1407
|
+
function notice(text) {
|
|
1408
|
+
const prefix = NOTICE_PREFIXES.find((one) => text.startsWith(one));
|
|
1409
|
+
return prefix ? text.slice(prefix.length).trim() : undefined;
|
|
1410
|
+
}
|
|
1411
|
+
EduRoomUtil.notice = notice;
|
|
1412
|
+
function report(text) {
|
|
1413
|
+
const match = new RegExp(`\`\`\`${LEARNING}\\n([\\s\\S]*?)\\n\`\`\``).exec(text);
|
|
1414
|
+
const learning = match ? EduUtil.learning(match[1]) : undefined;
|
|
1415
|
+
return learning?.report ? learning : undefined;
|
|
1416
|
+
}
|
|
1417
|
+
EduRoomUtil.report = report;
|
|
1418
|
+
function asks(lines, me, since) {
|
|
1419
|
+
const answered = new Set(lines.filter((line) => line.from === me && line.re).map((line) => line.re));
|
|
1420
|
+
const after = (line) => lines.some((other) => other.from === me && other.at > line.at);
|
|
1421
|
+
return lines.filter((line) => line.from !== me && line.at >= since && line.person && line.to?.includes(me) && !answered.has(line.id) && !after(line));
|
|
1422
|
+
}
|
|
1423
|
+
EduRoomUtil.asks = asks;
|
|
1424
|
+
function quizText(quiz, intro) {
|
|
1425
|
+
const body = {
|
|
1426
|
+
id: quiz.id,
|
|
1427
|
+
room: quiz.room,
|
|
1428
|
+
teacher: quiz.teacher,
|
|
1429
|
+
title: quiz.title,
|
|
1430
|
+
questions: quiz.questions.map((question) => ({
|
|
1431
|
+
q: question.q,
|
|
1432
|
+
...question.kind === "choice" ? { options: question.options } : {},
|
|
1433
|
+
answer: question.kind === "choice" ? EduUtil.letter(question.answer) : question.answer,
|
|
1434
|
+
...question.explain ? { explain: question.explain } : {},
|
|
1435
|
+
...question.figure ? { figure: question.figure } : {},
|
|
1436
|
+
...question.subject ? { subject: question.subject } : {},
|
|
1437
|
+
...question.topic ? { topic: question.topic } : {}
|
|
1438
|
+
}))
|
|
1439
|
+
};
|
|
1440
|
+
return `${intro}
|
|
1441
|
+
|
|
1442
|
+
\`\`\`${QUIZ}
|
|
1443
|
+
${JSON.stringify(body)}
|
|
1444
|
+
\`\`\``;
|
|
1445
|
+
}
|
|
1446
|
+
EduRoomUtil.quizText = quizText;
|
|
1447
|
+
function reportText(learning, intro) {
|
|
1448
|
+
return `${intro}
|
|
1449
|
+
|
|
1450
|
+
\`\`\`${LEARNING}
|
|
1451
|
+
${JSON.stringify(learning)}
|
|
1452
|
+
\`\`\``;
|
|
1453
|
+
}
|
|
1454
|
+
EduRoomUtil.reportText = reportText;
|
|
1455
|
+
function consentText(line, intro) {
|
|
1456
|
+
return `${intro}
|
|
1457
|
+
|
|
1458
|
+
\`\`\`${CONSENT}
|
|
1459
|
+
${JSON.stringify(line)}
|
|
1460
|
+
\`\`\``;
|
|
1461
|
+
}
|
|
1462
|
+
EduRoomUtil.consentText = consentText;
|
|
1463
|
+
function consent(text) {
|
|
1464
|
+
const match = new RegExp(`\`\`\`${CONSENT}\\n([\\s\\S]*?)\\n\`\`\``).exec(text);
|
|
1465
|
+
let raw;
|
|
1466
|
+
try {
|
|
1467
|
+
raw = JSON.parse(match ? match[1] : text);
|
|
1468
|
+
} catch {
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
return raw && (raw.kind === "ask" || raw.kind === "grant" || raw.kind === "revoke") && typeof raw.room === "string" && typeof raw.child === "string" && typeof raw.name === "string" ? { kind: raw.kind, room: raw.room, child: raw.child, name: raw.name, ...typeof raw.from === "string" ? { from: raw.from } : {} } : undefined;
|
|
1472
|
+
}
|
|
1473
|
+
EduRoomUtil.consent = consent;
|
|
1474
|
+
})(EduRoomUtil ||= {});
|
|
1475
|
+
|
|
1476
|
+
class EduRooms {
|
|
1477
|
+
side;
|
|
1478
|
+
store;
|
|
1479
|
+
list = [];
|
|
1480
|
+
friendList = [];
|
|
1481
|
+
listeners = new Set;
|
|
1482
|
+
loading;
|
|
1483
|
+
stop;
|
|
1484
|
+
me;
|
|
1485
|
+
version = 0;
|
|
1486
|
+
constructor(side, store) {
|
|
1487
|
+
this.side = side;
|
|
1488
|
+
this.store = store;
|
|
1489
|
+
}
|
|
1490
|
+
get server() {
|
|
1491
|
+
return this.side.rooms;
|
|
1492
|
+
}
|
|
1493
|
+
identity() {
|
|
1494
|
+
this.me ??= this.server ? this.server.getIdentity().catch(() => {
|
|
1495
|
+
return;
|
|
1496
|
+
}) : Promise.resolve(undefined);
|
|
1497
|
+
return this.me;
|
|
1498
|
+
}
|
|
1499
|
+
get rooms() {
|
|
1500
|
+
return this.list;
|
|
1501
|
+
}
|
|
1502
|
+
get friends() {
|
|
1503
|
+
return this.friendList;
|
|
1504
|
+
}
|
|
1505
|
+
subscribe = (listener) => {
|
|
1506
|
+
this.listeners.add(listener);
|
|
1507
|
+
if (!this.stop && this.side.onRoomEvent) {
|
|
1508
|
+
this.stop = this.side.onRoomEvent((event) => {
|
|
1509
|
+
if (event.type === "rooms" || event.type === "state" && event.key.startsWith(STATE)) {
|
|
1510
|
+
this.load();
|
|
1511
|
+
}
|
|
1512
|
+
}, { messages: false, state: [STATE] });
|
|
1513
|
+
this.load();
|
|
1514
|
+
}
|
|
1515
|
+
return () => {
|
|
1516
|
+
this.listeners.delete(listener);
|
|
1517
|
+
if (!this.listeners.size) {
|
|
1518
|
+
this.stop?.();
|
|
1519
|
+
this.stop = undefined;
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
};
|
|
1523
|
+
load() {
|
|
1524
|
+
const server = this.server;
|
|
1525
|
+
if (!server) {
|
|
1526
|
+
return Promise.resolve();
|
|
1527
|
+
}
|
|
1528
|
+
this.loading ??= Promise.all([server.listRooms().catch(() => this.list), server.listFriends().catch(() => this.friendList)]).then(([rooms, friends]) => {
|
|
1529
|
+
this.list = rooms.filter((room) => room.status === "member");
|
|
1530
|
+
this.friendList = friends.filter((friend) => friend.status === "friend");
|
|
1531
|
+
this.version++;
|
|
1532
|
+
for (const listener of this.listeners) {
|
|
1533
|
+
listener();
|
|
1534
|
+
}
|
|
1535
|
+
}).finally(() => {
|
|
1536
|
+
this.loading = undefined;
|
|
1537
|
+
});
|
|
1538
|
+
return this.loading;
|
|
1539
|
+
}
|
|
1540
|
+
groups() {
|
|
1541
|
+
return this.list.filter((room) => room.kind === GROUP_KIND);
|
|
1542
|
+
}
|
|
1543
|
+
classes() {
|
|
1544
|
+
const { classes } = this.store.state.settings;
|
|
1545
|
+
return classes.flatMap((id) => this.list.find((room) => room.id === id) ?? []);
|
|
1546
|
+
}
|
|
1547
|
+
memberOf(room) {
|
|
1548
|
+
return room.members.find((member) => member.self)?.member;
|
|
1549
|
+
}
|
|
1550
|
+
async publishKey(room) {
|
|
1551
|
+
const me = this.memberOf(room);
|
|
1552
|
+
const server = this.server;
|
|
1553
|
+
if (!me || !server) {
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
const keys = await this.store.teacherKeys();
|
|
1557
|
+
const key = EduRoomUtil.keyOf(me);
|
|
1558
|
+
const state = await server.getState(room.id, key);
|
|
1559
|
+
if (state[key]?.value && JSON.stringify(state[key].value) === JSON.stringify(keys.publicKey)) {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
await server.setState(room.id, key, keys.publicKey);
|
|
1563
|
+
}
|
|
1564
|
+
async postQuiz(room, quiz, intro) {
|
|
1565
|
+
const me = this.memberOf(room);
|
|
1566
|
+
const server = this.server;
|
|
1567
|
+
if (!me || !server) {
|
|
1568
|
+
throw new Error("Not in the class.");
|
|
1569
|
+
}
|
|
1570
|
+
await this.publishKey(room);
|
|
1571
|
+
const id = `q${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
1572
|
+
const sent = { ...quiz, reveal: false, id, room: room.id, teacher: me };
|
|
1573
|
+
await server.say(room.id, EduRoomUtil.quizText(sent, intro));
|
|
1574
|
+
const gone = await this.store.addPosted({ id, room: room.id, title: quiz.title ?? "", at: Date.now(), questions: quiz.questions });
|
|
1575
|
+
for (const old of gone) {
|
|
1576
|
+
const state = await server.getState(old.room, `${STATE}sub:${old.id}:`).catch(() => ({}));
|
|
1577
|
+
for (const key of Object.keys(state)) {
|
|
1578
|
+
await server.setState(old.room, key, null).catch(() => {
|
|
1579
|
+
return;
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
async submit(quiz, submission) {
|
|
1585
|
+
const server = this.server;
|
|
1586
|
+
if (!quiz.id || !quiz.room || !quiz.teacher || !server) {
|
|
1587
|
+
return "not-in";
|
|
1588
|
+
}
|
|
1589
|
+
if (!this.list.length) {
|
|
1590
|
+
await this.load();
|
|
1591
|
+
}
|
|
1592
|
+
const room = this.list.find((one) => one.id === quiz.room);
|
|
1593
|
+
const me = room && this.memberOf(room);
|
|
1594
|
+
if (!room || !me) {
|
|
1595
|
+
return "not-in";
|
|
1596
|
+
}
|
|
1597
|
+
const key = (await server.getState(room.id, EduRoomUtil.keyOf(quiz.teacher)))[EduRoomUtil.keyOf(quiz.teacher)]?.value;
|
|
1598
|
+
if (!EduSeal.isPublic(key)) {
|
|
1599
|
+
return "no-key";
|
|
1600
|
+
}
|
|
1601
|
+
await server.setState(room.id, EduRoomUtil.submissionOf(quiz.id, me), await EduSeal.seal(submission, key));
|
|
1602
|
+
return "sent";
|
|
1603
|
+
}
|
|
1604
|
+
async submitted(quiz) {
|
|
1605
|
+
const room = quiz.room ? this.list.find((one) => one.id === quiz.room) : undefined;
|
|
1606
|
+
const me = room && this.memberOf(room);
|
|
1607
|
+
if (!room || !me || !quiz.id || !this.server) {
|
|
1608
|
+
return false;
|
|
1609
|
+
}
|
|
1610
|
+
const key = EduRoomUtil.submissionOf(quiz.id, me);
|
|
1611
|
+
return !!(await this.server.getState(room.id, key))[key]?.value;
|
|
1612
|
+
}
|
|
1613
|
+
async submissions(posted) {
|
|
1614
|
+
const server = this.server;
|
|
1615
|
+
if (!server) {
|
|
1616
|
+
return [];
|
|
1617
|
+
}
|
|
1618
|
+
const keys = await this.store.teacherKeys();
|
|
1619
|
+
const state = await server.getState(posted.room, `${STATE}sub:${posted.id}:`).catch(() => ({}));
|
|
1620
|
+
const opened = await Promise.all(Object.values(state).map((value) => EduSeal.open(value.value, keys)));
|
|
1621
|
+
return opened.filter((one) => !!one && typeof one.name === "string" && Array.isArray(one.right));
|
|
1622
|
+
}
|
|
1623
|
+
async lines(room, limit = 80) {
|
|
1624
|
+
return (await this.server?.readChat?.(room, { limit }).catch(() => {
|
|
1625
|
+
return;
|
|
1626
|
+
}))?.lines ?? [];
|
|
1627
|
+
}
|
|
1628
|
+
async notices() {
|
|
1629
|
+
const since = Date.now() - 30 * DAY2;
|
|
1630
|
+
const all = await Promise.all(this.classes().map(async (room) => (await this.lines(room.id)).flatMap((line) => {
|
|
1631
|
+
const text = !line.failed && line.at >= since ? EduRoomUtil.notice(line.text) : undefined;
|
|
1632
|
+
return text ? [{ id: line.id, room: room.id, klass: room.title, from: line.name, text, at: line.at }] : [];
|
|
1633
|
+
})));
|
|
1634
|
+
return all.flat().sort((a, b) => b.at - a.at);
|
|
1635
|
+
}
|
|
1636
|
+
async postNotice(room, text, prefix) {
|
|
1637
|
+
await this.server?.say(room, `${prefix}${text.trim()}`);
|
|
1638
|
+
}
|
|
1639
|
+
async asks() {
|
|
1640
|
+
const since = Date.now() - 7 * DAY2;
|
|
1641
|
+
const all = await Promise.all(this.classes().map(async (room) => {
|
|
1642
|
+
const me = this.memberOf(room);
|
|
1643
|
+
return me ? EduRoomUtil.asks(await this.lines(room.id), me, since).map((line) => ({
|
|
1644
|
+
id: line.id,
|
|
1645
|
+
room: room.id,
|
|
1646
|
+
klass: room.title,
|
|
1647
|
+
from: line.name,
|
|
1648
|
+
text: line.text,
|
|
1649
|
+
at: line.at
|
|
1650
|
+
})) : [];
|
|
1651
|
+
}));
|
|
1652
|
+
return all.flat().sort((a, b) => b.at - a.at);
|
|
1653
|
+
}
|
|
1654
|
+
async reports() {
|
|
1655
|
+
const directs = this.list.filter((room) => room.kind === DIRECT_KIND);
|
|
1656
|
+
const found = await Promise.all(directs.map(async (room) => {
|
|
1657
|
+
const lines = await this.lines(room.id, 60);
|
|
1658
|
+
for (const line of [...lines].reverse()) {
|
|
1659
|
+
const learning = room.members.find((member) => member.member === line.from)?.self ? undefined : EduRoomUtil.report(line.text);
|
|
1660
|
+
if (learning) {
|
|
1661
|
+
return [{ room: room.id, child: line.name, at: line.at, learning }];
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
return [];
|
|
1665
|
+
}));
|
|
1666
|
+
return found.flat().sort((a, b) => b.at - a.at);
|
|
1667
|
+
}
|
|
1668
|
+
async sendReport(friend, learning, intro, make = true) {
|
|
1669
|
+
return !!await this.sendTo(friend, () => EduRoomUtil.reportText(learning, intro), make);
|
|
1670
|
+
}
|
|
1671
|
+
async sendTo(friend, text, make = true) {
|
|
1672
|
+
const server = this.server;
|
|
1673
|
+
if (!server) {
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
let room = await this.direct(friend);
|
|
1677
|
+
if (!room && make && this.side.openFriend && await this.side.openFriend(friend)) {
|
|
1678
|
+
for (let tries = 0;tries < 20 && !room; tries++) {
|
|
1679
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
1680
|
+
room = await this.direct(friend, true);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
if (!room) {
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
await server.say(room.id, text(room.id));
|
|
1687
|
+
return room.id;
|
|
1688
|
+
}
|
|
1689
|
+
async consentOf() {
|
|
1690
|
+
const me = (await this.identity())?.id;
|
|
1691
|
+
const said = (await this.consents()).filter((one) => !one.self && one.by && one.consent.child === me && one.consent.kind !== "ask");
|
|
1692
|
+
const last = said.sort((a, b) => a.line.at - b.line.at).at(-1);
|
|
1693
|
+
if (!last) {
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
return last.consent.kind === "grant" && last.by ? { by: last.by, name: last.line.name, at: last.line.at } : null;
|
|
1697
|
+
}
|
|
1698
|
+
async consentAsks() {
|
|
1699
|
+
const said = await this.consents();
|
|
1700
|
+
const asks = new Map;
|
|
1701
|
+
for (const one of said) {
|
|
1702
|
+
if (!one.self && one.consent.kind === "ask" && one.by === one.consent.child) {
|
|
1703
|
+
asks.set(one.consent.child, { room: one.consent.room, child: one.consent.child, name: one.line.name, at: one.line.at });
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return [...asks.values()].filter((ask) => !said.some((one) => one.self && one.consent.kind !== "ask" && one.consent.child === ask.child && one.line.at > ask.at)).sort((a, b) => b.at - a.at);
|
|
1707
|
+
}
|
|
1708
|
+
async consentAnswer(room, child) {
|
|
1709
|
+
const said = (await this.consents(room)).filter((one) => one.self && one.consent.kind !== "ask" && one.consent.child === child);
|
|
1710
|
+
return said.sort((a, b) => a.line.at - b.line.at).at(-1)?.consent.kind;
|
|
1711
|
+
}
|
|
1712
|
+
async answerConsent(ask, yes, words) {
|
|
1713
|
+
const me = await this.identity();
|
|
1714
|
+
const line = { kind: yes ? "grant" : "revoke", room: ask.room, child: ask.child, name: ask.name, ...me ? { from: me.name } : {} };
|
|
1715
|
+
await this.server?.say(ask.room, EduRoomUtil.consentText(line, yes ? words.consentGrantIntro : words.consentRevokeIntro));
|
|
1716
|
+
}
|
|
1717
|
+
async consents(only) {
|
|
1718
|
+
if (!this.list.length) {
|
|
1719
|
+
await this.load();
|
|
1720
|
+
}
|
|
1721
|
+
const directs = this.list.filter((room) => room.kind === DIRECT_KIND && (!only || room.id === only));
|
|
1722
|
+
const all = await Promise.all(directs.map(async (room) => (await this.lines(room.id, 200)).flatMap((line) => {
|
|
1723
|
+
const consent = !line.failed && line.text.includes(CONSENT) ? EduRoomUtil.consent(line.text) : undefined;
|
|
1724
|
+
const member = room.members.find((one) => one.member === line.from);
|
|
1725
|
+
return consent && consent.room === room.id ? [{ line, consent, by: member?.id, self: !!member?.self }] : [];
|
|
1726
|
+
})));
|
|
1727
|
+
return all.flat();
|
|
1728
|
+
}
|
|
1729
|
+
async direct(friend, again = false) {
|
|
1730
|
+
if (again || !this.list.length) {
|
|
1731
|
+
await this.load();
|
|
1732
|
+
}
|
|
1733
|
+
return this.list.filter((room) => room.kind === DIRECT_KIND && room.members.some((member) => !member.self && member.id === friend)).sort((a, b) => a.createdAt - b.createdAt)[0];
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
// web-src/edu-roles.ts
|
|
1738
|
+
var QUIZ_FORMAT = `To give questions to answer, write a fenced block of language ${QUIZ} holding JSON, which Ta draws as a card the user answers in, checked at once: {"title"?: string, "reveal"?: boolean, "questions": [{"q": string, "options"?: [string] (a choice question; "answer" the letter), "answer": "B" | true | false (true or false question) | ["answers", "taken as right"] (fill in the blank), "explain": string, "subject": the school subject, "topic": the point it tests, "review"?: id of the mistake it reviews, "figure"?: its figure (geometry, a graph), drawn right under its text: {"ta-plot": the JSON of a ta-plot block} | {"ta-3d": that of a ta-3d block} | ""}]}. A figure goes in the question it belongs to, never as a block before the card; its text says "如图", not "如图 3". Mistakes the user makes in it are kept for review. To show how someone is learning, a ${LEARNING} block: {"title"?: string, "items": [{"label": topic, "value": 0-100 mastery, "note"?: string}], "weak"?: [string], "next"?: [what to do next]}.`;
|
|
1739
|
+
var ROLES = {
|
|
1740
|
+
student: {
|
|
1741
|
+
assistant: "assistantStudent",
|
|
1742
|
+
tagline: "taglineStudent",
|
|
1743
|
+
icon: "BookOpen",
|
|
1744
|
+
skills: ["edu-tutor", "edu-quiz"],
|
|
1745
|
+
actions: [
|
|
1746
|
+
{ key: "explain", icon: "Image" },
|
|
1747
|
+
{ key: "quizMe", icon: "ListChecks", send: true },
|
|
1748
|
+
{ key: "review", icon: "RotateCcw", send: true },
|
|
1749
|
+
{ key: "recite", icon: "Mic" }
|
|
1750
|
+
],
|
|
1751
|
+
rules: "You tutor a student. Never give the final answer or a whole solution before the student has tried: ask what they know, give one hint at a time, let them do each step, and show the full solution only once they reached it or asked twice after trying. Check understanding with a question in another form. Never write their essays or homework for them: outlines, questions and comments on what they wrote. Encourage effort, not talent. If they speak of distress, listen, and tell them to talk to a parent or a teacher they trust."
|
|
1752
|
+
},
|
|
1753
|
+
parent: {
|
|
1754
|
+
assistant: "assistantParent",
|
|
1755
|
+
tagline: "taglineParent",
|
|
1756
|
+
icon: "House",
|
|
1757
|
+
skills: ["edu-parent", "edu-quiz"],
|
|
1758
|
+
actions: [
|
|
1759
|
+
{ key: "check", icon: "Image" },
|
|
1760
|
+
{ key: "talk", icon: "MessageCircle" },
|
|
1761
|
+
{ key: "toTeacher", icon: "Send" },
|
|
1762
|
+
{ key: "plan", icon: "Calendar" }
|
|
1763
|
+
],
|
|
1764
|
+
rules: "You help a parent help their child. Tell the parent where and why the child went wrong, the words to explain it to the child at their age, and one practice question; do not do the homework for the child. Help them keep calm and kind; on messages to teachers, help them be clear, specific and respectful. Their child is theirs to judge: no labels, no diagnosis."
|
|
1765
|
+
},
|
|
1766
|
+
teacher: {
|
|
1767
|
+
assistant: "assistantTeacher",
|
|
1768
|
+
tagline: "taglineTeacher",
|
|
1769
|
+
icon: "Pencil",
|
|
1770
|
+
skills: ["edu-grading", "edu-quiz", "edu-lesson"],
|
|
1771
|
+
actions: [
|
|
1772
|
+
{ key: "grade", icon: "ListChecks" },
|
|
1773
|
+
{ key: "makeQuiz", icon: "FilePlus" },
|
|
1774
|
+
{ key: "lesson", icon: "FileText" },
|
|
1775
|
+
{ key: "exam", icon: "ChartSpline" },
|
|
1776
|
+
{ key: "weekly", icon: "Calendar", send: true }
|
|
1777
|
+
],
|
|
1778
|
+
rules: 'You assist a teacher. Marking: right or wrong for each question, the causes of the mistakes grouped, what the class shares, and an outline to go over it; what you are unsure of you say. Questions: in three levels (basic, better, stretch) with answers and explanations, "reveal": true. Score sheets and records in the working directory you read yourself; you count, the teacher decides. Names of students stay on this computer.'
|
|
1779
|
+
},
|
|
1780
|
+
homeroom: {
|
|
1781
|
+
assistant: "assistantHomeroom",
|
|
1782
|
+
tagline: "taglineHomeroom",
|
|
1783
|
+
icon: "Users",
|
|
1784
|
+
skills: ["edu-homeroom"],
|
|
1785
|
+
actions: [
|
|
1786
|
+
{ key: "reply", icon: "MessageCircle" },
|
|
1787
|
+
{ key: "comments", icon: "Pencil" },
|
|
1788
|
+
{ key: "meeting", icon: "Users" },
|
|
1789
|
+
{ key: "notice", icon: "Megaphone" }
|
|
1790
|
+
],
|
|
1791
|
+
rules: "You assist a class teacher. Replies to parents are drafts the teacher sends: warm, clear, within what the school decides, never promising what is not theirs. Report comments come from what the teacher told of each student, specific and kind, no stock phrases. A student at risk (self-harm, abuse, bullying): tell the teacher to bring in the school counsellor, the school leaders and the parents at once; do not handle it alone."
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
var STAGE_NAMES = { primary: "primary school", junior: "middle school", senior: "high school" };
|
|
1795
|
+
var EduRoles;
|
|
1796
|
+
((EduRoles) => {
|
|
1797
|
+
function prompt(identity, settings) {
|
|
1798
|
+
const role = ROLES[identity];
|
|
1799
|
+
const about = [
|
|
1800
|
+
settings.stage && `stage: ${STAGE_NAMES[settings.stage]}`,
|
|
1801
|
+
settings.subject && `subjects: ${settings.subject}`,
|
|
1802
|
+
settings.textbook && `textbooks: ${settings.textbook}`
|
|
1803
|
+
].filter(Boolean);
|
|
1804
|
+
return [
|
|
1805
|
+
`${MARK} You are Ta for a ${identity === "homeroom" ? "class teacher" : identity} in school education in China${about.length ? ` (${about.join("; ")})` : ""}.`,
|
|
1806
|
+
role.rules,
|
|
1807
|
+
`Skills for this: ${role.skills.join(", ")}.`,
|
|
1808
|
+
"What students, scores and families are is private: keep it on this computer, and leave names out of what is shared unless the user asks.",
|
|
1809
|
+
QUIZ_FORMAT
|
|
1810
|
+
].join(`
|
|
1811
|
+
`);
|
|
1812
|
+
}
|
|
1813
|
+
EduRoles.prompt = prompt;
|
|
1814
|
+
function action(words, key) {
|
|
1815
|
+
return words[key];
|
|
1816
|
+
}
|
|
1817
|
+
EduRoles.action = action;
|
|
1818
|
+
})(EduRoles ||= {});
|
|
1819
|
+
|
|
1820
|
+
// web-src/i18n.ts
|
|
1821
|
+
var EN2 = {
|
|
1822
|
+
student: "Student",
|
|
1823
|
+
parent: "Parent",
|
|
1824
|
+
teacher: "Teacher",
|
|
1825
|
+
homeroom: "Class teacher",
|
|
1826
|
+
assistantStudent: "Study buddy",
|
|
1827
|
+
assistantParent: "Homework coach",
|
|
1828
|
+
assistantTeacher: "Teaching assistant",
|
|
1829
|
+
assistantHomeroom: "Class assistant",
|
|
1830
|
+
taglineStudent: "Works it out with you, not for you",
|
|
1831
|
+
taglineParent: "See where your child went wrong, and how to explain it",
|
|
1832
|
+
taglineTeacher: "Marking, questions, lesson plans, test analysis",
|
|
1833
|
+
taglineHomeroom: "Parents, report comments, class meetings, notices",
|
|
1834
|
+
due: "{count} mistakes to review today",
|
|
1835
|
+
locked: "A parent or teacher turns this on for primary school",
|
|
1836
|
+
primary: "Primary",
|
|
1837
|
+
junior: "Middle school",
|
|
1838
|
+
senior: "High school",
|
|
1839
|
+
explain: { label: "Explain a problem", text: "I can't do this one. Don't tell me the answer yet, help me think it through:" },
|
|
1840
|
+
quizMe: { label: "Quiz me", text: "Give me a few questions on what I learned lately" },
|
|
1841
|
+
review: { label: "Review mistakes", text: "Review the {count} mistakes due today" },
|
|
1842
|
+
recite: { label: "Recite", text: "Help me learn this passage by heart: let me try first, then tell me what I got wrong:" },
|
|
1843
|
+
check: { label: "Check homework", text: "Look at my child’s homework: what is wrong, and how do I explain it to them?" },
|
|
1844
|
+
talk: { label: "What to say", text: "My child is in this situation. How should I talk to them about it?" },
|
|
1845
|
+
toTeacher: { label: "Message the teacher", text: "Help me write to the teacher, clearly and politely:" },
|
|
1846
|
+
plan: { label: "Plan the week", text: "Plan my child’s study for this week. How things are:" },
|
|
1847
|
+
grade: {
|
|
1848
|
+
label: "Mark homework",
|
|
1849
|
+
text: "Mark these (photos below): right or wrong for each question, the causes of the mistakes grouped, and an outline for going over them in class:"
|
|
1850
|
+
},
|
|
1851
|
+
makeQuiz: { label: "Set questions", text: "Set questions in three levels (basic, better, stretch) on:" },
|
|
1852
|
+
lesson: { label: "Lesson plan", text: "Write a lesson plan for:" },
|
|
1853
|
+
exam: { label: "Analyse a test", text: "Analyse this score sheet (file below): the weak points the class shares, and the students to look after:" },
|
|
1854
|
+
weekly: {
|
|
1855
|
+
label: "Weekly summary",
|
|
1856
|
+
text: "Every Friday at 4 pm, read this week’s scores and homework records in this folder and write me a summary of how the class is learning"
|
|
1857
|
+
},
|
|
1858
|
+
reply: { label: "Reply to a parent", text: `A parent wrote:
|
|
1859
|
+
|
|
1860
|
+
Draft me a reply; I will read it before I send it:` },
|
|
1861
|
+
comments: { label: "Report comments", text: `Write report comments from how each student did, below, with no stock phrases:
|
|
1862
|
+
` },
|
|
1863
|
+
meeting: { label: "Class meeting", text: "Plan a class meeting on:" },
|
|
1864
|
+
notice: { label: "Notice to parents", text: "Write a notice to parents about:" },
|
|
1865
|
+
settingsTitle: "Education",
|
|
1866
|
+
identitiesLabel: "Who you are",
|
|
1867
|
+
identitiesHint: "Each one you pick has its assistant in your list",
|
|
1868
|
+
stageLabel: "Stage",
|
|
1869
|
+
subjectLabel: "Subjects",
|
|
1870
|
+
subjectHint: "Such as maths, English",
|
|
1871
|
+
textbookLabel: "Textbooks",
|
|
1872
|
+
textbookHint: "The edition your school uses",
|
|
1873
|
+
consentLabel: "Study buddy at primary school",
|
|
1874
|
+
consentHint: "A parent says yes in their own Ta; it is not changed here",
|
|
1875
|
+
quiz: "Practice",
|
|
1876
|
+
submit: "Check",
|
|
1877
|
+
right: "Right",
|
|
1878
|
+
wrongAnswer: "The answer: {answer}",
|
|
1879
|
+
score: "{right} of {total} right",
|
|
1880
|
+
explainWrong: "Go over my mistakes",
|
|
1881
|
+
explainWrongText: "Go over the questions I got wrong",
|
|
1882
|
+
judgeTrue: "True",
|
|
1883
|
+
judgeFalse: "False",
|
|
1884
|
+
blank: "Your answer",
|
|
1885
|
+
revealAnswer: "Answer: {answer}",
|
|
1886
|
+
learning: "How it is going",
|
|
1887
|
+
weak: "Weak points",
|
|
1888
|
+
next: "Next"
|
|
1506
1889
|
};
|
|
1507
|
-
var
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
parentPrivacy: "送るかどうかはお子さんが決め、送った内容はお子さんにも見えます",
|
|
1570
|
-
noClass: "クラスのグループがまだありません",
|
|
1571
|
-
noClassHint: "Ta で生徒と保護者のグループを作り、ここでつなぎます。クラスに送った練習はグループの中で答えられ、答えはあなただけに届きます",
|
|
1572
|
-
latestQuiz: "最近の練習",
|
|
1573
|
-
submitted: "{count} / {total} 提出",
|
|
1574
|
-
average: "平均正答率 {score}%",
|
|
1575
|
-
hardest: "第 {no} 問は {pct}% が間違い",
|
|
1576
|
-
hardestWho: "{count} 人",
|
|
1577
|
-
goOver: "解説の案を作る",
|
|
1578
|
-
followUp: "その生徒に追加練習",
|
|
1579
|
-
noQuiz: "まだ練習を送っていません",
|
|
1580
|
-
noQuizHint: "授業アシスタントで問題を作り、カードの「クラスに送る」を押します",
|
|
1581
|
-
tileMake: "問題を作る",
|
|
1582
|
-
tileLesson: "授業準備",
|
|
1583
|
-
tileScores: "成績分析",
|
|
1584
|
-
tileMark: "宿題を採点",
|
|
1585
|
-
askTopic: "練習の内容",
|
|
1586
|
-
askTopicHint: "例:一次方程式、10 問",
|
|
1587
|
-
askLesson: "単元",
|
|
1588
|
-
askLessonHint: "例:分数の意味",
|
|
1589
|
-
askRecite: "どの部分を覚えますか",
|
|
1590
|
-
askRecitePrefill: `この部分を覚えたいです。まず自分で言ってみるので、違うところを教えてください:
|
|
1591
|
-
`,
|
|
1592
|
-
sendToClass: "クラスに送る",
|
|
1593
|
-
sentToClass: "{klass} に送りました",
|
|
1594
|
-
pickClass: "どのクラスに送りますか",
|
|
1595
|
-
quizIntro: "{title} · {count} 問、終わると先生に提出されます",
|
|
1596
|
-
handedIn: "先生に提出しました",
|
|
1597
|
-
handIn: "先生に提出",
|
|
1598
|
-
noTeacherKey: "先生がまだ Ta の教育を開いていません。あとで提出してください",
|
|
1599
|
-
handedCount: "{count} 人提出",
|
|
1600
|
-
results: "結果を見る",
|
|
1601
|
-
parentAsks: "保護者からの連絡",
|
|
1602
|
-
waiting: "未返信 {count} 件",
|
|
1603
|
-
noAsks: "今週は保護者からの @ はありません",
|
|
1604
|
-
draftReply: "返信の下書き",
|
|
1605
|
-
tileReply: "保護者に返信",
|
|
1606
|
-
tileComments: "所見を書く",
|
|
1607
|
-
tileMeeting: "学級活動",
|
|
1608
|
-
tileNotice: "お知らせを送る",
|
|
1609
|
-
noticeTitle: "{klass} へのお知らせ",
|
|
1610
|
-
noticePrefix: "【クラスのお知らせ】",
|
|
1611
|
-
recentNotices: "最近のお知らせ",
|
|
1612
|
-
classesTitle: "クラスのグループ",
|
|
1613
|
-
classesHint: "どのグループがあなたのクラスか",
|
|
1614
|
-
noGroups: "グループがまだありません:パートナーで作ってから、ここでつなぎます",
|
|
1615
|
-
manageClasses: "クラスのグループ",
|
|
1616
|
-
chipPhoto: "写真で質問",
|
|
1617
|
-
chipHint: "ヒント",
|
|
1618
|
-
chipHintText: "もう少しヒントをください。答えはまだ言わないで",
|
|
1619
|
-
chipAgain: "別の説明",
|
|
1620
|
-
chipAgainText: "別の言い方でもう一度説明して",
|
|
1621
|
-
chipGot: "わかった",
|
|
1622
|
-
chipGotText: "わかりました。同じような問題を一問出して",
|
|
1623
|
-
photoStudent: "この問題がわかりません。答えはまだ言わずに、一歩ずつ考えさせてください",
|
|
1624
|
-
photoParent: "子どもがこの問題を間違えました。どこが違うか、どう説明すればいいですか",
|
|
1625
|
-
photoTeacher: "これを採点してください。一問ずつ正誤、間違いの原因の分類、最後に解説の要点を",
|
|
1626
|
-
scoresText: "成績表 {file} を分析して、クラス共通の弱点と気にかけるべき生徒を挙げてください",
|
|
1627
|
-
goOverText: "練習「{title}」の授業での解説を考えてください",
|
|
1628
|
-
followUpText: "練習「{title}」の第 {no} 問を間違えた生徒に、同じような問題を作ってください",
|
|
1629
|
-
noticeHelp: "先生からのお知らせです。何をいつまでにすればいいですか",
|
|
1630
|
-
askHelp: "保護者がクラスのグループで連絡をくれました。返信の下書きをお願いします。読んでから送ります",
|
|
1631
|
-
failed: "うまくいきませんでした:{error}",
|
|
1632
|
-
today: "今日",
|
|
1633
|
-
yesterday: "昨日"
|
|
1890
|
+
var ZH2 = {
|
|
1891
|
+
student: "学生",
|
|
1892
|
+
parent: "家长",
|
|
1893
|
+
teacher: "老师",
|
|
1894
|
+
homeroom: "班主任",
|
|
1895
|
+
assistantStudent: "学习伙伴",
|
|
1896
|
+
assistantParent: "辅导助手",
|
|
1897
|
+
assistantTeacher: "教学助手",
|
|
1898
|
+
assistantHomeroom: "班级助手",
|
|
1899
|
+
taglineStudent: "不直接给答案,带你自己做出来",
|
|
1900
|
+
taglineParent: "看懂孩子错在哪,知道怎么讲",
|
|
1901
|
+
taglineTeacher: "批改、出题、备课、试卷分析",
|
|
1902
|
+
taglineHomeroom: "家长沟通、评语、班会、通知",
|
|
1903
|
+
due: "{count} 道错题今天该复习",
|
|
1904
|
+
locked: "小学生需要家长或老师开启",
|
|
1905
|
+
primary: "小学",
|
|
1906
|
+
junior: "初中",
|
|
1907
|
+
senior: "高中",
|
|
1908
|
+
explain: { label: "拍题讲解", text: "这道题我不会,先别告诉我答案,带我一步步想:" },
|
|
1909
|
+
quizMe: { label: "考考我", text: "按我最近学的内容出几道题考考我" },
|
|
1910
|
+
review: { label: "复习错题", text: "复习今天该复习的 {count} 道错题" },
|
|
1911
|
+
recite: { label: "背诵默写", text: "帮我背这一段,先让我自己背,再告诉我哪里错了:" },
|
|
1912
|
+
check: { label: "看作业对错", text: "帮我看看孩子这份作业哪里错了,告诉我怎么讲给孩子听:" },
|
|
1913
|
+
talk: { label: "怎么跟孩子讲", text: "孩子遇到这个情况,我该怎么跟他说:" },
|
|
1914
|
+
toTeacher: { label: "给老师写消息", text: "帮我写一段给老师的话,说清楚、有分寸:" },
|
|
1915
|
+
plan: { label: "安排学习计划", text: "帮孩子安排这周的学习计划,情况是:" },
|
|
1916
|
+
grade: { label: "批改作业", text: "批改这些作业(照片在下面),逐题判对错,归类错因,最后给讲评提纲:" },
|
|
1917
|
+
makeQuiz: { label: "出一套题", text: "出一套题,分基础、提升、拓展三层,主题是:" },
|
|
1918
|
+
lesson: { label: "写教学设计", text: "写一份教学设计,课题是:" },
|
|
1919
|
+
exam: { label: "试卷分析", text: "分析这份成绩表(文件在下面),找出共性薄弱点和需要关注的学生:" },
|
|
1920
|
+
weekly: { label: "每周学情小结", text: "每周五下午 4 点,读本目录里这一周的成绩和作业记录,写一份学情小结给我" },
|
|
1921
|
+
reply: { label: "回家长消息", text: `家长发来:
|
|
1922
|
+
|
|
1923
|
+
帮我拟一段回复,我看过再发:` },
|
|
1924
|
+
comments: { label: "写评语", text: `按下面每个学生的表现写评语,不写套话:
|
|
1925
|
+
` },
|
|
1926
|
+
meeting: { label: "班会方案", text: "设计一次班会,主题是:" },
|
|
1927
|
+
notice: { label: "写通知", text: "写一则给家长的通知,内容是:" },
|
|
1928
|
+
settingsTitle: "教育",
|
|
1929
|
+
identitiesLabel: "身份",
|
|
1930
|
+
identitiesHint: "选了哪个,列表里就有对应的助手",
|
|
1931
|
+
stageLabel: "学段",
|
|
1932
|
+
subjectLabel: "学科",
|
|
1933
|
+
subjectHint: "如 数学、英语",
|
|
1934
|
+
textbookLabel: "教材版本",
|
|
1935
|
+
textbookHint: "学校用的教材版本",
|
|
1936
|
+
consentLabel: "小学段使用学习伙伴",
|
|
1937
|
+
consentHint: "由家长在他自己的 Ta 里同意,这里改不了",
|
|
1938
|
+
quiz: "练习",
|
|
1939
|
+
submit: "提交",
|
|
1940
|
+
right: "答对了",
|
|
1941
|
+
wrongAnswer: "正确答案:{answer}",
|
|
1942
|
+
score: "答对 {right}/{total}",
|
|
1943
|
+
explainWrong: "讲讲我错的",
|
|
1944
|
+
explainWrongText: "讲讲这几道我做错的题",
|
|
1945
|
+
judgeTrue: "对",
|
|
1946
|
+
judgeFalse: "错",
|
|
1947
|
+
blank: "写下答案",
|
|
1948
|
+
revealAnswer: "答案:{answer}",
|
|
1949
|
+
learning: "学情",
|
|
1950
|
+
weak: "薄弱点",
|
|
1951
|
+
next: "接下来"
|
|
1634
1952
|
};
|
|
1635
|
-
var
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1953
|
+
var ZH_TW2 = {
|
|
1954
|
+
student: "學生",
|
|
1955
|
+
parent: "家長",
|
|
1956
|
+
teacher: "老師",
|
|
1957
|
+
homeroom: "班導師",
|
|
1958
|
+
assistantStudent: "學習夥伴",
|
|
1959
|
+
assistantParent: "輔導助手",
|
|
1960
|
+
assistantTeacher: "教學助手",
|
|
1961
|
+
assistantHomeroom: "班級助手",
|
|
1962
|
+
taglineStudent: "不直接給答案,帶你自己做出來",
|
|
1963
|
+
taglineParent: "看懂孩子錯在哪,知道怎麼講",
|
|
1964
|
+
taglineTeacher: "批改、出題、備課、試卷分析",
|
|
1965
|
+
taglineHomeroom: "家長溝通、評語、班會、通知",
|
|
1966
|
+
due: "{count} 道錯題今天該複習",
|
|
1967
|
+
locked: "小學生需要家長或老師開啟",
|
|
1968
|
+
primary: "小學",
|
|
1969
|
+
junior: "國中",
|
|
1970
|
+
senior: "高中",
|
|
1971
|
+
explain: { label: "拍題講解", text: "這道題我不會,先別告訴我答案,帶我一步步想:" },
|
|
1972
|
+
quizMe: { label: "考考我", text: "依我最近學的內容出幾道題考考我" },
|
|
1973
|
+
review: { label: "複習錯題", text: "複習今天該複習的 {count} 道錯題" },
|
|
1974
|
+
recite: { label: "背誦默寫", text: "幫我背這一段,先讓我自己背,再告訴我哪裡錯了:" },
|
|
1975
|
+
check: { label: "看作業對錯", text: "幫我看看孩子這份作業哪裡錯了,告訴我怎麼講給孩子聽:" },
|
|
1976
|
+
talk: { label: "怎麼跟孩子講", text: "孩子遇到這個情況,我該怎麼跟他說:" },
|
|
1977
|
+
toTeacher: { label: "給老師寫訊息", text: "幫我寫一段給老師的話,說清楚、有分寸:" },
|
|
1978
|
+
plan: { label: "安排學習計畫", text: "幫孩子安排這週的學習計畫,情況是:" },
|
|
1979
|
+
grade: { label: "批改作業", text: "批改這些作業(照片在下面),逐題判對錯,歸類錯因,最後給講評提綱:" },
|
|
1980
|
+
makeQuiz: { label: "出一套題", text: "出一套題,分基礎、提升、拓展三層,主題是:" },
|
|
1981
|
+
lesson: { label: "寫教學設計", text: "寫一份教學設計,課題是:" },
|
|
1982
|
+
exam: { label: "試卷分析", text: "分析這份成績表(檔案在下面),找出共同的薄弱點和需要關注的學生:" },
|
|
1983
|
+
weekly: { label: "每週學習小結", text: "每週五下午 4 點,讀本目錄裡這一週的成績和作業紀錄,寫一份學習小結給我" },
|
|
1984
|
+
reply: { label: "回家長訊息", text: `家長傳來:
|
|
1985
|
+
|
|
1986
|
+
幫我擬一段回覆,我看過再傳:` },
|
|
1987
|
+
comments: { label: "寫評語", text: `依下面每個學生的表現寫評語,不寫套話:
|
|
1988
|
+
` },
|
|
1989
|
+
meeting: { label: "班會方案", text: "設計一次班會,主題是:" },
|
|
1990
|
+
notice: { label: "寫通知", text: "寫一則給家長的通知,內容是:" },
|
|
1991
|
+
settingsTitle: "教育",
|
|
1992
|
+
identitiesLabel: "身分",
|
|
1993
|
+
identitiesHint: "選了哪個,列表裡就有對應的助手",
|
|
1994
|
+
stageLabel: "學段",
|
|
1995
|
+
subjectLabel: "學科",
|
|
1996
|
+
subjectHint: "如 數學、英語",
|
|
1997
|
+
textbookLabel: "教材版本",
|
|
1998
|
+
textbookHint: "學校用的教材版本",
|
|
1999
|
+
consentLabel: "小學階段使用學習夥伴",
|
|
2000
|
+
consentHint: "由家長在他自己的 Ta 裡同意,這裡改不了",
|
|
2001
|
+
quiz: "練習",
|
|
2002
|
+
submit: "送出",
|
|
2003
|
+
right: "答對了",
|
|
2004
|
+
wrongAnswer: "正確答案:{answer}",
|
|
2005
|
+
score: "答對 {right}/{total}",
|
|
2006
|
+
explainWrong: "講講我錯的",
|
|
2007
|
+
explainWrongText: "講講這幾道我做錯的題",
|
|
2008
|
+
judgeTrue: "對",
|
|
2009
|
+
judgeFalse: "錯",
|
|
2010
|
+
blank: "寫下答案",
|
|
2011
|
+
revealAnswer: "答案:{answer}",
|
|
2012
|
+
learning: "學習情況",
|
|
2013
|
+
weak: "薄弱點",
|
|
2014
|
+
next: "接下來"
|
|
2015
|
+
};
|
|
2016
|
+
var JA2 = {
|
|
2017
|
+
student: "生徒",
|
|
2018
|
+
parent: "保護者",
|
|
2019
|
+
teacher: "先生",
|
|
2020
|
+
homeroom: "担任",
|
|
2021
|
+
assistantStudent: "学習パートナー",
|
|
2022
|
+
assistantParent: "家庭学習サポート",
|
|
2023
|
+
assistantTeacher: "授業アシスタント",
|
|
2024
|
+
assistantHomeroom: "クラスアシスタント",
|
|
2025
|
+
taglineStudent: "答えを教えず、自分で解けるまで一緒に考えます",
|
|
2026
|
+
taglineParent: "どこで間違えたか、どう伝えればいいかが分かります",
|
|
2027
|
+
taglineTeacher: "採点、出題、授業準備、テスト分析",
|
|
2028
|
+
taglineHomeroom: "保護者対応、所見、学級活動、お知らせ",
|
|
2029
|
+
due: "今日復習する間違いが {count} 問",
|
|
2030
|
+
locked: "小学生は保護者か先生がオンにします",
|
|
2031
|
+
primary: "小学校",
|
|
2032
|
+
junior: "中学校",
|
|
2033
|
+
senior: "高校",
|
|
2034
|
+
explain: { label: "問題を解説", text: "この問題が分かりません。答えはまだ言わずに、一歩ずつ考えさせてください:" },
|
|
2035
|
+
quizMe: { label: "問題を出して", text: "最近習ったところから何問か出してください" },
|
|
2036
|
+
review: { label: "間違いを復習", text: "今日復習する {count} 問の間違いを復習する" },
|
|
2037
|
+
recite: { label: "暗記・暗唱", text: "この部分を覚えたいです。まず自分で言ってみるので、違うところを教えてください:" },
|
|
2038
|
+
check: { label: "宿題を確認", text: "子どもの宿題のどこが間違っているか、どう説明すればいいか教えてください:" },
|
|
2039
|
+
talk: { label: "どう話すか", text: "子どもがこういう状況です。どう話せばいいでしょうか:" },
|
|
2040
|
+
toTeacher: { label: "先生への連絡", text: "先生への連絡を、分かりやすく失礼のないように書いてください:" },
|
|
2041
|
+
plan: { label: "学習計画", text: "子どもの今週の学習計画を立ててください。状況は:" },
|
|
2042
|
+
grade: { label: "宿題を採点", text: "この宿題(写真は下)を採点してください。一問ずつ正誤、間違いの原因の分類、最後に解説授業の要点を:" },
|
|
2043
|
+
makeQuiz: { label: "問題を作る", text: "基礎・応用・発展の三段階で問題を作ってください。テーマは:" },
|
|
2044
|
+
lesson: { label: "指導案", text: "指導案を書いてください。単元は:" },
|
|
2045
|
+
exam: { label: "テスト分析", text: "この成績表(ファイルは下)を分析して、クラス共通の弱点と気にかけるべき生徒を挙げてください:" },
|
|
2046
|
+
weekly: { label: "毎週のまとめ", text: "毎週金曜の午後 4 時に、このフォルダの今週の成績と宿題の記録を読んで、学習状況のまとめを書いてください" },
|
|
2047
|
+
reply: { label: "保護者に返信", text: `保護者からの連絡:
|
|
2048
|
+
|
|
2049
|
+
返信の下書きをお願いします。読んでから送ります:` },
|
|
2050
|
+
comments: { label: "所見を書く", text: `下の各生徒の様子をもとに、決まり文句なしで所見を書いてください:
|
|
2051
|
+
` },
|
|
2052
|
+
meeting: { label: "学級活動", text: "学級活動の案を作ってください。テーマは:" },
|
|
2053
|
+
notice: { label: "お知らせ", text: "保護者へのお知らせを書いてください。内容は:" },
|
|
2054
|
+
settingsTitle: "教育",
|
|
2055
|
+
identitiesLabel: "あなたの立場",
|
|
2056
|
+
identitiesHint: "選んだ立場ごとに、リストにアシスタントが出ます",
|
|
2057
|
+
stageLabel: "学校段階",
|
|
2058
|
+
subjectLabel: "教科",
|
|
2059
|
+
subjectHint: "例:数学、英語",
|
|
2060
|
+
textbookLabel: "教科書",
|
|
2061
|
+
textbookHint: "学校で使っている教科書",
|
|
2062
|
+
consentLabel: "小学生の学習パートナー",
|
|
2063
|
+
consentHint: "保護者が自分の Ta で同意します。ここでは変えられません",
|
|
2064
|
+
quiz: "練習",
|
|
2065
|
+
submit: "答え合わせ",
|
|
2066
|
+
right: "正解",
|
|
2067
|
+
wrongAnswer: "正解:{answer}",
|
|
2068
|
+
score: "{total} 問中 {right} 問正解",
|
|
2069
|
+
explainWrong: "間違いを解説",
|
|
2070
|
+
explainWrongText: "間違えた問題を解説して",
|
|
2071
|
+
judgeTrue: "正しい",
|
|
2072
|
+
judgeFalse: "誤り",
|
|
2073
|
+
blank: "答えを書く",
|
|
2074
|
+
revealAnswer: "答え:{answer}",
|
|
2075
|
+
learning: "学習状況",
|
|
2076
|
+
weak: "弱点",
|
|
2077
|
+
next: "次に"
|
|
2078
|
+
};
|
|
2079
|
+
var WORDS = { "zh-CN": ZH2, "zh-TW": ZH_TW2, "en-US": EN2, "ja-JP": JA2 };
|
|
2080
|
+
var EduWords;
|
|
2081
|
+
((EduWords) => {
|
|
1639
2082
|
function of(language) {
|
|
1640
|
-
return TaLanguageUtil.pick(language,
|
|
2083
|
+
return TaLanguageUtil.pick(language, WORDS);
|
|
2084
|
+
}
|
|
2085
|
+
EduWords.of = of;
|
|
2086
|
+
function format(text, values) {
|
|
2087
|
+
return text.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
|
|
2088
|
+
}
|
|
2089
|
+
EduWords.format = format;
|
|
2090
|
+
})(EduWords ||= {});
|
|
2091
|
+
|
|
2092
|
+
// web-src/edu-chats.ts
|
|
2093
|
+
var EduChats;
|
|
2094
|
+
((EduChats) => {
|
|
2095
|
+
function identityOf(store, sessionFile) {
|
|
2096
|
+
const { chats } = store.state;
|
|
2097
|
+
return sessionFile ? Object.keys(chats).find((one) => chats[one] === sessionFile) : undefined;
|
|
2098
|
+
}
|
|
2099
|
+
EduChats.identityOf = identityOf;
|
|
2100
|
+
async function open(pi, store, identity) {
|
|
2101
|
+
const words = EduWords.of(pi.ui.language);
|
|
2102
|
+
const { settings, chats, consent } = store.state;
|
|
2103
|
+
if (EduUtil.locked(settings, identity, consent)) {
|
|
2104
|
+
pi.ui.notify(HomeWordsUtil.of(pi.ui.language).consentLocked, "warning");
|
|
2105
|
+
await pi.ui.showView(PAGE);
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
const role = EduRoles.prompt(identity, store.state.settings);
|
|
2109
|
+
const title = words[ROLES[identity].assistant];
|
|
2110
|
+
const file = chats[identity];
|
|
2111
|
+
if (file) {
|
|
2112
|
+
const open2 = (await pi.server.listSessions()).find((session) => session.sessionFile === file);
|
|
2113
|
+
if (open2) {
|
|
2114
|
+
await pi.switchSession(open2.sessionId);
|
|
2115
|
+
pi.ui.showView("");
|
|
2116
|
+
return open2.sessionId;
|
|
2117
|
+
}
|
|
2118
|
+
const saved = (await pi.server.listSavedSessions()).find((session) => session.sessionFile === file);
|
|
2119
|
+
if (saved) {
|
|
2120
|
+
const opened2 = pi.server.openSession({ cwd: saved.cwd, sessionFile: file, group: NAME, appendSystemPrompt: role });
|
|
2121
|
+
const id2 = opened2.then((session) => session.sessionId);
|
|
2122
|
+
await pi.switchSession(id2, { title, cwd: saved.cwd, sessionFile: file });
|
|
2123
|
+
pi.ui.showView("");
|
|
2124
|
+
return id2;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
const { cwd } = await pi.server.getServerInfo();
|
|
2128
|
+
const opened = pi.server.openSession({ cwd, group: NAME, appendSystemPrompt: role });
|
|
2129
|
+
const named = opened.then(async (session) => {
|
|
2130
|
+
if (session.sessionFile) {
|
|
2131
|
+
await store.setChat(identity, session.sessionFile);
|
|
2132
|
+
}
|
|
2133
|
+
await pi.server.setSessionName(session.sessionId, title);
|
|
2134
|
+
});
|
|
2135
|
+
const id = opened.then((session) => session.sessionId);
|
|
2136
|
+
await pi.switchSession(id, { title, cwd });
|
|
2137
|
+
pi.ui.showView("");
|
|
2138
|
+
await named;
|
|
2139
|
+
return id;
|
|
2140
|
+
}
|
|
2141
|
+
EduChats.open = open;
|
|
2142
|
+
async function say(pi, store, identity, message, images) {
|
|
2143
|
+
const id = await open(pi, store, identity);
|
|
2144
|
+
if (id) {
|
|
2145
|
+
await send(pi, id, message, images);
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
EduChats.say = say;
|
|
2149
|
+
async function send(pi, sessionId, message, images) {
|
|
2150
|
+
await pi.server.prompt(sessionId, { message, ...images?.length ? { images } : {}, clientMessageId: crypto.randomUUID() });
|
|
2151
|
+
}
|
|
2152
|
+
EduChats.send = send;
|
|
2153
|
+
})(EduChats ||= {});
|
|
2154
|
+
var EduPhotos;
|
|
2155
|
+
((EduPhotos) => {
|
|
2156
|
+
function pick() {
|
|
2157
|
+
return new Promise((resolve) => {
|
|
2158
|
+
const input = document.createElement("input");
|
|
2159
|
+
input.type = "file";
|
|
2160
|
+
input.accept = "image/*";
|
|
2161
|
+
input.multiple = true;
|
|
2162
|
+
input.style.display = "none";
|
|
2163
|
+
input.addEventListener("change", () => {
|
|
2164
|
+
const files = [...input.files ?? []].slice(0, 6);
|
|
2165
|
+
input.remove();
|
|
2166
|
+
Promise.all(files.map(shrink)).then(resolve, () => resolve([]));
|
|
2167
|
+
});
|
|
2168
|
+
input.addEventListener("cancel", () => {
|
|
2169
|
+
input.remove();
|
|
2170
|
+
resolve([]);
|
|
2171
|
+
});
|
|
2172
|
+
document.body.appendChild(input);
|
|
2173
|
+
input.click();
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
EduPhotos.pick = pick;
|
|
2177
|
+
async function shrink(file) {
|
|
2178
|
+
const bitmap = await createImageBitmap(file);
|
|
2179
|
+
const scale = Math.min(1, 1600 / Math.max(bitmap.width, bitmap.height));
|
|
2180
|
+
const canvas = document.createElement("canvas");
|
|
2181
|
+
canvas.width = Math.round(bitmap.width * scale);
|
|
2182
|
+
canvas.height = Math.round(bitmap.height * scale);
|
|
2183
|
+
canvas.getContext("2d")?.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
|
|
2184
|
+
bitmap.close();
|
|
2185
|
+
const url = canvas.toDataURL("image/jpeg", 0.85);
|
|
2186
|
+
return { type: "image", data: url.slice(url.indexOf(",") + 1), mimeType: "image/jpeg" };
|
|
2187
|
+
}
|
|
2188
|
+
function upload(pi, accept) {
|
|
2189
|
+
return new Promise((resolve) => {
|
|
2190
|
+
const input = document.createElement("input");
|
|
2191
|
+
input.type = "file";
|
|
2192
|
+
input.accept = accept;
|
|
2193
|
+
input.style.display = "none";
|
|
2194
|
+
input.addEventListener("change", () => {
|
|
2195
|
+
const file = input.files?.[0];
|
|
2196
|
+
input.remove();
|
|
2197
|
+
if (!file) {
|
|
2198
|
+
resolve(undefined);
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
const reader = new FileReader;
|
|
2202
|
+
reader.onload = () => {
|
|
2203
|
+
const url = String(reader.result);
|
|
2204
|
+
const path = `edu/${file.name.replace(/[\\/]/g, "_")}`;
|
|
2205
|
+
pi.workspace.uploadFile(path, url.slice(url.indexOf(",") + 1)).then(() => resolve(path), () => resolve(undefined));
|
|
2206
|
+
};
|
|
2207
|
+
reader.onerror = () => resolve(undefined);
|
|
2208
|
+
reader.readAsDataURL(file);
|
|
2209
|
+
});
|
|
2210
|
+
input.addEventListener("cancel", () => {
|
|
2211
|
+
input.remove();
|
|
2212
|
+
resolve(undefined);
|
|
2213
|
+
});
|
|
2214
|
+
document.body.appendChild(input);
|
|
2215
|
+
input.click();
|
|
2216
|
+
});
|
|
1641
2217
|
}
|
|
1642
|
-
|
|
1643
|
-
})(
|
|
2218
|
+
EduPhotos.upload = upload;
|
|
2219
|
+
})(EduPhotos ||= {});
|
|
1644
2220
|
|
|
1645
2221
|
// web-src/react.ts
|
|
1646
2222
|
var React;
|
|
@@ -1824,11 +2400,17 @@ function ParentHome({ context }) {
|
|
|
1824
2400
|
const home = HomeWordsUtil.of(pi.ui.language);
|
|
1825
2401
|
const reports = useAsync(() => rooms.reports(), [version]);
|
|
1826
2402
|
const notices = useAsync(() => rooms.notices(), [version, store.state.settings.classes.join()]);
|
|
2403
|
+
const [answered, setAnswered] = React.useState(0);
|
|
2404
|
+
const asks = useAsync(() => rooms.consentAsks(), [version, answered]);
|
|
1827
2405
|
const [child, setChild] = React.useState();
|
|
1828
2406
|
const children = [...new Map((reports ?? []).map((report2) => [report2.child, report2])).values()];
|
|
1829
2407
|
const report = children.find((one) => one.child === child) ?? children[0];
|
|
1830
2408
|
const Lock = iconOf(pi, "Lock");
|
|
1831
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
2409
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, asks && asks.length > 0 && /* @__PURE__ */ React.createElement(ConsentAsks, {
|
|
2410
|
+
context,
|
|
2411
|
+
asks,
|
|
2412
|
+
answered: () => setAnswered((n) => n + 1)
|
|
2413
|
+
}), children.length > 1 && /* @__PURE__ */ React.createElement("div", {
|
|
1832
2414
|
className: "ted-chips"
|
|
1833
2415
|
}, children.map((one) => /* @__PURE__ */ React.createElement("button", {
|
|
1834
2416
|
key: one.child,
|
|
@@ -1891,6 +2473,48 @@ function ParentHome({ context }) {
|
|
|
1891
2473
|
size: 12
|
|
1892
2474
|
}), home.parentPrivacy));
|
|
1893
2475
|
}
|
|
2476
|
+
function ConsentAsks({ context, asks, answered }) {
|
|
2477
|
+
const { pi, rooms } = context;
|
|
2478
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2479
|
+
const [busy, setBusy] = React.useState();
|
|
2480
|
+
const say = (ask2, yes) => {
|
|
2481
|
+
setBusy(ask2.child);
|
|
2482
|
+
rooms.answerConsent(ask2, yes, home).then(answered, failed(pi, home)).finally(() => setBusy(undefined));
|
|
2483
|
+
};
|
|
2484
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2485
|
+
className: "ted-consent-asks"
|
|
2486
|
+
}, /* @__PURE__ */ React.createElement(Section, {
|
|
2487
|
+
title: home.consentAsks
|
|
2488
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2489
|
+
className: "ted-panel ted-list"
|
|
2490
|
+
}, asks.map((ask2) => /* @__PURE__ */ React.createElement("div", {
|
|
2491
|
+
key: ask2.child,
|
|
2492
|
+
className: "ted-consent-ask"
|
|
2493
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2494
|
+
className: "ted-row ted-row-static"
|
|
2495
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Face, {
|
|
2496
|
+
seed: ask2.child,
|
|
2497
|
+
size: 36
|
|
2498
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2499
|
+
className: "ted-row-main"
|
|
2500
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2501
|
+
className: "ted-row-title"
|
|
2502
|
+
}, format(home.consentAskTitle, { name: ask2.name })), /* @__PURE__ */ React.createElement("span", {
|
|
2503
|
+
className: "ted-row-sub ted-wrap"
|
|
2504
|
+
}, home.consentAskBody))), /* @__PURE__ */ React.createElement("div", {
|
|
2505
|
+
className: "ted-consent-acts"
|
|
2506
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2507
|
+
type: "button",
|
|
2508
|
+
className: "ta-button ted-pill",
|
|
2509
|
+
disabled: busy === ask2.child,
|
|
2510
|
+
onClick: () => say(ask2, false)
|
|
2511
|
+
}, home.consentNo), /* @__PURE__ */ React.createElement("button", {
|
|
2512
|
+
type: "button",
|
|
2513
|
+
className: "ta-button ta-primary ted-pill",
|
|
2514
|
+
disabled: busy === ask2.child,
|
|
2515
|
+
onClick: () => say(ask2, true)
|
|
2516
|
+
}, home.consentYes)))))));
|
|
2517
|
+
}
|
|
1894
2518
|
function ReportCard({ context, report }) {
|
|
1895
2519
|
const { pi, store } = context;
|
|
1896
2520
|
const home = HomeWordsUtil.of(pi.ui.language);
|
|
@@ -2114,9 +2738,16 @@ function Question(props) {
|
|
|
2114
2738
|
className: "ted-q-text"
|
|
2115
2739
|
}, /* @__PURE__ */ React.createElement(Markdown, {
|
|
2116
2740
|
text: question.q
|
|
2117
|
-
}))), question.
|
|
2741
|
+
}))), question.figure && /* @__PURE__ */ React.createElement("div", {
|
|
2742
|
+
className: "ted-figure"
|
|
2743
|
+
}, /* @__PURE__ */ React.createElement(Markdown, {
|
|
2744
|
+
text: question.figure
|
|
2745
|
+
})), question.kind === "choice" && /* @__PURE__ */ React.createElement("div", {
|
|
2118
2746
|
className: "ted-options"
|
|
2119
|
-
}, question.options.map((option, at) => choice(String(at), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("b", null, EduUtil.letter(at)), /* @__PURE__ */ React.createElement(
|
|
2747
|
+
}, question.options.map((option, at) => choice(String(at), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("b", null, EduUtil.letter(at)), /* @__PURE__ */ React.createElement(Markdown, {
|
|
2748
|
+
inline: true,
|
|
2749
|
+
text: option
|
|
2750
|
+
})), String(at)))), question.kind === "judge" && /* @__PURE__ */ React.createElement("div", {
|
|
2120
2751
|
className: "ted-options ted-judge"
|
|
2121
2752
|
}, choice("true", words.judgeTrue, "true"), choice("false", words.judgeFalse, "false")), question.kind === "blank" && !shown && /* @__PURE__ */ React.createElement("form", {
|
|
2122
2753
|
className: "ted-blank",
|
|
@@ -2130,816 +2761,561 @@ function Question(props) {
|
|
|
2130
2761
|
className: "ta-input",
|
|
2131
2762
|
value: typed,
|
|
2132
2763
|
placeholder: words.blank,
|
|
2133
|
-
onChange: (event) => setTyped(event.target.value)
|
|
2134
|
-
}), /* @__PURE__ */ React.createElement("button", {
|
|
2135
|
-
type: "submit",
|
|
2136
|
-
className: "ta-button",
|
|
2137
|
-
disabled: !typed.trim()
|
|
2138
|
-
}, words.submit)), shown && /* @__PURE__ */ React.createElement("div", {
|
|
2139
|
-
className: "ted-result"
|
|
2140
|
-
}, done && question.kind === "blank" && /* @__PURE__ */ React.createElement("div", {
|
|
2141
|
-
className: "ted-given"
|
|
2142
|
-
}, given), /* @__PURE__ */ React.createElement("div", {
|
|
2143
|
-
className: "ted-verdict"
|
|
2144
|
-
}, done && right ? words.right : EduWords.format(done ? words.wrongAnswer : words.revealAnswer, { answer: EduUtil.answerText(question) })), question.explain && /* @__PURE__ */ React.createElement("div", {
|
|
2145
|
-
className: "ted-explain"
|
|
2146
|
-
}, /* @__PURE__ */ React.createElement(Markdown, {
|
|
2147
|
-
text: question.explain
|
|
2148
|
-
}))));
|
|
2149
|
-
}
|
|
2150
|
-
function quizCard(pi, store, rooms) {
|
|
2151
|
-
return function QuizCard({ code, closed, send }) {
|
|
2152
|
-
const state = useStore2(store);
|
|
2153
|
-
const [, tick] = React.useReducer((n) => n + 1, 0);
|
|
2154
|
-
React.useEffect(() => rooms.subscribe(tick), []);
|
|
2155
|
-
const words = EduWords.of(pi.ui.language);
|
|
2156
|
-
const quiz = closed ? EduUtil.quiz(code) : undefined;
|
|
2157
|
-
if (!closed) {
|
|
2158
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2159
|
-
className: "ted-card"
|
|
2160
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.Loading, {
|
|
2161
|
-
label: words.quiz,
|
|
2162
|
-
compact: true
|
|
2163
|
-
}));
|
|
2164
|
-
}
|
|
2165
|
-
if (!quiz) {
|
|
2166
|
-
throw new Error("Not a quiz");
|
|
2167
|
-
}
|
|
2168
|
-
const card = EduUtil.hash(code);
|
|
2169
|
-
const room = quiz.room ? rooms.rooms.find((one) => one.id === quiz.room) : undefined;
|
|
2170
|
-
const mine = !!room && !!quiz.teacher && rooms.me(room) === quiz.teacher;
|
|
2171
|
-
const reveal = quiz.reveal || mine;
|
|
2172
|
-
const given = state.answers[card] ?? {};
|
|
2173
|
-
const answered = quiz.questions.filter((_, at) => given[at] !== undefined);
|
|
2174
|
-
const wrong = quiz.questions.flatMap((question, at) => given[at] !== undefined && !rightOf(question, given[at]) ? [{ question, at }] : []);
|
|
2175
|
-
const all = answered.length === quiz.questions.length;
|
|
2176
|
-
const explain = () => {
|
|
2177
|
-
const lines = wrong.map(({ question, at }) => JSON.stringify({ no: at + 1, q: question.q, answer: EduUtil.answerText(question), given: givenText(question, given[at]) }));
|
|
2178
|
-
const context = `[${NAME}:mistakes]
|
|
2179
|
-
The questions of the quiz above the user got wrong. Go over why, step by step, and give one more question on each point.
|
|
2180
|
-
${lines.join(`
|
|
2181
|
-
`)}`;
|
|
2182
|
-
(send ?? pi.sendUserMessage)(TaMessageContext.wrap(context, words.explainWrongText));
|
|
2183
|
-
};
|
|
2184
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2185
|
-
className: "ted-card"
|
|
2186
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2187
|
-
className: "ted-head"
|
|
2188
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2189
|
-
className: "ted-mark"
|
|
2190
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.icons.ListChecks, {
|
|
2191
|
-
size: 15
|
|
2192
|
-
})), /* @__PURE__ */ React.createElement("span", {
|
|
2193
|
-
className: "ted-title"
|
|
2194
|
-
}, quiz.title ?? words.quiz), answered.length > 0 && !reveal && /* @__PURE__ */ React.createElement("span", {
|
|
2195
|
-
className: "ted-score"
|
|
2196
|
-
}, EduWords.format(words.score, { right: answered.length - wrong.length, total: quiz.questions.length }))), /* @__PURE__ */ React.createElement("ol", {
|
|
2197
|
-
className: "ted-qs"
|
|
2198
|
-
}, quiz.questions.map((question, at) => /* @__PURE__ */ React.createElement(Question, {
|
|
2199
|
-
key: at,
|
|
2200
|
-
pi,
|
|
2201
|
-
words,
|
|
2202
|
-
question,
|
|
2203
|
-
index: at,
|
|
2204
|
-
given: given[at],
|
|
2205
|
-
reveal,
|
|
2206
|
-
answer: (value) => void store.answer(card, at, question, value, givenText(question, value), rightOf(question, value))
|
|
2207
|
-
}))), mine && room && /* @__PURE__ */ React.createElement(Handed, {
|
|
2208
|
-
pi,
|
|
2209
|
-
rooms,
|
|
2210
|
-
quiz,
|
|
2211
|
-
room
|
|
2212
|
-
}), !mine && quiz.id && all && /* @__PURE__ */ React.createElement(HandIn, {
|
|
2213
|
-
pi,
|
|
2214
|
-
rooms,
|
|
2215
|
-
quiz,
|
|
2216
|
-
name: () => rooms.server?.getIdentity().then((one) => one.name),
|
|
2217
|
-
given
|
|
2218
|
-
}), all && wrong.length > 0 && !reveal && /* @__PURE__ */ React.createElement("div", {
|
|
2219
|
-
className: "ted-foot"
|
|
2220
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
2221
|
-
type: "button",
|
|
2222
|
-
className: "ta-button ta-primary",
|
|
2223
|
-
onClick: explain
|
|
2224
|
-
}, words.explainWrong)), quiz.reveal && !quiz.id && state.settings.identities.includes("teacher") && rooms.server && /* @__PURE__ */ React.createElement(SendToClass, {
|
|
2225
|
-
pi,
|
|
2226
|
-
store,
|
|
2227
|
-
rooms,
|
|
2228
|
-
quiz
|
|
2229
|
-
}));
|
|
2230
|
-
};
|
|
2231
|
-
}
|
|
2232
|
-
function HandIn(props) {
|
|
2233
|
-
const { pi, rooms, quiz, given } = props;
|
|
2234
|
-
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2235
|
-
const [status, setStatus] = React.useState("checking");
|
|
2236
|
-
const handIn = React.useCallback(async () => {
|
|
2237
|
-
setStatus("sending");
|
|
2238
|
-
try {
|
|
2239
|
-
const name = await props.name() ?? "";
|
|
2240
|
-
const submission = {
|
|
2241
|
-
name,
|
|
2242
|
-
given: quiz.questions.map((question, at) => givenText(question, given[at] ?? "")),
|
|
2243
|
-
right: quiz.questions.map((question, at) => given[at] !== undefined && rightOf(question, given[at])),
|
|
2244
|
-
at: Date.now()
|
|
2245
|
-
};
|
|
2246
|
-
const result = await rooms.submit(quiz, submission);
|
|
2247
|
-
setStatus(result === "sent" ? "sent" : result === "no-key" ? "no-key" : "failed");
|
|
2248
|
-
} catch {
|
|
2249
|
-
setStatus("failed");
|
|
2250
|
-
}
|
|
2251
|
-
}, [quiz, given, rooms]);
|
|
2252
|
-
React.useEffect(() => {
|
|
2253
|
-
rooms.submitted(quiz).then((done) => done ? setStatus("sent") : handIn(), () => handIn());
|
|
2254
|
-
}, []);
|
|
2255
|
-
const Check = pi.ui.icons.Check;
|
|
2256
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2257
|
-
className: "ted-foot ted-handin",
|
|
2258
|
-
"data-status": status
|
|
2259
|
-
}, status === "sent" ? /* @__PURE__ */ React.createElement("span", {
|
|
2260
|
-
className: "ted-handed"
|
|
2261
|
-
}, /* @__PURE__ */ React.createElement(Check, {
|
|
2262
|
-
size: 14,
|
|
2263
|
-
strokeWidth: 2.6
|
|
2264
|
-
}), home.handedIn) : status === "checking" || status === "sending" ? /* @__PURE__ */ React.createElement(pi.ui.Loading, {
|
|
2265
|
-
compact: true
|
|
2266
|
-
}) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
2267
|
-
className: "ted-handin-note"
|
|
2268
|
-
}, status === "no-key" ? home.noTeacherKey : ""), /* @__PURE__ */ React.createElement("button", {
|
|
2269
|
-
type: "button",
|
|
2270
|
-
className: "ta-button",
|
|
2271
|
-
onClick: () => void handIn()
|
|
2272
|
-
}, home.handIn)));
|
|
2273
|
-
}
|
|
2274
|
-
function Handed({ pi, rooms, quiz, room }) {
|
|
2275
|
-
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2276
|
-
const [count, setCount] = React.useState();
|
|
2277
|
-
React.useEffect(() => {
|
|
2278
|
-
rooms.server?.getState(room.id, `edu:sub:${quiz.id}:`).then((state) => setCount(Object.keys(state).length), () => {
|
|
2279
|
-
return;
|
|
2280
|
-
});
|
|
2281
|
-
}, [room.id, quiz.id, rooms.version]);
|
|
2282
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2283
|
-
className: "ted-foot ted-handin"
|
|
2284
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2285
|
-
className: "ted-handin-note"
|
|
2286
|
-
}, count === undefined ? "" : EduWords.format(home.handedCount, { count })), /* @__PURE__ */ React.createElement("button", {
|
|
2287
|
-
type: "button",
|
|
2288
|
-
className: "ta-button",
|
|
2289
|
-
onClick: () => void pi.ui.showView(PAGE)
|
|
2290
|
-
}, home.results));
|
|
2291
|
-
}
|
|
2292
|
-
function SendToClass({ pi, store, rooms, quiz }) {
|
|
2293
|
-
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2294
|
-
const [sent, setSent] = React.useState();
|
|
2295
|
-
const [busy, setBusy] = React.useState(false);
|
|
2296
|
-
const context = { pi, store, rooms };
|
|
2297
|
-
const post = async (room) => {
|
|
2298
|
-
setBusy(true);
|
|
2299
|
-
try {
|
|
2300
|
-
const intro = EduWords.format(home.quizIntro, { title: quiz.title ?? EduWords.of(pi.ui.language).quiz, count: quiz.questions.length });
|
|
2301
|
-
await rooms.postQuiz(room, quiz, intro);
|
|
2302
|
-
await store.setSettings({ klass: room.id });
|
|
2303
|
-
setSent(room.title);
|
|
2304
|
-
pi.ui.notify(EduWords.format(home.sentToClass, { klass: room.title }));
|
|
2305
|
-
} catch (error) {
|
|
2306
|
-
pi.ui.notify(EduWords.format(home.failed, { error: error instanceof Error ? error.message : String(error) }), "error");
|
|
2307
|
-
} finally {
|
|
2308
|
-
setBusy(false);
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
const pick = async () => {
|
|
2312
|
-
await rooms.load();
|
|
2313
|
-
const classes = rooms.classes();
|
|
2314
|
-
if (!classes.length) {
|
|
2315
|
-
openClasses(context);
|
|
2316
|
-
return;
|
|
2317
|
-
}
|
|
2318
|
-
if (classes.length === 1) {
|
|
2319
|
-
if (await pi.ui.confirm(home.sendToClass, classes[0].title, { confirmLabel: home.sendToClass })) {
|
|
2320
|
-
await post(classes[0]);
|
|
2321
|
-
}
|
|
2322
|
-
return;
|
|
2323
|
-
}
|
|
2324
|
-
pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2325
|
-
title: home.pickClass,
|
|
2326
|
-
onClose: close
|
|
2327
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2328
|
-
className: "ted-list"
|
|
2329
|
-
}, classes.map((room) => /* @__PURE__ */ React.createElement("button", {
|
|
2330
|
-
key: room.id,
|
|
2331
|
-
type: "button",
|
|
2332
|
-
className: "ted-row",
|
|
2333
|
-
onClick: () => {
|
|
2334
|
-
close();
|
|
2335
|
-
post(room);
|
|
2336
|
-
}
|
|
2337
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2338
|
-
className: "ted-row-main"
|
|
2339
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2340
|
-
className: "ted-row-title"
|
|
2341
|
-
}, room.title)))))));
|
|
2342
|
-
};
|
|
2343
|
-
const Send = pi.ui.icons.Send;
|
|
2344
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2345
|
-
className: "ted-foot ted-handin"
|
|
2346
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2347
|
-
className: "ted-handin-note"
|
|
2348
|
-
}, sent ? EduWords.format(home.sentToClass, { klass: sent }) : ""), /* @__PURE__ */ React.createElement("button", {
|
|
2349
|
-
type: "button",
|
|
2764
|
+
onChange: (event) => setTyped(event.target.value)
|
|
2765
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
2766
|
+
type: "submit",
|
|
2350
2767
|
className: "ta-button",
|
|
2351
|
-
disabled:
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2768
|
+
disabled: !typed.trim()
|
|
2769
|
+
}, words.submit)), shown && /* @__PURE__ */ React.createElement("div", {
|
|
2770
|
+
className: "ted-result"
|
|
2771
|
+
}, done && question.kind === "blank" && /* @__PURE__ */ React.createElement("div", {
|
|
2772
|
+
className: "ted-given"
|
|
2773
|
+
}, /* @__PURE__ */ React.createElement(Markdown, {
|
|
2774
|
+
inline: true,
|
|
2775
|
+
text: given
|
|
2776
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
2777
|
+
className: "ted-verdict"
|
|
2778
|
+
}, done && right ? words.right : /* @__PURE__ */ React.createElement(Markdown, {
|
|
2779
|
+
inline: true,
|
|
2780
|
+
text: EduWords.format(done ? words.wrongAnswer : words.revealAnswer, { answer: EduUtil.answerText(question) })
|
|
2781
|
+
})), question.explain && /* @__PURE__ */ React.createElement("div", {
|
|
2782
|
+
className: "ted-explain"
|
|
2783
|
+
}, /* @__PURE__ */ React.createElement(Markdown, {
|
|
2784
|
+
text: question.explain
|
|
2785
|
+
}))));
|
|
2356
2786
|
}
|
|
2357
|
-
function
|
|
2358
|
-
return function
|
|
2787
|
+
function quizCard(pi, store, rooms) {
|
|
2788
|
+
return function QuizCard({ code, closed, send }) {
|
|
2789
|
+
const state = useStore2(store);
|
|
2790
|
+
const [, tick] = React.useReducer((n) => n + 1, 0);
|
|
2791
|
+
React.useEffect(() => rooms.subscribe(tick), []);
|
|
2359
2792
|
const words = EduWords.of(pi.ui.language);
|
|
2360
|
-
const
|
|
2793
|
+
const quiz = closed ? EduUtil.quiz(code) : undefined;
|
|
2361
2794
|
if (!closed) {
|
|
2362
2795
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2363
2796
|
className: "ted-card"
|
|
2364
2797
|
}, /* @__PURE__ */ React.createElement(pi.ui.Loading, {
|
|
2365
|
-
label: words.
|
|
2798
|
+
label: words.quiz,
|
|
2366
2799
|
compact: true
|
|
2367
2800
|
}));
|
|
2368
2801
|
}
|
|
2369
|
-
if (!
|
|
2370
|
-
throw new Error("Not a
|
|
2802
|
+
if (!quiz) {
|
|
2803
|
+
throw new Error("Not a quiz");
|
|
2371
2804
|
}
|
|
2805
|
+
const card = EduUtil.hash(code);
|
|
2806
|
+
const room = quiz.room ? rooms.rooms.find((one) => one.id === quiz.room) : undefined;
|
|
2807
|
+
const mine = !!room && !!quiz.teacher && rooms.memberOf(room) === quiz.teacher;
|
|
2808
|
+
const reveal = quiz.reveal || mine;
|
|
2809
|
+
const given = state.answers[card] ?? {};
|
|
2810
|
+
const answered = quiz.questions.filter((_, at) => given[at] !== undefined);
|
|
2811
|
+
const wrong = quiz.questions.flatMap((question, at) => given[at] !== undefined && !rightOf(question, given[at]) ? [{ question, at }] : []);
|
|
2812
|
+
const all = answered.length === quiz.questions.length;
|
|
2813
|
+
const explain = () => {
|
|
2814
|
+
const lines = wrong.map(({ question, at }) => JSON.stringify({ no: at + 1, q: question.q, answer: EduUtil.answerText(question), given: givenText(question, given[at]) }));
|
|
2815
|
+
const context = `[${NAME}:mistakes]
|
|
2816
|
+
The questions of the quiz above the user got wrong. Go over why, step by step, and give one more question on each point.
|
|
2817
|
+
${lines.join(`
|
|
2818
|
+
`)}`;
|
|
2819
|
+
(send ?? pi.sendUserMessage)(TaMessageContext.wrap(context, words.explainWrongText));
|
|
2820
|
+
};
|
|
2372
2821
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2373
2822
|
className: "ted-card"
|
|
2374
2823
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2375
2824
|
className: "ted-head"
|
|
2376
2825
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
2377
2826
|
className: "ted-mark"
|
|
2378
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.icons.
|
|
2827
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.icons.ListChecks, {
|
|
2379
2828
|
size: 15
|
|
2380
2829
|
})), /* @__PURE__ */ React.createElement("span", {
|
|
2381
2830
|
className: "ted-title"
|
|
2382
|
-
},
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
className: "ted-
|
|
2387
|
-
},
|
|
2388
|
-
className: "ted-
|
|
2389
|
-
},
|
|
2390
|
-
key:
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
},
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
}, one)))), learning.next.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2413
|
-
className: "ted-part"
|
|
2414
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2415
|
-
className: "ted-part-title"
|
|
2416
|
-
}, words.next), /* @__PURE__ */ React.createElement("div", {
|
|
2417
|
-
className: "ted-next"
|
|
2418
|
-
}, learning.next.map((one) => /* @__PURE__ */ React.createElement("button", {
|
|
2419
|
-
key: one,
|
|
2420
|
-
type: "button",
|
|
2421
|
-
className: "ted-chip",
|
|
2422
|
-
onClick: () => void (send ?? pi.sendUserMessage)(one)
|
|
2423
|
-
}, one)))));
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
// web-src/composer.tsx
|
|
2428
|
-
var TONES2 = { student: "0", parent: "4", teacher: "3", homeroom: "5" };
|
|
2429
|
-
function photoText(identity, pi) {
|
|
2430
|
-
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2431
|
-
return identity === "student" ? home.photoStudent : identity === "parent" ? home.photoParent : home.photoTeacher;
|
|
2432
|
-
}
|
|
2433
|
-
async function run(pi, store, conversation, identity, key) {
|
|
2434
|
-
const words = EduWords.of(pi.ui.language);
|
|
2435
|
-
const action = ROLES[identity].actions.find((one) => one.key === key);
|
|
2436
|
-
if (!action) {
|
|
2437
|
-
return;
|
|
2438
|
-
}
|
|
2439
|
-
const { label, text } = EduRoles.action(words, action.key);
|
|
2440
|
-
if (action.key === "review") {
|
|
2441
|
-
const due = EduUtil.due(store.state.mistakes, Date.now());
|
|
2442
|
-
await EduChats.send(pi, conversation.sessionId, TaMessageContext.wrap(reviewContext(due), EduWords.format(text, { count: due.length })));
|
|
2443
|
-
return;
|
|
2444
|
-
}
|
|
2445
|
-
if (action.icon === "Image") {
|
|
2446
|
-
const images = await EduPhotos.pick();
|
|
2447
|
-
if (images.length) {
|
|
2448
|
-
await EduChats.send(pi, conversation.sessionId, photoText(identity, pi), images);
|
|
2449
|
-
}
|
|
2450
|
-
return;
|
|
2451
|
-
}
|
|
2452
|
-
const message = action.send ? text : await pi.ui.editor(label, text);
|
|
2453
|
-
if (message?.trim()) {
|
|
2454
|
-
await EduChats.send(pi, conversation.sessionId, message.trim());
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
function Empty({ pi, store, conversation, identity }) {
|
|
2458
|
-
useStore(store);
|
|
2459
|
-
const words = EduWords.of(pi.ui.language);
|
|
2460
|
-
const role = ROLES[identity];
|
|
2461
|
-
const Icon = iconOf(pi, role.icon);
|
|
2462
|
-
const due = EduUtil.due(store.state.mistakes, Date.now()).length;
|
|
2463
|
-
const actions = role.actions.filter((action) => action.key !== "review" || due > 0).slice(0, 4);
|
|
2464
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2465
|
-
className: "ted-hero"
|
|
2466
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2467
|
-
className: "ted-hero-face",
|
|
2468
|
-
style: tone(TONES2[identity])
|
|
2469
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
2470
|
-
size: 30,
|
|
2471
|
-
strokeWidth: 1.8
|
|
2472
|
-
})), /* @__PURE__ */ React.createElement("h1", {
|
|
2473
|
-
className: "ted-hero-title"
|
|
2474
|
-
}, words[role.assistant]), /* @__PURE__ */ React.createElement("p", {
|
|
2475
|
-
className: "ted-hero-hint"
|
|
2476
|
-
}, words[role.tagline]), /* @__PURE__ */ React.createElement("div", {
|
|
2477
|
-
className: "ted-hero-starts"
|
|
2478
|
-
}, actions.map((action) => {
|
|
2479
|
-
const { label } = EduRoles.action(words, action.key);
|
|
2480
|
-
const ActionIcon = iconOf(pi, action.icon === "Image" ? "Camera" : action.icon, action.icon);
|
|
2481
|
-
return /* @__PURE__ */ React.createElement("button", {
|
|
2482
|
-
key: action.key,
|
|
2483
|
-
type: "button",
|
|
2484
|
-
className: "ted-start",
|
|
2485
|
-
onClick: () => void run(pi, store, conversation, identity, action.key)
|
|
2486
|
-
}, /* @__PURE__ */ React.createElement(ActionIcon, {
|
|
2487
|
-
size: 16,
|
|
2488
|
-
strokeWidth: 1.9
|
|
2489
|
-
}), /* @__PURE__ */ React.createElement("span", null, action.key === "review" ? `${label} · ${due}` : label));
|
|
2490
|
-
})));
|
|
2491
|
-
}
|
|
2492
|
-
function Chips({ pi, conversation }) {
|
|
2493
|
-
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2494
|
-
const chips = [
|
|
2495
|
-
{
|
|
2496
|
-
key: "photo",
|
|
2497
|
-
label: home.chipPhoto,
|
|
2498
|
-
icon: "Camera",
|
|
2499
|
-
fallback: "Image",
|
|
2500
|
-
run: async () => {
|
|
2501
|
-
const images = await EduPhotos.pick();
|
|
2502
|
-
if (images.length) {
|
|
2503
|
-
await EduChats.send(pi, conversation.sessionId, home.photoStudent, images);
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
},
|
|
2507
|
-
{ key: "hint", label: home.chipHint, icon: "Lightbulb", run: () => EduChats.send(pi, conversation.sessionId, home.chipHintText) },
|
|
2508
|
-
{
|
|
2509
|
-
key: "again",
|
|
2510
|
-
label: home.chipAgain,
|
|
2511
|
-
icon: "Shuffle",
|
|
2512
|
-
fallback: "RotateCcw",
|
|
2513
|
-
run: () => EduChats.send(pi, conversation.sessionId, home.chipAgainText)
|
|
2514
|
-
},
|
|
2515
|
-
{ key: "got", label: home.chipGot, icon: "Check", run: () => EduChats.send(pi, conversation.sessionId, home.chipGotText) }
|
|
2516
|
-
];
|
|
2517
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2518
|
-
className: "ted-chiprow"
|
|
2519
|
-
}, chips.map((chip) => {
|
|
2520
|
-
const Icon = chip.key === "photo" ? iconOf(pi, chip.icon, chip.fallback) : undefined;
|
|
2521
|
-
return /* @__PURE__ */ React.createElement("button", {
|
|
2522
|
-
key: chip.key,
|
|
2831
|
+
}, quiz.title ? /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2832
|
+
inline: true,
|
|
2833
|
+
text: quiz.title
|
|
2834
|
+
}) : words.quiz), answered.length > 0 && !reveal && /* @__PURE__ */ React.createElement("span", {
|
|
2835
|
+
className: "ted-score"
|
|
2836
|
+
}, EduWords.format(words.score, { right: answered.length - wrong.length, total: quiz.questions.length }))), /* @__PURE__ */ React.createElement("ol", {
|
|
2837
|
+
className: "ted-qs"
|
|
2838
|
+
}, quiz.questions.map((question, at) => /* @__PURE__ */ React.createElement(Question, {
|
|
2839
|
+
key: at,
|
|
2840
|
+
pi,
|
|
2841
|
+
words,
|
|
2842
|
+
question,
|
|
2843
|
+
index: at,
|
|
2844
|
+
given: given[at],
|
|
2845
|
+
reveal,
|
|
2846
|
+
answer: (value) => void store.answer(card, at, question, value, givenText(question, value), rightOf(question, value))
|
|
2847
|
+
}))), mine && room && /* @__PURE__ */ React.createElement(Handed, {
|
|
2848
|
+
pi,
|
|
2849
|
+
rooms,
|
|
2850
|
+
quiz,
|
|
2851
|
+
room
|
|
2852
|
+
}), !mine && quiz.id && all && /* @__PURE__ */ React.createElement(HandIn, {
|
|
2853
|
+
pi,
|
|
2854
|
+
rooms,
|
|
2855
|
+
quiz,
|
|
2856
|
+
name: () => rooms.server?.getIdentity().then((one) => one.name),
|
|
2857
|
+
given
|
|
2858
|
+
}), all && wrong.length > 0 && !reveal && /* @__PURE__ */ React.createElement("div", {
|
|
2859
|
+
className: "ted-foot"
|
|
2860
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2523
2861
|
type: "button",
|
|
2524
|
-
className: "
|
|
2525
|
-
onClick:
|
|
2526
|
-
|
|
2527
|
-
})
|
|
2528
|
-
}, Icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
2529
|
-
size: 14,
|
|
2530
|
-
strokeWidth: 2
|
|
2531
|
-
}), chip.label);
|
|
2532
|
-
}));
|
|
2533
|
-
}
|
|
2534
|
-
function eduComposer(pi, store) {
|
|
2535
|
-
const identityOf = (conversation) => conversation.group === NAME ? EduChats.identityOf(store, conversation.sessionFile) : undefined;
|
|
2536
|
-
return {
|
|
2537
|
-
actions: (conversation) => {
|
|
2538
|
-
const identity = identityOf(conversation);
|
|
2539
|
-
if (!identity) {
|
|
2540
|
-
return [];
|
|
2541
|
-
}
|
|
2542
|
-
const words = EduWords.of(pi.ui.language);
|
|
2543
|
-
const due = EduUtil.due(store.state.mistakes, Date.now()).length;
|
|
2544
|
-
return ROLES[identity].actions.map((action) => {
|
|
2545
|
-
const { label, text } = EduRoles.action(words, action.key);
|
|
2546
|
-
const icon = pi.ui.icons[action.icon];
|
|
2547
|
-
if (action.key === "review") {
|
|
2548
|
-
return {
|
|
2549
|
-
key: action.key,
|
|
2550
|
-
label,
|
|
2551
|
-
icon,
|
|
2552
|
-
detail: due ? String(due) : undefined,
|
|
2553
|
-
disabled: due === 0,
|
|
2554
|
-
run: () => void run(pi, store, conversation, identity, action.key)
|
|
2555
|
-
};
|
|
2556
|
-
}
|
|
2557
|
-
return action.send || action.icon === "Image" ? { key: action.key, label, icon, run: () => void run(pi, store, conversation, identity, action.key) } : { key: action.key, label, icon, insert: text };
|
|
2558
|
-
});
|
|
2559
|
-
},
|
|
2560
|
-
subscribe: (listener) => store.subscribe(listener),
|
|
2561
|
-
above: ({ conversation }) => identityOf(conversation) === "student" ? /* @__PURE__ */ React.createElement(Chips, {
|
|
2862
|
+
className: "ta-button ta-primary",
|
|
2863
|
+
onClick: explain
|
|
2864
|
+
}, words.explainWrong)), quiz.reveal && !quiz.id && state.settings.identities.includes("teacher") && rooms.server && /* @__PURE__ */ React.createElement(SendToClass, {
|
|
2562
2865
|
pi,
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
return identity ? /* @__PURE__ */ React.createElement(Empty, {
|
|
2568
|
-
pi,
|
|
2569
|
-
store,
|
|
2570
|
-
conversation,
|
|
2571
|
-
identity
|
|
2572
|
-
}) : undefined;
|
|
2573
|
-
}
|
|
2866
|
+
store,
|
|
2867
|
+
rooms,
|
|
2868
|
+
quiz
|
|
2869
|
+
}));
|
|
2574
2870
|
};
|
|
2575
2871
|
}
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
((
|
|
2581
|
-
|
|
2582
|
-
const week = EduUtil.lastWeek(days, now);
|
|
2583
|
-
const books = EduUtil.books(mistakes, now, words.otherSubject);
|
|
2584
|
-
const format2 = (text, values) => text.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
|
|
2585
|
-
return {
|
|
2586
|
-
title: format2(words.reportTitle, { name }),
|
|
2587
|
-
stats: [
|
|
2588
|
-
{ label: words.statQuestions, value: String(week.n) },
|
|
2589
|
-
{ label: words.statRight, value: week.n ? `${Math.round(week.right / week.n * 100)}%` : "—" },
|
|
2590
|
-
{ label: words.statDays, value: String(week.days) }
|
|
2591
|
-
],
|
|
2592
|
-
items: books.slice(0, 5).map((book) => ({ label: book.subject, value: book.progress, note: format2(words.reportNote, { count: book.mistakes.length }) })),
|
|
2593
|
-
weak: EduUtil.weak(mistakes),
|
|
2594
|
-
next: [],
|
|
2595
|
-
report: true
|
|
2596
|
-
};
|
|
2597
|
-
}
|
|
2598
|
-
EduReport.of = of;
|
|
2599
|
-
function due(reportTo, reportAt, now) {
|
|
2600
|
-
return !!reportTo && (!reportAt || now - reportAt >= WEEK);
|
|
2601
|
-
}
|
|
2602
|
-
EduReport.due = due;
|
|
2603
|
-
})(EduReport ||= {});
|
|
2604
|
-
|
|
2605
|
-
// web-src/edu-seal.ts
|
|
2606
|
-
var CURVE = { name: "ECDH", namedCurve: "P-256" };
|
|
2607
|
-
function base64(bytes) {
|
|
2608
|
-
let text = "";
|
|
2609
|
-
for (const byte of new Uint8Array(bytes)) {
|
|
2610
|
-
text += String.fromCharCode(byte);
|
|
2611
|
-
}
|
|
2612
|
-
return btoa(text);
|
|
2613
|
-
}
|
|
2614
|
-
function bytes(text) {
|
|
2615
|
-
const binary = atob(text);
|
|
2616
|
-
const out = new Uint8Array(binary.length);
|
|
2617
|
-
for (let i = 0;i < binary.length; i++) {
|
|
2618
|
-
out[i] = binary.charCodeAt(i);
|
|
2619
|
-
}
|
|
2620
|
-
return out;
|
|
2621
|
-
}
|
|
2622
|
-
async function secret(privateKey, publicKey) {
|
|
2623
|
-
const other = await crypto.subtle.importKey("jwk", publicKey, CURVE, false, []);
|
|
2624
|
-
return crypto.subtle.deriveKey({ name: "ECDH", public: other }, privateKey, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
|
|
2625
|
-
}
|
|
2626
|
-
var EduSeal;
|
|
2627
|
-
((EduSeal) => {
|
|
2628
|
-
async function keys() {
|
|
2629
|
-
const pair = await crypto.subtle.generateKey(CURVE, true, ["deriveKey"]);
|
|
2630
|
-
return { publicKey: await crypto.subtle.exportKey("jwk", pair.publicKey), privateKey: await crypto.subtle.exportKey("jwk", pair.privateKey) };
|
|
2631
|
-
}
|
|
2632
|
-
EduSeal.keys = keys;
|
|
2633
|
-
function isKeys(value) {
|
|
2634
|
-
const keys2 = value;
|
|
2635
|
-
return !!keys2 && typeof keys2.publicKey?.x === "string" && typeof keys2.privateKey?.d === "string";
|
|
2636
|
-
}
|
|
2637
|
-
EduSeal.isKeys = isKeys;
|
|
2638
|
-
function isPublic(value) {
|
|
2639
|
-
const key = value;
|
|
2640
|
-
return !!key && key.kty === "EC" && typeof key.x === "string" && typeof key.y === "string" && !("d" in key);
|
|
2641
|
-
}
|
|
2642
|
-
EduSeal.isPublic = isPublic;
|
|
2643
|
-
async function seal(value, publicKey) {
|
|
2644
|
-
const pair = await crypto.subtle.generateKey(CURVE, true, ["deriveKey"]);
|
|
2645
|
-
const key = await secret(pair.privateKey, publicKey);
|
|
2646
|
-
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
2647
|
-
const data = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, key, new TextEncoder().encode(JSON.stringify(value)));
|
|
2648
|
-
const e = await crypto.subtle.exportKey("jwk", pair.publicKey);
|
|
2649
|
-
return { e: { kty: e.kty, crv: e.crv, x: e.x, y: e.y }, iv: base64(iv), d: base64(data) };
|
|
2650
|
-
}
|
|
2651
|
-
EduSeal.seal = seal;
|
|
2652
|
-
async function open(sealed, keys2) {
|
|
2653
|
-
const value = sealed;
|
|
2654
|
-
if (!value || !isPublic(value.e) || typeof value.iv !== "string" || typeof value.d !== "string") {
|
|
2655
|
-
return;
|
|
2656
|
-
}
|
|
2872
|
+
function HandIn(props) {
|
|
2873
|
+
const { pi, rooms, quiz, given } = props;
|
|
2874
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2875
|
+
const [status, setStatus] = React.useState("checking");
|
|
2876
|
+
const handIn = React.useCallback(async () => {
|
|
2877
|
+
setStatus("sending");
|
|
2657
2878
|
try {
|
|
2658
|
-
const
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2661
|
-
|
|
2879
|
+
const name = await props.name() ?? "";
|
|
2880
|
+
const submission = {
|
|
2881
|
+
name,
|
|
2882
|
+
given: quiz.questions.map((question, at) => givenText(question, given[at] ?? "")),
|
|
2883
|
+
right: quiz.questions.map((question, at) => given[at] !== undefined && rightOf(question, given[at])),
|
|
2884
|
+
at: Date.now()
|
|
2885
|
+
};
|
|
2886
|
+
const result = await rooms.submit(quiz, submission);
|
|
2887
|
+
setStatus(result === "sent" ? "sent" : result === "no-key" ? "no-key" : "failed");
|
|
2662
2888
|
} catch {
|
|
2663
|
-
|
|
2889
|
+
setStatus("failed");
|
|
2664
2890
|
}
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
\`\`\`${LEARNING}
|
|
2724
|
-
${JSON.stringify(learning)}
|
|
2725
|
-
\`\`\``;
|
|
2726
|
-
}
|
|
2727
|
-
EduRoomUtil.reportText = reportText;
|
|
2728
|
-
})(EduRoomUtil ||= {});
|
|
2729
|
-
|
|
2730
|
-
class EduRooms {
|
|
2731
|
-
pi;
|
|
2732
|
-
store;
|
|
2733
|
-
list = [];
|
|
2734
|
-
friendList = [];
|
|
2735
|
-
listeners = new Set;
|
|
2736
|
-
loading;
|
|
2737
|
-
stop;
|
|
2738
|
-
version = 0;
|
|
2739
|
-
constructor(pi, store) {
|
|
2740
|
-
this.pi = pi;
|
|
2741
|
-
this.store = store;
|
|
2742
|
-
}
|
|
2743
|
-
get server() {
|
|
2744
|
-
return this.pi.rooms;
|
|
2745
|
-
}
|
|
2746
|
-
get rooms() {
|
|
2747
|
-
return this.list;
|
|
2748
|
-
}
|
|
2749
|
-
get friends() {
|
|
2750
|
-
return this.friendList;
|
|
2751
|
-
}
|
|
2752
|
-
subscribe = (listener) => {
|
|
2753
|
-
this.listeners.add(listener);
|
|
2754
|
-
if (!this.stop && this.pi.onRoomEvent) {
|
|
2755
|
-
this.stop = this.pi.onRoomEvent((event) => {
|
|
2756
|
-
if (event.type === "rooms" || event.type === "state" && event.key.startsWith(STATE)) {
|
|
2757
|
-
this.load();
|
|
2758
|
-
}
|
|
2759
|
-
}, { messages: false, state: [STATE] });
|
|
2760
|
-
this.load();
|
|
2891
|
+
}, [quiz, given, rooms]);
|
|
2892
|
+
React.useEffect(() => {
|
|
2893
|
+
rooms.submitted(quiz).then((done) => done ? setStatus("sent") : handIn(), () => handIn());
|
|
2894
|
+
}, []);
|
|
2895
|
+
const Check = pi.ui.icons.Check;
|
|
2896
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2897
|
+
className: "ted-foot ted-handin",
|
|
2898
|
+
"data-status": status
|
|
2899
|
+
}, status === "sent" ? /* @__PURE__ */ React.createElement("span", {
|
|
2900
|
+
className: "ted-handed"
|
|
2901
|
+
}, /* @__PURE__ */ React.createElement(Check, {
|
|
2902
|
+
size: 14,
|
|
2903
|
+
strokeWidth: 2.6
|
|
2904
|
+
}), home.handedIn) : status === "checking" || status === "sending" ? /* @__PURE__ */ React.createElement(pi.ui.Loading, {
|
|
2905
|
+
compact: true
|
|
2906
|
+
}) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
2907
|
+
className: "ted-handin-note"
|
|
2908
|
+
}, status === "no-key" ? home.noTeacherKey : ""), /* @__PURE__ */ React.createElement("button", {
|
|
2909
|
+
type: "button",
|
|
2910
|
+
className: "ta-button",
|
|
2911
|
+
onClick: () => void handIn()
|
|
2912
|
+
}, home.handIn)));
|
|
2913
|
+
}
|
|
2914
|
+
function Handed({ pi, rooms, quiz, room }) {
|
|
2915
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2916
|
+
const [count, setCount] = React.useState();
|
|
2917
|
+
React.useEffect(() => {
|
|
2918
|
+
rooms.server?.getState(room.id, `edu:sub:${quiz.id}:`).then((state) => setCount(Object.keys(state).length), () => {
|
|
2919
|
+
return;
|
|
2920
|
+
});
|
|
2921
|
+
}, [room.id, quiz.id, rooms.version]);
|
|
2922
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2923
|
+
className: "ted-foot ted-handin"
|
|
2924
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2925
|
+
className: "ted-handin-note"
|
|
2926
|
+
}, count === undefined ? "" : EduWords.format(home.handedCount, { count })), /* @__PURE__ */ React.createElement("button", {
|
|
2927
|
+
type: "button",
|
|
2928
|
+
className: "ta-button",
|
|
2929
|
+
onClick: () => void pi.ui.showView(PAGE)
|
|
2930
|
+
}, home.results));
|
|
2931
|
+
}
|
|
2932
|
+
function SendToClass({ pi, store, rooms, quiz }) {
|
|
2933
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
2934
|
+
const [sent, setSent] = React.useState();
|
|
2935
|
+
const [busy, setBusy] = React.useState(false);
|
|
2936
|
+
const context = { pi, store, rooms };
|
|
2937
|
+
const post = async (room) => {
|
|
2938
|
+
setBusy(true);
|
|
2939
|
+
try {
|
|
2940
|
+
const intro = EduWords.format(home.quizIntro, { title: quiz.title ?? EduWords.of(pi.ui.language).quiz, count: quiz.questions.length });
|
|
2941
|
+
await rooms.postQuiz(room, quiz, intro);
|
|
2942
|
+
await store.setSettings({ klass: room.id });
|
|
2943
|
+
setSent(room.title);
|
|
2944
|
+
pi.ui.notify(EduWords.format(home.sentToClass, { klass: room.title }));
|
|
2945
|
+
} catch (error) {
|
|
2946
|
+
pi.ui.notify(EduWords.format(home.failed, { error: error instanceof Error ? error.message : String(error) }), "error");
|
|
2947
|
+
} finally {
|
|
2948
|
+
setBusy(false);
|
|
2761
2949
|
}
|
|
2762
|
-
return () => {
|
|
2763
|
-
this.listeners.delete(listener);
|
|
2764
|
-
if (!this.listeners.size) {
|
|
2765
|
-
this.stop?.();
|
|
2766
|
-
this.stop = undefined;
|
|
2767
|
-
}
|
|
2768
|
-
};
|
|
2769
2950
|
};
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2951
|
+
const pick = async () => {
|
|
2952
|
+
await rooms.load();
|
|
2953
|
+
const classes = rooms.classes();
|
|
2954
|
+
if (!classes.length) {
|
|
2955
|
+
openClasses(context);
|
|
2956
|
+
return;
|
|
2774
2957
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
this.version++;
|
|
2779
|
-
for (const listener of this.listeners) {
|
|
2780
|
-
listener();
|
|
2958
|
+
if (classes.length === 1) {
|
|
2959
|
+
if (await pi.ui.confirm(home.sendToClass, classes[0].title, { confirmLabel: home.sendToClass })) {
|
|
2960
|
+
await post(classes[0]);
|
|
2781
2961
|
}
|
|
2782
|
-
}).finally(() => {
|
|
2783
|
-
this.loading = undefined;
|
|
2784
|
-
});
|
|
2785
|
-
return this.loading;
|
|
2786
|
-
}
|
|
2787
|
-
groups() {
|
|
2788
|
-
return this.list.filter((room) => room.kind === GROUP_KIND);
|
|
2789
|
-
}
|
|
2790
|
-
classes() {
|
|
2791
|
-
const { classes } = this.store.state.settings;
|
|
2792
|
-
return classes.flatMap((id) => this.list.find((room) => room.id === id) ?? []);
|
|
2793
|
-
}
|
|
2794
|
-
me(room) {
|
|
2795
|
-
return room.members.find((member) => member.self)?.member;
|
|
2796
|
-
}
|
|
2797
|
-
async publishKey(room) {
|
|
2798
|
-
const me = this.me(room);
|
|
2799
|
-
const server = this.server;
|
|
2800
|
-
if (!me || !server) {
|
|
2801
2962
|
return;
|
|
2802
2963
|
}
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2964
|
+
pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2965
|
+
title: home.pickClass,
|
|
2966
|
+
onClose: close
|
|
2967
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2968
|
+
className: "ted-list"
|
|
2969
|
+
}, classes.map((room) => /* @__PURE__ */ React.createElement("button", {
|
|
2970
|
+
key: room.id,
|
|
2971
|
+
type: "button",
|
|
2972
|
+
className: "ted-row",
|
|
2973
|
+
onClick: () => {
|
|
2974
|
+
close();
|
|
2975
|
+
post(room);
|
|
2976
|
+
}
|
|
2977
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2978
|
+
className: "ted-row-main"
|
|
2979
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2980
|
+
className: "ted-row-title"
|
|
2981
|
+
}, room.title)))))));
|
|
2982
|
+
};
|
|
2983
|
+
const Send = pi.ui.icons.Send;
|
|
2984
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2985
|
+
className: "ted-foot ted-handin"
|
|
2986
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2987
|
+
className: "ted-handin-note"
|
|
2988
|
+
}, sent ? EduWords.format(home.sentToClass, { klass: sent }) : ""), /* @__PURE__ */ React.createElement("button", {
|
|
2989
|
+
type: "button",
|
|
2990
|
+
className: "ta-button",
|
|
2991
|
+
disabled: busy,
|
|
2992
|
+
onClick: () => void pick()
|
|
2993
|
+
}, /* @__PURE__ */ React.createElement(Send, {
|
|
2994
|
+
size: 14
|
|
2995
|
+
}), home.sendToClass));
|
|
2996
|
+
}
|
|
2997
|
+
function learningCard(pi) {
|
|
2998
|
+
return function LearningCard({ code, closed, send }) {
|
|
2999
|
+
const words = EduWords.of(pi.ui.language);
|
|
3000
|
+
const learning = closed ? EduUtil.learning(code) : undefined;
|
|
3001
|
+
if (!closed) {
|
|
3002
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3003
|
+
className: "ted-card"
|
|
3004
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Loading, {
|
|
3005
|
+
label: words.learning,
|
|
3006
|
+
compact: true
|
|
3007
|
+
}));
|
|
2808
3008
|
}
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
async postQuiz(room, quiz, intro) {
|
|
2812
|
-
const me = this.me(room);
|
|
2813
|
-
const server = this.server;
|
|
2814
|
-
if (!me || !server) {
|
|
2815
|
-
throw new Error("Not in the class.");
|
|
3009
|
+
if (!learning) {
|
|
3010
|
+
throw new Error("Not a learning card");
|
|
2816
3011
|
}
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
3012
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3013
|
+
className: "ted-card"
|
|
3014
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3015
|
+
className: "ted-head"
|
|
3016
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3017
|
+
className: "ted-mark"
|
|
3018
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.icons.TrendingUp, {
|
|
3019
|
+
size: 15
|
|
3020
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
3021
|
+
className: "ted-title"
|
|
3022
|
+
}, learning.title ? /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
3023
|
+
inline: true,
|
|
3024
|
+
text: learning.title
|
|
3025
|
+
}) : words.learning)), learning.stats.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
3026
|
+
className: "ted-stats ted-stats-card"
|
|
3027
|
+
}, learning.stats.map((one) => /* @__PURE__ */ React.createElement("div", {
|
|
3028
|
+
key: one.label,
|
|
3029
|
+
className: "ted-stat"
|
|
3030
|
+
}, /* @__PURE__ */ React.createElement("b", null, one.value), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
3031
|
+
inline: true,
|
|
3032
|
+
text: one.label
|
|
3033
|
+
}))))), learning.items.length > 0 && /* @__PURE__ */ React.createElement("ul", {
|
|
3034
|
+
className: "ted-bars"
|
|
3035
|
+
}, learning.items.map((item) => /* @__PURE__ */ React.createElement("li", {
|
|
3036
|
+
key: item.label,
|
|
3037
|
+
className: "ted-bar",
|
|
3038
|
+
"data-level": item.value >= 85 ? "good" : item.value >= 60 ? "warn" : "bad"
|
|
3039
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3040
|
+
className: "ted-bar-label"
|
|
3041
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
3042
|
+
inline: true,
|
|
3043
|
+
text: item.label
|
|
3044
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
3045
|
+
className: "ted-bar-track"
|
|
3046
|
+
}, /* @__PURE__ */ React.createElement("i", {
|
|
3047
|
+
style: { width: `${item.value}%` }
|
|
3048
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
3049
|
+
className: "ted-bar-value"
|
|
3050
|
+
}, item.value, "%"), item.note && /* @__PURE__ */ React.createElement("span", {
|
|
3051
|
+
className: "ted-bar-note"
|
|
3052
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
3053
|
+
inline: true,
|
|
3054
|
+
text: item.note
|
|
3055
|
+
}))))), learning.weak.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
3056
|
+
className: "ted-part"
|
|
3057
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3058
|
+
className: "ted-part-title"
|
|
3059
|
+
}, words.weak), /* @__PURE__ */ React.createElement("div", {
|
|
3060
|
+
className: "ted-tags"
|
|
3061
|
+
}, learning.weak.map((one) => /* @__PURE__ */ React.createElement("span", {
|
|
3062
|
+
key: one,
|
|
3063
|
+
className: "ted-tag"
|
|
3064
|
+
}, one)))), learning.next.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
3065
|
+
className: "ted-part"
|
|
3066
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3067
|
+
className: "ted-part-title"
|
|
3068
|
+
}, words.next), /* @__PURE__ */ React.createElement("div", {
|
|
3069
|
+
className: "ted-next"
|
|
3070
|
+
}, learning.next.map((one) => /* @__PURE__ */ React.createElement("button", {
|
|
3071
|
+
key: one,
|
|
3072
|
+
type: "button",
|
|
3073
|
+
className: "ted-chip",
|
|
3074
|
+
onClick: () => void (send ?? pi.sendUserMessage)(one)
|
|
3075
|
+
}, one)))));
|
|
3076
|
+
};
|
|
3077
|
+
}
|
|
3078
|
+
function consentCard(pi, rooms) {
|
|
3079
|
+
return function ConsentCard({ code, closed }) {
|
|
3080
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
3081
|
+
const line = closed ? EduRoomUtil.consent(code) : undefined;
|
|
3082
|
+
const [me, setMe] = React.useState();
|
|
3083
|
+
const [answer, setAnswer] = React.useState();
|
|
3084
|
+
const [pending, setPending] = React.useState(false);
|
|
3085
|
+
const [busy, setBusy] = React.useState(false);
|
|
3086
|
+
const [round, setRound] = React.useState(0);
|
|
3087
|
+
React.useEffect(() => {
|
|
3088
|
+
let live = true;
|
|
3089
|
+
rooms.identity().then((identity) => live && setMe(identity?.id));
|
|
3090
|
+
return () => {
|
|
3091
|
+
live = false;
|
|
3092
|
+
};
|
|
3093
|
+
}, []);
|
|
3094
|
+
const parent = !!line && !!me && me !== line.child;
|
|
3095
|
+
React.useEffect(() => {
|
|
3096
|
+
let live = true;
|
|
3097
|
+
if (line && parent) {
|
|
3098
|
+
Promise.all([rooms.consentAnswer(line.room, line.child), rooms.consentAsks()]).then(([kind, asks]) => {
|
|
3099
|
+
if (live) {
|
|
3100
|
+
setAnswer(kind);
|
|
3101
|
+
setPending(asks.some((one) => one.room === line.room && one.child === line.child));
|
|
3102
|
+
}
|
|
3103
|
+
}, () => {
|
|
2826
3104
|
return;
|
|
2827
3105
|
});
|
|
2828
3106
|
}
|
|
3107
|
+
return () => {
|
|
3108
|
+
live = false;
|
|
3109
|
+
};
|
|
3110
|
+
}, [code, parent, round]);
|
|
3111
|
+
if (!closed) {
|
|
3112
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3113
|
+
className: "ted-card"
|
|
3114
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Loading, {
|
|
3115
|
+
label: home.consentAsk,
|
|
3116
|
+
compact: true
|
|
3117
|
+
}));
|
|
2829
3118
|
}
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
const server = this.server;
|
|
2833
|
-
if (!quiz.id || !quiz.room || !quiz.teacher || !server) {
|
|
2834
|
-
return "not-in";
|
|
2835
|
-
}
|
|
2836
|
-
if (!this.list.length) {
|
|
2837
|
-
await this.load();
|
|
2838
|
-
}
|
|
2839
|
-
const room = this.list.find((one) => one.id === quiz.room);
|
|
2840
|
-
const me = room && this.me(room);
|
|
2841
|
-
if (!room || !me) {
|
|
2842
|
-
return "not-in";
|
|
2843
|
-
}
|
|
2844
|
-
const key = (await server.getState(room.id, EduRoomUtil.keyOf(quiz.teacher)))[EduRoomUtil.keyOf(quiz.teacher)]?.value;
|
|
2845
|
-
if (!EduSeal.isPublic(key)) {
|
|
2846
|
-
return "no-key";
|
|
2847
|
-
}
|
|
2848
|
-
await server.setState(room.id, EduRoomUtil.submissionOf(quiz.id, me), await EduSeal.seal(submission, key));
|
|
2849
|
-
return "sent";
|
|
2850
|
-
}
|
|
2851
|
-
async submitted(quiz) {
|
|
2852
|
-
const room = quiz.room ? this.list.find((one) => one.id === quiz.room) : undefined;
|
|
2853
|
-
const me = room && this.me(room);
|
|
2854
|
-
if (!room || !me || !quiz.id || !this.server) {
|
|
2855
|
-
return false;
|
|
2856
|
-
}
|
|
2857
|
-
const key = EduRoomUtil.submissionOf(quiz.id, me);
|
|
2858
|
-
return !!(await this.server.getState(room.id, key))[key]?.value;
|
|
2859
|
-
}
|
|
2860
|
-
async submissions(posted) {
|
|
2861
|
-
const server = this.server;
|
|
2862
|
-
if (!server) {
|
|
2863
|
-
return [];
|
|
3119
|
+
if (!line) {
|
|
3120
|
+
throw new Error("Not a consent");
|
|
2864
3121
|
}
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
3122
|
+
const say = (yes) => {
|
|
3123
|
+
setBusy(true);
|
|
3124
|
+
rooms.answerConsent(line, yes, home).then(() => setRound((n) => n + 1)).catch((error) => pi.ui.notify(EduWords.format(home.failed, { error: error instanceof Error ? error.message : String(error) }), "error")).finally(() => setBusy(false));
|
|
3125
|
+
};
|
|
3126
|
+
const from = line.from ?? "";
|
|
3127
|
+
const [title, sub] = line.kind === "ask" ? parent ? [EduWords.format(home.consentAskTitle, { name: line.name }), home.consentAskBody] : [home.consentWaitingChild, home.consentNeededHint] : line.kind === "grant" ? [parent ? EduWords.format(home.consentYouGranted, { name: line.name }) : EduWords.format(home.consentGrantedChild, { name: from }), ""] : [parent ? EduWords.format(home.consentYouRevoked, { name: line.name }) : EduWords.format(home.consentRevokedChild, { name: from }), ""];
|
|
3128
|
+
const Icon = line.kind === "grant" ? pi.ui.icons.Check : pi.ui.icons.Lock ?? pi.ui.icons.BookOpen;
|
|
3129
|
+
const ask2 = parent && line.kind === "ask" && pending;
|
|
3130
|
+
const takeBack = parent && line.kind === "grant" && answer === "grant";
|
|
3131
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3132
|
+
className: "ted-card ted-consent-card",
|
|
3133
|
+
"data-kind": line.kind
|
|
3134
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3135
|
+
className: "ted-head"
|
|
3136
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3137
|
+
className: "ted-mark"
|
|
3138
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3139
|
+
size: 15
|
|
3140
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
3141
|
+
className: "ted-title"
|
|
3142
|
+
}, title)), sub && /* @__PURE__ */ React.createElement("div", {
|
|
3143
|
+
className: "ted-consent-body"
|
|
3144
|
+
}, sub), parent && line.kind === "ask" && !pending && answer && /* @__PURE__ */ React.createElement("div", {
|
|
3145
|
+
className: "ted-consent-body ted-consent-said"
|
|
3146
|
+
}, EduWords.format(answer === "grant" ? home.consentYouGranted : home.consentYouRevoked, { name: line.name })), (ask2 || takeBack) && /* @__PURE__ */ React.createElement("div", {
|
|
3147
|
+
className: "ted-foot"
|
|
3148
|
+
}, ask2 ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
|
|
3149
|
+
type: "button",
|
|
3150
|
+
className: "ta-button",
|
|
3151
|
+
disabled: busy,
|
|
3152
|
+
onClick: () => say(false)
|
|
3153
|
+
}, home.consentNo), /* @__PURE__ */ React.createElement("button", {
|
|
3154
|
+
type: "button",
|
|
3155
|
+
className: "ta-button ta-primary",
|
|
3156
|
+
disabled: busy,
|
|
3157
|
+
onClick: () => say(true)
|
|
3158
|
+
}, home.consentYes)) : /* @__PURE__ */ React.createElement("button", {
|
|
3159
|
+
type: "button",
|
|
3160
|
+
className: "ta-button",
|
|
3161
|
+
disabled: busy,
|
|
3162
|
+
onClick: () => say(false)
|
|
3163
|
+
}, home.consentTakeBack)));
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
// web-src/composer.tsx
|
|
3168
|
+
var TONES2 = { student: "0", parent: "4", teacher: "3", homeroom: "5" };
|
|
3169
|
+
function photoText(identity, pi) {
|
|
3170
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
3171
|
+
return identity === "student" ? home.photoStudent : identity === "parent" ? home.photoParent : home.photoTeacher;
|
|
3172
|
+
}
|
|
3173
|
+
async function run(pi, store, conversation, identity, key) {
|
|
3174
|
+
const words = EduWords.of(pi.ui.language);
|
|
3175
|
+
const action = ROLES[identity].actions.find((one) => one.key === key);
|
|
3176
|
+
if (!action) {
|
|
3177
|
+
return;
|
|
2882
3178
|
}
|
|
2883
|
-
|
|
2884
|
-
|
|
3179
|
+
const { label, text } = EduRoles.action(words, action.key);
|
|
3180
|
+
if (action.key === "review") {
|
|
3181
|
+
const due = EduUtil.due(store.state.mistakes, Date.now());
|
|
3182
|
+
await EduChats.send(pi, conversation.sessionId, TaMessageContext.wrap(reviewContext(due), EduWords.format(text, { count: due.length })));
|
|
3183
|
+
return;
|
|
2885
3184
|
}
|
|
2886
|
-
|
|
2887
|
-
const
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
room: room.id,
|
|
2893
|
-
klass: room.title,
|
|
2894
|
-
from: line.name,
|
|
2895
|
-
text: line.text,
|
|
2896
|
-
at: line.at
|
|
2897
|
-
})) : [];
|
|
2898
|
-
}));
|
|
2899
|
-
return all.flat().sort((a, b) => b.at - a.at);
|
|
3185
|
+
if (action.icon === "Image") {
|
|
3186
|
+
const images = await EduPhotos.pick();
|
|
3187
|
+
if (images.length) {
|
|
3188
|
+
await EduChats.send(pi, conversation.sessionId, photoText(identity, pi), images);
|
|
3189
|
+
}
|
|
3190
|
+
return;
|
|
2900
3191
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
3192
|
+
const message = action.send ? text : await pi.ui.editor(label, text);
|
|
3193
|
+
if (message?.trim()) {
|
|
3194
|
+
await EduChats.send(pi, conversation.sessionId, message.trim());
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
function Empty({ pi, store, conversation, identity }) {
|
|
3198
|
+
useStore(store);
|
|
3199
|
+
const words = EduWords.of(pi.ui.language);
|
|
3200
|
+
const role = ROLES[identity];
|
|
3201
|
+
const Icon = iconOf(pi, role.icon);
|
|
3202
|
+
const due = EduUtil.due(store.state.mistakes, Date.now()).length;
|
|
3203
|
+
const actions = role.actions.filter((action) => action.key !== "review" || due > 0).slice(0, 4);
|
|
3204
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3205
|
+
className: "ted-hero"
|
|
3206
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3207
|
+
className: "ted-hero-face",
|
|
3208
|
+
style: tone(TONES2[identity])
|
|
3209
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3210
|
+
size: 30,
|
|
3211
|
+
strokeWidth: 1.8
|
|
3212
|
+
})), /* @__PURE__ */ React.createElement("h1", {
|
|
3213
|
+
className: "ted-hero-title"
|
|
3214
|
+
}, words[role.assistant]), /* @__PURE__ */ React.createElement("p", {
|
|
3215
|
+
className: "ted-hero-hint"
|
|
3216
|
+
}, words[role.tagline]), /* @__PURE__ */ React.createElement("div", {
|
|
3217
|
+
className: "ted-hero-starts"
|
|
3218
|
+
}, actions.map((action) => {
|
|
3219
|
+
const { label } = EduRoles.action(words, action.key);
|
|
3220
|
+
const ActionIcon = iconOf(pi, action.icon === "Image" ? "Camera" : action.icon, action.icon);
|
|
3221
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
3222
|
+
key: action.key,
|
|
3223
|
+
type: "button",
|
|
3224
|
+
className: "ted-start",
|
|
3225
|
+
onClick: () => void run(pi, store, conversation, identity, action.key)
|
|
3226
|
+
}, /* @__PURE__ */ React.createElement(ActionIcon, {
|
|
3227
|
+
size: 16,
|
|
3228
|
+
strokeWidth: 1.9
|
|
3229
|
+
}), /* @__PURE__ */ React.createElement("span", null, action.key === "review" ? `${label} · ${due}` : label));
|
|
3230
|
+
})));
|
|
3231
|
+
}
|
|
3232
|
+
function Chips({ pi, conversation }) {
|
|
3233
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
3234
|
+
const chips = [
|
|
3235
|
+
{
|
|
3236
|
+
key: "photo",
|
|
3237
|
+
label: home.chipPhoto,
|
|
3238
|
+
icon: "Camera",
|
|
3239
|
+
fallback: "Image",
|
|
3240
|
+
run: async () => {
|
|
3241
|
+
const images = await EduPhotos.pick();
|
|
3242
|
+
if (images.length) {
|
|
3243
|
+
await EduChats.send(pi, conversation.sessionId, home.photoStudent, images);
|
|
2909
3244
|
}
|
|
2910
3245
|
}
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
3246
|
+
},
|
|
3247
|
+
{ key: "hint", label: home.chipHint, icon: "Lightbulb", run: () => EduChats.send(pi, conversation.sessionId, home.chipHintText) },
|
|
3248
|
+
{
|
|
3249
|
+
key: "again",
|
|
3250
|
+
label: home.chipAgain,
|
|
3251
|
+
icon: "Shuffle",
|
|
3252
|
+
fallback: "RotateCcw",
|
|
3253
|
+
run: () => EduChats.send(pi, conversation.sessionId, home.chipAgainText)
|
|
3254
|
+
},
|
|
3255
|
+
{ key: "got", label: home.chipGot, icon: "Check", run: () => EduChats.send(pi, conversation.sessionId, home.chipGotText) }
|
|
3256
|
+
];
|
|
3257
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3258
|
+
className: "ted-chiprow"
|
|
3259
|
+
}, chips.map((chip) => {
|
|
3260
|
+
const Icon = chip.key === "photo" ? iconOf(pi, chip.icon, chip.fallback) : undefined;
|
|
3261
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
3262
|
+
key: chip.key,
|
|
3263
|
+
type: "button",
|
|
3264
|
+
className: "ted-chip ted-chip-icon",
|
|
3265
|
+
onClick: () => void chip.run().catch(() => {
|
|
3266
|
+
return;
|
|
3267
|
+
})
|
|
3268
|
+
}, Icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
3269
|
+
size: 14,
|
|
3270
|
+
strokeWidth: 2
|
|
3271
|
+
}), chip.label);
|
|
3272
|
+
}));
|
|
3273
|
+
}
|
|
3274
|
+
function eduComposer(pi, store) {
|
|
3275
|
+
const identityOf = (conversation) => conversation.group === NAME ? EduChats.identityOf(store, conversation.sessionFile) : undefined;
|
|
3276
|
+
return {
|
|
3277
|
+
actions: (conversation) => {
|
|
3278
|
+
const identity = identityOf(conversation);
|
|
3279
|
+
if (!identity) {
|
|
3280
|
+
return [];
|
|
2925
3281
|
}
|
|
3282
|
+
const words = EduWords.of(pi.ui.language);
|
|
3283
|
+
const due = EduUtil.due(store.state.mistakes, Date.now()).length;
|
|
3284
|
+
return ROLES[identity].actions.map((action) => {
|
|
3285
|
+
const { label, text } = EduRoles.action(words, action.key);
|
|
3286
|
+
const icon = pi.ui.icons[action.icon];
|
|
3287
|
+
if (action.key === "review") {
|
|
3288
|
+
return {
|
|
3289
|
+
key: action.key,
|
|
3290
|
+
label,
|
|
3291
|
+
icon,
|
|
3292
|
+
detail: due ? String(due) : undefined,
|
|
3293
|
+
disabled: due === 0,
|
|
3294
|
+
run: () => void run(pi, store, conversation, identity, action.key)
|
|
3295
|
+
};
|
|
3296
|
+
}
|
|
3297
|
+
return action.send || action.icon === "Image" ? { key: action.key, label, icon, run: () => void run(pi, store, conversation, identity, action.key) } : { key: action.key, label, icon, insert: text };
|
|
3298
|
+
});
|
|
3299
|
+
},
|
|
3300
|
+
subscribe: (listener) => store.subscribe(listener),
|
|
3301
|
+
above: ({ conversation }) => identityOf(conversation) === "student" ? /* @__PURE__ */ React.createElement(Chips, {
|
|
3302
|
+
pi,
|
|
3303
|
+
conversation
|
|
3304
|
+
}) : null,
|
|
3305
|
+
empty: (conversation) => {
|
|
3306
|
+
const identity = identityOf(conversation);
|
|
3307
|
+
return identity ? /* @__PURE__ */ React.createElement(Empty, {
|
|
3308
|
+
pi,
|
|
3309
|
+
store,
|
|
3310
|
+
conversation,
|
|
3311
|
+
identity
|
|
3312
|
+
}) : undefined;
|
|
2926
3313
|
}
|
|
2927
|
-
|
|
2928
|
-
return false;
|
|
2929
|
-
}
|
|
2930
|
-
await server.say(room.id, EduRoomUtil.reportText(learning, intro));
|
|
2931
|
-
return true;
|
|
2932
|
-
}
|
|
2933
|
-
async direct(friend, again = false) {
|
|
2934
|
-
if (again || !this.list.length) {
|
|
2935
|
-
await this.load();
|
|
2936
|
-
}
|
|
2937
|
-
return this.list.filter((room) => room.kind === DIRECT_KIND && room.members.some((member) => !member.self && member.id === friend)).sort((a, b) => a.createdAt - b.createdAt)[0];
|
|
2938
|
-
}
|
|
3314
|
+
};
|
|
2939
3315
|
}
|
|
2940
3316
|
|
|
2941
3317
|
// web-src/edu-store.ts
|
|
2942
|
-
var KEYS = [Keys.SETTINGS, Keys.MISTAKES, Keys.CHATS, Keys.ANSWERS, Keys.DAYS, Keys.POSTED];
|
|
3318
|
+
var KEYS = [Keys.SETTINGS, Keys.MISTAKES, Keys.CHATS, Keys.ANSWERS, Keys.DAYS, Keys.POSTED, Keys.CONSENT, Keys.REPORTED];
|
|
2943
3319
|
var MAX_POSTED = 30;
|
|
2944
3320
|
|
|
2945
3321
|
class EduStore {
|
|
@@ -2951,7 +3327,8 @@ class EduStore {
|
|
|
2951
3327
|
chats: {},
|
|
2952
3328
|
answers: {},
|
|
2953
3329
|
days: {},
|
|
2954
|
-
posted: []
|
|
3330
|
+
posted: [],
|
|
3331
|
+
consent: {}
|
|
2955
3332
|
};
|
|
2956
3333
|
listeners = new Set;
|
|
2957
3334
|
keys;
|
|
@@ -2972,6 +3349,15 @@ class EduStore {
|
|
|
2972
3349
|
this.set({ ...this.current, settings });
|
|
2973
3350
|
return this.write(Keys.SETTINGS, settings);
|
|
2974
3351
|
}
|
|
3352
|
+
setAsked(asked) {
|
|
3353
|
+
const consent = { ...this.current.consent, asked };
|
|
3354
|
+
this.set({ ...this.current, consent });
|
|
3355
|
+
return this.write(Keys.CONSENT, consent);
|
|
3356
|
+
}
|
|
3357
|
+
setReported(at) {
|
|
3358
|
+
this.set({ ...this.current, reportedAt: at });
|
|
3359
|
+
return this.write(Keys.REPORTED, { at });
|
|
3360
|
+
}
|
|
2975
3361
|
setChat(identity, sessionFile) {
|
|
2976
3362
|
const chats = { ...this.current.chats, [identity]: sessionFile };
|
|
2977
3363
|
this.set({ ...this.current, chats });
|
|
@@ -3009,14 +3395,16 @@ class EduStore {
|
|
|
3009
3395
|
return this.pi.storage.set(key, value).catch((error) => this.pi.ui.notify(error instanceof Error ? error.message : String(error), "error"));
|
|
3010
3396
|
}
|
|
3011
3397
|
read() {
|
|
3012
|
-
Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, mistakes, chats, answers, days, posted]) => this.update({
|
|
3398
|
+
Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, mistakes, chats, answers, days, posted, consent, reported]) => this.update({
|
|
3013
3399
|
loaded: true,
|
|
3014
3400
|
settings: EduUtil.settings(settings),
|
|
3015
3401
|
mistakes: EduUtil.mistakes(mistakes),
|
|
3016
3402
|
chats: chats && typeof chats === "object" ? chats : {},
|
|
3017
3403
|
answers: EduUtil.answers(answers),
|
|
3018
3404
|
days: EduUtil.days(days),
|
|
3019
|
-
posted: Array.isArray(posted) ? posted.filter((one) => typeof one?.id === "string" && typeof one.room === "string" && Array.isArray(one.questions)) : []
|
|
3405
|
+
posted: Array.isArray(posted) ? posted.filter((one) => typeof one?.id === "string" && typeof one.room === "string" && Array.isArray(one.questions)) : [],
|
|
3406
|
+
consent: EduUtil.consent(consent),
|
|
3407
|
+
reportedAt: EduUtil.reportedAt(reported)
|
|
3020
3408
|
}), () => this.set({ ...this.current, loaded: true }));
|
|
3021
3409
|
}
|
|
3022
3410
|
update(state) {
|
|
@@ -3348,6 +3736,43 @@ ${one.from}(${one.klass}):
|
|
|
3348
3736
|
}, asks ? home.noAsks : " ")));
|
|
3349
3737
|
}
|
|
3350
3738
|
|
|
3739
|
+
// web-src/edu-report.ts
|
|
3740
|
+
var WEEK = 7 * 86400000;
|
|
3741
|
+
var EduReport;
|
|
3742
|
+
((EduReport) => {
|
|
3743
|
+
function of(days, mistakes, name, words, now) {
|
|
3744
|
+
const week = EduUtil.lastWeek(days, now);
|
|
3745
|
+
const books = EduUtil.books(mistakes, now, words.otherSubject);
|
|
3746
|
+
const format2 = (text, values) => text.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
|
|
3747
|
+
return {
|
|
3748
|
+
title: format2(words.reportTitle, { name }),
|
|
3749
|
+
stats: [
|
|
3750
|
+
{ label: words.statQuestions, value: String(week.n) },
|
|
3751
|
+
{ label: words.statRight, value: week.n ? `${Math.round(week.right / week.n * 100)}%` : "—" },
|
|
3752
|
+
{ label: words.statDays, value: String(week.days) }
|
|
3753
|
+
],
|
|
3754
|
+
items: books.slice(0, 5).map((book) => ({ label: book.subject, value: book.progress, note: format2(words.reportNote, { count: book.mistakes.length }) })),
|
|
3755
|
+
weak: EduUtil.weak(mistakes),
|
|
3756
|
+
next: [],
|
|
3757
|
+
report: true
|
|
3758
|
+
};
|
|
3759
|
+
}
|
|
3760
|
+
EduReport.of = of;
|
|
3761
|
+
EduReport.DAY = 0;
|
|
3762
|
+
EduReport.HOUR = 18;
|
|
3763
|
+
function slot(now) {
|
|
3764
|
+
const date = new Date(now);
|
|
3765
|
+
date.setHours(EduReport.HOUR, 0, 0, 0);
|
|
3766
|
+
date.setDate(date.getDate() - (date.getDay() - EduReport.DAY + 7) % 7);
|
|
3767
|
+
return date.getTime() > now ? date.getTime() - WEEK : date.getTime();
|
|
3768
|
+
}
|
|
3769
|
+
EduReport.slot = slot;
|
|
3770
|
+
function due(reportTo, reportedAt, now) {
|
|
3771
|
+
return !!reportTo && (reportedAt === undefined || reportedAt < slot(now));
|
|
3772
|
+
}
|
|
3773
|
+
EduReport.due = due;
|
|
3774
|
+
})(EduReport ||= {});
|
|
3775
|
+
|
|
3351
3776
|
// web-src/student.tsx
|
|
3352
3777
|
function WeekDots({ context }) {
|
|
3353
3778
|
const { pi, store } = context;
|
|
@@ -3386,7 +3811,9 @@ function StudentHome({ context, books, openBook }) {
|
|
|
3386
3811
|
text: home.dueHead,
|
|
3387
3812
|
count: due.length,
|
|
3388
3813
|
tone: TONES.student
|
|
3389
|
-
}) : home.dueNone)), /* @__PURE__ */ React.createElement(
|
|
3814
|
+
}) : home.dueNone)), EduUtil.locked(state.settings, "student", state.consent) ? /* @__PURE__ */ React.createElement(ConsentPanel, {
|
|
3815
|
+
context
|
|
3816
|
+
}) : /* @__PURE__ */ React.createElement("div", {
|
|
3390
3817
|
className: "ted-panel ted-today"
|
|
3391
3818
|
}, first ? /* @__PURE__ */ React.createElement("div", {
|
|
3392
3819
|
className: "ted-today-q"
|
|
@@ -3400,7 +3827,10 @@ function StudentHome({ context, books, openBook }) {
|
|
|
3400
3827
|
text: first.question
|
|
3401
3828
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
3402
3829
|
className: "ted-meta ted-meta-faint"
|
|
3403
|
-
},
|
|
3830
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
3831
|
+
inline: true,
|
|
3832
|
+
text: format(home.lastWrong, { given: first.given })
|
|
3833
|
+
}))) : /* @__PURE__ */ React.createElement("div", {
|
|
3404
3834
|
className: "ted-today-q ted-today-none"
|
|
3405
3835
|
}, home.noDueHint), /* @__PURE__ */ React.createElement("div", {
|
|
3406
3836
|
className: "ted-today-foot"
|
|
@@ -3498,6 +3928,53 @@ function StudentHome({ context, books, openBook }) {
|
|
|
3498
3928
|
context
|
|
3499
3929
|
}))));
|
|
3500
3930
|
}
|
|
3931
|
+
function ConsentPanel({ context }) {
|
|
3932
|
+
const { pi, store, rooms } = context;
|
|
3933
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
3934
|
+
const { asked } = store.state.consent;
|
|
3935
|
+
const Lock = iconOf(pi, "Lock");
|
|
3936
|
+
const ask2 = async (id, name) => {
|
|
3937
|
+
const me = await rooms.identity();
|
|
3938
|
+
const room = me && await rooms.sendTo(id, (room2) => EduRoomUtil.consentText({ kind: "ask", room: room2, child: me.id, name: me.name }, format(home.consentAskIntro, { name: me.name })));
|
|
3939
|
+
if (!room) {
|
|
3940
|
+
pi.ui.notify(home.reportFailed, "warning");
|
|
3941
|
+
return false;
|
|
3942
|
+
}
|
|
3943
|
+
await store.setAsked({ to: id, name, at: Date.now() });
|
|
3944
|
+
pi.ui.notify(format(home.consentAsked, { name }));
|
|
3945
|
+
return true;
|
|
3946
|
+
};
|
|
3947
|
+
const open = () => pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
3948
|
+
title: home.consentAsk,
|
|
3949
|
+
onClose: close
|
|
3950
|
+
}, /* @__PURE__ */ React.createElement(FriendPicker, {
|
|
3951
|
+
context,
|
|
3952
|
+
close,
|
|
3953
|
+
hint: home.consentNeededHint,
|
|
3954
|
+
chosen: asked?.to,
|
|
3955
|
+
pick: ask2
|
|
3956
|
+
})));
|
|
3957
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3958
|
+
className: "ted-panel ted-consent"
|
|
3959
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3960
|
+
className: "ted-consent-main"
|
|
3961
|
+
}, /* @__PURE__ */ React.createElement(Tile, {
|
|
3962
|
+
icon: Lock,
|
|
3963
|
+
tone: TONES.parent
|
|
3964
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
3965
|
+
className: "ted-row-main"
|
|
3966
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3967
|
+
className: "ted-row-title"
|
|
3968
|
+
}, home.consentNeeded), /* @__PURE__ */ React.createElement("span", {
|
|
3969
|
+
className: "ted-row-sub ted-wrap"
|
|
3970
|
+
}, asked ? format(home.consentAsked, { name: asked.name }) : home.consentNeededHint))), /* @__PURE__ */ React.createElement("div", {
|
|
3971
|
+
className: "ted-today-foot"
|
|
3972
|
+
}, /* @__PURE__ */ React.createElement("span", null), pi.rooms && /* @__PURE__ */ React.createElement("button", {
|
|
3973
|
+
type: "button",
|
|
3974
|
+
className: `ta-button ted-pill${asked ? "" : " ta-primary"}`,
|
|
3975
|
+
onClick: open
|
|
3976
|
+
}, asked ? home.consentAskOther : home.consentAsk)));
|
|
3977
|
+
}
|
|
3501
3978
|
function ToParent({ context }) {
|
|
3502
3979
|
const { pi, store, rooms } = context;
|
|
3503
3980
|
const home = HomeWordsUtil.of(pi.ui.language);
|
|
@@ -3507,12 +3984,32 @@ function ToParent({ context }) {
|
|
|
3507
3984
|
if (!pi.rooms) {
|
|
3508
3985
|
return null;
|
|
3509
3986
|
}
|
|
3987
|
+
const send = async (id, name) => {
|
|
3988
|
+
const me = await pi.rooms.getIdentity();
|
|
3989
|
+
const learning = EduReport.of(store.state.days, store.state.mistakes, me.name, home, Date.now());
|
|
3990
|
+
if (!await rooms.sendReport(id, learning, format(home.reportIntro, { name: me.name }))) {
|
|
3991
|
+
pi.ui.notify(home.reportFailed, "warning");
|
|
3992
|
+
return false;
|
|
3993
|
+
}
|
|
3994
|
+
await store.setSettings({ reportTo: id });
|
|
3995
|
+
await store.setReported(Date.now());
|
|
3996
|
+
pi.ui.notify(format(home.reportSent, { name }));
|
|
3997
|
+
return true;
|
|
3998
|
+
};
|
|
3510
3999
|
const menu = () => pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
3511
4000
|
title: home.pickParent,
|
|
3512
4001
|
onClose: close
|
|
3513
4002
|
}, /* @__PURE__ */ React.createElement(FriendPicker, {
|
|
3514
4003
|
context,
|
|
3515
|
-
close
|
|
4004
|
+
close,
|
|
4005
|
+
hint: home.reportPrivacy,
|
|
4006
|
+
chosen: store.state.settings.reportTo,
|
|
4007
|
+
pick: send,
|
|
4008
|
+
foot: store.state.settings.reportTo && /* @__PURE__ */ React.createElement("button", {
|
|
4009
|
+
type: "button",
|
|
4010
|
+
className: "ta-button",
|
|
4011
|
+
onClick: () => void store.setSettings({ reportTo: undefined }).then(close)
|
|
4012
|
+
}, home.stopSending)
|
|
3516
4013
|
})));
|
|
3517
4014
|
return /* @__PURE__ */ React.createElement("div", {
|
|
3518
4015
|
className: "ted-panel ted-list ted-toparent"
|
|
@@ -3534,23 +4031,23 @@ function ToParent({ context }) {
|
|
|
3534
4031
|
"data-on": friend ? true : undefined
|
|
3535
4032
|
})));
|
|
3536
4033
|
}
|
|
3537
|
-
function FriendPicker({
|
|
3538
|
-
|
|
4034
|
+
function FriendPicker({
|
|
4035
|
+
context,
|
|
4036
|
+
close,
|
|
4037
|
+
hint,
|
|
4038
|
+
chosen,
|
|
4039
|
+
pick,
|
|
4040
|
+
foot
|
|
4041
|
+
}) {
|
|
4042
|
+
const { pi, rooms } = context;
|
|
3539
4043
|
useRooms(rooms);
|
|
3540
4044
|
const home = HomeWordsUtil.of(pi.ui.language);
|
|
3541
|
-
const { settings } = store.state;
|
|
3542
4045
|
const [busy, setBusy] = React.useState(false);
|
|
3543
|
-
const
|
|
4046
|
+
const choose = async (id, name) => {
|
|
3544
4047
|
setBusy(true);
|
|
3545
4048
|
try {
|
|
3546
|
-
|
|
3547
|
-
const sent = await rooms.sendReport(id, learning, format(home.reportIntro, { name: (await pi.rooms.getIdentity()).name }));
|
|
3548
|
-
if (sent) {
|
|
3549
|
-
await store.setSettings({ reportTo: id, reportAt: Date.now() });
|
|
3550
|
-
pi.ui.notify(format(home.reportSent, { name }));
|
|
4049
|
+
if (await pick(id, name)) {
|
|
3551
4050
|
close();
|
|
3552
|
-
} else {
|
|
3553
|
-
pi.ui.notify(home.reportFailed, "warning");
|
|
3554
4051
|
}
|
|
3555
4052
|
} catch (error) {
|
|
3556
4053
|
failed(pi, home)(error);
|
|
@@ -3562,14 +4059,14 @@ function FriendPicker({ context, close }) {
|
|
|
3562
4059
|
className: "ted-picker"
|
|
3563
4060
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
3564
4061
|
className: "ted-picker-hint ted-picker-hint-alone"
|
|
3565
|
-
},
|
|
4062
|
+
}, hint), rooms.friends.length ? /* @__PURE__ */ React.createElement("div", {
|
|
3566
4063
|
className: "ted-list"
|
|
3567
4064
|
}, rooms.friends.map((friend) => /* @__PURE__ */ React.createElement("button", {
|
|
3568
4065
|
key: friend.id,
|
|
3569
4066
|
type: "button",
|
|
3570
4067
|
className: "ted-row",
|
|
3571
4068
|
disabled: busy,
|
|
3572
|
-
onClick: () => void
|
|
4069
|
+
onClick: () => void choose(friend.id, friend.name)
|
|
3573
4070
|
}, /* @__PURE__ */ React.createElement(pi.ui.Face, {
|
|
3574
4071
|
seed: friend.id,
|
|
3575
4072
|
look: friend.look,
|
|
@@ -3580,20 +4077,16 @@ function FriendPicker({ context, close }) {
|
|
|
3580
4077
|
className: "ted-row-title"
|
|
3581
4078
|
}, friend.name)), /* @__PURE__ */ React.createElement("span", {
|
|
3582
4079
|
className: "ted-check",
|
|
3583
|
-
"data-on": friend.id ===
|
|
3584
|
-
}, friend.id ===
|
|
4080
|
+
"data-on": friend.id === chosen || undefined
|
|
4081
|
+
}, friend.id === chosen && /* @__PURE__ */ React.createElement(pi.ui.icons.Check, {
|
|
3585
4082
|
size: 13,
|
|
3586
4083
|
strokeWidth: 3
|
|
3587
4084
|
}))))) : /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
3588
4085
|
compact: true,
|
|
3589
4086
|
title: home.noFriends
|
|
3590
|
-
}),
|
|
4087
|
+
}), foot && /* @__PURE__ */ React.createElement("div", {
|
|
3591
4088
|
className: "ted-picker-foot"
|
|
3592
|
-
},
|
|
3593
|
-
type: "button",
|
|
3594
|
-
className: "ta-button",
|
|
3595
|
-
onClick: () => void store.setSettings({ reportTo: undefined }).then(close)
|
|
3596
|
-
}, home.stopSending)));
|
|
4089
|
+
}, foot));
|
|
3597
4090
|
}
|
|
3598
4091
|
function MistakeBook({ context, book }) {
|
|
3599
4092
|
const { pi } = context;
|
|
@@ -3630,9 +4123,15 @@ function MistakeBook({ context, book }) {
|
|
|
3630
4123
|
className: "ted-mistake-a"
|
|
3631
4124
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
3632
4125
|
className: "ted-given"
|
|
3633
|
-
}, /* @__PURE__ */ React.createElement("small", null, home.yourAnswer), /* @__PURE__ */ React.createElement("s", null,
|
|
4126
|
+
}, /* @__PURE__ */ React.createElement("small", null, home.yourAnswer), /* @__PURE__ */ React.createElement("s", null, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
4127
|
+
inline: true,
|
|
4128
|
+
text: mistake.given
|
|
4129
|
+
}))), /* @__PURE__ */ React.createElement("span", {
|
|
3634
4130
|
className: "ted-right"
|
|
3635
|
-
}, /* @__PURE__ */ React.createElement("small", null, home.rightAnswer),
|
|
4131
|
+
}, /* @__PURE__ */ React.createElement("small", null, home.rightAnswer), /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
4132
|
+
inline: true,
|
|
4133
|
+
text: mistake.answer
|
|
4134
|
+
})))))), /* @__PURE__ */ React.createElement("div", {
|
|
3636
4135
|
className: "ted-bottom"
|
|
3637
4136
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
3638
4137
|
type: "button",
|
|
@@ -3877,6 +4376,7 @@ function Picker({ context, first, close }) {
|
|
|
3877
4376
|
}
|
|
3878
4377
|
|
|
3879
4378
|
// web-src/settings.tsx
|
|
4379
|
+
var format2 = EduWords.format;
|
|
3880
4380
|
function useSettings(store) {
|
|
3881
4381
|
const [, tick] = React.useReducer((n) => n + 1, 0);
|
|
3882
4382
|
React.useEffect(() => store.subscribe(tick), [store]);
|
|
@@ -3931,17 +4431,16 @@ function eduSettings(pi, store) {
|
|
|
3931
4431
|
});
|
|
3932
4432
|
}
|
|
3933
4433
|
function Consent() {
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
});
|
|
4434
|
+
useSettings(store);
|
|
4435
|
+
const home = HomeWordsUtil.of(pi.ui.language);
|
|
4436
|
+
const { granted } = store.state.consent;
|
|
4437
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
4438
|
+
className: "ted-setting-note"
|
|
4439
|
+
}, granted ? format2(home.consentBy, { name: granted.name, date: new Date(granted.at).toLocaleDateString(pi.ui.language) }) : home.consentNone);
|
|
3940
4440
|
}
|
|
3941
4441
|
return {
|
|
3942
4442
|
title: label("settingsTitle"),
|
|
3943
4443
|
icon: pi.ui.icons.BookOpen,
|
|
3944
|
-
group: "ta",
|
|
3945
4444
|
rows: [
|
|
3946
4445
|
{ key: "identities", label: label("identitiesLabel"), description: label("identitiesHint"), render: Identities },
|
|
3947
4446
|
{ key: "stage", label: label("stageLabel"), render: Stage },
|
|
@@ -4053,6 +4552,18 @@ button.ted-row:hover:not(:disabled) { background: var(--ta-hover); }
|
|
|
4053
4552
|
.ted-switchmark[data-on] { background: var(--ta-green); }
|
|
4054
4553
|
.ted-switchmark[data-on]::after { transform: translateX(14px); }
|
|
4055
4554
|
.ted-toparent { margin-top: 12px; }
|
|
4555
|
+
.ted-consent { padding: 14px 14px 12px; }
|
|
4556
|
+
.ted-consent-main { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ta-border-muted); }
|
|
4557
|
+
.ted-consent-asks { margin-bottom: 16px; }
|
|
4558
|
+
.ted-consent-asks .ted-section { margin-top: 0; }
|
|
4559
|
+
.ted-consent-ask + .ted-consent-ask { border-top: 1px solid var(--ta-border-muted); }
|
|
4560
|
+
.ted-row.ted-row-static { cursor: default; align-items: flex-start; }
|
|
4561
|
+
.ted-consent-acts { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 12px; }
|
|
4562
|
+
.ted-consent-body { padding: 10px 14px; color: var(--ta-secondary); font-size: calc(13px * var(--ted-s)); }
|
|
4563
|
+
.ted-consent-said { color: var(--ta-muted); }
|
|
4564
|
+
.ted-consent-card[data-kind='grant'] .ted-mark { color: var(--ta-green); background: color-mix(in srgb, var(--ta-green) 12%, transparent); }
|
|
4565
|
+
.ted-consent-card .ted-foot { gap: 8px; }
|
|
4566
|
+
.ted-setting-note { color: var(--ta-secondary); font-size: calc(13px * var(--ted-s)); }
|
|
4056
4567
|
.ted-toparent .ted-row-sub { white-space: normal; }
|
|
4057
4568
|
.ted-quiet { padding: 14px; color: var(--ta-muted); font-size: calc(13px * var(--ted-s)); }
|
|
4058
4569
|
.ted-week { padding: 14px; }
|
|
@@ -4159,7 +4670,7 @@ button.ted-row:hover:not(:disabled) { background: var(--ta-hover); }
|
|
|
4159
4670
|
.ted-q[data-state='right'] .ted-q-no { background: color-mix(in srgb, var(--ta-green) 16%, transparent); color: var(--ta-green); }
|
|
4160
4671
|
.ted-q[data-state='wrong'] .ted-q-no { background: color-mix(in srgb, var(--ta-red) 14%, transparent); color: var(--ta-red); }
|
|
4161
4672
|
.ted-q-text { flex: 1; min-width: 0; }
|
|
4162
|
-
.ted-q-text p, .ted-explain p { margin: 0; }
|
|
4673
|
+
.ted-figure { margin: 10px 0 0 calc(28px * var(--ted-s)); min-width: 0; }.ted-q-text p, .ted-explain p { margin: 0; }
|
|
4163
4674
|
.ted-options { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0 calc(28px * var(--ted-s)); }
|
|
4164
4675
|
.ted-judge { flex-direction: row; }
|
|
4165
4676
|
.ted-option { display: flex; align-items: baseline; gap: 8px; min-height: calc(36px * var(--ted-s)); padding: 7px 12px; box-sizing: border-box; border: 1px solid var(--ta-border); border-radius: 10px; background: transparent; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 120ms, border-color 120ms; }
|
|
@@ -4217,7 +4728,13 @@ function activate(pi) {
|
|
|
4217
4728
|
bind(pi.React);
|
|
4218
4729
|
const removeStyle = injectStyle();
|
|
4219
4730
|
const store = new EduStore(pi);
|
|
4220
|
-
const rooms = new EduRooms(
|
|
4731
|
+
const rooms = new EduRooms({
|
|
4732
|
+
get rooms() {
|
|
4733
|
+
return pi.rooms;
|
|
4734
|
+
},
|
|
4735
|
+
onRoomEvent: pi.onRoomEvent ? (listener, options) => pi.onRoomEvent(listener, options) : undefined,
|
|
4736
|
+
openFriend: pi.ui.openPartner ? (id) => pi.ui.openPartner?.(id, "friend") ?? Promise.resolve(false) : undefined
|
|
4737
|
+
}, store);
|
|
4221
4738
|
const context = { pi, store, rooms };
|
|
4222
4739
|
pi.registerView("home", {
|
|
4223
4740
|
title: () => HomeWordsUtil.of(pi.ui.language).eduTitle,
|
|
@@ -4247,24 +4764,8 @@ function activate(pi) {
|
|
|
4247
4764
|
pi.registerSettings(eduSettings(pi, store));
|
|
4248
4765
|
pi.registerCodeRenderer?.(QUIZ, quizCard(pi, store, rooms), { spoken: (code) => EduUtil.quiz(code)?.title });
|
|
4249
4766
|
pi.registerCodeRenderer?.(LEARNING, learningCard(pi), { spoken: (code) => EduUtil.learning(code)?.title });
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
if (!loaded || !settings.reportTo || !EduReport.due(settings.reportTo, settings.reportAt, Date.now()) || !pi.rooms) {
|
|
4253
|
-
return;
|
|
4254
|
-
}
|
|
4255
|
-
const to = settings.reportTo;
|
|
4256
|
-
store.setSettings({ reportAt: Date.now() });
|
|
4257
|
-
pi.rooms.getIdentity().then((me) => {
|
|
4258
|
-
const home = HomeWordsUtil.of(pi.ui.language);
|
|
4259
|
-
return rooms.sendReport(to, EduReport.of(days, mistakes, me.name, home, Date.now()), EduWords.format(home.reportIntro, { name: me.name }), false);
|
|
4260
|
-
}).catch(() => {
|
|
4261
|
-
return;
|
|
4262
|
-
});
|
|
4263
|
-
});
|
|
4264
|
-
return () => {
|
|
4265
|
-
weekly();
|
|
4266
|
-
removeStyle();
|
|
4267
|
-
};
|
|
4767
|
+
pi.registerCodeRenderer?.(CONSENT, consentCard(pi, rooms), { spoken: (code) => EduRoomUtil.consent(code)?.name });
|
|
4768
|
+
return removeStyle;
|
|
4268
4769
|
}
|
|
4269
4770
|
export {
|
|
4270
4771
|
activate as default
|