dsh-mishu 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/lib/client.js +492 -354
- package/lib/core/index.js +1 -0
- package/lib/core/schedule/tasks.js +149 -0
- package/lib/dsh/api.js +44 -2
- package/lib/dsh/plugin.js +9 -0
- package/lib/dsh/runtime.js +24 -1
- package/lib/dsh/schedule.js +221 -0
- package/lib/types/core/index.d.ts +1 -0
- package/lib/types/core/schedule/tasks.d.ts +89 -0
- package/lib/types/dsh/runtime.d.ts +13 -0
- package/lib/types/dsh/schedule.d.ts +113 -0
- 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_react7 = require("react");
|
|
37
37
|
|
|
38
38
|
// src/client/api.ts
|
|
39
39
|
async function post(path, body) {
|
|
@@ -84,7 +84,11 @@ var settingsApi = {
|
|
|
84
84
|
saveWatch: (lang, watch) => post("/watch/save", { lang, watch }),
|
|
85
85
|
testWatch: (lang, watch) => post("/watch/test", { lang, watch }),
|
|
86
86
|
deleteWatch: (lang, id) => post("/watch/delete", { lang, id }),
|
|
87
|
-
syncWatch: (lang, id) => post("/watch/sync", { lang, id })
|
|
87
|
+
syncWatch: (lang, id) => post("/watch/sync", { lang, id }),
|
|
88
|
+
armBrief: (lang) => post("/schedule/brief/arm", { lang }),
|
|
89
|
+
disarmBrief: (lang) => post("/schedule/brief/disarm", { lang }),
|
|
90
|
+
runTask: (lang, id) => post("/schedule/run", { lang, id }),
|
|
91
|
+
deleteTask: (lang, id) => post("/schedule/delete", { lang, id })
|
|
88
92
|
};
|
|
89
93
|
|
|
90
94
|
// src/client/AskAI.tsx
|
|
@@ -281,6 +285,24 @@ var zh = {
|
|
|
281
285
|
nQuiet: "\u514D\u6253\u6270\uFF0C\u4ECE",
|
|
282
286
|
nTo: "\u5230",
|
|
283
287
|
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`,
|
|
288
|
+
nSchedule: "\u4EA4\u7ED9 DSH \u7684\u81EA\u52A8\u5316\u4EFB\u52A1",
|
|
289
|
+
nScheduleHint: "\u9664\u4E86\u7535\u8111\u901A\u77E5\uFF0C\u7B80\u62A5\u4E5F\u53EF\u4EE5\u505A\u6210 DSH \u7684\u5B9A\u65F6\u4EFB\u52A1\uFF1A\u5230\u70B9\u5728\u5BF9\u8BDD\u91CC\u51FA\u73B0\u4E00\u6761\uFF0C\u4F60\u6253\u5F00 DSH \u5C31\u80FD\u770B\u89C1\u3002",
|
|
290
|
+
nScheduleArm: "\u628A\u7B80\u62A5\u505A\u6210\u5B9A\u65F6\u4EFB\u52A1",
|
|
291
|
+
nScheduleArmed: "\u7B80\u62A5\u5DF2\u7ECF\u662F\u5B9A\u65F6\u4EFB\u52A1\u4E86\uFF0C\u6539\u65F6\u95F4\u4F1A\u81EA\u52A8\u8DDF\u7740\u6539\u3002",
|
|
292
|
+
nScheduleDisarm: "\u53D6\u6D88\u8FD9\u4E2A\u5B9A\u65F6\u4EFB\u52A1",
|
|
293
|
+
nScheduleDisarmConfirm: "\u53D6\u6D88\u7B80\u62A5\u7684\u5B9A\u65F6\u4EFB\u52A1\uFF1F\u7535\u8111\u901A\u77E5\u4E0D\u53D7\u5F71\u54CD\u3002",
|
|
294
|
+
nScheduleNoService: "\u8FD9\u4E2A DSH \u6CA1\u6709\u81EA\u52A8\u5316\u4EFB\u52A1\u670D\u52A1\uFF08\u63D2\u4EF6\u6CA1\u88C5\uFF0C\u6216\u8005\u7248\u672C\u592A\u8001\uFF09\u3002\u7B80\u62A5\u53EA\u80FD\u7528\u7535\u8111\u901A\u77E5\u53D1\u3002",
|
|
295
|
+
nScheduleTasks: "DSH \u91CC\u7684\u5B9A\u65F6\u4EFB\u52A1",
|
|
296
|
+
nScheduleNone: "DSH \u91CC\u8FD8\u6CA1\u6709\u5B9A\u65F6\u4EFB\u52A1\u3002",
|
|
297
|
+
nScheduleMine: "\u5C0F\u79D8\u4E66\u5EFA\u7684",
|
|
298
|
+
nScheduleRunNow: "\u73B0\u5728\u8DD1\u4E00\u6B21",
|
|
299
|
+
nScheduleRunning: "\u6B63\u5728\u8DD1",
|
|
300
|
+
nScheduleDeleteConfirm: "\u5220\u6389\u8FD9\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF1F\u5220\u4E86\u5C31\u4E0D\u518D\u6309\u65F6\u95F4\u8DD1\u4E86\u3002",
|
|
301
|
+
nScheduleNext: (when) => `\u4E0B\u4E00\u6B21 ${when}`,
|
|
302
|
+
nScheduleEnded: "\u5DF2\u7ECF\u8DD1\u5B8C\u4E86",
|
|
303
|
+
nSchedulePaused: "\u5DF2\u6682\u505C",
|
|
304
|
+
nScheduleLast: (when) => `\u4E0A\u6B21 ${when}`,
|
|
305
|
+
nSchedulePrompt: "\u5230\u70B9\u5B83\u4F1A\u8BF4",
|
|
284
306
|
nChannels: "\u53D1\u5230\u54EA\u91CC",
|
|
285
307
|
nDesktop: "\u7535\u8111\u901A\u77E5",
|
|
286
308
|
nDesktopOn: "\u5728\u8FD9\u53F0\u7535\u8111\u53F3\u4E0A\u89D2\u5F39\u51FA\u901A\u77E5\u3002",
|
|
@@ -497,6 +519,24 @@ var en = {
|
|
|
497
519
|
nQuiet: "Quiet hours from",
|
|
498
520
|
nTo: "to",
|
|
499
521
|
nZone: (zone) => `In ${zone} time. Nothing is sent during quiet hours; urgent items from then come when they end.`,
|
|
522
|
+
nSchedule: "Hand the brief to DSH's scheduled tasks",
|
|
523
|
+
nScheduleHint: "Besides a desktop notification, the brief can be a DSH scheduled task: at that hour a turn appears in a conversation, there whenever you open DSH.",
|
|
524
|
+
nScheduleArm: "Make the brief a scheduled task",
|
|
525
|
+
nScheduleArmed: "The brief is a scheduled task; changing its time moves it too.",
|
|
526
|
+
nScheduleDisarm: "Remove that scheduled task",
|
|
527
|
+
nScheduleDisarmConfirm: "Remove the brief's scheduled task? The desktop notification is unaffected.",
|
|
528
|
+
nScheduleNoService: "This DSH has no scheduled-tasks service (the plugin is missing or too old). The brief stays a desktop notification.",
|
|
529
|
+
nScheduleTasks: "Scheduled tasks on this DSH",
|
|
530
|
+
nScheduleNone: "No scheduled tasks yet.",
|
|
531
|
+
nScheduleMine: "made by the secretary",
|
|
532
|
+
nScheduleRunNow: "Run now",
|
|
533
|
+
nScheduleRunning: "Running",
|
|
534
|
+
nScheduleDeleteConfirm: "Delete this scheduled task? It will stop running.",
|
|
535
|
+
nScheduleNext: (when) => `next ${when}`,
|
|
536
|
+
nScheduleEnded: "already finished",
|
|
537
|
+
nSchedulePaused: "paused",
|
|
538
|
+
nScheduleLast: (when) => `last ${when}`,
|
|
539
|
+
nSchedulePrompt: "What it will say",
|
|
500
540
|
nChannels: "Where to send",
|
|
501
541
|
nDesktop: "This computer",
|
|
502
542
|
nDesktopOn: "A notification in the corner of this screen.",
|
|
@@ -578,7 +618,7 @@ function AskAI({ topic, lang, locale, openChat: openChat2, compact = false }) {
|
|
|
578
618
|
}
|
|
579
619
|
|
|
580
620
|
// src/client/Settings.tsx
|
|
581
|
-
var
|
|
621
|
+
var import_react6 = require("react");
|
|
582
622
|
|
|
583
623
|
// src/client/Fold.tsx
|
|
584
624
|
var import_react2 = require("react");
|
|
@@ -792,20 +832,115 @@ function FeishuDialog({ lang, locale, onDone }) {
|
|
|
792
832
|
] });
|
|
793
833
|
}
|
|
794
834
|
|
|
795
|
-
// src/client/
|
|
835
|
+
// src/client/Schedule.tsx
|
|
836
|
+
var import_react5 = require("react");
|
|
796
837
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
838
|
+
function ScheduleSection({ view, lang, locale, take }) {
|
|
839
|
+
const t = TEXT[lang];
|
|
840
|
+
const [busy, setBusy] = (0, import_react5.useState)();
|
|
841
|
+
const [error, setError] = (0, import_react5.useState)();
|
|
842
|
+
const schedule = view.schedule;
|
|
843
|
+
if (schedule === null) {
|
|
844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t.nSchedule }),
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.nScheduleNoService })
|
|
847
|
+
] });
|
|
848
|
+
}
|
|
849
|
+
const act = async (key, call, saved) => {
|
|
850
|
+
setBusy(key);
|
|
851
|
+
const result = await call();
|
|
852
|
+
setBusy(void 0);
|
|
853
|
+
setError(result.ok ? void 0 : result.message);
|
|
854
|
+
take(result, saved);
|
|
855
|
+
};
|
|
856
|
+
const afterTask = (result) => {
|
|
857
|
+
if (!result.ok) {
|
|
858
|
+
setError(result.message);
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
setError(void 0);
|
|
862
|
+
take({ ok: true, view: { ...view, schedule: result.schedule } });
|
|
863
|
+
};
|
|
864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t.nSchedule }),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.nScheduleHint }),
|
|
867
|
+
schedule.brief.armed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-ok", children: t.nScheduleArmed }),
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy !== void 0, onClick: () => {
|
|
870
|
+
if (window.confirm(t.nScheduleDisarmConfirm)) void act("disarm", () => settingsApi.disarmBrief(locale()));
|
|
871
|
+
}, children: t.nScheduleDisarm }) })
|
|
872
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy !== void 0, onClick: () => {
|
|
873
|
+
void act("arm", () => settingsApi.armBrief(locale()), t.sSaved);
|
|
874
|
+
}, children: busy === "arm" ? t.loading : t.nScheduleArm }) }),
|
|
875
|
+
schedule.brief.error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-error", children: schedule.brief.error }),
|
|
876
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-error", children: error }),
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t.nScheduleTasks }),
|
|
878
|
+
schedule.tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-empty", children: t.nScheduleNone }) : schedule.tasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
879
|
+
TaskRow,
|
|
880
|
+
{
|
|
881
|
+
task,
|
|
882
|
+
lang,
|
|
883
|
+
locale,
|
|
884
|
+
busy: busy === task.id,
|
|
885
|
+
onRun: () => {
|
|
886
|
+
setBusy(task.id);
|
|
887
|
+
void settingsApi.runTask(locale(), task.id).then((r) => {
|
|
888
|
+
setBusy(void 0);
|
|
889
|
+
afterTask(r);
|
|
890
|
+
});
|
|
891
|
+
},
|
|
892
|
+
onDelete: () => {
|
|
893
|
+
setBusy(task.id);
|
|
894
|
+
void settingsApi.deleteTask(locale(), task.id).then((r) => {
|
|
895
|
+
setBusy(void 0);
|
|
896
|
+
afterTask(r);
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
task.id
|
|
901
|
+
))
|
|
902
|
+
] });
|
|
903
|
+
}
|
|
904
|
+
function TaskRow({ task, lang, locale, busy, onRun, onDelete }) {
|
|
905
|
+
const t = TEXT[lang];
|
|
906
|
+
const state = task.status === "ended" ? t.nScheduleEnded : task.status === "paused" ? t.nSchedulePaused : task.next === null ? "" : t.nScheduleNext(task.next);
|
|
907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Fold, { id: `task-${task.id}`, title: `${task.title}${task.mine ? ` \xB7 ${t.nScheduleMine}` : ""}`, children: [
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-card-meta", children: [
|
|
909
|
+
task.when,
|
|
910
|
+
state === "" ? "" : ` \xB7 ${state}`
|
|
911
|
+
] }),
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-card-meta", children: [
|
|
913
|
+
task.running ? t.nScheduleRunning : "",
|
|
914
|
+
task.lastDelivery === null ? "" : `${task.running ? " \xB7 " : ""}${t.nScheduleLast(task.lastDelivery)}`
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-card-note", children: [
|
|
917
|
+
t.nSchedulePrompt,
|
|
918
|
+
"\uFF1A",
|
|
919
|
+
task.prompt
|
|
920
|
+
] }),
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy || task.status === "ended", onClick: onRun, children: busy ? t.loading : t.nScheduleRunNow }),
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", disabled: busy, onClick: () => {
|
|
924
|
+
if (window.confirm(t.nScheduleDeleteConfirm)) onDelete();
|
|
925
|
+
}, children: t.sDelete })
|
|
926
|
+
] })
|
|
927
|
+
] });
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// src/client/Settings.tsx
|
|
931
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
797
932
|
var CATEGORIES = ["document", "bill", "birthday", "renewal", "other"];
|
|
798
933
|
function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
799
934
|
const t = TEXT[lang];
|
|
800
|
-
const [view, setView] = (0,
|
|
801
|
-
const [error, setError] = (0,
|
|
802
|
-
const [note, setNote] = (0,
|
|
803
|
-
const [lead, setLead] = (0,
|
|
804
|
-
const [githubTest, setGithubTest] = (0,
|
|
805
|
-
const [confirmOn, setConfirmOn] = (0,
|
|
806
|
-
const [pasting, setPasting] = (0,
|
|
807
|
-
const [editing, setEditing] = (0,
|
|
808
|
-
const [watching, setWatching] = (0,
|
|
935
|
+
const [view, setView] = (0, import_react6.useState)();
|
|
936
|
+
const [error, setError] = (0, import_react6.useState)();
|
|
937
|
+
const [note, setNote] = (0, import_react6.useState)();
|
|
938
|
+
const [lead, setLead] = (0, import_react6.useState)({});
|
|
939
|
+
const [githubTest, setGithubTest] = (0, import_react6.useState)();
|
|
940
|
+
const [confirmOn, setConfirmOn] = (0, import_react6.useState)(false);
|
|
941
|
+
const [pasting, setPasting] = (0, import_react6.useState)(false);
|
|
942
|
+
const [editing, setEditing] = (0, import_react6.useState)();
|
|
943
|
+
const [watching, setWatching] = (0, import_react6.useState)();
|
|
809
944
|
const take = (result, saved) => {
|
|
810
945
|
if (result.ok) {
|
|
811
946
|
setView(result.view);
|
|
@@ -816,11 +951,11 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
816
951
|
setError(result.message);
|
|
817
952
|
}
|
|
818
953
|
};
|
|
819
|
-
(0,
|
|
954
|
+
(0, import_react6.useEffect)(() => {
|
|
820
955
|
void settingsApi.load(locale()).then((r) => take(r));
|
|
821
956
|
}, [locale]);
|
|
822
957
|
if (view === void 0) {
|
|
823
|
-
return /* @__PURE__ */ (0,
|
|
958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-settings", children: error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-error", children: [
|
|
824
959
|
t.failed,
|
|
825
960
|
error
|
|
826
961
|
] }) });
|
|
@@ -828,71 +963,71 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
828
963
|
const save = async (settings) => take(await settingsApi.save(locale(), settings), t.sSaved);
|
|
829
964
|
const token = view.github.token;
|
|
830
965
|
const secretKind = t.secretKinds[view.secrets.kind] ?? view.secrets.kind;
|
|
831
|
-
const markRead = /* @__PURE__ */ (0,
|
|
832
|
-
/* @__PURE__ */ (0,
|
|
966
|
+
const markRead = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
833
968
|
t.sMarkRead,
|
|
834
|
-
/* @__PURE__ */ (0,
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { value: view.settings.markRead, onChange: (e) => {
|
|
835
970
|
const value = e.target.value;
|
|
836
971
|
if (value === "on") setConfirmOn(true);
|
|
837
972
|
else void save({ markRead: value });
|
|
838
973
|
}, children: [
|
|
839
|
-
/* @__PURE__ */ (0,
|
|
840
|
-
/* @__PURE__ */ (0,
|
|
841
|
-
/* @__PURE__ */ (0,
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "off", children: t.sMarkOff }),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "shadow", children: t.sMarkShadow }),
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "on", children: t.sMarkOn })
|
|
842
977
|
] })
|
|
843
978
|
] }),
|
|
844
|
-
confirmOn ? /* @__PURE__ */ (0,
|
|
845
|
-
/* @__PURE__ */ (0,
|
|
846
|
-
/* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
979
|
+
confirmOn ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-banner", children: [
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: t.sMarkConfirm }),
|
|
981
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
848
983
|
setConfirmOn(false);
|
|
849
984
|
void save({ markRead: "on" });
|
|
850
985
|
}, children: t.sConfirm }),
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setConfirmOn(false), children: t.sCancel })
|
|
852
987
|
] })
|
|
853
988
|
] }) : null
|
|
854
989
|
] });
|
|
855
|
-
return /* @__PURE__ */ (0,
|
|
856
|
-
error === void 0 ? null : /* @__PURE__ */ (0,
|
|
990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FoldGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-settings", children: [
|
|
991
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-error", children: [
|
|
857
992
|
t.failed,
|
|
858
993
|
error
|
|
859
994
|
] }),
|
|
860
|
-
note === void 0 ? null : /* @__PURE__ */ (0,
|
|
861
|
-
/* @__PURE__ */ (0,
|
|
862
|
-
/* @__PURE__ */ (0,
|
|
863
|
-
/* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
995
|
+
note === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-ok", children: note }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: "sources", className: "mishu-panel", title: t.bSources, children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.bSourcesHint }),
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: t.sGithub }),
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-check", children: [
|
|
1000
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", checked: view.settings.githubEnabled, onChange: (e) => {
|
|
866
1001
|
void save({ githubEnabled: e.target.checked });
|
|
867
1002
|
} }),
|
|
868
1003
|
t.sGithubOn
|
|
869
1004
|
] }),
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
871
|
-
/* @__PURE__ */ (0,
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
1005
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row-explain", children: [
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-row-label", children: t.sToken }),
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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 })
|
|
873
1008
|
] }),
|
|
874
|
-
token.found ? /* @__PURE__ */ (0,
|
|
875
|
-
/* @__PURE__ */ (0,
|
|
1009
|
+
token.found ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1010
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
|
|
876
1011
|
setGithubTest(t.sTesting);
|
|
877
1012
|
void settingsApi.testGithub(locale()).then((r) => setGithubTest(r.ok ? t.sGithubOk(r.login) : `${t.failed}${r.message}`));
|
|
878
1013
|
}, children: t.sTest }),
|
|
879
|
-
token.from === "env" || pasting ? null : /* @__PURE__ */ (0,
|
|
880
|
-
token.from === "keychain" ? /* @__PURE__ */ (0,
|
|
1014
|
+
token.from === "env" || pasting ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setPasting(true), children: t.sTokenReplace }),
|
|
1015
|
+
token.from === "keychain" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
|
|
881
1016
|
if (window.confirm(t.sTokenRemoveConfirm)) void settingsApi.deleteToken(locale()).then((r) => {
|
|
882
1017
|
setGithubTest(void 0);
|
|
883
1018
|
take(r);
|
|
884
1019
|
});
|
|
885
1020
|
}, children: t.sTokenRemove }) : null,
|
|
886
|
-
githubTest === void 0 ? null : /* @__PURE__ */ (0,
|
|
1021
|
+
githubTest === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-hint", children: githubTest })
|
|
887
1022
|
] }) : null,
|
|
888
|
-
!token.found || pasting ? /* @__PURE__ */ (0,
|
|
1023
|
+
!token.found || pasting ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GithubConnect, { view, lang, locale, onSaved: (next, login) => {
|
|
889
1024
|
setPasting(false);
|
|
890
1025
|
setGithubTest(t.sTokenSaved(login));
|
|
891
1026
|
take({ ok: true, view: next });
|
|
892
1027
|
}, onCancel: token.found ? () => setPasting(false) : void 0 }) : null,
|
|
893
|
-
/* @__PURE__ */ (0,
|
|
894
|
-
/* @__PURE__ */ (0,
|
|
895
|
-
view.accounts.length === 0 ? /* @__PURE__ */ (0,
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: t.sMail }),
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.sMailPrivacy }),
|
|
1030
|
+
view.accounts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-empty", children: t.sNoAccounts }) : view.accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
896
1031
|
AccountRow,
|
|
897
1032
|
{
|
|
898
1033
|
account,
|
|
@@ -905,8 +1040,8 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
905
1040
|
},
|
|
906
1041
|
account.id
|
|
907
1042
|
)),
|
|
908
|
-
/* @__PURE__ */ (0,
|
|
909
|
-
editing === void 0 ? null : /* @__PURE__ */ (0,
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setEditing({ preset: "custom", sinceDays: 14, enabled: true }), children: t.sAddAccount }),
|
|
1044
|
+
editing === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
910
1045
|
MailDialog,
|
|
911
1046
|
{
|
|
912
1047
|
draft: editing,
|
|
@@ -920,9 +1055,9 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
920
1055
|
}
|
|
921
1056
|
}
|
|
922
1057
|
),
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
924
|
-
/* @__PURE__ */ (0,
|
|
925
|
-
view.watches.length === 0 ? /* @__PURE__ */ (0,
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: t.sWatch }),
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.sWatchHint }),
|
|
1060
|
+
view.watches.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-empty", children: t.sNoWatches }) : view.watches.map((watch) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
926
1061
|
WatchRow,
|
|
927
1062
|
{
|
|
928
1063
|
watch,
|
|
@@ -934,8 +1069,8 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
934
1069
|
},
|
|
935
1070
|
watch.id
|
|
936
1071
|
)),
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
938
|
-
watching === void 0 ? null : /* @__PURE__ */ (0,
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setWatching({ label: "", url: "", keywords: "", enabled: true, intervalMinutes: 60 }), children: t.sAddWatch }),
|
|
1073
|
+
watching === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
939
1074
|
WatchDialog,
|
|
940
1075
|
{
|
|
941
1076
|
draft: watching,
|
|
@@ -949,50 +1084,53 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
|
|
|
949
1084
|
}
|
|
950
1085
|
)
|
|
951
1086
|
] }),
|
|
952
|
-
/* @__PURE__ */ (0,
|
|
953
|
-
/* @__PURE__ */ (0,
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
955
|
-
/* @__PURE__ */ (0,
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: "what", className: "mishu-panel", title: t.bWhat, children: [
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.bUrgentRule }),
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-field", children: t.sLead }),
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-grid5", children: CATEGORIES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
956
1091
|
t.categories[c],
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", min: 0, max: 366, value: lead[c] ?? 0, onChange: (e) => setLead({ ...lead, [c]: Number(e.target.value) }) })
|
|
958
1093
|
] }, c)) }),
|
|
959
|
-
/* @__PURE__ */ (0,
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
960
1095
|
void save({ leadDays: lead });
|
|
961
1096
|
}, children: t.sSave })
|
|
962
1097
|
] }),
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
964
|
-
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: "when", className: "mishu-panel", title: t.bWhen, children: [
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotifySection, { view, lang, locale, take }),
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ScheduleSection, { view, lang, locale, take })
|
|
1101
|
+
] }),
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: "do", className: "mishu-panel", title: t.bDo, children: [
|
|
965
1103
|
markRead,
|
|
966
|
-
/* @__PURE__ */ (0,
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.bMailReadOnly })
|
|
967
1105
|
] }),
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: "general", className: "mishu-panel", title: t.sGeneral, children: [
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
970
1108
|
t.sLanguage,
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { value: view.settings.language, onChange: (e) => {
|
|
972
1110
|
void save({ language: e.target.value });
|
|
973
1111
|
}, children: [
|
|
974
|
-
/* @__PURE__ */ (0,
|
|
975
|
-
/* @__PURE__ */ (0,
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "auto", children: t.sLanguageAuto }),
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "zh", children: "\u4E2D\u6587" }),
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "en", children: "English" })
|
|
977
1115
|
] })
|
|
978
1116
|
] }),
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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) })
|
|
980
1118
|
] })
|
|
981
1119
|
] }) });
|
|
982
1120
|
}
|
|
983
1121
|
function GithubConnect({ view, lang, locale, onSaved, onCancel }) {
|
|
984
1122
|
const t = TEXT[lang];
|
|
985
|
-
const [signingIn, setSigningIn] = (0,
|
|
986
|
-
const [paste, setPaste] = (0,
|
|
987
|
-
if (!view.github.deviceLogin) return /* @__PURE__ */ (0,
|
|
988
|
-
return /* @__PURE__ */ (0,
|
|
989
|
-
/* @__PURE__ */ (0,
|
|
990
|
-
/* @__PURE__ */ (0,
|
|
991
|
-
paste ? null : /* @__PURE__ */ (0,
|
|
992
|
-
onCancel === void 0 ? null : /* @__PURE__ */ (0,
|
|
1123
|
+
const [signingIn, setSigningIn] = (0, import_react6.useState)(false);
|
|
1124
|
+
const [paste, setPaste] = (0, import_react6.useState)(!view.github.deviceLogin);
|
|
1125
|
+
if (!view.github.deviceLogin) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel });
|
|
1126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => setSigningIn(true), children: t.gLogin }),
|
|
1129
|
+
paste ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => setPaste(true), children: t.gPasteInstead }),
|
|
1130
|
+
onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
|
|
993
1131
|
] }),
|
|
994
|
-
paste ? /* @__PURE__ */ (0,
|
|
995
|
-
signingIn ? /* @__PURE__ */ (0,
|
|
1132
|
+
paste ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel: void 0 }) : null,
|
|
1133
|
+
signingIn ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GithubLoginDialog, { lang, locale, onClose: () => setSigningIn(false), onSaved: (next, login) => {
|
|
996
1134
|
setSigningIn(false);
|
|
997
1135
|
onSaved(next, login);
|
|
998
1136
|
} }) : null
|
|
@@ -1000,12 +1138,12 @@ function GithubConnect({ view, lang, locale, onSaved, onCancel }) {
|
|
|
1000
1138
|
}
|
|
1001
1139
|
function GithubLoginDialog({ lang, locale, onClose, onSaved }) {
|
|
1002
1140
|
const t = TEXT[lang];
|
|
1003
|
-
const [login, setLogin] = (0,
|
|
1004
|
-
const [error, setError] = (0,
|
|
1005
|
-
const [copied, setCopied] = (0,
|
|
1006
|
-
const [attempt, setAttempt] = (0,
|
|
1007
|
-
const saved = (0,
|
|
1008
|
-
(0,
|
|
1141
|
+
const [login, setLogin] = (0, import_react6.useState)();
|
|
1142
|
+
const [error, setError] = (0, import_react6.useState)();
|
|
1143
|
+
const [copied, setCopied] = (0, import_react6.useState)(false);
|
|
1144
|
+
const [attempt, setAttempt] = (0, import_react6.useState)(0);
|
|
1145
|
+
const saved = (0, import_react6.useRef)(void 0);
|
|
1146
|
+
(0, import_react6.useEffect)(() => {
|
|
1009
1147
|
let alive = true;
|
|
1010
1148
|
let timer;
|
|
1011
1149
|
setLogin(void 0);
|
|
@@ -1049,42 +1187,42 @@ function GithubLoginDialog({ lang, locale, onClose, onSaved }) {
|
|
|
1049
1187
|
const copy2 = (code) => {
|
|
1050
1188
|
void navigator.clipboard?.writeText(code).then(() => setCopied(true), () => setCopied(false));
|
|
1051
1189
|
};
|
|
1052
|
-
return /* @__PURE__ */ (0,
|
|
1053
|
-
/* @__PURE__ */ (0,
|
|
1054
|
-
/* @__PURE__ */ (0,
|
|
1055
|
-
] }) : login === void 0 || login.state === "idle" ? /* @__PURE__ */ (0,
|
|
1056
|
-
/* @__PURE__ */ (0,
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
1058
|
-
/* @__PURE__ */ (0,
|
|
1059
|
-
/* @__PURE__ */ (0,
|
|
1190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Modal, { title: t.gLogin, onClose: close, children: error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1191
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-preview mishu-danger", children: error }),
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose }) })
|
|
1193
|
+
] }) : login === void 0 || login.state === "idle" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.gStarting }) : login.state === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-field", children: t.gStep1 }),
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-code-row", children: [
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { className: "mishu-code", children: login.userCode }),
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => copy2(login.userCode), children: copied ? t.gCopied : t.gCopy })
|
|
1060
1198
|
] }),
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-field", children: t.gStep2 }),
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1201
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => window.open(login.verificationUri, "_blank", "noopener"), children: t.gOpen }),
|
|
1202
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-hint", children: t.gWaiting })
|
|
1065
1203
|
] }),
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
] }) : login.state === "done" ? /* @__PURE__ */ (0,
|
|
1068
|
-
/* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
1070
|
-
] }) : /* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.gScopes })
|
|
1205
|
+
] }) : login.state === "done" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-ok", children: t.gDone(login.login) }),
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: close, children: t.gClose }) })
|
|
1208
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1209
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-preview mishu-danger", children: login.message }),
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
|
|
1074
1212
|
setCopied(false);
|
|
1075
1213
|
setAttempt(attempt + 1);
|
|
1076
1214
|
}, children: t.gRetry }),
|
|
1077
|
-
/* @__PURE__ */ (0,
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose })
|
|
1078
1216
|
] })
|
|
1079
1217
|
] }) });
|
|
1080
1218
|
}
|
|
1081
1219
|
function TokenForm({ view, lang, locale, onSaved, onCancel }) {
|
|
1082
1220
|
const t = TEXT[lang];
|
|
1083
|
-
const [token, setToken] = (0,
|
|
1084
|
-
const [busy, setBusy] = (0,
|
|
1085
|
-
const [message, setMessage] = (0,
|
|
1221
|
+
const [token, setToken] = (0, import_react6.useState)("");
|
|
1222
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1223
|
+
const [message, setMessage] = (0, import_react6.useState)();
|
|
1086
1224
|
if (!view.secrets.available) {
|
|
1087
|
-
return /* @__PURE__ */ (0,
|
|
1225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sTokenNoKeychain(view.github.tokenEnv, view.secrets.why ?? "") });
|
|
1088
1226
|
}
|
|
1089
1227
|
const save = async () => {
|
|
1090
1228
|
setBusy(true);
|
|
@@ -1098,54 +1236,54 @@ function TokenForm({ view, lang, locale, onSaved, onCancel }) {
|
|
|
1098
1236
|
setMessage(r.message);
|
|
1099
1237
|
}
|
|
1100
1238
|
};
|
|
1101
|
-
return /* @__PURE__ */ (0,
|
|
1102
|
-
/* @__PURE__ */ (0,
|
|
1239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-add", children: [
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1103
1241
|
t.sTokenPaste,
|
|
1104
|
-
/* @__PURE__ */ (0,
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "password", value: token, autoComplete: "off", spellCheck: false, placeholder: "ghp_\u2026", onChange: (e) => {
|
|
1105
1243
|
setToken(e.target.value);
|
|
1106
1244
|
setMessage(void 0);
|
|
1107
1245
|
} })
|
|
1108
1246
|
] }),
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1110
|
-
message === void 0 ? null : /* @__PURE__ */ (0,
|
|
1111
|
-
/* @__PURE__ */ (0,
|
|
1112
|
-
/* @__PURE__ */ (0,
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.sTokenHow }),
|
|
1248
|
+
message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-preview mishu-danger", children: message }),
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(view.github.newTokenUrl, "_blank", "noopener"), children: t.sTokenNew }),
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || token.trim() === "", onClick: () => {
|
|
1114
1252
|
void save();
|
|
1115
1253
|
}, children: busy ? t.sTesting : t.sTokenSave }),
|
|
1116
|
-
onCancel === void 0 ? null : /* @__PURE__ */ (0,
|
|
1254
|
+
onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
|
|
1117
1255
|
] })
|
|
1118
1256
|
] });
|
|
1119
1257
|
}
|
|
1120
1258
|
function AccountRow({ account, secretsOk, lang, locale, openChat: openChat2, onEdit, onView }) {
|
|
1121
1259
|
const t = TEXT[lang];
|
|
1122
|
-
const [busy, setBusy] = (0,
|
|
1260
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1123
1261
|
const report = account.report;
|
|
1124
1262
|
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`;
|
|
1125
1263
|
const failed = !account.hasPassword || report?.error !== void 0;
|
|
1126
|
-
return /* @__PURE__ */ (0,
|
|
1127
|
-
/* @__PURE__ */ (0,
|
|
1264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: `account-${account.id}`, title: `${account.label}${account.enabled ? "" : ` (${lang === "zh" ? "\u5DF2\u505C\u7528" : "disabled"})`}`, children: [
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-card-meta", children: [
|
|
1128
1266
|
account.address,
|
|
1129
1267
|
" \xB7 ",
|
|
1130
1268
|
account.host,
|
|
1131
1269
|
":",
|
|
1132
1270
|
account.port
|
|
1133
1271
|
] }),
|
|
1134
|
-
account.mismatch === null ? null : /* @__PURE__ */ (0,
|
|
1135
|
-
/* @__PURE__ */ (0,
|
|
1272
|
+
account.mismatch === null ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-card-note mishu-warn", children: account.mismatch }),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `mishu-card-note ${failed ? "mishu-danger" : ""}`, children: [
|
|
1136
1274
|
status,
|
|
1137
|
-
account.hasPassword && report?.error !== void 0 ? /* @__PURE__ */ (0,
|
|
1275
|
+
account.hasPassword && report?.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "mail-error", accountId: account.id }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1138
1276
|
] }),
|
|
1139
|
-
/* @__PURE__ */ (0,
|
|
1140
|
-
/* @__PURE__ */ (0,
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy || !account.hasPassword, onClick: () => {
|
|
1141
1279
|
setBusy(true);
|
|
1142
1280
|
void settingsApi.syncMail(locale(), account.id).then((r) => {
|
|
1143
1281
|
setBusy(false);
|
|
1144
1282
|
onView(r);
|
|
1145
1283
|
});
|
|
1146
1284
|
}, children: busy ? t.sTesting : t.sCheckNow }),
|
|
1147
|
-
/* @__PURE__ */ (0,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: account.hasPassword && account.mismatch === null ? "mishu-btn" : "mishu-btn primary", onClick: onEdit, children: t.sEdit }),
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
|
|
1149
1287
|
if (window.confirm(t.sDeleteConfirm)) void settingsApi.deleteMail(locale(), account.id).then(onView);
|
|
1150
1288
|
}, children: t.sDelete })
|
|
1151
1289
|
] })
|
|
@@ -1154,12 +1292,12 @@ function AccountRow({ account, secretsOk, lang, locale, openChat: openChat2, onE
|
|
|
1154
1292
|
function MailDialog({ draft, view, lang, locale, openChat: openChat2, onDone }) {
|
|
1155
1293
|
const t = TEXT[lang];
|
|
1156
1294
|
const existing = draft.id !== void 0;
|
|
1157
|
-
const [account, setAccount] = (0,
|
|
1158
|
-
const [picked, setPicked] = (0,
|
|
1159
|
-
const [password, setPassword] = (0,
|
|
1160
|
-
const [message, setMessage] = (0,
|
|
1161
|
-
const [failedTest, setFailedTest] = (0,
|
|
1162
|
-
const [busy, setBusy] = (0,
|
|
1295
|
+
const [account, setAccount] = (0, import_react6.useState)(draft);
|
|
1296
|
+
const [picked, setPicked] = (0, import_react6.useState)(existing);
|
|
1297
|
+
const [password, setPassword] = (0, import_react6.useState)("");
|
|
1298
|
+
const [message, setMessage] = (0, import_react6.useState)();
|
|
1299
|
+
const [failedTest, setFailedTest] = (0, import_react6.useState)(false);
|
|
1300
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1163
1301
|
const preset = view.presets.find((p) => p.id === account.preset) ?? view.presets[view.presets.length - 1];
|
|
1164
1302
|
const custom = preset.id === "custom";
|
|
1165
1303
|
const set = (patch) => {
|
|
@@ -1192,115 +1330,115 @@ function MailDialog({ draft, view, lang, locale, openChat: openChat2, onDone })
|
|
|
1192
1330
|
setMessage({ ok: false, text: r.message });
|
|
1193
1331
|
}
|
|
1194
1332
|
};
|
|
1195
|
-
return /* @__PURE__ */ (0,
|
|
1196
|
-
/* @__PURE__ */ (0,
|
|
1333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Modal, { title: existing ? t.mTitleEdit : t.mTitleAdd, onClose: () => onDone(), children: [
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1197
1335
|
t.sAddress,
|
|
1198
|
-
/* @__PURE__ */ (0,
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "email", value: account.address ?? "", autoComplete: "off", autoFocus: !existing, onChange: (e) => setAddress(e.target.value) })
|
|
1199
1337
|
] }),
|
|
1200
|
-
/* @__PURE__ */ (0,
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1201
1339
|
t.sProvider,
|
|
1202
|
-
/* @__PURE__ */ (0,
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { value: account.preset, onChange: (e) => {
|
|
1203
1341
|
setPicked(true);
|
|
1204
1342
|
set({ preset: e.target.value });
|
|
1205
|
-
}, children: view.presets.map((p) => /* @__PURE__ */ (0,
|
|
1343
|
+
}, children: view.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: p.id, children: p.label }, p.id)) })
|
|
1206
1344
|
] }),
|
|
1207
|
-
/* @__PURE__ */ (0,
|
|
1208
|
-
preset.steps.length === 0 ? preset.howTo : /* @__PURE__ */ (0,
|
|
1345
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `mishu-steps${preset.supported ? "" : " mishu-danger"}${failedTest ? " attention" : ""}`, children: [
|
|
1346
|
+
preset.steps.length === 0 ? preset.howTo : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { children: preset.steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { children: [
|
|
1209
1347
|
step.text,
|
|
1210
|
-
step.link === void 0 ? null : /* @__PURE__ */ (0,
|
|
1348
|
+
step.link === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1211
1349
|
" ",
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(step.link.url, "_blank", "noopener"), children: step.link.label })
|
|
1213
1351
|
] })
|
|
1214
1352
|
] }, i)) }),
|
|
1215
|
-
preset.supported ? /* @__PURE__ */ (0,
|
|
1353
|
+
preset.supported ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-steps-help", children: [
|
|
1216
1354
|
t.mStepsHelp,
|
|
1217
|
-
/* @__PURE__ */ (0,
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id }, lang, locale, openChat: openChat2, compact: true })
|
|
1218
1356
|
] }) : null
|
|
1219
1357
|
] }),
|
|
1220
|
-
/* @__PURE__ */ (0,
|
|
1358
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1221
1359
|
t.sPassword,
|
|
1222
|
-
/* @__PURE__ */ (0,
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "password", value: password, autoComplete: "new-password", placeholder: existing && view.secrets.available ? t.sPasswordKeep : "", onChange: (e) => {
|
|
1223
1361
|
setPassword(e.target.value);
|
|
1224
1362
|
setMessage(void 0);
|
|
1225
1363
|
setFailedTest(false);
|
|
1226
1364
|
} })
|
|
1227
1365
|
] }),
|
|
1228
|
-
lengthOff ? /* @__PURE__ */ (0,
|
|
1229
|
-
view.secrets.available ? null : /* @__PURE__ */ (0,
|
|
1230
|
-
custom ? /* @__PURE__ */ (0,
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1366
|
+
lengthOff ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint mishu-warn", children: t.mLength(preset.label, preset.passwordLength, typed.length) }) : null,
|
|
1367
|
+
view.secrets.available ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sPasswordTestOnly }),
|
|
1368
|
+
custom ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row", children: [
|
|
1369
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1232
1370
|
t.sHost,
|
|
1233
|
-
/* @__PURE__ */ (0,
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: account.host ?? "", placeholder: "imap.example.com", onChange: (e) => set({ host: e.target.value }) })
|
|
1234
1372
|
] }),
|
|
1235
|
-
/* @__PURE__ */ (0,
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1236
1374
|
t.sPort,
|
|
1237
|
-
/* @__PURE__ */ (0,
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", value: account.port ?? 993, onChange: (e) => set({ port: Number(e.target.value) }) })
|
|
1238
1376
|
] })
|
|
1239
1377
|
] }) : null,
|
|
1240
|
-
/* @__PURE__ */ (0,
|
|
1241
|
-
/* @__PURE__ */ (0,
|
|
1242
|
-
/* @__PURE__ */ (0,
|
|
1243
|
-
/* @__PURE__ */ (0,
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "mishu-more", children: [
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("summary", { children: t.mMore }),
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row", children: [
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1244
1382
|
t.sLabel,
|
|
1245
|
-
/* @__PURE__ */ (0,
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: account.label ?? "", placeholder: account.address ?? "", onChange: (e) => set({ label: e.target.value }) })
|
|
1246
1384
|
] }),
|
|
1247
|
-
/* @__PURE__ */ (0,
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1248
1386
|
t.sUser,
|
|
1249
|
-
/* @__PURE__ */ (0,
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: account.user ?? "", placeholder: account.address ?? "", autoComplete: "off", onChange: (e) => set({ user: e.target.value }) })
|
|
1250
1388
|
] })
|
|
1251
1389
|
] }),
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row", children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1254
1392
|
t.sSince,
|
|
1255
|
-
/* @__PURE__ */ (0,
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", min: 1, max: 90, value: account.sinceDays ?? 14, onChange: (e) => set({ sinceDays: Number(e.target.value) }) })
|
|
1256
1394
|
] }),
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-check", children: [
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", checked: account.enabled !== false, onChange: (e) => set({ enabled: e.target.checked }) }),
|
|
1259
1397
|
t.sEnabled
|
|
1260
1398
|
] })
|
|
1261
1399
|
] })
|
|
1262
1400
|
] }),
|
|
1263
|
-
message === void 0 ? null : /* @__PURE__ */ (0,
|
|
1401
|
+
message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `mishu-preview ${message.ok ? "" : "mishu-danger"}`, children: [
|
|
1264
1402
|
message.text,
|
|
1265
|
-
message.ok || !preset.supported ? null : /* @__PURE__ */ (0,
|
|
1403
|
+
message.ok || !preset.supported ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id, error: message.text }, lang, locale, openChat: openChat2, compact: true })
|
|
1266
1404
|
] }),
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1268
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || !preset.supported || (account.address ?? "") === "", onClick: () => {
|
|
1269
1407
|
void testAndSave();
|
|
1270
1408
|
}, children: busy ? t.sTesting : t.mTestSave }),
|
|
1271
|
-
failedTest ? /* @__PURE__ */ (0,
|
|
1409
|
+
failedTest ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", disabled: busy, onClick: () => {
|
|
1272
1410
|
setBusy(true);
|
|
1273
1411
|
void save();
|
|
1274
1412
|
}, children: t.mSaveAnyway }) : null,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1413
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
|
|
1276
1414
|
] })
|
|
1277
1415
|
] });
|
|
1278
1416
|
}
|
|
1279
1417
|
function WatchRow({ watch, lang, locale, openChat: openChat2, onEdit, onView }) {
|
|
1280
1418
|
const t = TEXT[lang];
|
|
1281
|
-
const [busy, setBusy] = (0,
|
|
1419
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1282
1420
|
const failed = watch.report?.error !== void 0;
|
|
1283
|
-
return /* @__PURE__ */ (0,
|
|
1284
|
-
/* @__PURE__ */ (0,
|
|
1421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Fold, { id: `watch-${watch.id}`, title: `${watch.label}${watch.enabled ? "" : ` (${t.wDisabled})`}`, children: [
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-card-meta", children: [
|
|
1285
1423
|
watch.url,
|
|
1286
1424
|
" \xB7 ",
|
|
1287
1425
|
t.wEveryUnit(watch.intervalMinutes)
|
|
1288
1426
|
] }),
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-card-meta", children: watch.summary }),
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `mishu-card-note ${failed ? "mishu-danger" : ""}`, children: [
|
|
1291
1429
|
watch.status,
|
|
1292
|
-
failed ? /* @__PURE__ */ (0,
|
|
1430
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "watch-error", watchId: watch.id }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1293
1431
|
] }),
|
|
1294
|
-
/* @__PURE__ */ (0,
|
|
1295
|
-
/* @__PURE__ */ (0,
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy, onClick: () => {
|
|
1296
1434
|
setBusy(true);
|
|
1297
1435
|
void settingsApi.syncWatch(locale(), watch.id).then((r) => {
|
|
1298
1436
|
setBusy(false);
|
|
1299
1437
|
onView(r);
|
|
1300
1438
|
});
|
|
1301
1439
|
}, children: busy ? t.wTesting : t.wCheckNow }),
|
|
1302
|
-
/* @__PURE__ */ (0,
|
|
1303
|
-
/* @__PURE__ */ (0,
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: onEdit, children: t.sEdit }),
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
|
|
1304
1442
|
if (window.confirm(t.wDeleteConfirm)) void settingsApi.deleteWatch(locale(), watch.id).then(onView);
|
|
1305
1443
|
}, children: t.sDelete })
|
|
1306
1444
|
] })
|
|
@@ -1309,10 +1447,10 @@ function WatchRow({ watch, lang, locale, openChat: openChat2, onEdit, onView })
|
|
|
1309
1447
|
function WatchDialog({ draft, lang, locale, openChat: openChat2, onDone }) {
|
|
1310
1448
|
const t = TEXT[lang];
|
|
1311
1449
|
const existing = draft.id !== void 0;
|
|
1312
|
-
const [watch, setWatch] = (0,
|
|
1313
|
-
const [message, setMessage] = (0,
|
|
1314
|
-
const [tested, setTested] = (0,
|
|
1315
|
-
const [busy, setBusy] = (0,
|
|
1450
|
+
const [watch, setWatch] = (0, import_react6.useState)(draft);
|
|
1451
|
+
const [message, setMessage] = (0, import_react6.useState)();
|
|
1452
|
+
const [tested, setTested] = (0, import_react6.useState)();
|
|
1453
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1316
1454
|
const set = (patch) => {
|
|
1317
1455
|
setWatch({ ...watch, ...patch });
|
|
1318
1456
|
setMessage(void 0);
|
|
@@ -1350,49 +1488,49 @@ function WatchDialog({ draft, lang, locale, openChat: openChat2, onDone }) {
|
|
|
1350
1488
|
text: r.keywordHit === false && hit !== void 0 ? `${t.wTestOk(r.items, r.title)} ${t.wTestNoHit(hit)}` : r.keywordHit === true && hit !== void 0 ? `${t.wTestOk(r.items, r.title)} ${t.wTestHit(hit)}` : t.wTestOk(r.items, r.title)
|
|
1351
1489
|
});
|
|
1352
1490
|
};
|
|
1353
|
-
return /* @__PURE__ */ (0,
|
|
1354
|
-
/* @__PURE__ */ (0,
|
|
1491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Modal, { title: existing ? t.wTitleEdit : t.wTitleAdd, onClose: () => onDone(), children: [
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1355
1493
|
t.wUrl,
|
|
1356
|
-
/* @__PURE__ */ (0,
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: watch.url, autoComplete: "off", autoFocus: !existing, placeholder: "https://example.com/news.xml", onChange: (e) => set({ url: e.target.value }) })
|
|
1357
1495
|
] }),
|
|
1358
|
-
/* @__PURE__ */ (0,
|
|
1359
|
-
/* @__PURE__ */ (0,
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.wUrlHint }),
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1360
1498
|
t.wLabel,
|
|
1361
|
-
/* @__PURE__ */ (0,
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: watch.label, placeholder: hostOf(watch.url), onChange: (e) => set({ label: e.target.value }) })
|
|
1362
1500
|
] }),
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1364
1502
|
t.wKeywords,
|
|
1365
|
-
/* @__PURE__ */ (0,
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: watch.keywords, placeholder: lang === "zh" ? "\u4E0A\u65B0, \u8865\u4E01, \u9762\u8BD5" : "release, patch, interview", onChange: (e) => set({ keywords: e.target.value }) })
|
|
1366
1504
|
] }),
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1368
|
-
/* @__PURE__ */ (0,
|
|
1369
|
-
/* @__PURE__ */ (0,
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.wKeywordsHint }),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row", children: [
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
|
|
1370
1508
|
t.wEvery,
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", min: 15, max: 1440, step: 15, value: watch.intervalMinutes, onChange: (e) => set({ intervalMinutes: Number(e.target.value) }) })
|
|
1372
1510
|
] }),
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-check", children: [
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", checked: watch.enabled, onChange: (e) => set({ enabled: e.target.checked }) }),
|
|
1375
1513
|
t.sEnabled
|
|
1376
1514
|
] })
|
|
1377
1515
|
] }),
|
|
1378
|
-
tested === void 0 ? null : tested.excerpt === "" ? null : /* @__PURE__ */ (0,
|
|
1379
|
-
message === void 0 ? null : /* @__PURE__ */ (0,
|
|
1516
|
+
tested === void 0 ? null : tested.excerpt === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-preview", children: tested.excerpt }),
|
|
1517
|
+
message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `mishu-preview ${message.ok ? "" : "mishu-danger"}`, children: [
|
|
1380
1518
|
message.text,
|
|
1381
|
-
message.ok ? null : /* @__PURE__ */ (0,
|
|
1519
|
+
message.ok ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "watch-setup" }, lang, locale, openChat: openChat2, compact: true })
|
|
1382
1520
|
] }),
|
|
1383
|
-
/* @__PURE__ */ (0,
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy || watch.url.trim() === "", onClick: () => {
|
|
1385
1523
|
void test();
|
|
1386
1524
|
}, children: t.wTest }),
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || watch.url.trim() === "", onClick: () => {
|
|
1388
1526
|
void save(true);
|
|
1389
1527
|
}, children: busy ? t.wTesting : t.wSaveAndCheck }),
|
|
1390
|
-
/* @__PURE__ */ (0,
|
|
1528
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
|
|
1391
1529
|
] }),
|
|
1392
|
-
existing ? null : /* @__PURE__ */ (0,
|
|
1530
|
+
existing ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "mishu-hint", children: [
|
|
1393
1531
|
t.wAskSetup,
|
|
1394
1532
|
" ",
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "watch-setup" }, lang, locale, openChat: openChat2, compact: true })
|
|
1396
1534
|
] })
|
|
1397
1535
|
] });
|
|
1398
1536
|
}
|
|
@@ -1405,7 +1543,7 @@ function hostOf(url) {
|
|
|
1405
1543
|
}
|
|
1406
1544
|
|
|
1407
1545
|
// src/client/Board.tsx
|
|
1408
|
-
var
|
|
1546
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1409
1547
|
var SOURCE_KEY = "dsh-mishu.source";
|
|
1410
1548
|
function loadSource() {
|
|
1411
1549
|
try {
|
|
@@ -1441,15 +1579,15 @@ function saveWidths(widths) {
|
|
|
1441
1579
|
}
|
|
1442
1580
|
}
|
|
1443
1581
|
function MishuBoard({ locale, openChat: openChat2 }) {
|
|
1444
|
-
const [board, setBoard] = (0,
|
|
1445
|
-
const [error, setError] = (0,
|
|
1446
|
-
const [busy, setBusy] = (0,
|
|
1447
|
-
const [syncing, setSyncing] = (0,
|
|
1448
|
-
const [dropOn, setDropOn] = (0,
|
|
1449
|
-
const [widths, setWidths] = (0,
|
|
1450
|
-
const [tab, setTab] = (0,
|
|
1451
|
-
const [openCard, setOpenCard] = (0,
|
|
1452
|
-
const [source, setSourceState] = (0,
|
|
1582
|
+
const [board, setBoard] = (0, import_react7.useState)();
|
|
1583
|
+
const [error, setError] = (0, import_react7.useState)();
|
|
1584
|
+
const [busy, setBusy] = (0, import_react7.useState)(false);
|
|
1585
|
+
const [syncing, setSyncing] = (0, import_react7.useState)(false);
|
|
1586
|
+
const [dropOn, setDropOn] = (0, import_react7.useState)();
|
|
1587
|
+
const [widths, setWidths] = (0, import_react7.useState)(loadWidths);
|
|
1588
|
+
const [tab, setTab] = (0, import_react7.useState)("board");
|
|
1589
|
+
const [openCard, setOpenCard] = (0, import_react7.useState)();
|
|
1590
|
+
const [source, setSourceState] = (0, import_react7.useState)(loadSource);
|
|
1453
1591
|
const setSource = (next) => {
|
|
1454
1592
|
setSourceState(next);
|
|
1455
1593
|
try {
|
|
@@ -1457,11 +1595,11 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1457
1595
|
} catch {
|
|
1458
1596
|
}
|
|
1459
1597
|
};
|
|
1460
|
-
const dragged = (0,
|
|
1461
|
-
const columnsRef = (0,
|
|
1598
|
+
const dragged = (0, import_react7.useRef)(void 0);
|
|
1599
|
+
const columnsRef = (0, import_react7.useRef)(null);
|
|
1462
1600
|
const lang = board?.lang ?? uiLang(locale());
|
|
1463
1601
|
const t = TEXT[lang];
|
|
1464
|
-
const take = (0,
|
|
1602
|
+
const take = (0, import_react7.useCallback)((result) => {
|
|
1465
1603
|
if (result.ok) {
|
|
1466
1604
|
setBoard(result.board);
|
|
1467
1605
|
setError(void 0);
|
|
@@ -1469,8 +1607,8 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1469
1607
|
setError(result.message);
|
|
1470
1608
|
}
|
|
1471
1609
|
}, []);
|
|
1472
|
-
const load = (0,
|
|
1473
|
-
(0,
|
|
1610
|
+
const load = (0, import_react7.useCallback)(() => mishuApi.board(locale()).then(take), [locale, take]);
|
|
1611
|
+
(0, import_react7.useEffect)(() => {
|
|
1474
1612
|
void load();
|
|
1475
1613
|
const timer = setInterval(() => {
|
|
1476
1614
|
void load();
|
|
@@ -1565,7 +1703,7 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1565
1703
|
const key = cardKey(item);
|
|
1566
1704
|
setOpenCard((current) => current === key ? void 0 : key);
|
|
1567
1705
|
};
|
|
1568
|
-
const card = (item, column) => /* @__PURE__ */ (0,
|
|
1706
|
+
const card = (item, column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1569
1707
|
Card,
|
|
1570
1708
|
{
|
|
1571
1709
|
item,
|
|
@@ -1591,12 +1729,12 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1591
1729
|
cardKey(item)
|
|
1592
1730
|
);
|
|
1593
1731
|
if (board === void 0) {
|
|
1594
|
-
return /* @__PURE__ */ (0,
|
|
1595
|
-
/* @__PURE__ */ (0,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
1597
|
-
/* @__PURE__ */ (0,
|
|
1732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-page", children: [
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-head", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-title", children: [
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { children: t.title }),
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RestartButton, { lang, locale })
|
|
1598
1736
|
] }) }),
|
|
1599
|
-
error === void 0 ? /* @__PURE__ */ (0,
|
|
1737
|
+
error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-error", children: [
|
|
1600
1738
|
t.failed,
|
|
1601
1739
|
error
|
|
1602
1740
|
] })
|
|
@@ -1622,7 +1760,7 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1622
1760
|
{ id: "manual", label: t.sourceManual }
|
|
1623
1761
|
];
|
|
1624
1762
|
const template = `minmax(0, ${widths[0]}fr) 10px minmax(0, ${widths[1]}fr) 10px minmax(0, ${widths[2]}fr)`;
|
|
1625
|
-
const divider = (index) => /* @__PURE__ */ (0,
|
|
1763
|
+
const divider = (index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1626
1764
|
"div",
|
|
1627
1765
|
{
|
|
1628
1766
|
className: "mishu-divider",
|
|
@@ -1633,112 +1771,112 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1633
1771
|
onDoubleClick: resetWidths
|
|
1634
1772
|
}
|
|
1635
1773
|
);
|
|
1636
|
-
return /* @__PURE__ */ (0,
|
|
1637
|
-
/* @__PURE__ */ (0,
|
|
1638
|
-
/* @__PURE__ */ (0,
|
|
1639
|
-
/* @__PURE__ */ (0,
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-page", "data-mishu-board": "", children: [
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-head", children: [
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-title", children: [
|
|
1777
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { children: t.title }),
|
|
1778
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-tabs", role: "tablist", children: [
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "board", className: tab === "board" ? "active" : "", onClick: () => setTab("board"), children: t.tabBoard }),
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "settings", className: tab === "settings" ? "active" : "", onClick: () => setTab("settings"), children: t.tabSettings })
|
|
1643
1781
|
] }),
|
|
1644
|
-
/* @__PURE__ */ (0,
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RestartButton, { lang, locale })
|
|
1645
1783
|
] }),
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-sources", children: [
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: `mishu-dot ${board.sources.github.state}` }),
|
|
1649
1787
|
board.sources.github.text,
|
|
1650
|
-
board.sources.github.state === "error" ? /* @__PURE__ */ (0,
|
|
1788
|
+
board.sources.github.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AskAI, { topic: { kind: "github-error" }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1651
1789
|
] }),
|
|
1652
|
-
board.sources.mail.map((m) => /* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1790
|
+
board.sources.mail.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: `mishu-dot ${m.state}` }),
|
|
1654
1792
|
m.text,
|
|
1655
|
-
m.state === "error" ? /* @__PURE__ */ (0,
|
|
1793
|
+
m.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AskAI, { topic: { kind: "mail-error", accountId: m.id }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1656
1794
|
] }, m.id)),
|
|
1657
|
-
board.sources.watch.map((w) => /* @__PURE__ */ (0,
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
1795
|
+
board.sources.watch.map((w) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: `mishu-dot ${w.state}` }),
|
|
1659
1797
|
w.text,
|
|
1660
|
-
w.state === "error" ? /* @__PURE__ */ (0,
|
|
1798
|
+
w.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AskAI, { topic: { kind: "watch-error", watchId: w.id }, lang, locale, openChat: openChat2, compact: true }) : null
|
|
1661
1799
|
] }, `watch-${w.id}`)),
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
1800
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "mishu-btn", disabled: syncing, onClick: () => {
|
|
1663
1801
|
void sync();
|
|
1664
1802
|
}, children: syncing ? t.syncing : t.sync })
|
|
1665
1803
|
] })
|
|
1666
1804
|
] }),
|
|
1667
|
-
tab === "settings" ? /* @__PURE__ */ (0,
|
|
1668
|
-
tab === "settings" ? null : /* @__PURE__ */ (0,
|
|
1669
|
-
error === void 0 ? null : /* @__PURE__ */ (0,
|
|
1805
|
+
tab === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MishuSettings, { lang, locale, openChat: openChat2 }) : null,
|
|
1806
|
+
tab === "settings" ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1807
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-error", children: [
|
|
1670
1808
|
t.failed,
|
|
1671
1809
|
error
|
|
1672
1810
|
] }),
|
|
1673
|
-
/* @__PURE__ */ (0,
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "mishu-summary", children: [
|
|
1674
1812
|
board.summary,
|
|
1675
1813
|
" ",
|
|
1676
|
-
/* @__PURE__ */ (0,
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AskAI, { topic: { kind: "summary" }, lang, locale, openChat: openChat2, compact: true })
|
|
1677
1815
|
] }),
|
|
1678
|
-
/* @__PURE__ */ (0,
|
|
1679
|
-
/* @__PURE__ */ (0,
|
|
1680
|
-
/* @__PURE__ */ (0,
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metrics", children: [
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metric", children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-metric-label", children: t.metricHandle }),
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metric-value", children: [
|
|
1682
1820
|
metrics.handle,
|
|
1683
|
-
metrics.overdue > 0 ? /* @__PURE__ */ (0,
|
|
1821
|
+
metrics.overdue > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("small", { className: "mishu-danger", children: [
|
|
1684
1822
|
metrics.overdue,
|
|
1685
1823
|
" ",
|
|
1686
1824
|
t.metricOverdue
|
|
1687
1825
|
] }) : null
|
|
1688
1826
|
] })
|
|
1689
1827
|
] }),
|
|
1690
|
-
/* @__PURE__ */ (0,
|
|
1691
|
-
/* @__PURE__ */ (0,
|
|
1692
|
-
/* @__PURE__ */ (0,
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metric", children: [
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-metric-label", children: t.metricSoon }),
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-metric-value", children: metrics.dueSoon })
|
|
1693
1831
|
] }),
|
|
1694
|
-
/* @__PURE__ */ (0,
|
|
1695
|
-
/* @__PURE__ */ (0,
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metric", children: [
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-metric-label", children: t.metricClosed }),
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-metric-value", children: metrics.closedToday })
|
|
1697
1835
|
] }),
|
|
1698
|
-
/* @__PURE__ */ (0,
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1700
|
-
/* @__PURE__ */ (0,
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metric", children: [
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-metric-label", children: t.metricShadow }),
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-metric-value", children: [
|
|
1701
1839
|
metrics.shadow,
|
|
1702
|
-
board.markRead === "shadow" ? /* @__PURE__ */ (0,
|
|
1840
|
+
board.markRead === "shadow" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "mishu-warn", children: t.shadowTag }) : null
|
|
1703
1841
|
] })
|
|
1704
1842
|
] })
|
|
1705
1843
|
] }),
|
|
1706
|
-
/* @__PURE__ */ (0,
|
|
1844
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-filters", role: "group", children: sources.map((s) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", "aria-pressed": source === s.id, className: `mishu-chip ${source === s.id ? "active" : ""}`, onClick: () => setSource(s.id), children: [
|
|
1707
1845
|
s.label,
|
|
1708
|
-
/* @__PURE__ */ (0,
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: count(s.id) })
|
|
1709
1847
|
] }, s.id)) }),
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1711
|
-
/* @__PURE__ */ (0,
|
|
1712
|
-
/* @__PURE__ */ (0,
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-columns", ref: columnsRef, style: { ["--mishu-cols"]: template }, children: [
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: `mishu-col ${dropOn === "handle" ? "drop" : ""}`, ...dropProps("handle"), "aria-label": t.handle, children: [
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-col-head", children: [
|
|
1713
1851
|
t.handle,
|
|
1714
|
-
/* @__PURE__ */ (0,
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: columns.handle.length })
|
|
1715
1853
|
] }),
|
|
1716
|
-
columns.handle.length === 0 ? /* @__PURE__ */ (0,
|
|
1854
|
+
columns.handle.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-empty", children: t.emptyHandle }) : columns.handle.map((item) => card(item, "handle"))
|
|
1717
1855
|
] }),
|
|
1718
1856
|
divider(0),
|
|
1719
|
-
/* @__PURE__ */ (0,
|
|
1720
|
-
/* @__PURE__ */ (0,
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: `mishu-col ${dropOn === "remember" ? "drop" : ""}`, ...dropProps("remember"), "aria-label": t.remember, title: t.dropRemember, children: [
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-col-head", children: [
|
|
1721
1859
|
t.remember,
|
|
1722
|
-
/* @__PURE__ */ (0,
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: columns.remember.length })
|
|
1723
1861
|
] }),
|
|
1724
|
-
columns.remember.length === 0 ? /* @__PURE__ */ (0,
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
1862
|
+
columns.remember.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-empty", children: t.emptyRemember }) : columns.remember.map((item) => card(item, "remember")),
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AddForm, { lang, locale, onAdded: (next) => setBoard(next) })
|
|
1726
1864
|
] }),
|
|
1727
1865
|
divider(1),
|
|
1728
|
-
/* @__PURE__ */ (0,
|
|
1729
|
-
/* @__PURE__ */ (0,
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: `mishu-col ${dropOn === "done" ? "drop" : ""}`, ...dropProps("done"), "aria-label": t.done, title: t.dropDone, children: [
|
|
1867
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-col-head", children: [
|
|
1730
1868
|
t.done,
|
|
1731
|
-
/* @__PURE__ */ (0,
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: columns.done.total })
|
|
1732
1870
|
] }),
|
|
1733
|
-
columns.done.groups.length === 0 ? /* @__PURE__ */ (0,
|
|
1734
|
-
/* @__PURE__ */ (0,
|
|
1871
|
+
columns.done.groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-empty", children: t.emptyDone }) : columns.done.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { className: "mishu-group", children: [
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
|
|
1735
1873
|
group.label,
|
|
1736
|
-
/* @__PURE__ */ (0,
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: group.items.length })
|
|
1737
1875
|
] }),
|
|
1738
1876
|
group.items.map((item) => card(item, "done"))
|
|
1739
1877
|
] }, group.reason)),
|
|
1740
|
-
columns.done.total > 0 ? /* @__PURE__ */ (0,
|
|
1741
|
-
metrics.shadow > 0 ? /* @__PURE__ */ (0,
|
|
1878
|
+
columns.done.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mishu-hint", children: t.doneHint }) : null,
|
|
1879
|
+
metrics.shadow > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-banner", children: t.shadow(metrics.shadow) }) : null
|
|
1742
1880
|
] })
|
|
1743
1881
|
] })
|
|
1744
1882
|
] })
|
|
@@ -1746,10 +1884,10 @@ function MishuBoard({ locale, openChat: openChat2 }) {
|
|
|
1746
1884
|
}
|
|
1747
1885
|
function Card({ item, column, lang, locale, busy, label, openChat: openChat2, open, onToggle, onAct, onDragStart, onDragEnd }) {
|
|
1748
1886
|
const t = TEXT[lang];
|
|
1749
|
-
const [detail, setDetail] = (0,
|
|
1887
|
+
const [detail, setDetail] = (0, import_react7.useState)();
|
|
1750
1888
|
const explain = item.explain;
|
|
1751
1889
|
const compact = column === "done";
|
|
1752
|
-
(0,
|
|
1890
|
+
(0, import_react7.useEffect)(() => {
|
|
1753
1891
|
if (!open || item.target !== "matter" || detail !== void 0) return;
|
|
1754
1892
|
let alive = true;
|
|
1755
1893
|
void mishuApi.detail(locale(), item.id).then((r) => {
|
|
@@ -1759,11 +1897,11 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, op
|
|
|
1759
1897
|
alive = false;
|
|
1760
1898
|
};
|
|
1761
1899
|
}, [open, item.target, item.id, detail, locale]);
|
|
1762
|
-
const row = (name, text, className = "") => text === null || text === void 0 || text === "" ? null : /* @__PURE__ */ (0,
|
|
1763
|
-
/* @__PURE__ */ (0,
|
|
1764
|
-
/* @__PURE__ */ (0,
|
|
1900
|
+
const row = (name, text, className = "") => text === null || text === void 0 || text === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `mishu-row-explain ${className}`, children: [
|
|
1901
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mishu-row-label", children: name }),
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: text })
|
|
1765
1903
|
] });
|
|
1766
|
-
return /* @__PURE__ */ (0,
|
|
1904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1767
1905
|
"div",
|
|
1768
1906
|
{
|
|
1769
1907
|
className: `mishu-card ${open ? "open" : ""} ${item.tone === "normal" ? "" : item.tone}`,
|
|
@@ -1774,7 +1912,7 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, op
|
|
|
1774
1912
|
},
|
|
1775
1913
|
onDragEnd,
|
|
1776
1914
|
children: [
|
|
1777
|
-
/* @__PURE__ */ (0,
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1778
1916
|
"div",
|
|
1779
1917
|
{
|
|
1780
1918
|
className: "mishu-card-head",
|
|
@@ -1789,40 +1927,40 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, op
|
|
|
1789
1927
|
onToggle();
|
|
1790
1928
|
},
|
|
1791
1929
|
children: [
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
1930
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mishu-caret", "aria-hidden": "true" }),
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mishu-card-title", children: item.title })
|
|
1794
1932
|
]
|
|
1795
1933
|
}
|
|
1796
1934
|
),
|
|
1797
|
-
open ? /* @__PURE__ */ (0,
|
|
1798
|
-
/* @__PURE__ */ (0,
|
|
1799
|
-
!compact && explain !== null ? /* @__PURE__ */ (0,
|
|
1935
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-card-body", children: [
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-card-meta", children: item.meta }),
|
|
1937
|
+
!compact && explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-explain", children: [
|
|
1800
1938
|
row(t.what, explain.what),
|
|
1801
1939
|
row(column === "remember" ? t.whyKeep : t.why, explain.why),
|
|
1802
1940
|
row(t.fix, explain.fix, "mishu-fix")
|
|
1803
1941
|
] }) : null,
|
|
1804
|
-
!compact && explain === null && item.note !== null ? /* @__PURE__ */ (0,
|
|
1805
|
-
item.target === "matter" ? /* @__PURE__ */ (0,
|
|
1806
|
-
compact && detail.explain !== null ? /* @__PURE__ */ (0,
|
|
1942
|
+
!compact && explain === null && item.note !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-card-note", children: item.note }) : null,
|
|
1943
|
+
item.target === "matter" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-detail", children: detail === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-empty", children: t.loading }) : "error" in detail ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-danger", children: detail.error }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1944
|
+
compact && detail.explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1807
1945
|
row(t.what, detail.explain.what),
|
|
1808
1946
|
row(t.whyDone, detail.explain.why)
|
|
1809
1947
|
] }) : null,
|
|
1810
|
-
detail.did.length > 0 ? /* @__PURE__ */ (0,
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1948
|
+
detail.did.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-row-explain", children: [
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mishu-row-label", children: t.did }),
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: detail.did.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: line }, i)) })
|
|
1813
1951
|
] }) : null,
|
|
1814
|
-
detail.messages.length > 0 ? /* @__PURE__ */ (0,
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
1816
|
-
/* @__PURE__ */ (0,
|
|
1817
|
-
/* @__PURE__ */ (0,
|
|
1952
|
+
detail.messages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-messages", children: [
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mishu-row-label", children: t.messages(detail.messages.length) }),
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: detail.messages.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { children: [
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: m.at }),
|
|
1818
1956
|
" ",
|
|
1819
1957
|
m.title
|
|
1820
1958
|
] }, i)) })
|
|
1821
1959
|
] }) : null
|
|
1822
1960
|
] }) }) : null,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
column === "handle" ? /* @__PURE__ */ (0,
|
|
1825
|
-
item.actions.map((action, index) => /* @__PURE__ */ (0,
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-actions", children: [
|
|
1962
|
+
column === "handle" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2 }) : null,
|
|
1963
|
+
item.actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1826
1964
|
"button",
|
|
1827
1965
|
{
|
|
1828
1966
|
type: "button",
|
|
@@ -1833,7 +1971,7 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, op
|
|
|
1833
1971
|
},
|
|
1834
1972
|
action
|
|
1835
1973
|
)),
|
|
1836
|
-
column === "handle" ? null : /* @__PURE__ */ (0,
|
|
1974
|
+
column === "handle" ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2, compact: true })
|
|
1837
1975
|
] })
|
|
1838
1976
|
] }) : null
|
|
1839
1977
|
]
|
|
@@ -1843,11 +1981,11 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, op
|
|
|
1843
1981
|
var EMPTY = { title: "", due: "", repeat: "none", category: "other", note: "" };
|
|
1844
1982
|
function AddForm({ lang, locale, onAdded }) {
|
|
1845
1983
|
const t = TEXT[lang];
|
|
1846
|
-
const [open, setOpen] = (0,
|
|
1847
|
-
const [item, setItem] = (0,
|
|
1848
|
-
const [preview, setPreview] = (0,
|
|
1849
|
-
const [saving, setSaving] = (0,
|
|
1850
|
-
(0,
|
|
1984
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
1985
|
+
const [item, setItem] = (0, import_react7.useState)(EMPTY);
|
|
1986
|
+
const [preview, setPreview] = (0, import_react7.useState)();
|
|
1987
|
+
const [saving, setSaving] = (0, import_react7.useState)(false);
|
|
1988
|
+
(0, import_react7.useEffect)(() => {
|
|
1851
1989
|
if (!open || item.title.trim() === "" || item.due === "") {
|
|
1852
1990
|
setPreview(void 0);
|
|
1853
1991
|
return;
|
|
@@ -1858,7 +1996,7 @@ function AddForm({ lang, locale, onAdded }) {
|
|
|
1858
1996
|
return () => clearTimeout(timer);
|
|
1859
1997
|
}, [open, item, locale]);
|
|
1860
1998
|
if (!open) {
|
|
1861
|
-
return /* @__PURE__ */ (0,
|
|
1999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setOpen(true), children: [
|
|
1862
2000
|
"+ ",
|
|
1863
2001
|
t.add
|
|
1864
2002
|
] });
|
|
@@ -1876,49 +2014,49 @@ function AddForm({ lang, locale, onAdded }) {
|
|
|
1876
2014
|
setPreview({ ok: false, text: result.message });
|
|
1877
2015
|
}
|
|
1878
2016
|
};
|
|
1879
|
-
return /* @__PURE__ */ (0,
|
|
1880
|
-
/* @__PURE__ */ (0,
|
|
2017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-add", children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "mishu-field", children: [
|
|
1881
2019
|
t.addTitle,
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
2020
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { value: item.title, placeholder: t.addTitlePlaceholder, onChange: set("title") })
|
|
1883
2021
|
] }),
|
|
1884
|
-
/* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-row", children: [
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "mishu-field", children: [
|
|
1886
2024
|
t.addDue,
|
|
1887
|
-
/* @__PURE__ */ (0,
|
|
2025
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "date", value: item.due, onChange: set("due") })
|
|
1888
2026
|
] }),
|
|
1889
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "mishu-field", children: [
|
|
1890
2028
|
t.addRepeat,
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("select", { value: item.repeat, onChange: set("repeat"), children: Object.entries(t.repeats).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value, children: text }, value)) })
|
|
1892
2030
|
] })
|
|
1893
2031
|
] }),
|
|
1894
|
-
/* @__PURE__ */ (0,
|
|
1895
|
-
/* @__PURE__ */ (0,
|
|
2032
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-row", children: [
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "mishu-field", children: [
|
|
1896
2034
|
t.addCategory,
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("select", { value: item.category, onChange: set("category"), children: Object.entries(t.categories).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value, children: text }, value)) })
|
|
1898
2036
|
] }),
|
|
1899
|
-
/* @__PURE__ */ (0,
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "mishu-field", children: [
|
|
1900
2038
|
t.addNote,
|
|
1901
|
-
/* @__PURE__ */ (0,
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { value: item.note, onChange: set("note") })
|
|
1902
2040
|
] })
|
|
1903
2041
|
] }),
|
|
1904
|
-
/* @__PURE__ */ (0,
|
|
1905
|
-
/* @__PURE__ */ (0,
|
|
1906
|
-
/* @__PURE__ */ (0,
|
|
2042
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `mishu-preview ${preview?.ok === false ? "mishu-danger" : ""}`, children: preview?.text ?? t.previewHint }),
|
|
2043
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mishu-actions", children: [
|
|
2044
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: saving || preview?.ok !== true, onClick: () => {
|
|
1907
2045
|
void save();
|
|
1908
2046
|
}, children: t.save }),
|
|
1909
|
-
/* @__PURE__ */ (0,
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
|
|
1910
2048
|
setOpen(false);
|
|
1911
2049
|
setItem(EMPTY);
|
|
1912
2050
|
}, children: t.cancel })
|
|
1913
2051
|
] }),
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
2052
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mishu-hint", children: t.chatHint })
|
|
1915
2053
|
] });
|
|
1916
2054
|
}
|
|
1917
2055
|
function RestartButton({ lang, locale }) {
|
|
1918
2056
|
const t = TEXT[lang];
|
|
1919
|
-
const [why, setWhy] = (0,
|
|
1920
|
-
const [status, setStatus] = (0,
|
|
1921
|
-
(0,
|
|
2057
|
+
const [why, setWhy] = (0, import_react7.useState)();
|
|
2058
|
+
const [status, setStatus] = (0, import_react7.useState)();
|
|
2059
|
+
(0, import_react7.useEffect)(() => {
|
|
1922
2060
|
void restartApi.info(locale()).then((r) => {
|
|
1923
2061
|
if (r.ok && !r.supported) setWhy(r.why);
|
|
1924
2062
|
});
|
|
@@ -1938,12 +2076,12 @@ function RestartButton({ lang, locale }) {
|
|
|
1938
2076
|
setStatus({ ok: true, text: await reconnect(locale) ? t.restartReloading : t.restartSlow });
|
|
1939
2077
|
}
|
|
1940
2078
|
};
|
|
1941
|
-
return /* @__PURE__ */ (0,
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
2079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "mishu-btn", title: why === void 0 ? t.restartTip : `${t.restartTip}
|
|
1943
2081
|
${why}`, disabled: status?.ok === true, onClick: () => {
|
|
1944
2082
|
void restart();
|
|
1945
2083
|
}, children: t.restart }),
|
|
1946
|
-
status === void 0 ? null : /* @__PURE__ */ (0,
|
|
2084
|
+
status === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: status.ok ? "mishu-hint" : "mishu-hint mishu-warn", children: status.text })
|
|
1947
2085
|
] });
|
|
1948
2086
|
}
|
|
1949
2087
|
async function reconnect(locale) {
|
|
@@ -2097,18 +2235,18 @@ var STYLES = `
|
|
|
2097
2235
|
`;
|
|
2098
2236
|
|
|
2099
2237
|
// src/client/index.tsx
|
|
2100
|
-
var
|
|
2238
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2101
2239
|
var PACKAGE_NAME = "dsh-mishu";
|
|
2102
2240
|
var inject = ["slots", "locale"];
|
|
2103
2241
|
var PANEL_ID = "dsh-mishu";
|
|
2104
2242
|
var NS = "dsh-mishu";
|
|
2105
2243
|
var openChat;
|
|
2106
2244
|
function MishuIcon({ size }) {
|
|
2107
|
-
return /* @__PURE__ */ (0,
|
|
2108
|
-
/* @__PURE__ */ (0,
|
|
2109
|
-
/* @__PURE__ */ (0,
|
|
2110
|
-
/* @__PURE__ */ (0,
|
|
2111
|
-
/* @__PURE__ */ (0,
|
|
2245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.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: [
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("rect", { x: "5", y: "4", width: "14", height: "17", rx: "2" }),
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M9 4h6v3H9z" }),
|
|
2248
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M9 12l2 2 4-4" }),
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M9 17h6" })
|
|
2112
2250
|
] });
|
|
2113
2251
|
}
|
|
2114
2252
|
function apply(ctx) {
|