dsh-mishu 0.6.2 → 0.7.1
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.md +22 -6
- package/lib/client.js +629 -365
- package/lib/core/channels.js +142 -0
- package/lib/core/index.js +2 -0
- package/lib/core/notify.js +198 -0
- package/lib/dsh/api.js +47 -1
- package/lib/dsh/plugin.js +4 -0
- package/lib/dsh/runtime.js +39 -1
- package/lib/types/core/channels.d.ts +61 -0
- package/lib/types/core/index.d.ts +2 -0
- package/lib/types/core/notify.d.ts +97 -0
- package/lib/types/dsh/runtime.d.ts +10 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(index_exports);
|
|
34
34
|
|
|
35
35
|
// src/client/Board.tsx
|
|
36
|
-
var
|
|
36
|
+
var import_react5 = require("react");
|
|
37
37
|
|
|
38
38
|
// src/client/api.ts
|
|
39
39
|
async function post(path, body) {
|
|
@@ -70,6 +70,10 @@ var settingsApi = {
|
|
|
70
70
|
testGithub: (lang) => post("/github/test", { lang }),
|
|
71
71
|
saveToken: (lang, token) => post("/github/token/save", { lang, token }),
|
|
72
72
|
deleteToken: (lang) => post("/github/token/delete", { lang }),
|
|
73
|
+
saveNotify: (lang, notify) => post("/notify/save", { lang, notify }),
|
|
74
|
+
testNotify: (lang, channel) => post("/notify/test", { lang, channel }),
|
|
75
|
+
saveFeishu: (lang, webhook, secret) => post("/feishu/save", { lang, webhook, secret }),
|
|
76
|
+
deleteFeishu: (lang) => post("/feishu/delete", { lang }),
|
|
73
77
|
deviceStart: (lang) => post("/github/device/start", { lang }),
|
|
74
78
|
deviceStatus: (lang) => post("/github/device/status", { lang }),
|
|
75
79
|
deviceCancel: (lang) => post("/github/device/cancel", { lang }),
|
|
@@ -232,8 +236,41 @@ var zh = {
|
|
|
232
236
|
mMore: "\u66F4\u591A\u8BBE\u7F6E",
|
|
233
237
|
mLength: (label, want, got) => `${label}${/[A-Za-z]$/.test(label) ? " " : ""}\u7684\u6388\u6743\u7801\uFF08\u5E94\u7528\u4E13\u7528\u5BC6\u7801\uFF09\u662F ${want} \u4F4D\uFF0C\u4F60\u586B\u7684\u662F ${got} \u4F4D\uFF0C\u53EF\u80FD\u586B\u6210\u4E86\u767B\u5F55\u5BC6\u7801\u3002`,
|
|
234
238
|
mSavedUnread: (n) => `\u5DF2\u4FDD\u5B58\u3002\u8FDE\u4E0A\u4E86\uFF0C\u6700\u8FD1\u6709 ${n} \u5C01\u672A\u8BFB\u90AE\u4EF6\u3002`,
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
bSources: "\u2460 \u5B83\u770B\u54EA\u91CC",
|
|
240
|
+
bSourcesHint: "\u5C0F\u79D8\u4E66\u4ECE\u8FD9\u4E9B\u5730\u65B9\u627E\u8981\u4F60\u5904\u7406\u7684\u4E8B\u3002",
|
|
241
|
+
bWhat: "\u2461 \u4EC0\u4E48\u4E8B\u8981\u544A\u8BC9\u4F60",
|
|
242
|
+
bUrgentRule: "\u8FD9\u4E9B\u7B97\u6025\u4E8B\uFF0C\u4E00\u51FA\u73B0\u5C31\u63D0\u9192\u4F60\uFF1A\u6709\u4EBA\u8BF7\u4F60 review\u3001@ \u4F60\u3001\u628A\u4E8B\u5206\u914D\u7ED9\u4F60\uFF1B\u4F1A\u8BAE\u9080\u8BF7\uFF1B\u4F60\u4EA4\u4EE3\u7684\u4E8B\u5230\u4E86\u5F53\u5929\u6216\u5DF2\u7ECF\u8FC7\u671F\u3002\u5176\u4ED6\u4E8B\u90FD\u653E\u8FDB\u6BCF\u5929\u7684\u7B80\u62A5\u3002",
|
|
243
|
+
bWhen: "\u2462 \u4EC0\u4E48\u65F6\u5019\u3001\u600E\u4E48\u544A\u8BC9\u4F60",
|
|
244
|
+
bDo: "\u2463 \u80FD\u66FF\u4F60\u529E\u4EC0\u4E48",
|
|
245
|
+
bMailReadOnly: "\u90AE\u4EF6\uFF1A\u53EA\u8BFB\u3002\u5C0F\u79D8\u4E66\u4ECE\u4E0D\u66FF\u4F60\u6539\u90AE\u7BB1\u91CC\u7684\u4EFB\u4F55\u4E1C\u897F\uFF0C\u4E5F\u4E0D\u4F1A\u628A\u90AE\u4EF6\u6807\u6210\u5DF2\u8BFB\u3002",
|
|
246
|
+
nBrief: "\u6BCF\u65E5\u7B80\u62A5\uFF0C\u65F6\u95F4",
|
|
247
|
+
nUrgent: "\u6025\u4E8B\u7ACB\u523B\u63D0\u9192",
|
|
248
|
+
nQuiet: "\u514D\u6253\u6270\uFF0C\u4ECE",
|
|
249
|
+
nTo: "\u5230",
|
|
250
|
+
nZone: (zone) => `\u6309 ${zone} \u7684\u65F6\u95F4\u3002\u514D\u6253\u6270\u671F\u95F4\u4E0D\u53D1\uFF0C\u671F\u95F4\u51FA\u73B0\u7684\u6025\u4E8B\u7B49\u7ED3\u675F\u540E\u4E00\u8D77\u53D1\u3002`,
|
|
251
|
+
nChannels: "\u53D1\u5230\u54EA\u91CC",
|
|
252
|
+
nDesktop: "\u7535\u8111\u901A\u77E5",
|
|
253
|
+
nDesktopOn: "\u5728\u8FD9\u53F0\u7535\u8111\u53F3\u4E0A\u89D2\u5F39\u51FA\u901A\u77E5\u3002",
|
|
254
|
+
nFeishu: "\u98DE\u4E66",
|
|
255
|
+
nFeishuOn: "\u53D1\u5230\u4F60\u7684\u98DE\u4E66\u7FA4\uFF0C\u624B\u673A\u4E0A\u4E5F\u80FD\u6536\u5230\u3002",
|
|
256
|
+
nTest: "\u53D1\u4E00\u6761\u8BD5\u8BD5",
|
|
257
|
+
nTestSent: "\u53D1\u51FA\u53BB\u4E86\uFF0C\u770B\u770B\u6536\u5230\u6CA1\u6709",
|
|
258
|
+
nFeishuConnect: "\u8FDE\u4E0A\u98DE\u4E66",
|
|
259
|
+
nFeishuChange: "\u6362\u4E00\u4E2A\u673A\u5668\u4EBA",
|
|
260
|
+
nFeishuRemove: "\u79FB\u9664",
|
|
261
|
+
nFeishuRemoveConfirm: "\u79FB\u9664\u98DE\u4E66\u673A\u5668\u4EBA\uFF1F\u4EE5\u540E\u63D0\u9192\u4E0D\u518D\u53D1\u5230\u98DE\u4E66\u3002",
|
|
262
|
+
nFeishuSaved: "\u98DE\u4E66\u8FDE\u4E0A\u4E86\uFF0C\u7FA4\u91CC\u5E94\u8BE5\u6536\u5230\u4E86\u4E00\u6761\u6D88\u606F\u3002",
|
|
263
|
+
nFeishuSteps: [
|
|
264
|
+
"\u5728\u98DE\u4E66\u91CC\u5EFA\u4E00\u4E2A\u7FA4\uFF0C\u53EA\u62C9\u4F60\u81EA\u5DF1\u4E5F\u884C\u3002",
|
|
265
|
+
'\u6253\u5F00\u7FA4\u8BBE\u7F6E \u2192\u300C\u7FA4\u673A\u5668\u4EBA\u300D\u2192\u300C\u6DFB\u52A0\u673A\u5668\u4EBA\u300D\u2192\u300C\u81EA\u5B9A\u4E49\u673A\u5668\u4EBA\u300D\uFF0C\u540D\u5B57\u586B"\u5C0F\u79D8\u4E66"\u3002',
|
|
266
|
+
'\u5B89\u5168\u8BBE\u7F6E\u9009\u300C\u7B7E\u540D\u6821\u9A8C\u300D\u5E76\u590D\u5236\u5BC6\u94A5\uFF1B\u6216\u8005\u9009\u300C\u81EA\u5B9A\u4E49\u5173\u952E\u8BCD\u300D\uFF0C\u5173\u952E\u8BCD\u586B"\u5C0F\u79D8\u4E66"\u3002',
|
|
267
|
+
"\u70B9\u300C\u6DFB\u52A0\u300D\uFF0C\u590D\u5236\u300CWebhook \u5730\u5740\u300D\uFF0C\u7C98\u8D34\u5230\u4E0B\u9762\u3002"
|
|
268
|
+
],
|
|
269
|
+
nWebhook: "Webhook \u5730\u5740",
|
|
270
|
+
nSecret: "\u7B7E\u540D\u5BC6\u94A5\uFF08\u9009\u4E86\u7B7E\u540D\u6821\u9A8C\u624D\u586B\uFF09",
|
|
271
|
+
nFeishuPrivacy: "\u63D0\u9192\u7684\u5185\u5BB9\uFF08\u4E8B\u60C5\u7684\u6807\u9898\u548C\u7B80\u77ED\u8BF4\u660E\uFF09\u4F1A\u7ECF\u8FC7\u98DE\u4E66\u7684\u670D\u52A1\u5668\u3002\u5730\u5740\u548C\u5BC6\u94A5\u53EA\u5B58\u5728\u8FD9\u53F0\u7535\u8111\u4E0A\u3002",
|
|
272
|
+
nFeishuTry: "\u8FDE\u4E0A\u5E76\u53D1\u4E00\u6761\u8BD5\u8BD5",
|
|
273
|
+
nLast: (at, kind, results) => `\u4E0A\u6B21\u63D0\u9192\uFF1A${at} ${kind === "brief" ? "\u6BCF\u65E5\u7B80\u62A5" : kind === "urgent" ? "\u6025\u4E8B" : "\u6D4B\u8BD5"}\uFF0C${results.map((r) => `${r.channel === "feishu" ? "\u98DE\u4E66" : "\u7535\u8111\u901A\u77E5"}${r.ok ? "\u5DF2\u9001\u8FBE" : `\u6CA1\u9001\u5230\uFF08${r.error ?? ""}\uFF09`}`).join("\uFF0C")}`,
|
|
237
274
|
ai: "+AI",
|
|
238
275
|
aiTitle: "\u5728\u5BF9\u8BDD\u91CC\u95EE AI\uFF1A\u628A\u8FD9\u4EF6\u4E8B\u653E\u8FDB\u4E00\u4E2A\u65B0\u5BF9\u8BDD\u7684\u8F93\u5165\u6846\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u53D1\u9001\uFF0C\u4F60\u770B\u8FC7\u518D\u6309\u53D1\u9001",
|
|
239
276
|
aiOpened: "\u5DF2\u653E\u8FDB\u65B0\u5BF9\u8BDD\u7684\u8F93\u5165\u6846\uFF0C\u770B\u8FC7\u540E\u6309\u53D1\u9001\u5C31\u884C",
|
|
@@ -386,8 +423,41 @@ var en = {
|
|
|
386
423
|
mMore: "More settings",
|
|
387
424
|
mLength: (label, want, got) => `A ${label} app password is ${want} characters; this one is ${got}. It may be your sign-in password instead.`,
|
|
388
425
|
mSavedUnread: (n) => `Saved. Connected; ${n} unread messages recently.`,
|
|
389
|
-
|
|
390
|
-
|
|
426
|
+
bSources: "1. Where it looks",
|
|
427
|
+
bSourcesHint: "The secretary finds what needs you in these places.",
|
|
428
|
+
bWhat: "2. What to tell you about",
|
|
429
|
+
bUrgentRule: "These are urgent and reach you as they come: a review requested, a mention, an assignment; a meeting invitation; something you told it that is due today or overdue. Everything else goes into the daily brief.",
|
|
430
|
+
bWhen: "3. When and how to tell you",
|
|
431
|
+
bDo: "4. What it may do for you",
|
|
432
|
+
bMailReadOnly: "Mail: read-only. The secretary never changes anything in your mailbox and never marks mail read.",
|
|
433
|
+
nBrief: "Daily brief at",
|
|
434
|
+
nUrgent: "Urgent items right away",
|
|
435
|
+
nQuiet: "Quiet hours from",
|
|
436
|
+
nTo: "to",
|
|
437
|
+
nZone: (zone) => `In ${zone} time. Nothing is sent during quiet hours; urgent items from then come when they end.`,
|
|
438
|
+
nChannels: "Where to send",
|
|
439
|
+
nDesktop: "This computer",
|
|
440
|
+
nDesktopOn: "A notification in the corner of this screen.",
|
|
441
|
+
nFeishu: "Feishu / Lark",
|
|
442
|
+
nFeishuOn: "To your Feishu group, on your phone too.",
|
|
443
|
+
nTest: "Send a test",
|
|
444
|
+
nTestSent: "Sent; check that it arrived",
|
|
445
|
+
nFeishuConnect: "Connect Feishu",
|
|
446
|
+
nFeishuChange: "Use another bot",
|
|
447
|
+
nFeishuRemove: "Remove",
|
|
448
|
+
nFeishuRemoveConfirm: "Remove the Feishu bot? Reminders will no longer go to Feishu.",
|
|
449
|
+
nFeishuSaved: "Feishu is connected; the group should have a message.",
|
|
450
|
+
nFeishuSteps: [
|
|
451
|
+
"Create a Feishu group; just you is fine.",
|
|
452
|
+
'Group settings \u2192 Bots \u2192 Add bot \u2192 Custom bot; name it "\u5C0F\u79D8\u4E66".',
|
|
453
|
+
'Under security choose signature verification and copy the secret, or a custom keyword set to "\u5C0F\u79D8\u4E66".',
|
|
454
|
+
"Click Add, copy the webhook address and paste it below."
|
|
455
|
+
],
|
|
456
|
+
nWebhook: "Webhook address",
|
|
457
|
+
nSecret: "Signing secret (only with signature verification)",
|
|
458
|
+
nFeishuPrivacy: "What reminders say (titles and a short note) passes through Feishu's servers. The address and secret stay on this computer.",
|
|
459
|
+
nFeishuTry: "Connect and send a test",
|
|
460
|
+
nLast: (at, kind, results) => `Last reminder: ${at}, ${kind === "brief" ? "daily brief" : kind === "urgent" ? "urgent" : "test"}; ${results.map((r) => `${r.channel === "feishu" ? "Feishu" : "this computer"} ${r.ok ? "delivered" : `failed (${r.error ?? ""})`}`).join(", ")}`,
|
|
391
461
|
ai: "+AI",
|
|
392
462
|
aiTitle: "Ask AI in a chat: puts this into a new chat's input box, unsent; read it, then press send",
|
|
393
463
|
aiOpened: "Put into a new chat's input box; read it and press send",
|
|
@@ -446,7 +516,7 @@ function AskAI({ topic, lang, locale, openChat: openChat2, compact = false }) {
|
|
|
446
516
|
}
|
|
447
517
|
|
|
448
518
|
// src/client/Settings.tsx
|
|
449
|
-
var
|
|
519
|
+
var import_react4 = require("react");
|
|
450
520
|
|
|
451
521
|
// src/client/Modal.tsx
|
|
452
522
|
var import_react2 = require("react");
|
|
@@ -474,19 +544,162 @@ function Modal({ title, onClose, children }) {
|
|
|
474
544
|
);
|
|
475
545
|
}
|
|
476
546
|
|
|
477
|
-
// src/client/
|
|
547
|
+
// src/client/Notify.tsx
|
|
548
|
+
var import_react3 = require("react");
|
|
478
549
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
550
|
+
var browserZone = () => {
|
|
551
|
+
try {
|
|
552
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone ?? "";
|
|
553
|
+
} catch {
|
|
554
|
+
return "";
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
function NotifySection({ view, lang, locale, take }) {
|
|
558
|
+
const t = TEXT[lang];
|
|
559
|
+
const notify = view.notify.settings;
|
|
560
|
+
const [tested, setTested] = (0, import_react3.useState)({});
|
|
561
|
+
const [feishuOpen, setFeishuOpen] = (0, import_react3.useState)(false);
|
|
562
|
+
const save = async (patch) => take(await settingsApi.saveNotify(locale(), patch), t.sSaved);
|
|
563
|
+
(0, import_react3.useEffect)(() => {
|
|
564
|
+
const zone = browserZone();
|
|
565
|
+
if (notify.timeZone === "" && zone !== "") void settingsApi.saveNotify(locale(), { timeZone: zone }).then((r) => take(r));
|
|
566
|
+
}, [notify.timeZone, locale]);
|
|
567
|
+
const test = async (channel) => {
|
|
568
|
+
setTested({ ...tested, [channel]: { ok: true, text: t.sTesting } });
|
|
569
|
+
const r = await settingsApi.testNotify(locale(), channel);
|
|
570
|
+
setTested({ ...tested, [channel]: r.ok ? { ok: true, text: t.nTestSent } : { ok: false, text: r.message } });
|
|
571
|
+
};
|
|
572
|
+
const time = (value, onChange) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "time", step: 60, value, onChange: (e) => {
|
|
573
|
+
if (e.target.value !== "") onChange(e.target.value);
|
|
574
|
+
} });
|
|
575
|
+
const last = view.notify.last;
|
|
576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-notify-row", children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", checked: notify.brief.enabled, onChange: (e) => {
|
|
580
|
+
void save({ brief: { ...notify.brief, enabled: e.target.checked } });
|
|
581
|
+
} }),
|
|
582
|
+
t.nBrief
|
|
583
|
+
] }),
|
|
584
|
+
time(notify.brief.time, (value) => {
|
|
585
|
+
void save({ brief: { ...notify.brief, time: value } });
|
|
586
|
+
})
|
|
587
|
+
] }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-notify-row", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", checked: notify.urgent, onChange: (e) => {
|
|
590
|
+
void save({ urgent: e.target.checked });
|
|
591
|
+
} }),
|
|
592
|
+
t.nUrgent
|
|
593
|
+
] }) }),
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-notify-row", children: [
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", checked: notify.quiet.enabled, onChange: (e) => {
|
|
597
|
+
void save({ quiet: { ...notify.quiet, enabled: e.target.checked } });
|
|
598
|
+
} }),
|
|
599
|
+
t.nQuiet
|
|
600
|
+
] }),
|
|
601
|
+
time(notify.quiet.from, (value) => {
|
|
602
|
+
void save({ quiet: { ...notify.quiet, from: value } });
|
|
603
|
+
}),
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "mishu-hint", children: t.nTo }),
|
|
605
|
+
time(notify.quiet.to, (value) => {
|
|
606
|
+
void save({ quiet: { ...notify.quiet, to: value } });
|
|
607
|
+
})
|
|
608
|
+
] }),
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.nZone(notify.timeZone || browserZone()) }),
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t.nChannels }),
|
|
611
|
+
view.notify.channels.map((channel) => {
|
|
612
|
+
const result = tested[channel.id];
|
|
613
|
+
const feishu = channel.id === "feishu";
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-card", children: [
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-notify-row", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
617
|
+
"input",
|
|
618
|
+
{
|
|
619
|
+
type: "checkbox",
|
|
620
|
+
checked: channel.enabled,
|
|
621
|
+
disabled: !channel.available,
|
|
622
|
+
onChange: (e) => {
|
|
623
|
+
void save({ channels: { ...notify.channels, [channel.id]: e.target.checked } });
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
feishu ? t.nFeishu : t.nDesktop
|
|
628
|
+
] }) }),
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `mishu-card-note ${channel.available ? "" : "mishu-warn"}`, children: channel.available ? feishu ? t.nFeishuOn : t.nDesktopOn : channel.why }),
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
|
|
631
|
+
channel.available ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
|
|
632
|
+
void test(channel.id);
|
|
633
|
+
}, children: t.nTest }) : null,
|
|
634
|
+
feishu ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: view.notify.feishu.configured ? "mishu-btn" : "mishu-btn primary", onClick: () => setFeishuOpen(true), children: view.notify.feishu.configured ? t.nFeishuChange : t.nFeishuConnect }) : null,
|
|
635
|
+
feishu && view.notify.feishu.configured ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
|
|
636
|
+
if (window.confirm(t.nFeishuRemoveConfirm)) void settingsApi.deleteFeishu(locale()).then((r) => take(r));
|
|
637
|
+
}, children: t.nFeishuRemove }) : null,
|
|
638
|
+
result === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: result.ok ? "mishu-hint" : "mishu-hint mishu-danger", children: result.text })
|
|
639
|
+
] })
|
|
640
|
+
] }, channel.id);
|
|
641
|
+
}),
|
|
642
|
+
last === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.nLast(new Date(last.at).toLocaleString(), last.kind, last.results) }),
|
|
643
|
+
feishuOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FeishuDialog, { lang, locale, onDone: (next) => {
|
|
644
|
+
setFeishuOpen(false);
|
|
645
|
+
if (next !== void 0) take({ ok: true, view: next }, t.nFeishuSaved);
|
|
646
|
+
} }) : null
|
|
647
|
+
] });
|
|
648
|
+
}
|
|
649
|
+
function FeishuDialog({ lang, locale, onDone }) {
|
|
650
|
+
const t = TEXT[lang];
|
|
651
|
+
const [webhook, setWebhook] = (0, import_react3.useState)("");
|
|
652
|
+
const [secret, setSecret] = (0, import_react3.useState)("");
|
|
653
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
654
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
655
|
+
const connect = async () => {
|
|
656
|
+
setBusy(true);
|
|
657
|
+
setError(void 0);
|
|
658
|
+
const r = await settingsApi.saveFeishu(locale(), webhook, secret);
|
|
659
|
+
setBusy(false);
|
|
660
|
+
if (r.ok) onDone(r.view);
|
|
661
|
+
else setError(r.message);
|
|
662
|
+
};
|
|
663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Modal, { title: t.nFeishuConnect, onClose: () => onDone(), children: [
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-steps", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ol", { children: t.nFeishuSteps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: step }, i)) }) }),
|
|
665
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
|
|
666
|
+
t.nWebhook,
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { value: webhook, autoComplete: "off", spellCheck: false, placeholder: "https://open.feishu.cn/open-apis/bot/v2/hook/\u2026", onChange: (e) => {
|
|
668
|
+
setWebhook(e.target.value);
|
|
669
|
+
setError(void 0);
|
|
670
|
+
} })
|
|
671
|
+
] }),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
|
|
673
|
+
t.nSecret,
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "password", value: secret, autoComplete: "off", spellCheck: false, onChange: (e) => {
|
|
675
|
+
setSecret(e.target.value);
|
|
676
|
+
setError(void 0);
|
|
677
|
+
} })
|
|
678
|
+
] }),
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.nFeishuPrivacy }),
|
|
680
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-preview mishu-danger", children: error }),
|
|
681
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || webhook.trim() === "", onClick: () => {
|
|
683
|
+
void connect();
|
|
684
|
+
}, children: busy ? t.sTesting : t.nFeishuTry }),
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
|
|
686
|
+
] })
|
|
687
|
+
] });
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// src/client/Settings.tsx
|
|
691
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
479
692
|
var CATEGORIES = ["document", "bill", "birthday", "renewal", "other"];
|
|
480
693
|
function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
481
694
|
const t = TEXT[lang];
|
|
482
|
-
const [view, setView] = (0,
|
|
483
|
-
const [error, setError] = (0,
|
|
484
|
-
const [note, setNote] = (0,
|
|
485
|
-
const [lead, setLead] = (0,
|
|
486
|
-
const [githubTest, setGithubTest] = (0,
|
|
487
|
-
const [confirmOn, setConfirmOn] = (0,
|
|
488
|
-
const [pasting, setPasting] = (0,
|
|
489
|
-
const [editing, setEditing] = (0,
|
|
695
|
+
const [view, setView] = (0, import_react4.useState)();
|
|
696
|
+
const [error, setError] = (0, import_react4.useState)();
|
|
697
|
+
const [note, setNote] = (0, import_react4.useState)();
|
|
698
|
+
const [lead, setLead] = (0, import_react4.useState)({});
|
|
699
|
+
const [githubTest, setGithubTest] = (0, import_react4.useState)();
|
|
700
|
+
const [confirmOn, setConfirmOn] = (0, import_react4.useState)(false);
|
|
701
|
+
const [pasting, setPasting] = (0, import_react4.useState)(false);
|
|
702
|
+
const [editing, setEditing] = (0, import_react4.useState)();
|
|
490
703
|
const take = (result, saved) => {
|
|
491
704
|
if (result.ok) {
|
|
492
705
|
setView(result.view);
|
|
@@ -497,11 +710,11 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
497
710
|
setError(result.message);
|
|
498
711
|
}
|
|
499
712
|
};
|
|
500
|
-
(0,
|
|
713
|
+
(0, import_react4.useEffect)(() => {
|
|
501
714
|
void settingsApi.load(locale()).then((r) => take(r));
|
|
502
715
|
}, [locale]);
|
|
503
716
|
if (view === void 0) {
|
|
504
|
-
return /* @__PURE__ */ (0,
|
|
717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-settings", children: error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-error", children: [
|
|
505
718
|
t.failed,
|
|
506
719
|
error
|
|
507
720
|
] }) });
|
|
@@ -509,92 +722,72 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
509
722
|
const save = async (settings) => take(await settingsApi.save(locale(), settings), t.sSaved);
|
|
510
723
|
const token = view.github.token;
|
|
511
724
|
const secretKind = t.secretKinds[view.secrets.kind] ?? view.secrets.kind;
|
|
512
|
-
|
|
513
|
-
|
|
725
|
+
const markRead = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
727
|
+
t.sMarkRead,
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { value: view.settings.markRead, onChange: (e) => {
|
|
729
|
+
const value = e.target.value;
|
|
730
|
+
if (value === "on") setConfirmOn(true);
|
|
731
|
+
else void save({ markRead: value });
|
|
732
|
+
}, children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "off", children: t.sMarkOff }),
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "shadow", children: t.sMarkShadow }),
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "on", children: t.sMarkOn })
|
|
736
|
+
] })
|
|
737
|
+
] }),
|
|
738
|
+
confirmOn ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-banner", children: [
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: t.sMarkConfirm }),
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
742
|
+
setConfirmOn(false);
|
|
743
|
+
void save({ markRead: "on" });
|
|
744
|
+
}, children: t.sConfirm }),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setConfirmOn(false), children: t.sCancel })
|
|
746
|
+
] })
|
|
747
|
+
] }) : null
|
|
748
|
+
] });
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-settings", children: [
|
|
750
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-error", children: [
|
|
514
751
|
t.failed,
|
|
515
752
|
error
|
|
516
753
|
] }),
|
|
517
|
-
note === void 0 ? null : /* @__PURE__ */ (0,
|
|
518
|
-
/* @__PURE__ */ (0,
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
520
|
-
/* @__PURE__ */ (0,
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}, children: [
|
|
525
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "auto", children: t.sLanguageAuto }),
|
|
526
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "zh", children: "\u4E2D\u6587" }),
|
|
527
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "en", children: "English" })
|
|
528
|
-
] })
|
|
529
|
-
] }),
|
|
530
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-field", children: t.sLead }),
|
|
531
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-grid5", children: CATEGORIES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
|
|
532
|
-
t.categories[c],
|
|
533
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "number", min: 0, max: 366, value: lead[c] ?? 0, onChange: (e) => setLead({ ...lead, [c]: Number(e.target.value) }) })
|
|
534
|
-
] }, c)) }),
|
|
535
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
536
|
-
void save({ leadDays: lead });
|
|
537
|
-
}, children: t.sSave })
|
|
538
|
-
] }),
|
|
539
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "mishu-panel", children: [
|
|
540
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t.sGithub }),
|
|
541
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
|
|
542
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", checked: view.settings.githubEnabled, onChange: (e) => {
|
|
754
|
+
note === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-ok", children: note }),
|
|
755
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "mishu-panel", children: [
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: t.bSources }),
|
|
757
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.bSourcesHint }),
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t.sGithub }),
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-check", children: [
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", checked: view.settings.githubEnabled, onChange: (e) => {
|
|
543
761
|
void save({ githubEnabled: e.target.checked });
|
|
544
762
|
} }),
|
|
545
763
|
t.sGithubOn
|
|
546
764
|
] }),
|
|
547
|
-
/* @__PURE__ */ (0,
|
|
548
|
-
/* @__PURE__ */ (0,
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row-explain", children: [
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-row-label", children: t.sToken }),
|
|
767
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: token.found ? "" : "mishu-danger", children: token.found ? token.from === "env" ? t.sTokenEnv(view.github.tokenEnv) : token.from === "keychain" ? t.sTokenKeychain : t.sTokenGh : token.text })
|
|
550
768
|
] }),
|
|
551
|
-
token.found ? /* @__PURE__ */ (0,
|
|
552
|
-
/* @__PURE__ */ (0,
|
|
769
|
+
token.found ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
|
|
553
771
|
setGithubTest(t.sTesting);
|
|
554
772
|
void settingsApi.testGithub(locale()).then((r) => setGithubTest(r.ok ? t.sGithubOk(r.login) : `${t.failed}${r.message}`));
|
|
555
773
|
}, children: t.sTest }),
|
|
556
|
-
token.from === "env" || pasting ? null : /* @__PURE__ */ (0,
|
|
557
|
-
token.from === "keychain" ? /* @__PURE__ */ (0,
|
|
774
|
+
token.from === "env" || pasting ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setPasting(true), children: t.sTokenReplace }),
|
|
775
|
+
token.from === "keychain" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
|
|
558
776
|
if (window.confirm(t.sTokenRemoveConfirm)) void settingsApi.deleteToken(locale()).then((r) => {
|
|
559
777
|
setGithubTest(void 0);
|
|
560
778
|
take(r);
|
|
561
779
|
});
|
|
562
780
|
}, children: t.sTokenRemove }) : null,
|
|
563
|
-
githubTest === void 0 ? null : /* @__PURE__ */ (0,
|
|
781
|
+
githubTest === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-hint", children: githubTest })
|
|
564
782
|
] }) : null,
|
|
565
|
-
!token.found || pasting ? /* @__PURE__ */ (0,
|
|
783
|
+
!token.found || pasting ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GithubConnect, { view, lang, locale, onSaved: (next, login) => {
|
|
566
784
|
setPasting(false);
|
|
567
785
|
setGithubTest(t.sTokenSaved(login));
|
|
568
786
|
take({ ok: true, view: next });
|
|
569
787
|
}, onCancel: token.found ? () => setPasting(false) : void 0 }) : null,
|
|
570
|
-
/* @__PURE__ */ (0,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const value = e.target.value;
|
|
574
|
-
if (value === "on") setConfirmOn(true);
|
|
575
|
-
else void save({ markRead: value });
|
|
576
|
-
}, children: [
|
|
577
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "off", children: t.sMarkOff }),
|
|
578
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "shadow", children: t.sMarkShadow }),
|
|
579
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "on", children: t.sMarkOn })
|
|
580
|
-
] })
|
|
581
|
-
] }),
|
|
582
|
-
confirmOn ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-banner", children: [
|
|
583
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: t.sMarkConfirm }),
|
|
584
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
|
|
585
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
586
|
-
setConfirmOn(false);
|
|
587
|
-
void save({ markRead: "on" });
|
|
588
|
-
}, children: t.sConfirm }),
|
|
589
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setConfirmOn(false), children: t.sCancel })
|
|
590
|
-
] })
|
|
591
|
-
] }) : null
|
|
592
|
-
] }),
|
|
593
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "mishu-panel", children: [
|
|
594
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t.sMail }),
|
|
595
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.sMailPrivacy }),
|
|
596
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: view.secrets.available && view.secrets.file === void 0 ? "mishu-hint" : "mishu-hint mishu-warn", children: !view.secrets.available ? t.sSecretsNone(view.secrets.why ?? secretKind) : view.secrets.file !== void 0 ? t.sSecretsFile(view.secrets.file.path, view.secrets.file.why) : t.sSecretsAt(secretKind) }),
|
|
597
|
-
view.accounts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-empty", children: t.sNoAccounts }) : view.accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
788
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t.sMail }),
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.sMailPrivacy }),
|
|
790
|
+
view.accounts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-empty", children: t.sNoAccounts }) : view.accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
598
791
|
AccountRow,
|
|
599
792
|
{
|
|
600
793
|
account,
|
|
@@ -607,8 +800,8 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
607
800
|
},
|
|
608
801
|
account.id
|
|
609
802
|
)),
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
611
|
-
editing === void 0 ? null : /* @__PURE__ */ (0,
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setEditing({ preset: "custom", sinceDays: 14, enabled: true }), children: t.sAddAccount }),
|
|
804
|
+
editing === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
612
805
|
MailDialog,
|
|
613
806
|
{
|
|
614
807
|
draft: editing,
|
|
@@ -623,25 +816,56 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
623
816
|
}
|
|
624
817
|
)
|
|
625
818
|
] }),
|
|
626
|
-
/* @__PURE__ */ (0,
|
|
627
|
-
/* @__PURE__ */ (0,
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "mishu-panel", children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: t.bWhat }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.bUrgentRule }),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-field", children: t.sLead }),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-grid5", children: CATEGORIES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
824
|
+
t.categories[c],
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", min: 0, max: 366, value: lead[c] ?? 0, onChange: (e) => setLead({ ...lead, [c]: Number(e.target.value) }) })
|
|
826
|
+
] }, c)) }),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
828
|
+
void save({ leadDays: lead });
|
|
829
|
+
}, children: t.sSave })
|
|
830
|
+
] }),
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "mishu-panel", children: [
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: t.bWhen }),
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NotifySection, { view, lang, locale, take })
|
|
834
|
+
] }),
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "mishu-panel", children: [
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: t.bDo }),
|
|
837
|
+
markRead,
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.bMailReadOnly })
|
|
839
|
+
] }),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "mishu-panel", children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: t.sGeneral }),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
843
|
+
t.sLanguage,
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { value: view.settings.language, onChange: (e) => {
|
|
845
|
+
void save({ language: e.target.value });
|
|
846
|
+
}, children: [
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "auto", children: t.sLanguageAuto }),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "zh", children: "\u4E2D\u6587" }),
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "en", children: "English" })
|
|
850
|
+
] })
|
|
851
|
+
] }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: view.secrets.available && view.secrets.file === void 0 ? "mishu-hint" : "mishu-hint mishu-warn", children: !view.secrets.available ? t.sSecretsNone(view.secrets.why ?? secretKind) : view.secrets.file !== void 0 ? t.sSecretsFile(view.secrets.file.path, view.secrets.file.why) : t.sSecretsAt(secretKind) })
|
|
629
853
|
] })
|
|
630
854
|
] });
|
|
631
855
|
}
|
|
632
856
|
function GithubConnect({ view, lang, locale, onSaved, onCancel }) {
|
|
633
857
|
const t = TEXT[lang];
|
|
634
|
-
const [signingIn, setSigningIn] = (0,
|
|
635
|
-
const [paste, setPaste] = (0,
|
|
636
|
-
if (!view.github.deviceLogin) return /* @__PURE__ */ (0,
|
|
637
|
-
return /* @__PURE__ */ (0,
|
|
638
|
-
/* @__PURE__ */ (0,
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
640
|
-
paste ? null : /* @__PURE__ */ (0,
|
|
641
|
-
onCancel === void 0 ? null : /* @__PURE__ */ (0,
|
|
858
|
+
const [signingIn, setSigningIn] = (0, import_react4.useState)(false);
|
|
859
|
+
const [paste, setPaste] = (0, import_react4.useState)(!view.github.deviceLogin);
|
|
860
|
+
if (!view.github.deviceLogin) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel });
|
|
861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => setSigningIn(true), children: t.gLogin }),
|
|
864
|
+
paste ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => setPaste(true), children: t.gPasteInstead }),
|
|
865
|
+
onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
|
|
642
866
|
] }),
|
|
643
|
-
paste ? /* @__PURE__ */ (0,
|
|
644
|
-
signingIn ? /* @__PURE__ */ (0,
|
|
867
|
+
paste ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel: void 0 }) : null,
|
|
868
|
+
signingIn ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GithubLoginDialog, { lang, locale, onClose: () => setSigningIn(false), onSaved: (next, login) => {
|
|
645
869
|
setSigningIn(false);
|
|
646
870
|
onSaved(next, login);
|
|
647
871
|
} }) : null
|
|
@@ -649,12 +873,12 @@ function GithubConnect({ view, lang, locale, onSaved, onCancel }) {
|
|
|
649
873
|
}
|
|
650
874
|
function GithubLoginDialog({ lang, locale, onClose, onSaved }) {
|
|
651
875
|
const t = TEXT[lang];
|
|
652
|
-
const [login, setLogin] = (0,
|
|
653
|
-
const [error, setError] = (0,
|
|
654
|
-
const [copied, setCopied] = (0,
|
|
655
|
-
const [attempt, setAttempt] = (0,
|
|
656
|
-
const saved = (0,
|
|
657
|
-
(0,
|
|
876
|
+
const [login, setLogin] = (0, import_react4.useState)();
|
|
877
|
+
const [error, setError] = (0, import_react4.useState)();
|
|
878
|
+
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
879
|
+
const [attempt, setAttempt] = (0, import_react4.useState)(0);
|
|
880
|
+
const saved = (0, import_react4.useRef)(void 0);
|
|
881
|
+
(0, import_react4.useEffect)(() => {
|
|
658
882
|
let alive = true;
|
|
659
883
|
let timer;
|
|
660
884
|
setLogin(void 0);
|
|
@@ -698,42 +922,42 @@ function GithubLoginDialog({ lang, locale, onClose, onSaved }) {
|
|
|
698
922
|
const copy2 = (code) => {
|
|
699
923
|
void navigator.clipboard?.writeText(code).then(() => setCopied(true), () => setCopied(false));
|
|
700
924
|
};
|
|
701
|
-
return /* @__PURE__ */ (0,
|
|
702
|
-
/* @__PURE__ */ (0,
|
|
703
|
-
/* @__PURE__ */ (0,
|
|
704
|
-
] }) : login === void 0 || login.state === "idle" ? /* @__PURE__ */ (0,
|
|
705
|
-
/* @__PURE__ */ (0,
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
707
|
-
/* @__PURE__ */ (0,
|
|
708
|
-
/* @__PURE__ */ (0,
|
|
925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Modal, { title: t.gLogin, onClose: close, children: error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-preview mishu-danger", children: error }),
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose }) })
|
|
928
|
+
] }) : login === void 0 || login.state === "idle" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.gStarting }) : login.state === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-field", children: t.gStep1 }),
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-code-row", children: [
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { className: "mishu-code", children: login.userCode }),
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => copy2(login.userCode), children: copied ? t.gCopied : t.gCopy })
|
|
709
933
|
] }),
|
|
710
|
-
/* @__PURE__ */ (0,
|
|
711
|
-
/* @__PURE__ */ (0,
|
|
712
|
-
/* @__PURE__ */ (0,
|
|
713
|
-
/* @__PURE__ */ (0,
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-field", children: t.gStep2 }),
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => window.open(login.verificationUri, "_blank", "noopener"), children: t.gOpen }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-hint", children: t.gWaiting })
|
|
714
938
|
] }),
|
|
715
|
-
/* @__PURE__ */ (0,
|
|
716
|
-
] }) : login.state === "done" ? /* @__PURE__ */ (0,
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
718
|
-
/* @__PURE__ */ (0,
|
|
719
|
-
] }) : /* @__PURE__ */ (0,
|
|
720
|
-
/* @__PURE__ */ (0,
|
|
721
|
-
/* @__PURE__ */ (0,
|
|
722
|
-
/* @__PURE__ */ (0,
|
|
939
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.gScopes })
|
|
940
|
+
] }) : login.state === "done" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-ok", children: t.gDone(login.login) }),
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: close, children: t.gClose }) })
|
|
943
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-preview mishu-danger", children: login.message }),
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
723
947
|
setCopied(false);
|
|
724
948
|
setAttempt(attempt + 1);
|
|
725
949
|
}, children: t.gRetry }),
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose })
|
|
727
951
|
] })
|
|
728
952
|
] }) });
|
|
729
953
|
}
|
|
730
954
|
function TokenForm({ view, lang, locale, onSaved, onCancel }) {
|
|
731
955
|
const t = TEXT[lang];
|
|
732
|
-
const [token, setToken] = (0,
|
|
733
|
-
const [busy, setBusy] = (0,
|
|
734
|
-
const [message, setMessage] = (0,
|
|
956
|
+
const [token, setToken] = (0, import_react4.useState)("");
|
|
957
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
958
|
+
const [message, setMessage] = (0, import_react4.useState)();
|
|
735
959
|
if (!view.secrets.available) {
|
|
736
|
-
return /* @__PURE__ */ (0,
|
|
960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sTokenNoKeychain(view.github.tokenEnv, view.secrets.why ?? "") });
|
|
737
961
|
}
|
|
738
962
|
const save = async () => {
|
|
739
963
|
setBusy(true);
|
|
@@ -747,58 +971,58 @@ function TokenForm({ view, lang, locale, onSaved, onCancel }) {
|
|
|
747
971
|
setMessage(r.message);
|
|
748
972
|
}
|
|
749
973
|
};
|
|
750
|
-
return /* @__PURE__ */ (0,
|
|
751
|
-
/* @__PURE__ */ (0,
|
|
974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-add", children: [
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
752
976
|
t.sTokenPaste,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "password", value: token, autoComplete: "off", spellCheck: false, placeholder: "ghp_\u2026", onChange: (e) => {
|
|
754
978
|
setToken(e.target.value);
|
|
755
979
|
setMessage(void 0);
|
|
756
980
|
} })
|
|
757
981
|
] }),
|
|
758
|
-
/* @__PURE__ */ (0,
|
|
759
|
-
message === void 0 ? null : /* @__PURE__ */ (0,
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
761
|
-
/* @__PURE__ */ (0,
|
|
762
|
-
/* @__PURE__ */ (0,
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.sTokenHow }),
|
|
983
|
+
message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-preview mishu-danger", children: message }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(view.github.newTokenUrl, "_blank", "noopener"), children: t.sTokenNew }),
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || token.trim() === "", onClick: () => {
|
|
763
987
|
void save();
|
|
764
988
|
}, children: busy ? t.sTesting : t.sTokenSave }),
|
|
765
|
-
onCancel === void 0 ? null : /* @__PURE__ */ (0,
|
|
989
|
+
onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
|
|
766
990
|
] })
|
|
767
991
|
] });
|
|
768
992
|
}
|
|
769
993
|
function AccountRow({ account, secretsOk, lang, locale, openChat: openChat2, onEdit, onView }) {
|
|
770
994
|
const t = TEXT[lang];
|
|
771
|
-
const [busy, setBusy] = (0,
|
|
995
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
772
996
|
const report = account.report;
|
|
773
997
|
const status = !account.hasPassword ? secretsOk ? t.sNoPassword : t.sEnvHint(account.envName) : report === null ? t.sNeverChecked : report.error !== void 0 ? report.error[lang] : lang === "zh" ? `${new Date(report.at).toLocaleString()} \u6536\u4FE1\uFF0C${report.messages} \u5C01\u672A\u8BFB` : `checked ${new Date(report.at).toLocaleString()}, ${report.messages} unread`;
|
|
774
998
|
const failed = !account.hasPassword || report?.error !== void 0;
|
|
775
|
-
return /* @__PURE__ */ (0,
|
|
776
|
-
/* @__PURE__ */ (0,
|
|
999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-card", children: [
|
|
1000
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-card-title", children: [
|
|
777
1001
|
account.label,
|
|
778
1002
|
account.enabled ? "" : ` (${lang === "zh" ? "\u5DF2\u505C\u7528" : "disabled"})`
|
|
779
1003
|
] }),
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-card-meta", children: [
|
|
781
1005
|
account.address,
|
|
782
1006
|
" \xB7 ",
|
|
783
1007
|
account.host,
|
|
784
1008
|
":",
|
|
785
1009
|
account.port
|
|
786
1010
|
] }),
|
|
787
|
-
account.mismatch === null ? null : /* @__PURE__ */ (0,
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
1011
|
+
account.mismatch === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-card-note mishu-warn", children: account.mismatch }),
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `mishu-card-note ${failed ? "mishu-danger" : ""}`, children: [
|
|
789
1013
|
status,
|
|
790
|
-
account.hasPassword && report?.error !== void 0 ? /* @__PURE__ */ (0,
|
|
1014
|
+
account.hasPassword && report?.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: { kind: "mail-error", accountId: account.id }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
791
1015
|
] }),
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy || !account.hasPassword, onClick: () => {
|
|
794
1018
|
setBusy(true);
|
|
795
1019
|
void settingsApi.syncMail(locale(), account.id).then((r) => {
|
|
796
1020
|
setBusy(false);
|
|
797
1021
|
onView(r);
|
|
798
1022
|
});
|
|
799
1023
|
}, children: busy ? t.sTesting : t.sCheckNow }),
|
|
800
|
-
/* @__PURE__ */ (0,
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: account.hasPassword && account.mismatch === null ? "mishu-btn" : "mishu-btn primary", onClick: onEdit, children: t.sEdit }),
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
|
|
802
1026
|
if (window.confirm(t.sDeleteConfirm)) void settingsApi.deleteMail(locale(), account.id).then(onView);
|
|
803
1027
|
}, children: t.sDelete })
|
|
804
1028
|
] })
|
|
@@ -807,12 +1031,12 @@ function AccountRow({ account, secretsOk, lang, locale, openChat: openChat2, onE
|
|
|
807
1031
|
function MailDialog({ draft, view, lang, locale, openChat: openChat2, onDone }) {
|
|
808
1032
|
const t = TEXT[lang];
|
|
809
1033
|
const existing = draft.id !== void 0;
|
|
810
|
-
const [account, setAccount] = (0,
|
|
811
|
-
const [picked, setPicked] = (0,
|
|
812
|
-
const [password, setPassword] = (0,
|
|
813
|
-
const [message, setMessage] = (0,
|
|
814
|
-
const [failedTest, setFailedTest] = (0,
|
|
815
|
-
const [busy, setBusy] = (0,
|
|
1034
|
+
const [account, setAccount] = (0, import_react4.useState)(draft);
|
|
1035
|
+
const [picked, setPicked] = (0, import_react4.useState)(existing);
|
|
1036
|
+
const [password, setPassword] = (0, import_react4.useState)("");
|
|
1037
|
+
const [message, setMessage] = (0, import_react4.useState)();
|
|
1038
|
+
const [failedTest, setFailedTest] = (0, import_react4.useState)(false);
|
|
1039
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
816
1040
|
const preset = view.presets.find((p) => p.id === account.preset) ?? view.presets[view.presets.length - 1];
|
|
817
1041
|
const custom = preset.id === "custom";
|
|
818
1042
|
const set = (patch) => {
|
|
@@ -845,93 +1069,93 @@ function MailDialog({ draft, view, lang, locale, openChat: openChat2, onDone })
|
|
|
845
1069
|
setMessage({ ok: false, text: r.message });
|
|
846
1070
|
}
|
|
847
1071
|
};
|
|
848
|
-
return /* @__PURE__ */ (0,
|
|
849
|
-
/* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Modal, { title: existing ? t.mTitleEdit : t.mTitleAdd, onClose: () => onDone(), children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
850
1074
|
t.sAddress,
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "email", value: account.address ?? "", autoComplete: "off", autoFocus: !existing, onChange: (e) => setAddress(e.target.value) })
|
|
852
1076
|
] }),
|
|
853
|
-
/* @__PURE__ */ (0,
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
854
1078
|
t.sProvider,
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { value: account.preset, onChange: (e) => {
|
|
856
1080
|
setPicked(true);
|
|
857
1081
|
set({ preset: e.target.value });
|
|
858
|
-
}, children: view.presets.map((p) => /* @__PURE__ */ (0,
|
|
1082
|
+
}, children: view.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: p.id, children: p.label }, p.id)) })
|
|
859
1083
|
] }),
|
|
860
|
-
/* @__PURE__ */ (0,
|
|
861
|
-
preset.steps.length === 0 ? preset.howTo : /* @__PURE__ */ (0,
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `mishu-steps${preset.supported ? "" : " mishu-danger"}${failedTest ? " attention" : ""}`, children: [
|
|
1085
|
+
preset.steps.length === 0 ? preset.howTo : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ol", { children: preset.steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { children: [
|
|
862
1086
|
step.text,
|
|
863
|
-
step.link === void 0 ? null : /* @__PURE__ */ (0,
|
|
1087
|
+
step.link === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
864
1088
|
" ",
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(step.link.url, "_blank", "noopener"), children: step.link.label })
|
|
866
1090
|
] })
|
|
867
1091
|
] }, i)) }),
|
|
868
|
-
preset.supported ? /* @__PURE__ */ (0,
|
|
1092
|
+
preset.supported ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-steps-help", children: [
|
|
869
1093
|
t.mStepsHelp,
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id }, lang, locale, openChat: openChat2, compact: true })
|
|
871
1095
|
] }) : null
|
|
872
1096
|
] }),
|
|
873
|
-
/* @__PURE__ */ (0,
|
|
1097
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
874
1098
|
t.sPassword,
|
|
875
|
-
/* @__PURE__ */ (0,
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "password", value: password, autoComplete: "new-password", placeholder: existing && view.secrets.available ? t.sPasswordKeep : "", onChange: (e) => {
|
|
876
1100
|
setPassword(e.target.value);
|
|
877
1101
|
setMessage(void 0);
|
|
878
1102
|
setFailedTest(false);
|
|
879
1103
|
} })
|
|
880
1104
|
] }),
|
|
881
|
-
lengthOff ? /* @__PURE__ */ (0,
|
|
882
|
-
view.secrets.available ? null : /* @__PURE__ */ (0,
|
|
883
|
-
custom ? /* @__PURE__ */ (0,
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
1105
|
+
lengthOff ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint mishu-warn", children: t.mLength(preset.label, preset.passwordLength, typed.length) }) : null,
|
|
1106
|
+
view.secrets.available ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sPasswordTestOnly }),
|
|
1107
|
+
custom ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row", children: [
|
|
1108
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
885
1109
|
t.sHost,
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: account.host ?? "", placeholder: "imap.example.com", onChange: (e) => set({ host: e.target.value }) })
|
|
887
1111
|
] }),
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
889
1113
|
t.sPort,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", value: account.port ?? 993, onChange: (e) => set({ port: Number(e.target.value) }) })
|
|
891
1115
|
] })
|
|
892
1116
|
] }) : null,
|
|
893
|
-
/* @__PURE__ */ (0,
|
|
894
|
-
/* @__PURE__ */ (0,
|
|
895
|
-
/* @__PURE__ */ (0,
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { className: "mishu-more", children: [
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("summary", { children: t.mMore }),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row", children: [
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
897
1121
|
t.sLabel,
|
|
898
|
-
/* @__PURE__ */ (0,
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: account.label ?? "", placeholder: account.address ?? "", onChange: (e) => set({ label: e.target.value }) })
|
|
899
1123
|
] }),
|
|
900
|
-
/* @__PURE__ */ (0,
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
901
1125
|
t.sUser,
|
|
902
|
-
/* @__PURE__ */ (0,
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: account.user ?? "", placeholder: account.address ?? "", autoComplete: "off", onChange: (e) => set({ user: e.target.value }) })
|
|
903
1127
|
] })
|
|
904
1128
|
] }),
|
|
905
|
-
/* @__PURE__ */ (0,
|
|
906
|
-
/* @__PURE__ */ (0,
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row", children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
|
|
907
1131
|
t.sSince,
|
|
908
|
-
/* @__PURE__ */ (0,
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", min: 1, max: 90, value: account.sinceDays ?? 14, onChange: (e) => set({ sinceDays: Number(e.target.value) }) })
|
|
909
1133
|
] }),
|
|
910
|
-
/* @__PURE__ */ (0,
|
|
911
|
-
/* @__PURE__ */ (0,
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-check", children: [
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", checked: account.enabled !== false, onChange: (e) => set({ enabled: e.target.checked }) }),
|
|
912
1136
|
t.sEnabled
|
|
913
1137
|
] })
|
|
914
1138
|
] })
|
|
915
1139
|
] }),
|
|
916
|
-
message === void 0 ? null : /* @__PURE__ */ (0,
|
|
1140
|
+
message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `mishu-preview ${message.ok ? "" : "mishu-danger"}`, children: [
|
|
917
1141
|
message.text,
|
|
918
|
-
message.ok || !preset.supported ? null : /* @__PURE__ */ (0,
|
|
1142
|
+
message.ok || !preset.supported ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id, error: message.text }, lang, locale, openChat: openChat2, compact: true })
|
|
919
1143
|
] }),
|
|
920
|
-
/* @__PURE__ */ (0,
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || !preset.supported || (account.address ?? "") === "", onClick: () => {
|
|
922
1146
|
void testAndSave();
|
|
923
1147
|
}, children: busy ? t.sTesting : t.mTestSave }),
|
|
924
|
-
failedTest ? /* @__PURE__ */ (0,
|
|
1148
|
+
failedTest ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", disabled: busy, onClick: () => {
|
|
925
1149
|
setBusy(true);
|
|
926
1150
|
void save();
|
|
927
1151
|
}, children: t.mSaveAnyway }) : null,
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
|
|
929
1153
|
] })
|
|
930
1154
|
] });
|
|
931
1155
|
}
|
|
932
1156
|
|
|
933
1157
|
// src/client/Board.tsx
|
|
934
|
-
var
|
|
1158
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
935
1159
|
var SOURCE_KEY = "dsh-mishu.source";
|
|
936
1160
|
function loadSource() {
|
|
937
1161
|
try {
|
|
@@ -967,14 +1191,15 @@ function saveWidths(widths) {
|
|
|
967
1191
|
}
|
|
968
1192
|
}
|
|
969
1193
|
function MishuBoard({ locale, openChat: openChat2 }) {
|
|
970
|
-
const [board, setBoard] = (0,
|
|
971
|
-
const [error, setError] = (0,
|
|
972
|
-
const [busy, setBusy] = (0,
|
|
973
|
-
const [syncing, setSyncing] = (0,
|
|
974
|
-
const [dropOn, setDropOn] = (0,
|
|
975
|
-
const [widths, setWidths] = (0,
|
|
976
|
-
const [tab, setTab] = (0,
|
|
977
|
-
const [
|
|
1194
|
+
const [board, setBoard] = (0, import_react5.useState)();
|
|
1195
|
+
const [error, setError] = (0, import_react5.useState)();
|
|
1196
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
1197
|
+
const [syncing, setSyncing] = (0, import_react5.useState)(false);
|
|
1198
|
+
const [dropOn, setDropOn] = (0, import_react5.useState)();
|
|
1199
|
+
const [widths, setWidths] = (0, import_react5.useState)(loadWidths);
|
|
1200
|
+
const [tab, setTab] = (0, import_react5.useState)("board");
|
|
1201
|
+
const [openCard, setOpenCard] = (0, import_react5.useState)();
|
|
1202
|
+
const [source, setSourceState] = (0, import_react5.useState)(loadSource);
|
|
978
1203
|
const setSource = (next) => {
|
|
979
1204
|
setSourceState(next);
|
|
980
1205
|
try {
|
|
@@ -982,11 +1207,11 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
982
1207
|
} catch {
|
|
983
1208
|
}
|
|
984
1209
|
};
|
|
985
|
-
const dragged = (0,
|
|
986
|
-
const columnsRef = (0,
|
|
1210
|
+
const dragged = (0, import_react5.useRef)(void 0);
|
|
1211
|
+
const columnsRef = (0, import_react5.useRef)(null);
|
|
987
1212
|
const lang = board?.lang ?? uiLang(locale());
|
|
988
1213
|
const t = TEXT[lang];
|
|
989
|
-
const take = (0,
|
|
1214
|
+
const take = (0, import_react5.useCallback)((result) => {
|
|
990
1215
|
if (result.ok) {
|
|
991
1216
|
setBoard(result.board);
|
|
992
1217
|
setError(void 0);
|
|
@@ -994,8 +1219,8 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
994
1219
|
setError(result.message);
|
|
995
1220
|
}
|
|
996
1221
|
}, []);
|
|
997
|
-
const load = (0,
|
|
998
|
-
(0,
|
|
1222
|
+
const load = (0, import_react5.useCallback)(() => mishuApi.board(locale()).then(take), [locale, take]);
|
|
1223
|
+
(0, import_react5.useEffect)(() => {
|
|
999
1224
|
void load();
|
|
1000
1225
|
const timer = setInterval(() => {
|
|
1001
1226
|
void load();
|
|
@@ -1085,7 +1310,12 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1085
1310
|
reopen: t.reopen,
|
|
1086
1311
|
stop: t.stop
|
|
1087
1312
|
};
|
|
1088
|
-
const
|
|
1313
|
+
const cardKey = (item) => `${item.target}-${item.id}`;
|
|
1314
|
+
const toggleCard = (item) => {
|
|
1315
|
+
const key = cardKey(item);
|
|
1316
|
+
setOpenCard((current) => current === key ? void 0 : key);
|
|
1317
|
+
};
|
|
1318
|
+
const card = (item, column) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1089
1319
|
Card,
|
|
1090
1320
|
{
|
|
1091
1321
|
item,
|
|
@@ -1095,6 +1325,8 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1095
1325
|
busy,
|
|
1096
1326
|
label,
|
|
1097
1327
|
openChat: openChat2,
|
|
1328
|
+
open: openCard === cardKey(item),
|
|
1329
|
+
onToggle: () => toggleCard(item),
|
|
1098
1330
|
onAct: (action) => {
|
|
1099
1331
|
void act(item, action);
|
|
1100
1332
|
},
|
|
@@ -1106,15 +1338,15 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1106
1338
|
setDropOn(void 0);
|
|
1107
1339
|
}
|
|
1108
1340
|
},
|
|
1109
|
-
|
|
1341
|
+
cardKey(item)
|
|
1110
1342
|
);
|
|
1111
1343
|
if (board === void 0) {
|
|
1112
|
-
return /* @__PURE__ */ (0,
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
1114
|
-
/* @__PURE__ */ (0,
|
|
1115
|
-
/* @__PURE__ */ (0,
|
|
1344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-page", children: [
|
|
1345
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-head", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-title", children: [
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: t.title }),
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RestartButton, { lang, locale })
|
|
1116
1348
|
] }) }),
|
|
1117
|
-
error === void 0 ? /* @__PURE__ */ (0,
|
|
1349
|
+
error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-error", children: [
|
|
1118
1350
|
t.failed,
|
|
1119
1351
|
error
|
|
1120
1352
|
] })
|
|
@@ -1139,7 +1371,7 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1139
1371
|
{ id: "manual", label: t.sourceManual }
|
|
1140
1372
|
];
|
|
1141
1373
|
const template = `minmax(0, ${widths[0]}fr) 10px minmax(0, ${widths[1]}fr) 10px minmax(0, ${widths[2]}fr)`;
|
|
1142
|
-
const divider = (index) => /* @__PURE__ */ (0,
|
|
1374
|
+
const divider = (index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1143
1375
|
"div",
|
|
1144
1376
|
{
|
|
1145
1377
|
className: "mishu-divider",
|
|
@@ -1150,133 +1382,135 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1150
1382
|
onDoubleClick: resetWidths
|
|
1151
1383
|
}
|
|
1152
1384
|
);
|
|
1153
|
-
return /* @__PURE__ */ (0,
|
|
1154
|
-
/* @__PURE__ */ (0,
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1156
|
-
/* @__PURE__ */ (0,
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-page", "data-mishu-board": "", children: [
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-head", children: [
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-title", children: [
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: t.title }),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-tabs", role: "tablist", children: [
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "board", className: tab === "board" ? "active" : "", onClick: () => setTab("board"), children: t.tabBoard }),
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "settings", className: tab === "settings" ? "active" : "", onClick: () => setTab("settings"), children: t.tabSettings })
|
|
1160
1392
|
] }),
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RestartButton, { lang, locale })
|
|
1162
1394
|
] }),
|
|
1163
|
-
/* @__PURE__ */ (0,
|
|
1164
|
-
/* @__PURE__ */ (0,
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-sources", children: [
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1397
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("i", { className: `mishu-dot ${board.sources.github.state}` }),
|
|
1166
1398
|
board.sources.github.text,
|
|
1167
|
-
board.sources.github.state === "error" ? /* @__PURE__ */ (0,
|
|
1399
|
+
board.sources.github.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: { kind: "github-error" }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1168
1400
|
] }),
|
|
1169
|
-
board.sources.mail.map((m) => /* @__PURE__ */ (0,
|
|
1170
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
board.sources.mail.map((m) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("i", { className: `mishu-dot ${m.state}` }),
|
|
1171
1403
|
m.text,
|
|
1172
|
-
m.state === "error" ? /* @__PURE__ */ (0,
|
|
1404
|
+
m.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: { kind: "mail-error", accountId: m.id }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1173
1405
|
] }, m.id)),
|
|
1174
|
-
/* @__PURE__ */ (0,
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", disabled: syncing, onClick: () => {
|
|
1175
1407
|
void sync();
|
|
1176
1408
|
}, children: syncing ? t.syncing : t.sync })
|
|
1177
1409
|
] })
|
|
1178
1410
|
] }),
|
|
1179
|
-
tab === "settings" ? /* @__PURE__ */ (0,
|
|
1180
|
-
tab === "settings" ? null : /* @__PURE__ */ (0,
|
|
1181
|
-
error === void 0 ? null : /* @__PURE__ */ (0,
|
|
1411
|
+
tab === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MishuSettings, { lang, locale, openChat: openChat2 }) : null,
|
|
1412
|
+
tab === "settings" ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1413
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-error", children: [
|
|
1182
1414
|
t.failed,
|
|
1183
1415
|
error
|
|
1184
1416
|
] }),
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "mishu-summary", children: [
|
|
1186
1418
|
board.summary,
|
|
1187
1419
|
" ",
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: { kind: "summary" }, lang, locale, openChat: openChat2, compact: true })
|
|
1189
1421
|
] }),
|
|
1190
|
-
/* @__PURE__ */ (0,
|
|
1191
|
-
/* @__PURE__ */ (0,
|
|
1192
|
-
/* @__PURE__ */ (0,
|
|
1193
|
-
/* @__PURE__ */ (0,
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metrics", children: [
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metric", children: [
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-metric-label", children: t.metricHandle }),
|
|
1425
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metric-value", children: [
|
|
1194
1426
|
metrics.handle,
|
|
1195
|
-
metrics.overdue > 0 ? /* @__PURE__ */ (0,
|
|
1427
|
+
metrics.overdue > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("small", { className: "mishu-danger", children: [
|
|
1196
1428
|
metrics.overdue,
|
|
1197
1429
|
" ",
|
|
1198
1430
|
t.metricOverdue
|
|
1199
1431
|
] }) : null
|
|
1200
1432
|
] })
|
|
1201
1433
|
] }),
|
|
1202
|
-
/* @__PURE__ */ (0,
|
|
1203
|
-
/* @__PURE__ */ (0,
|
|
1204
|
-
/* @__PURE__ */ (0,
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metric", children: [
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-metric-label", children: t.metricSoon }),
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-metric-value", children: metrics.dueSoon })
|
|
1205
1437
|
] }),
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1207
|
-
/* @__PURE__ */ (0,
|
|
1208
|
-
/* @__PURE__ */ (0,
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metric", children: [
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-metric-label", children: t.metricClosed }),
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-metric-value", children: metrics.closedToday })
|
|
1209
1441
|
] }),
|
|
1210
|
-
/* @__PURE__ */ (0,
|
|
1211
|
-
/* @__PURE__ */ (0,
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metric", children: [
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-metric-label", children: t.metricShadow }),
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-metric-value", children: [
|
|
1213
1445
|
metrics.shadow,
|
|
1214
|
-
board.markRead === "shadow" ? /* @__PURE__ */ (0,
|
|
1446
|
+
board.markRead === "shadow" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { className: "mishu-warn", children: t.shadowTag }) : null
|
|
1215
1447
|
] })
|
|
1216
1448
|
] })
|
|
1217
1449
|
] }),
|
|
1218
|
-
/* @__PURE__ */ (0,
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-filters", role: "group", children: sources.map((s) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", "aria-pressed": source === s.id, className: `mishu-chip ${source === s.id ? "active" : ""}`, onClick: () => setSource(s.id), children: [
|
|
1219
1451
|
s.label,
|
|
1220
|
-
/* @__PURE__ */ (0,
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: count(s.id) })
|
|
1221
1453
|
] }, s.id)) }),
|
|
1222
|
-
/* @__PURE__ */ (0,
|
|
1223
|
-
/* @__PURE__ */ (0,
|
|
1224
|
-
/* @__PURE__ */ (0,
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-columns", ref: columnsRef, style: { ["--mishu-cols"]: template }, children: [
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: `mishu-col ${dropOn === "handle" ? "drop" : ""}`, ...dropProps("handle"), "aria-label": t.handle, children: [
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-col-head", children: [
|
|
1225
1457
|
t.handle,
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: columns.handle.length })
|
|
1227
1459
|
] }),
|
|
1228
|
-
columns.handle.length === 0 ? /* @__PURE__ */ (0,
|
|
1460
|
+
columns.handle.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-empty", children: t.emptyHandle }) : columns.handle.map((item) => card(item, "handle"))
|
|
1229
1461
|
] }),
|
|
1230
1462
|
divider(0),
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1232
|
-
/* @__PURE__ */ (0,
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: `mishu-col ${dropOn === "remember" ? "drop" : ""}`, ...dropProps("remember"), "aria-label": t.remember, title: t.dropRemember, children: [
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-col-head", children: [
|
|
1233
1465
|
t.remember,
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: columns.remember.length })
|
|
1235
1467
|
] }),
|
|
1236
|
-
columns.remember.length === 0 ? /* @__PURE__ */ (0,
|
|
1237
|
-
/* @__PURE__ */ (0,
|
|
1468
|
+
columns.remember.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-empty", children: t.emptyRemember }) : columns.remember.map((item) => card(item, "remember")),
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AddForm, { lang, locale, onAdded: (next) => setBoard(next) })
|
|
1238
1470
|
] }),
|
|
1239
1471
|
divider(1),
|
|
1240
|
-
/* @__PURE__ */ (0,
|
|
1241
|
-
/* @__PURE__ */ (0,
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: `mishu-col ${dropOn === "done" ? "drop" : ""}`, ...dropProps("done"), "aria-label": t.done, title: t.dropDone, children: [
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-col-head", children: [
|
|
1242
1474
|
t.done,
|
|
1243
|
-
/* @__PURE__ */ (0,
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: columns.done.total })
|
|
1244
1476
|
] }),
|
|
1245
|
-
columns.done.groups.length === 0 ? /* @__PURE__ */ (0,
|
|
1246
|
-
/* @__PURE__ */ (0,
|
|
1477
|
+
columns.done.groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-empty", children: t.emptyDone }) : columns.done.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "mishu-group", children: [
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { children: [
|
|
1247
1479
|
group.label,
|
|
1248
|
-
/* @__PURE__ */ (0,
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: group.items.length })
|
|
1249
1481
|
] }),
|
|
1250
1482
|
group.items.map((item) => card(item, "done"))
|
|
1251
1483
|
] }, group.reason)),
|
|
1252
|
-
columns.done.total > 0 ? /* @__PURE__ */ (0,
|
|
1253
|
-
metrics.shadow > 0 ? /* @__PURE__ */ (0,
|
|
1484
|
+
columns.done.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.doneHint }) : null,
|
|
1485
|
+
metrics.shadow > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-banner", children: t.shadow(metrics.shadow) }) : null
|
|
1254
1486
|
] })
|
|
1255
1487
|
] })
|
|
1256
1488
|
] })
|
|
1257
1489
|
] });
|
|
1258
1490
|
}
|
|
1259
|
-
function Card({ item, column, lang, locale, busy, label, openChat: openChat2, onAct, onDragStart, onDragEnd }) {
|
|
1491
|
+
function Card({ item, column, lang, locale, busy, label, openChat: openChat2, open, onToggle, onAct, onDragStart, onDragEnd }) {
|
|
1260
1492
|
const t = TEXT[lang];
|
|
1261
|
-
const [
|
|
1262
|
-
const [detail, setDetail] = (0, import_react4.useState)();
|
|
1493
|
+
const [detail, setDetail] = (0, import_react5.useState)();
|
|
1263
1494
|
const explain = item.explain;
|
|
1264
1495
|
const compact = column === "done";
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1496
|
+
(0, import_react5.useEffect)(() => {
|
|
1497
|
+
if (!open || item.target !== "matter" || detail !== void 0) return;
|
|
1498
|
+
let alive = true;
|
|
1499
|
+
void mishuApi.detail(locale(), item.id).then((r) => {
|
|
1500
|
+
if (alive) setDetail(r.ok ? r.detail : { error: r.message });
|
|
1501
|
+
});
|
|
1502
|
+
return () => {
|
|
1503
|
+
alive = false;
|
|
1504
|
+
};
|
|
1505
|
+
}, [open, item.target, item.id, detail, locale]);
|
|
1506
|
+
const row = (name, text, className = "") => text === null || text === void 0 || text === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `mishu-row-explain ${className}`, children: [
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-row-label", children: name }),
|
|
1508
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: text })
|
|
1275
1509
|
] });
|
|
1276
|
-
return /* @__PURE__ */ (0,
|
|
1510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1277
1511
|
"div",
|
|
1278
1512
|
{
|
|
1279
|
-
className: `mishu-card ${item.tone === "normal" ? "" : item.tone}`,
|
|
1513
|
+
className: `mishu-card ${open ? "open" : ""} ${item.tone === "normal" ? "" : item.tone}`,
|
|
1280
1514
|
draggable: item.target === "matter" && column !== "done",
|
|
1281
1515
|
onDragStart: (event) => {
|
|
1282
1516
|
event.dataTransfer.effectAllowed = "move";
|
|
@@ -1284,48 +1518,68 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, on
|
|
|
1284
1518
|
},
|
|
1285
1519
|
onDragEnd,
|
|
1286
1520
|
children: [
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
detail.did.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row-explain", children: [
|
|
1301
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-row-label", children: t.did }),
|
|
1302
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: detail.did.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: line }, i)) })
|
|
1303
|
-
] }) : null,
|
|
1304
|
-
detail.messages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-messages", children: [
|
|
1305
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-row-label", children: t.messages(detail.messages.length) }),
|
|
1306
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { children: detail.messages.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { children: [
|
|
1307
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: m.at }),
|
|
1308
|
-
" ",
|
|
1309
|
-
m.title
|
|
1310
|
-
] }, i)) })
|
|
1311
|
-
] }) : null
|
|
1312
|
-
] }) }) : null,
|
|
1313
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
|
|
1314
|
-
column === "handle" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2 }) : null,
|
|
1315
|
-
item.actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1316
|
-
"button",
|
|
1317
|
-
{
|
|
1318
|
-
type: "button",
|
|
1319
|
-
className: `mishu-btn ${index === 0 ? "primary" : ""}`,
|
|
1320
|
-
disabled: busy && action !== "open",
|
|
1321
|
-
onClick: () => onAct(action),
|
|
1322
|
-
children: action === "open" && explain?.link !== void 0 ? explain.link.label : label[action]
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1522
|
+
"div",
|
|
1523
|
+
{
|
|
1524
|
+
className: "mishu-card-head",
|
|
1525
|
+
role: "button",
|
|
1526
|
+
tabIndex: 0,
|
|
1527
|
+
"aria-expanded": open,
|
|
1528
|
+
title: open ? t.hide : compact ? t.explainDone : t.detail,
|
|
1529
|
+
onClick: onToggle,
|
|
1530
|
+
onKeyDown: (event) => {
|
|
1531
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1532
|
+
event.preventDefault();
|
|
1533
|
+
onToggle();
|
|
1323
1534
|
},
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1535
|
+
children: [
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-caret", "aria-hidden": "true" }),
|
|
1537
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-card-title", children: item.title })
|
|
1538
|
+
]
|
|
1539
|
+
}
|
|
1540
|
+
),
|
|
1541
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-card-body", children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-card-meta", children: item.meta }),
|
|
1543
|
+
!compact && explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-explain", children: [
|
|
1544
|
+
row(t.what, explain.what),
|
|
1545
|
+
row(column === "remember" ? t.whyKeep : t.why, explain.why),
|
|
1546
|
+
row(t.fix, explain.fix, "mishu-fix")
|
|
1547
|
+
] }) : null,
|
|
1548
|
+
!compact && explain === null && item.note !== null ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-card-note", children: item.note }) : null,
|
|
1549
|
+
item.target === "matter" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-detail", children: detail === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-empty", children: t.loading }) : "error" in detail ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-danger", children: detail.error }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1550
|
+
compact && detail.explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1551
|
+
row(t.what, detail.explain.what),
|
|
1552
|
+
row(t.whyDone, detail.explain.why)
|
|
1553
|
+
] }) : null,
|
|
1554
|
+
detail.did.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row-explain", children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-row-label", children: t.did }),
|
|
1556
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: detail.did.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: line }, i)) })
|
|
1557
|
+
] }) : null,
|
|
1558
|
+
detail.messages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-messages", children: [
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-row-label", children: t.messages(detail.messages.length) }),
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: detail.messages.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { children: [
|
|
1561
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: m.at }),
|
|
1562
|
+
" ",
|
|
1563
|
+
m.title
|
|
1564
|
+
] }, i)) })
|
|
1565
|
+
] }) : null
|
|
1566
|
+
] }) }) : null,
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
|
|
1568
|
+
column === "handle" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2 }) : null,
|
|
1569
|
+
item.actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1570
|
+
"button",
|
|
1571
|
+
{
|
|
1572
|
+
type: "button",
|
|
1573
|
+
className: `mishu-btn ${index === 0 ? "primary" : ""}`,
|
|
1574
|
+
disabled: busy && action !== "open",
|
|
1575
|
+
onClick: () => onAct(action),
|
|
1576
|
+
children: action === "open" && explain?.link !== void 0 ? explain.link.label : label[action]
|
|
1577
|
+
},
|
|
1578
|
+
action
|
|
1579
|
+
)),
|
|
1580
|
+
column === "handle" ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2, compact: true })
|
|
1581
|
+
] })
|
|
1582
|
+
] }) : null
|
|
1329
1583
|
]
|
|
1330
1584
|
}
|
|
1331
1585
|
);
|
|
@@ -1333,11 +1587,11 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, on
|
|
|
1333
1587
|
var EMPTY = { title: "", due: "", repeat: "none", category: "other", note: "" };
|
|
1334
1588
|
function AddForm({ lang, locale, onAdded }) {
|
|
1335
1589
|
const t = TEXT[lang];
|
|
1336
|
-
const [open, setOpen] = (0,
|
|
1337
|
-
const [item, setItem] = (0,
|
|
1338
|
-
const [preview, setPreview] = (0,
|
|
1339
|
-
const [saving, setSaving] = (0,
|
|
1340
|
-
(0,
|
|
1590
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
1591
|
+
const [item, setItem] = (0, import_react5.useState)(EMPTY);
|
|
1592
|
+
const [preview, setPreview] = (0, import_react5.useState)();
|
|
1593
|
+
const [saving, setSaving] = (0, import_react5.useState)(false);
|
|
1594
|
+
(0, import_react5.useEffect)(() => {
|
|
1341
1595
|
if (!open || item.title.trim() === "" || item.due === "") {
|
|
1342
1596
|
setPreview(void 0);
|
|
1343
1597
|
return;
|
|
@@ -1348,7 +1602,7 @@ function AddForm({ lang, locale, onAdded }) {
|
|
|
1348
1602
|
return () => clearTimeout(timer);
|
|
1349
1603
|
}, [open, item, locale]);
|
|
1350
1604
|
if (!open) {
|
|
1351
|
-
return /* @__PURE__ */ (0,
|
|
1605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setOpen(true), children: [
|
|
1352
1606
|
"+ ",
|
|
1353
1607
|
t.add
|
|
1354
1608
|
] });
|
|
@@ -1366,49 +1620,49 @@ function AddForm({ lang, locale, onAdded }) {
|
|
|
1366
1620
|
setPreview({ ok: false, text: result.message });
|
|
1367
1621
|
}
|
|
1368
1622
|
};
|
|
1369
|
-
return /* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-add", children: [
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
|
|
1371
1625
|
t.addTitle,
|
|
1372
|
-
/* @__PURE__ */ (0,
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: item.title, placeholder: t.addTitlePlaceholder, onChange: set("title") })
|
|
1373
1627
|
] }),
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1375
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row", children: [
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
|
|
1376
1630
|
t.addDue,
|
|
1377
|
-
/* @__PURE__ */ (0,
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "date", value: item.due, onChange: set("due") })
|
|
1378
1632
|
] }),
|
|
1379
|
-
/* @__PURE__ */ (0,
|
|
1633
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
|
|
1380
1634
|
t.addRepeat,
|
|
1381
|
-
/* @__PURE__ */ (0,
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("select", { value: item.repeat, onChange: set("repeat"), children: Object.entries(t.repeats).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value, children: text }, value)) })
|
|
1382
1636
|
] })
|
|
1383
1637
|
] }),
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row", children: [
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
|
|
1386
1640
|
t.addCategory,
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("select", { value: item.category, onChange: set("category"), children: Object.entries(t.categories).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value, children: text }, value)) })
|
|
1388
1642
|
] }),
|
|
1389
|
-
/* @__PURE__ */ (0,
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
|
|
1390
1644
|
t.addNote,
|
|
1391
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: item.note, onChange: set("note") })
|
|
1392
1646
|
] })
|
|
1393
1647
|
] }),
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1396
|
-
/* @__PURE__ */ (0,
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `mishu-preview ${preview?.ok === false ? "mishu-danger" : ""}`, children: preview?.text ?? t.previewHint }),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: saving || preview?.ok !== true, onClick: () => {
|
|
1397
1651
|
void save();
|
|
1398
1652
|
}, children: t.save }),
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
|
|
1400
1654
|
setOpen(false);
|
|
1401
1655
|
setItem(EMPTY);
|
|
1402
1656
|
}, children: t.cancel })
|
|
1403
1657
|
] }),
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.chatHint })
|
|
1405
1659
|
] });
|
|
1406
1660
|
}
|
|
1407
1661
|
function RestartButton({ lang, locale }) {
|
|
1408
1662
|
const t = TEXT[lang];
|
|
1409
|
-
const [why, setWhy] = (0,
|
|
1410
|
-
const [status, setStatus] = (0,
|
|
1411
|
-
(0,
|
|
1663
|
+
const [why, setWhy] = (0, import_react5.useState)();
|
|
1664
|
+
const [status, setStatus] = (0, import_react5.useState)();
|
|
1665
|
+
(0, import_react5.useEffect)(() => {
|
|
1412
1666
|
void restartApi.info(locale()).then((r) => {
|
|
1413
1667
|
if (r.ok && !r.supported) setWhy(r.why);
|
|
1414
1668
|
});
|
|
@@ -1428,12 +1682,12 @@ function RestartButton({ lang, locale }) {
|
|
|
1428
1682
|
setStatus({ ok: true, text: await reconnect(locale) ? t.restartReloading : t.restartSlow });
|
|
1429
1683
|
}
|
|
1430
1684
|
};
|
|
1431
|
-
return /* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", title: why === void 0 ? t.restartTip : `${t.restartTip}
|
|
1433
1687
|
${why}`, disabled: status?.ok === true, onClick: () => {
|
|
1434
1688
|
void restart();
|
|
1435
1689
|
}, children: t.restart }),
|
|
1436
|
-
status === void 0 ? null : /* @__PURE__ */ (0,
|
|
1690
|
+
status === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: status.ok ? "mishu-hint" : "mishu-hint mishu-warn", children: status.text })
|
|
1437
1691
|
] });
|
|
1438
1692
|
}
|
|
1439
1693
|
async function reconnect(locale) {
|
|
@@ -1490,10 +1744,17 @@ var STYLES = `
|
|
|
1490
1744
|
.mishu-col-head{display:flex;justify-content:space-between;align-items:baseline;font-weight:600;margin:2px 4px 8px}
|
|
1491
1745
|
.mishu-col-head span{color:${MUTED};font-weight:400}
|
|
1492
1746
|
.mishu-empty{color:${FAINT};padding:8px 4px}
|
|
1493
|
-
.mishu-card{background:${LAYER2};border:1px solid ${LINE};border-radius:8px;padding:8px
|
|
1747
|
+
.mishu-card{background:${LAYER2};border:1px solid ${LINE};border-radius:8px;padding:6px 8px;margin-bottom:8px}
|
|
1494
1748
|
.mishu-card[draggable=true]{cursor:grab}
|
|
1495
1749
|
.mishu-card.danger{border-color:${DANGER}}
|
|
1496
|
-
.mishu-card
|
|
1750
|
+
.mishu-card.open{padding-bottom:8px}
|
|
1751
|
+
.mishu-card-head{display:flex;align-items:flex-start;gap:6px;width:100%;font:inherit;font-size:13px;text-align:left;color:inherit;background:transparent;border:0;border-radius:6px;padding:3px 4px;cursor:pointer}
|
|
1752
|
+
.mishu-card-head:hover{background:${HOVER}}
|
|
1753
|
+
.mishu-card-head:focus-visible{outline:2px solid ${ACCENT};outline-offset:1px}
|
|
1754
|
+
.mishu-caret{flex:0 0 auto;width:0;height:0;margin-top:6px;border-left:4px solid ${FAINT};border-top:4px solid transparent;border-bottom:4px solid transparent;transition:transform .12s}
|
|
1755
|
+
.mishu-card.open .mishu-caret{transform:rotate(90deg);border-left-color:${ACCENT}}
|
|
1756
|
+
.mishu-card-body{padding:0 4px}
|
|
1757
|
+
.mishu-card-title{font-weight:600;word-break:break-word;min-width:0;flex:1 1 auto}
|
|
1497
1758
|
.mishu-card-meta{font-size:12px;color:${MUTED};margin-top:2px}
|
|
1498
1759
|
.mishu-card.danger .mishu-card-meta{color:${DANGER}}
|
|
1499
1760
|
.mishu-card.warn .mishu-card-meta{color:${WARN}}
|
|
@@ -1555,6 +1816,9 @@ var STYLES = `
|
|
|
1555
1816
|
.mishu-settings{display:flex;flex-direction:column;gap:12px;max-width:760px}
|
|
1556
1817
|
.mishu-panel{background:${LAYER1};border-radius:12px;padding:12px 14px}
|
|
1557
1818
|
.mishu-panel h2{font-size:14px;font-weight:600;margin:0 0 8px}
|
|
1819
|
+
.mishu-panel h3{font-size:13px;font-weight:600;margin:14px 0 6px}
|
|
1820
|
+
.mishu-notify-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
|
|
1821
|
+
.mishu-notify-row input[type=time]{font:inherit;font-size:13px;color:${TEXT2};background:${LAYER2};border:1px solid ${LINE_STRONG};border-radius:6px;padding:2px 6px}
|
|
1558
1822
|
.mishu-grid5{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-bottom:8px}
|
|
1559
1823
|
.mishu-check{display:flex;align-items:center;gap:6px;font-size:13px;margin:4px 0 8px;color:${TEXT2}}
|
|
1560
1824
|
.mishu-ok{padding:6px 10px;border-radius:8px;border:1px solid ${OK};color:${OK};font-size:12px}
|
|
@@ -1570,18 +1834,18 @@ var STYLES = `
|
|
|
1570
1834
|
`;
|
|
1571
1835
|
|
|
1572
1836
|
// src/client/index.tsx
|
|
1573
|
-
var
|
|
1837
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1574
1838
|
var PACKAGE_NAME = "dsh-mishu";
|
|
1575
1839
|
var inject = ["slots", "locale"];
|
|
1576
1840
|
var PANEL_ID = "dsh-mishu";
|
|
1577
1841
|
var NS = "dsh-mishu";
|
|
1578
1842
|
var openChat;
|
|
1579
1843
|
function MishuIcon({ size }) {
|
|
1580
|
-
return /* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "5", y: "4", width: "14", height: "17", rx: "2" }),
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 4h6v3H9z" }),
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 12l2 2 4-4" }),
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 17h6" })
|
|
1585
1849
|
] });
|
|
1586
1850
|
}
|
|
1587
1851
|
function apply(ctx) {
|