@dsh-teamwork/dsh-teamwork 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/README.zh-CN.md +1 -1
- package/docs/development.md +72 -2
- package/docs/en/guide.md +43 -2
- package/docs/zh-CN/guide.md +18 -2
- package/lib/audit-archive.js +174 -0
- package/lib/audit-archive.js.map +1 -0
- package/lib/audit-cli.js +91 -0
- package/lib/audit-cli.js.map +1 -0
- package/lib/bridge.js +32 -10
- package/lib/bridge.js.map +1 -1
- package/lib/client.js +37 -15
- package/lib/client.js.map +1 -1
- package/lib/config-sync.js +1 -1
- package/lib/config-sync.js.map +1 -1
- package/lib/index.js +333 -94
- package/lib/index.js.map +1 -1
- package/lib/locale.js +18 -0
- package/lib/locale.js.map +1 -0
- package/lib/login-callback.js +1 -1
- package/lib/login-callback.js.map +1 -1
- package/lib/messages.js +119 -0
- package/lib/messages.js.map +1 -0
- package/lib/panel.js +27 -20
- package/lib/panel.js.map +1 -1
- package/lib/phone-security.js +120 -2
- package/lib/phone-security.js.map +1 -1
- package/lib/pin-lock.js +89 -0
- package/lib/pin-lock.js.map +1 -0
- package/lib/platform-models.js +10 -7
- package/lib/platform-models.js.map +1 -1
- package/lib/plugin-status.js +4 -4
- package/lib/plugin-status.js.map +1 -1
- package/lib/preset-session.js +2 -1
- package/lib/preset-session.js.map +1 -1
- package/lib/relay.js +14 -9
- package/lib/relay.js.map +1 -1
- package/lib/shared-mode.js +151 -0
- package/lib/shared-mode.js.map +1 -0
- package/lib/shared-owner.js +122 -0
- package/lib/shared-owner.js.map +1 -0
- package/lib/shared-roster.js +112 -0
- package/lib/shared-roster.js.map +1 -0
- package/lib/task-session.js +21 -19
- package/lib/task-session.js.map +1 -1
- package/lib/types/audit-archive.d.ts +78 -0
- package/lib/types/audit-archive.d.ts.map +1 -0
- package/lib/types/audit-cli.d.ts +14 -0
- package/lib/types/audit-cli.d.ts.map +1 -0
- package/lib/types/bridge.d.ts +7 -3
- package/lib/types/bridge.d.ts.map +1 -1
- package/lib/types/client.d.ts +21 -4
- package/lib/types/client.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/locale.d.ts +13 -0
- package/lib/types/locale.d.ts.map +1 -0
- package/lib/types/messages.d.ts +67 -0
- package/lib/types/messages.d.ts.map +1 -0
- package/lib/types/panel.d.ts +64 -8
- package/lib/types/panel.d.ts.map +1 -1
- package/lib/types/phone-security.d.ts +37 -0
- package/lib/types/phone-security.d.ts.map +1 -1
- package/lib/types/pin-lock.d.ts +36 -0
- package/lib/types/pin-lock.d.ts.map +1 -0
- package/lib/types/platform-models.d.ts.map +1 -1
- package/lib/types/preset-session.d.ts.map +1 -1
- package/lib/types/relay.d.ts +15 -1
- package/lib/types/relay.d.ts.map +1 -1
- package/lib/types/shared-mode.d.ts +50 -0
- package/lib/types/shared-mode.d.ts.map +1 -0
- package/lib/types/shared-owner.d.ts +42 -0
- package/lib/types/shared-owner.d.ts.map +1 -0
- package/lib/types/shared-roster.d.ts +49 -0
- package/lib/types/shared-roster.d.ts.map +1 -0
- package/lib/types/task-session.d.ts +2 -2
- package/lib/types/task-session.d.ts.map +1 -1
- package/lib/web/client.js +1086 -355
- package/package.json +8 -1
package/lib/web/client.js
CHANGED
|
@@ -31,8 +31,8 @@ var PANEL_ID = "dsh-teamwork";
|
|
|
31
31
|
function currentSessionTracker(list) {
|
|
32
32
|
let last;
|
|
33
33
|
return () => {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
34
|
+
const open2 = Object.values(list.getSnapshot().byId).find((s) => (s.retainedBy?.mainView ?? 0) > 0);
|
|
35
|
+
if (open2) last = open2.id;
|
|
36
36
|
return last;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -336,6 +336,11 @@ var css = String.raw`
|
|
|
336
336
|
.twui-resource-list .twui-item-subtitle { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--twui-fill); color: var(--twui-fg-muted); }
|
|
337
337
|
.twui-resource-list .twui-item-tags { margin-top: 8px; }
|
|
338
338
|
.twui-resource-list .twui-item-title { font-size: 15px; font-weight: 500; }
|
|
339
|
+
/* The one entry a screen leads with (the team assistant): a strong border, and the team's navy as a bar and on its tile. */
|
|
340
|
+
.twui-featured .twui-item { border-color: var(--twui-border-strong); box-shadow: inset 3px 0 0 var(--twui-brand); }
|
|
341
|
+
.twui-featured .twui-item-main { padding: 20px 20px 20px 23px; }
|
|
342
|
+
.twui-featured .twui-tile { background: var(--twui-brand); color: var(--twui-brand-fg); }
|
|
343
|
+
.twui-featured .twui-item-desc { max-width: 68ch; }
|
|
339
344
|
.twui-account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; margin-top: 12px; align-items: start; }
|
|
340
345
|
.twui-account-grid > section { gap: 20px; min-width: 0; }
|
|
341
346
|
.twui-account-grid h3 { font-size: 15px; font-weight: 500; }
|
|
@@ -620,7 +625,7 @@ function Select({ id, label, value, options, onChange, onActivate, disabled = fa
|
|
|
620
625
|
const root = (0, import_react3.useRef)(null);
|
|
621
626
|
const trigger = (0, import_react3.useRef)(null);
|
|
622
627
|
const list = (0, import_react3.useRef)(null);
|
|
623
|
-
const [
|
|
628
|
+
const [open2, setOpen] = (0, import_react3.useState)(false);
|
|
624
629
|
const [active, setActive] = (0, import_react3.useState)(0);
|
|
625
630
|
const [side, setSide] = (0, import_react3.useState)("bottom");
|
|
626
631
|
const [height, setHeight] = (0, import_react3.useState)(288);
|
|
@@ -647,7 +652,7 @@ function Select({ id, label, value, options, onChange, onActivate, disabled = fa
|
|
|
647
652
|
setOpen(true);
|
|
648
653
|
};
|
|
649
654
|
(0, import_react3.useEffect)(() => {
|
|
650
|
-
if (!
|
|
655
|
+
if (!open2) return;
|
|
651
656
|
const rect = root.current?.getBoundingClientRect();
|
|
652
657
|
if (rect) {
|
|
653
658
|
const below = window.innerHeight - rect.bottom, above = rect.top;
|
|
@@ -661,19 +666,19 @@ function Select({ id, label, value, options, onChange, onActivate, disabled = fa
|
|
|
661
666
|
};
|
|
662
667
|
document.addEventListener("pointerdown", outside);
|
|
663
668
|
return () => document.removeEventListener("pointerdown", outside);
|
|
664
|
-
}, [
|
|
669
|
+
}, [open2]);
|
|
665
670
|
(0, import_react3.useEffect)(() => {
|
|
666
|
-
if (
|
|
667
|
-
}, [active,
|
|
671
|
+
if (open2) list.current?.querySelector(`[data-index="${active}"]`)?.scrollIntoView?.({ block: "nearest" });
|
|
672
|
+
}, [active, open2]);
|
|
668
673
|
(0, import_react3.useEffect)(() => {
|
|
669
674
|
if (disabled) setOpen(false);
|
|
670
675
|
}, [disabled]);
|
|
671
676
|
(0, import_react3.useEffect)(() => {
|
|
672
|
-
if (!
|
|
677
|
+
if (!open2 || options[active] && !options[active].disabled) return;
|
|
673
678
|
const next = selected >= 0 && !options[selected].disabled ? selected : options.findIndex((o) => !o.disabled);
|
|
674
679
|
if (next < 0) close(true);
|
|
675
680
|
else setActive(next);
|
|
676
|
-
}, [options, selected, active,
|
|
681
|
+
}, [options, selected, active, open2]);
|
|
677
682
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-select", "data-split": !!onActivate || void 0, role: onActivate ? "group" : void 0, "aria-label": onActivate ? label : void 0, ref: root, onBlur: (e) => {
|
|
678
683
|
if (!e.currentTarget.contains(e.relatedTarget)) close();
|
|
679
684
|
}, children: [
|
|
@@ -690,10 +695,10 @@ function Select({ id, label, value, options, onChange, onActivate, disabled = fa
|
|
|
690
695
|
className: "twui-select-trigger",
|
|
691
696
|
"aria-label": `${label}:${options[selected]?.label ?? ""}`,
|
|
692
697
|
"aria-haspopup": "listbox",
|
|
693
|
-
"aria-expanded":
|
|
694
|
-
"aria-controls":
|
|
698
|
+
"aria-expanded": open2,
|
|
699
|
+
"aria-controls": open2 ? listId : void 0,
|
|
695
700
|
disabled,
|
|
696
|
-
onClick: () =>
|
|
701
|
+
onClick: () => open2 ? close(true) : show(),
|
|
697
702
|
onKeyDown: (e) => {
|
|
698
703
|
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) {
|
|
699
704
|
e.preventDefault();
|
|
@@ -706,7 +711,7 @@ function Select({ id, label, value, options, onChange, onActivate, disabled = fa
|
|
|
706
711
|
]
|
|
707
712
|
}
|
|
708
713
|
),
|
|
709
|
-
|
|
714
|
+
open2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
710
715
|
"div",
|
|
711
716
|
{
|
|
712
717
|
ref: list,
|
|
@@ -785,7 +790,7 @@ function Select({ id, label, value, options, onChange, onActivate, disabled = fa
|
|
|
785
790
|
}
|
|
786
791
|
|
|
787
792
|
// src/web/TeamworkPanel.tsx
|
|
788
|
-
var
|
|
793
|
+
var import_react5 = require("react");
|
|
789
794
|
|
|
790
795
|
// node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
791
796
|
var qrcode = function(typeNumber, errorCorrectionLevel) {
|
|
@@ -2425,6 +2430,13 @@ var stringToBytes = qrcode.stringToBytes;
|
|
|
2425
2430
|
var ROUTE_PREFIX = "/api/teamwork";
|
|
2426
2431
|
|
|
2427
2432
|
// src/web/api.ts
|
|
2433
|
+
var HostUnreachable = class extends Error {
|
|
2434
|
+
constructor(reason, status) {
|
|
2435
|
+
super(reason);
|
|
2436
|
+
this.reason = reason;
|
|
2437
|
+
this.status = status;
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2428
2440
|
var base = ROUTE_PREFIX.slice(1) + "/";
|
|
2429
2441
|
async function call(route, payload = {}) {
|
|
2430
2442
|
let response;
|
|
@@ -2436,17 +2448,18 @@ async function call(route, payload = {}) {
|
|
|
2436
2448
|
credentials: "same-origin"
|
|
2437
2449
|
});
|
|
2438
2450
|
} catch {
|
|
2439
|
-
throw new
|
|
2451
|
+
throw new HostUnreachable("offline");
|
|
2440
2452
|
}
|
|
2441
2453
|
const data = await response.json().catch(() => null);
|
|
2442
2454
|
if (!response.ok) {
|
|
2443
|
-
if (response.status === 404 && !data) throw new
|
|
2444
|
-
|
|
2455
|
+
if (response.status === 404 && !data) throw new HostUnreachable("not-loaded");
|
|
2456
|
+
if (data?.error) throw new Error(data.error);
|
|
2457
|
+
throw new HostUnreachable("status", response.status);
|
|
2445
2458
|
}
|
|
2446
2459
|
return data;
|
|
2447
2460
|
}
|
|
2448
2461
|
var api = {
|
|
2449
|
-
|
|
2462
|
+
summary: (teamId) => call("summary", { teamId }),
|
|
2450
2463
|
profile: () => call("profile"),
|
|
2451
2464
|
updateProfile: (input) => call("update-profile", input),
|
|
2452
2465
|
state: (sessionId) => call("state", { sessionId }),
|
|
@@ -2459,66 +2472,639 @@ var api = {
|
|
|
2459
2472
|
install: (id, version) => call("install", { id, version }),
|
|
2460
2473
|
pairPhone: () => call("pair-phone", {}),
|
|
2461
2474
|
decidePhone: (id, accept) => call("decide-phone", { id, accept }),
|
|
2462
|
-
revokePhone: (id) => call("revoke-phone", { id })
|
|
2475
|
+
revokePhone: (id) => call("revoke-phone", { id }),
|
|
2476
|
+
shareEnable: (key) => call("share-enable", { key }),
|
|
2477
|
+
shareDisable: () => call("share-disable"),
|
|
2478
|
+
shareAuditKey: (key) => call("share-audit-key", { key }),
|
|
2479
|
+
shareInvite: (email) => call("share-invite", { email }),
|
|
2480
|
+
shareUnlock: (email) => call("share-unlock", { email })
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2483
|
+
// src/web/messages.ts
|
|
2484
|
+
var import_react4 = require("react");
|
|
2485
|
+
|
|
2486
|
+
// src/locale.ts
|
|
2487
|
+
function fill(template, values) {
|
|
2488
|
+
return values ? template.replace(/\{(\w+)\}/g, (whole, name) => name in values ? String(values[name]) : whole) : template;
|
|
2489
|
+
}
|
|
2490
|
+
function translator(catalogs2, locale) {
|
|
2491
|
+
return (key, values) => fill(catalogs2[locale][key], values);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
// src/web/messages.ts
|
|
2495
|
+
var en = {
|
|
2496
|
+
// Shared
|
|
2497
|
+
"common.retry": "Try again",
|
|
2498
|
+
"common.cancel": "Cancel",
|
|
2499
|
+
"common.back": "Back to team resources",
|
|
2500
|
+
"common.admin": "Admin",
|
|
2501
|
+
"common.member": "Member",
|
|
2502
|
+
"common.allTeams": "All teams",
|
|
2503
|
+
"common.officialService": "Hosted service",
|
|
2504
|
+
"common.thisDsh": "this DSH",
|
|
2505
|
+
"error.offline": "Cannot reach DSH.",
|
|
2506
|
+
"error.notLoaded": "DSH has not loaded the Teamwork plugin’s host half yet. Restart DSH.",
|
|
2507
|
+
"error.status": "The request failed (HTTP {status}).",
|
|
2508
|
+
// Loading and sync
|
|
2509
|
+
"load.failed": "Could not read the team status",
|
|
2510
|
+
"load.stale": "The status did not refresh",
|
|
2511
|
+
"sync.failedTitle": "Sync failed; using the last synced configuration",
|
|
2512
|
+
"sync.failedBody": "Your team resources here may be out of date. Try again later, or check your connection.",
|
|
2513
|
+
"sync.done": "Team configuration synced",
|
|
2514
|
+
"sync.never": "Not synced yet",
|
|
2515
|
+
"sync.justNow": "Synced just now",
|
|
2516
|
+
"sync.minutes": "Synced {minutes} min ago",
|
|
2517
|
+
"sync.at": "Synced at {time}",
|
|
2518
|
+
"sync.running": "Syncing…",
|
|
2519
|
+
"sync.failed": "Sync failed",
|
|
2520
|
+
"sync.refresh": "Refresh",
|
|
2521
|
+
"team.gone": "The team you were browsing is no longer available, so all teams are shown.",
|
|
2522
|
+
// Header and navigation
|
|
2523
|
+
"nav.home": "Back to team resources",
|
|
2524
|
+
"nav.teams": "My teams",
|
|
2525
|
+
"nav.chooseTeam": "Choose a team",
|
|
2526
|
+
"nav.phones": "Phone",
|
|
2527
|
+
"nav.shared": "Shared DSH",
|
|
2528
|
+
"shared.title": "Shared DSH",
|
|
2529
|
+
"shared.body": "This DSH is its team’s shared DSH: it signs in as the team, and members reach it from the console or the app.",
|
|
2530
|
+
"shared.bodyTeam": "This DSH is {team}’s shared DSH: it signs in as the team, and members reach it from the console or the app.",
|
|
2531
|
+
"shared.keyFailed": "The team host key no longer works",
|
|
2532
|
+
"shared.auditTitle": "Audit key",
|
|
2533
|
+
"shared.auditSet": "Members’ sessions are archived, sealed to the key with fingerprint",
|
|
2534
|
+
"shared.auditMissingTitle": "No member can join yet",
|
|
2535
|
+
"shared.auditMissingBody": "Set your team’s audit key first. On your own computer run dsh-teamwork-audit keygen, keep the file it writes, and paste the public key it prints here.",
|
|
2536
|
+
"shared.auditKey": "Audit public key",
|
|
2537
|
+
"shared.auditPlaceholder": "The public key dsh-teamwork-audit keygen printed",
|
|
2538
|
+
"shared.auditSave": "Set key",
|
|
2539
|
+
"shared.auditReplace": "Replace key",
|
|
2540
|
+
"shared.auditSaved": "Audit key set; members can join",
|
|
2541
|
+
"shared.membersTitle": "Members who may reach it",
|
|
2542
|
+
"shared.noMembers": "Nobody is listed yet, or the relay is not connected. A team admin sets the list in the console.",
|
|
2543
|
+
"shared.noDevice": "No device yet",
|
|
2544
|
+
"shared.locked": "Locked",
|
|
2545
|
+
"shared.unlock": "Unlock",
|
|
2546
|
+
"shared.unlocked": "{email} can set a new PIN",
|
|
2547
|
+
"shared.invite": "Invite",
|
|
2548
|
+
"shared.inviteTitle": "Invite for {email}",
|
|
2549
|
+
"shared.inviteQr": "Invite QR code",
|
|
2550
|
+
"shared.inviteBody": "Single use, valid for a day. Hand it over yourself, in person or through a channel your team trusts, never through the Teamwork server. They open it in the app, or paste it in the console under Shared DSHs.",
|
|
2551
|
+
"shared.copy": "Copy link",
|
|
2552
|
+
"shared.copied": "Invite link copied",
|
|
2553
|
+
"shared.disable": "Turn shared mode off",
|
|
2554
|
+
"shared.disableTitle": "Turn shared mode off?",
|
|
2555
|
+
"shared.disableBody": "This DSH stops being the team’s: its key is deleted here, every member’s device and PIN is forgotten, and what the archive collected is sent first. A team admin can delete the key in the console too.",
|
|
2556
|
+
"shared.disabled": "Shared mode is off",
|
|
2557
|
+
"shared.enableTitle": "Use this DSH as a team’s shared DSH",
|
|
2558
|
+
"shared.enableBody": "A team admin creates a team host key under Shared DSHs in the team console. With it, this DSH signs in as the team, never as a person.",
|
|
2559
|
+
"shared.enableBodySignedIn": "A team admin creates a team host key under Shared DSHs in the team console. With it, this DSH signs in as the team, never as a person: you are signed out here first.",
|
|
2560
|
+
"shared.hostKey": "Team host key",
|
|
2561
|
+
"shared.enable": "Make it shared",
|
|
2562
|
+
"shared.enabled": "This DSH is now its team’s shared DSH",
|
|
2563
|
+
"nav.account": "Account",
|
|
2564
|
+
"nav.reviews": "{count} to review",
|
|
2565
|
+
"nav.reviewsHint": "Submissions waiting for your review in the team console",
|
|
2566
|
+
// No team, team chooser, teams page
|
|
2567
|
+
"noTeam.title": "Your account is connected. Next, join a team",
|
|
2568
|
+
"noTeam.body": "Accept an invitation or create a team on the website, then come back and refresh.",
|
|
2569
|
+
"noTeam.open": "Join or create a team",
|
|
2570
|
+
"noTeam.refresh": "I have joined; refresh",
|
|
2571
|
+
"noTeam.refreshed": "Team list refreshed",
|
|
2572
|
+
"choose.title": "Which team first?",
|
|
2573
|
+
"choose.body": "This only sets what you browse here. You can switch at the top at any time.",
|
|
2574
|
+
"choose.pick": "Choose",
|
|
2575
|
+
"choose.all": "Show every team’s resources",
|
|
2576
|
+
"teams.title": "My teams",
|
|
2577
|
+
"teams.body": "Switching what you browse never changes a running session or a paired phone.",
|
|
2578
|
+
"teams.browse": "Browse resources",
|
|
2579
|
+
"teams.manage": "Manage team",
|
|
2580
|
+
"teams.view": "View team",
|
|
2581
|
+
"teams.joinOrCreate": "Join or create a team",
|
|
2582
|
+
// Resource tabs
|
|
2583
|
+
"tabs.label": "Resource type",
|
|
2584
|
+
"tabs.presets": "Presets",
|
|
2585
|
+
"tabs.models": "Models",
|
|
2586
|
+
"tabs.plugins": "Plugins",
|
|
2587
|
+
"search.label": "Search team resources",
|
|
2588
|
+
"search.placeholder": "Search by name or purpose",
|
|
2589
|
+
"empty.noMatch": "Nothing matches",
|
|
2590
|
+
"empty.noMatchBody": "Try another word, or switch team.",
|
|
2591
|
+
"empty.none": "Nothing here yet",
|
|
2592
|
+
"empty.noneBody": "What an admin publishes on the website syncs here.",
|
|
2593
|
+
// Team assistant
|
|
2594
|
+
"assistant.label": "Team assistant",
|
|
2595
|
+
"assistant.body": "Ask it in a session about your team’s presets, models and plugins, your usage and budget, and what is waiting for review. Admins can also manage the team through it, with your approval for every change.",
|
|
2596
|
+
"assistant.examples": "Try asking",
|
|
2597
|
+
"assistant.example1": "What did I spend this month?",
|
|
2598
|
+
"assistant.example2": "Which presets does our team share?",
|
|
2599
|
+
"assistant.example3": "Submit my local preset for review",
|
|
2600
|
+
"assistant.ask": "Ask the assistant",
|
|
2601
|
+
// Presets
|
|
2602
|
+
"preset.sessionModel": "Session model",
|
|
2603
|
+
"preset.inUse": "In use in this session",
|
|
2604
|
+
"preset.ready": "Ready",
|
|
2605
|
+
"preset.checkOnStart": "Tools checked at start",
|
|
2606
|
+
"preset.notReady": "Not ready",
|
|
2607
|
+
"preset.details": "Details",
|
|
2608
|
+
"preset.newSession": "New session",
|
|
2609
|
+
"preset.useHere": "Use in this blank session",
|
|
2610
|
+
"preset.modelGone": "The team model this preset uses is no longer available. Ask an admin.",
|
|
2611
|
+
"preset.pluginsNotReady": "Plugins it needs are not ready: {plugins}.",
|
|
2612
|
+
"preset.toolsMissing": "Required tools are missing: {tools}. Install or enable them in DSH’s plugin manager.",
|
|
2613
|
+
"preset.sessionStarted": "This session has started, so the preset can only be used in a new session.",
|
|
2614
|
+
"preset.goInstall": "Go to install",
|
|
2615
|
+
"preset.model": "Model",
|
|
2616
|
+
"preset.tools": "Tools",
|
|
2617
|
+
"preset.noTools": "None required",
|
|
2618
|
+
"preset.required": "Required",
|
|
2619
|
+
"preset.optional": "optional",
|
|
2620
|
+
"preset.plugins": "Plugins it needs",
|
|
2621
|
+
"preset.noPlugins": "None",
|
|
2622
|
+
"preset.version": "Version",
|
|
2623
|
+
"preset.versionValue": "v{version}. A newer version arrives with the next sync after an admin publishes it.",
|
|
2624
|
+
"preset.toolsNote": "Tools are checked for the current session, again when you switch sessions, and before every request.",
|
|
2625
|
+
"preset.selected": "{name} is now used in this session.",
|
|
2626
|
+
"tool.available": "available",
|
|
2627
|
+
"tool.conditional": "checked when run",
|
|
2628
|
+
"tool.missing": "missing",
|
|
2629
|
+
"tool.unknown": "not checked yet",
|
|
2630
|
+
"list.separator": ", ",
|
|
2631
|
+
// Models
|
|
2632
|
+
"model.body": "Called by the team’s server, so the provider key stays there. Changes this session only, never your local default.",
|
|
2633
|
+
"model.use": "Use in this session",
|
|
2634
|
+
"model.openSession": "Open or start a session in DSH first, then choose a model.",
|
|
2635
|
+
"model.noContextWindow": "The team model “{name}” has no context window (contextWindow) configured, so it cannot be used yet. Ask a team admin to set it in the console, then sync again.",
|
|
2636
|
+
// Plugins
|
|
2637
|
+
"plugin.ready": "Enabled",
|
|
2638
|
+
"plugin.missing": "Not installed",
|
|
2639
|
+
"plugin.disabled": "Installed, not enabled",
|
|
2640
|
+
"plugin.versionMismatch": "Different local version",
|
|
2641
|
+
"plugin.failed": "Failed to load",
|
|
2642
|
+
"plugin.pending": "Waiting to load",
|
|
2643
|
+
"plugin.unknown": "Cannot confirm",
|
|
2644
|
+
"plugin.catalogChanged": "Team changed the version",
|
|
2645
|
+
"plugin.local": "Local {version}",
|
|
2646
|
+
"plugin.install": "Install",
|
|
2647
|
+
"plugin.managed": "Managed in DSH’s plugin manager",
|
|
2648
|
+
"plugin.confirmTitle": "Install and enable {spec}?",
|
|
2649
|
+
"plugin.confirmBody": "This runs the plugin’s code on your computer. The team fixes the version, and a plugin of the same name you already have is never overwritten.",
|
|
2650
|
+
"plugin.confirm": "Install and enable",
|
|
2651
|
+
// Footer budget
|
|
2652
|
+
"budget.loading": "Loading budget…",
|
|
2653
|
+
"budget.unavailable": "Budget unavailable",
|
|
2654
|
+
"budget.exhausted": "Budget used up",
|
|
2655
|
+
"budget.unconfirmed": "Budget being reconciled",
|
|
2656
|
+
"budget.remaining": "{points} points left",
|
|
2657
|
+
"budget.tokenLimited": "Token limit set",
|
|
2658
|
+
"budget.unlimited": "No budget limit",
|
|
2659
|
+
"budget.hint": "Your budget in the selected team; the model or provider may still have its own limits. Switching what you browse never changes the current session.",
|
|
2660
|
+
// Account
|
|
2661
|
+
"account.title": "Account",
|
|
2662
|
+
"account.body": "Your Teamwork profile, and how this DSH is connected.",
|
|
2663
|
+
"account.profile": "Profile",
|
|
2664
|
+
"account.readFailed": "Could not read your profile",
|
|
2665
|
+
"account.unnamed": "Teamwork user",
|
|
2666
|
+
"account.noEmail": "No email",
|
|
2667
|
+
"account.name": "Display name",
|
|
2668
|
+
"account.language": "Language",
|
|
2669
|
+
"account.languageHint": "Used here, on the Teamwork website and in the app.",
|
|
2670
|
+
"account.unsaved": "Unsaved changes are kept while you move between pages.",
|
|
2671
|
+
"account.save": "Save",
|
|
2672
|
+
"account.saved": "Profile saved",
|
|
2673
|
+
"account.discard": "Discard changes",
|
|
2674
|
+
"account.connection": "Connection",
|
|
2675
|
+
"account.restartNote": "Restarting DSH asks you to authorize again. Signing out removes the team configuration and disconnects the phone relay; your local sessions and installed plugins stay.",
|
|
2676
|
+
"account.signOut": "Sign this DSH out of Teamwork",
|
|
2677
|
+
"account.signOutTitle": "Sign out of Teamwork?",
|
|
2678
|
+
"account.signOutBody": "Team-model requests in progress may be affected, and phones can no longer reach this DSH through the current connection.",
|
|
2679
|
+
"account.signOutConfirm": "Sign out",
|
|
2680
|
+
"account.signedOut": "Signed out of Teamwork",
|
|
2681
|
+
// Sign-in
|
|
2682
|
+
"signIn.title": "Sign in to Teamwork",
|
|
2683
|
+
"signIn.reconnect": "Reconnect Teamwork",
|
|
2684
|
+
"signIn.lede": "Your team’s presets, models and plugins, published once and kept the same in every member’s DSH.",
|
|
2685
|
+
"signIn.step1": "Sign in in your browser",
|
|
2686
|
+
"signIn.step2Paste": "Authorize, then paste the line shown on the page below (valid for two minutes)",
|
|
2687
|
+
"signIn.step2Auto": "Authorize; this DSH finishes signing in by itself",
|
|
2688
|
+
"signIn.waiting": "Waiting for you to authorize in the browser. Team resources open here when you do.",
|
|
2689
|
+
"signIn.openPage": "Open the authorization page",
|
|
2690
|
+
"signIn.useCode": "Did not finish by itself? Use the code",
|
|
2691
|
+
"signIn.restart": "Start again",
|
|
2692
|
+
"signIn.expiredTitle": "This sign-in timed out",
|
|
2693
|
+
"signIn.expiredBody": "Open the authorization page again; a code from the old page does not work for a new sign-in.",
|
|
2694
|
+
"signIn.start": "Sign in in the browser",
|
|
2695
|
+
"signIn.pasteAuto": "Did not finish by itself? Paste the line shown on the page",
|
|
2696
|
+
"signIn.paste": "The line shown on the page",
|
|
2697
|
+
"signIn.finish": "Finish",
|
|
2698
|
+
"signIn.done": "Authorized, and the team configuration is synced",
|
|
2699
|
+
"signIn.keysTitle": "Keys stay on the server",
|
|
2700
|
+
"signIn.keysBody": "The team’s server calls the team models; provider keys never reach this computer.",
|
|
2701
|
+
"signIn.sideTitle": "Beside your own setup",
|
|
2702
|
+
"signIn.sideBody": "Team configuration is added as its own entries and never overwrites your models or presets.",
|
|
2703
|
+
"signIn.syncTitle": "Kept up to date",
|
|
2704
|
+
"signIn.syncBody": "Synced every minute. Once you are removed from a team, your next request is refused.",
|
|
2705
|
+
// Server
|
|
2706
|
+
"server.label": "Server",
|
|
2707
|
+
"server.change": "Change",
|
|
2708
|
+
"server.field": "Server address",
|
|
2709
|
+
"server.hint": "For a self-hosted team or local development, enter your DSH Teamwork address, for example http://localhost:3800. You sign in again after changing it.",
|
|
2710
|
+
"server.saveSignOut": "Sign out and switch server",
|
|
2711
|
+
"server.save": "Save",
|
|
2712
|
+
"server.reset": "Back to {host}",
|
|
2713
|
+
"server.wasReset": "Back on the default server",
|
|
2714
|
+
"server.changed": "Server changed",
|
|
2715
|
+
// Phones
|
|
2716
|
+
"phones.title": "Phone",
|
|
2717
|
+
"phones.body": "A phone connects to the DSH on this computer, whichever team you are browsing.",
|
|
2718
|
+
"relay.offTitle": "Phone access is not on",
|
|
2719
|
+
"relay.offBody": "Check that the server offers the phone relay and that this account is in a team.",
|
|
2720
|
+
"relay.connectingTitle": "Connecting to the relay…",
|
|
2721
|
+
"relay.connectingBody": "Once connected, you can pair a phone here.",
|
|
2722
|
+
"relay.refusedTitle": "The relay refused this computer",
|
|
2723
|
+
"relay.refusedBody": "The sign-in may have expired, or another DSH is connected as this computer. Sign out and in again to retry.",
|
|
2724
|
+
"phones.failed": "The phone action did not finish",
|
|
2725
|
+
"phones.expiredTitle": "The pairing code expired",
|
|
2726
|
+
"phones.expiredBody": "A code works once. Make a new one and scan it on your phone.",
|
|
2727
|
+
"phones.newCode": "Make a new code",
|
|
2728
|
+
"phones.emptyTitle": "Use this computer’s DSH from your phone",
|
|
2729
|
+
"phones.pair": "Pair a phone",
|
|
2730
|
+
"phones.emptyBody": "Phone and computer sign in to the same Teamwork account. Once paired, the phone reaches the personal and team sessions this DSH can reach; it cannot yet be limited to one team. Pairing adds no team permission, and either side can end it.",
|
|
2731
|
+
"phones.requested": "Asked to pair {time}",
|
|
2732
|
+
"phones.waiting": "Waiting for you",
|
|
2733
|
+
"phones.safetyCode": "Safety code: {code}. Check that the phone shows the same code, and confirm on the phone.",
|
|
2734
|
+
"phones.handshake": "Waiting for the phone to finish the encrypted handshake; it cannot be confirmed yet.",
|
|
2735
|
+
"phones.grant": "Once confirmed, the phone can see the personal and team sessions this DSH can reach, send messages, answer an agent’s questions and handle approvals. It cannot yet be limited to one team; pairing adds no team permission, and either side can end it. Phone and computer sign in to the same account.",
|
|
2736
|
+
"phones.reject": "Reject",
|
|
2737
|
+
"phones.rejected": "Rejected",
|
|
2738
|
+
"phones.accept": "Codes match; pair",
|
|
2739
|
+
"phones.accepted": "{device} is paired",
|
|
2740
|
+
"phones.paired": "Paired phones",
|
|
2741
|
+
"phones.none": "No phone is paired. Pairing is optional and does not affect team resources.",
|
|
2742
|
+
"phones.lastUsed": "Last used {time}",
|
|
2743
|
+
"phones.pairedAt": "Paired {time}",
|
|
2744
|
+
"phones.verified": "Verified encrypted device",
|
|
2745
|
+
"phones.repair": "Pair again",
|
|
2746
|
+
"phones.unpair": "Unpair",
|
|
2747
|
+
"phones.unpairTitle": "Unpair {device}?",
|
|
2748
|
+
"phones.unpairBody": "The phone disconnects at once and has to scan a new code to reach this computer again.",
|
|
2749
|
+
"phones.unpaired": "Unpaired",
|
|
2750
|
+
"phones.scan": "Scan with the DSH Teamwork app",
|
|
2751
|
+
"phones.manual": "Or type the pairing code in the app:",
|
|
2752
|
+
"phones.expires": "Expires in {time} and works once. Come back here to confirm after scanning.",
|
|
2753
|
+
"phones.collapsedNote": "Hidden, the code still works until it expires; a phone that submits it still needs your confirmation here.",
|
|
2754
|
+
"phones.hide": "Hide the code",
|
|
2755
|
+
"phones.qr": "Pairing QR code"
|
|
2756
|
+
};
|
|
2757
|
+
var zhCN = {
|
|
2758
|
+
"common.retry": "重试",
|
|
2759
|
+
"common.cancel": "取消",
|
|
2760
|
+
"common.back": "返回团队资源",
|
|
2761
|
+
"common.admin": "管理员",
|
|
2762
|
+
"common.member": "成员",
|
|
2763
|
+
"common.allTeams": "全部团队",
|
|
2764
|
+
"common.officialService": "官方服务",
|
|
2765
|
+
"common.thisDsh": "本机 DSH",
|
|
2766
|
+
"error.offline": "无法连接 DSH 服务。",
|
|
2767
|
+
"error.notLoaded": "DSH 还没有加载 Teamwork 插件的服务端,请重启 DSH。",
|
|
2768
|
+
"error.status": "请求失败(HTTP {status})。",
|
|
2769
|
+
"load.failed": "无法读取团队状态",
|
|
2770
|
+
"load.stale": "状态没有刷新",
|
|
2771
|
+
"sync.failedTitle": "同步失败,正在使用上次同步的配置",
|
|
2772
|
+
"sync.failedBody": "这里的团队资源可能不是最新的。请稍后重试,或检查网络连接。",
|
|
2773
|
+
"sync.done": "团队配置已同步",
|
|
2774
|
+
"sync.never": "尚未同步",
|
|
2775
|
+
"sync.justNow": "刚刚同步",
|
|
2776
|
+
"sync.minutes": "{minutes} 分钟前同步",
|
|
2777
|
+
"sync.at": "{time} 同步",
|
|
2778
|
+
"sync.running": "正在同步…",
|
|
2779
|
+
"sync.failed": "同步失败",
|
|
2780
|
+
"sync.refresh": "刷新",
|
|
2781
|
+
"team.gone": "当前团队已不可用,浏览范围已切换为全部团队。",
|
|
2782
|
+
"nav.home": "返回团队资源",
|
|
2783
|
+
"nav.teams": "我的团队",
|
|
2784
|
+
"nav.chooseTeam": "选择团队",
|
|
2785
|
+
"nav.phones": "手机连接",
|
|
2786
|
+
"nav.shared": "共享 DSH",
|
|
2787
|
+
"shared.title": "共享 DSH",
|
|
2788
|
+
"shared.body": "这台 DSH 是团队的共享 DSH:以团队身份登录,成员从控制台或 App 访问它。",
|
|
2789
|
+
"shared.bodyTeam": "这台 DSH 是 {team} 的共享 DSH:以团队身份登录,成员从控制台或 App 访问它。",
|
|
2790
|
+
"shared.keyFailed": "团队主机密钥已失效",
|
|
2791
|
+
"shared.auditTitle": "审计密钥",
|
|
2792
|
+
"shared.auditSet": "成员的会话已加密归档,密钥指纹",
|
|
2793
|
+
"shared.auditMissingTitle": "成员还不能加入",
|
|
2794
|
+
"shared.auditMissingBody": "请先设置团队的审计密钥。在你自己的电脑上运行 dsh-teamwork-audit keygen,妥善保管它写出的文件,并把打印出的公钥粘贴到这里。",
|
|
2795
|
+
"shared.auditKey": "审计公钥",
|
|
2796
|
+
"shared.auditPlaceholder": "dsh-teamwork-audit keygen 打印的公钥",
|
|
2797
|
+
"shared.auditSave": "设置密钥",
|
|
2798
|
+
"shared.auditReplace": "更换密钥",
|
|
2799
|
+
"shared.auditSaved": "审计密钥已设置,成员可以加入了",
|
|
2800
|
+
"shared.membersTitle": "可以访问的成员",
|
|
2801
|
+
"shared.noMembers": "名单还是空的,或者中继没有连接。团队管理员在控制台设置名单。",
|
|
2802
|
+
"shared.noDevice": "还没有设备",
|
|
2803
|
+
"shared.locked": "已锁定",
|
|
2804
|
+
"shared.unlock": "解锁",
|
|
2805
|
+
"shared.unlocked": "{email} 可以重新设置 PIN 了",
|
|
2806
|
+
"shared.invite": "邀请",
|
|
2807
|
+
"shared.inviteTitle": "给 {email} 的邀请",
|
|
2808
|
+
"shared.inviteQr": "邀请二维码",
|
|
2809
|
+
"shared.inviteBody": "只能使用一次,一天内有效。请亲自交给对方,当面或通过团队信任的渠道,不要经过 Teamwork 服务器。对方在 App 中打开,或粘贴到控制台的「共享 DSH」页。",
|
|
2810
|
+
"shared.copy": "复制链接",
|
|
2811
|
+
"shared.copied": "邀请链接已复制",
|
|
2812
|
+
"shared.disable": "关闭共享模式",
|
|
2813
|
+
"shared.disableTitle": "关闭共享模式?",
|
|
2814
|
+
"shared.disableBody": "这台 DSH 将不再属于团队:这里的密钥会被删除,所有成员的设备和 PIN 都会被遗忘,归档里已收集的内容会先发送出去。团队管理员也可以在控制台删除密钥。",
|
|
2815
|
+
"shared.disabled": "共享模式已关闭",
|
|
2816
|
+
"shared.enableTitle": "把这台 DSH 设为团队的共享 DSH",
|
|
2817
|
+
"shared.enableBody": "团队管理员在团队控制台的「共享 DSH」中创建团队主机密钥。用它登录后,这台 DSH 以团队身份运行,而不是某个人。",
|
|
2818
|
+
"shared.enableBodySignedIn": "团队管理员在团队控制台的「共享 DSH」中创建团队主机密钥。用它登录后,这台 DSH 以团队身份运行,而不是某个人:你会先在这里退出登录。",
|
|
2819
|
+
"shared.hostKey": "团队主机密钥",
|
|
2820
|
+
"shared.enable": "设为共享",
|
|
2821
|
+
"shared.enabled": "这台 DSH 已成为团队的共享 DSH",
|
|
2822
|
+
"nav.account": "我的账号",
|
|
2823
|
+
"nav.reviews": "{count} 项待审核",
|
|
2824
|
+
"nav.reviewsHint": "团队控制台里等待你审核的提交",
|
|
2825
|
+
"noTeam.title": "账号已连接,接下来加入团队",
|
|
2826
|
+
"noTeam.body": "在网页中接受邀请或创建团队,完成后回来刷新。",
|
|
2827
|
+
"noTeam.open": "加入或创建团队",
|
|
2828
|
+
"noTeam.refresh": "我已加入,刷新团队",
|
|
2829
|
+
"noTeam.refreshed": "团队列表已刷新",
|
|
2830
|
+
"choose.title": "先从哪个团队开始?",
|
|
2831
|
+
"choose.body": "这里只决定浏览哪个团队的资源,随时可以在页面顶部切换。",
|
|
2832
|
+
"choose.pick": "选择团队",
|
|
2833
|
+
"choose.all": "查看全部团队资源",
|
|
2834
|
+
"teams.title": "我的团队",
|
|
2835
|
+
"teams.body": "切换浏览范围不会改变已有会话或手机配对。",
|
|
2836
|
+
"teams.browse": "浏览资源",
|
|
2837
|
+
"teams.manage": "管理团队",
|
|
2838
|
+
"teams.view": "查看团队",
|
|
2839
|
+
"teams.joinOrCreate": "加入或创建团队",
|
|
2840
|
+
"tabs.label": "资源类型",
|
|
2841
|
+
"tabs.presets": "预设",
|
|
2842
|
+
"tabs.models": "模型",
|
|
2843
|
+
"tabs.plugins": "插件",
|
|
2844
|
+
"search.label": "搜索团队资源",
|
|
2845
|
+
"search.placeholder": "搜索名称或用途",
|
|
2846
|
+
"empty.noMatch": "没有匹配的资源",
|
|
2847
|
+
"empty.noMatchBody": "试试其他关键词或切换团队。",
|
|
2848
|
+
"empty.none": "这里还没有资源",
|
|
2849
|
+
"empty.noneBody": "管理员在网页发布后,资源会同步到这里。",
|
|
2850
|
+
"assistant.label": "团队助理",
|
|
2851
|
+
"assistant.body": "在会话里问它团队的预设、模型和插件,你的用量和预算,以及有哪些内容在等待审核。管理员还可以通过它管理团队,每一项改动都需要你批准。",
|
|
2852
|
+
"assistant.examples": "可以这样问",
|
|
2853
|
+
"assistant.example1": "我这个月用了多少?",
|
|
2854
|
+
"assistant.example2": "我们团队共享了哪些预设?",
|
|
2855
|
+
"assistant.example3": "把我本地的预设提交审核",
|
|
2856
|
+
"assistant.ask": "问问助理",
|
|
2857
|
+
"preset.sessionModel": "沿用会话模型",
|
|
2858
|
+
"preset.inUse": "本会话正在使用",
|
|
2859
|
+
"preset.ready": "可以使用",
|
|
2860
|
+
"preset.checkOnStart": "启动时检查工具",
|
|
2861
|
+
"preset.notReady": "未就绪",
|
|
2862
|
+
"preset.details": "详情",
|
|
2863
|
+
"preset.newSession": "新建会话",
|
|
2864
|
+
"preset.useHere": "用于当前空白会话",
|
|
2865
|
+
"preset.modelGone": "预设引用的团队模型已不可用,请联系管理员。",
|
|
2866
|
+
"preset.pluginsNotReady": "依赖插件 {plugins} 尚未就绪。",
|
|
2867
|
+
"preset.toolsMissing": "缺少必需工具 {tools},请在 DSH 插件管理器中安装或启用。",
|
|
2868
|
+
"preset.sessionStarted": "当前会话已开始对话,预设只能用在新会话里。",
|
|
2869
|
+
"preset.goInstall": "前往安装",
|
|
2870
|
+
"preset.model": "模型",
|
|
2871
|
+
"preset.tools": "工具",
|
|
2872
|
+
"preset.noTools": "无要求",
|
|
2873
|
+
"preset.required": "必需",
|
|
2874
|
+
"preset.optional": "可选",
|
|
2875
|
+
"preset.plugins": "依赖插件",
|
|
2876
|
+
"preset.noPlugins": "无",
|
|
2877
|
+
"preset.version": "版本",
|
|
2878
|
+
"preset.versionValue": "v{version},管理员发布新版本后下次同步生效",
|
|
2879
|
+
"preset.toolsNote": "工具按当前会话检查;切换会话后和每次请求前都会重新检查。",
|
|
2880
|
+
"preset.selected": "本会话已选择 {name}。",
|
|
2881
|
+
"tool.available": "可用",
|
|
2882
|
+
"tool.conditional": "执行时检查",
|
|
2883
|
+
"tool.missing": "缺失",
|
|
2884
|
+
"tool.unknown": "待检查",
|
|
2885
|
+
"list.separator": "、",
|
|
2886
|
+
"model.body": "由团队服务器代为调用,provider 密钥留在服务器上。只改当前会话,不改本地默认模型。",
|
|
2887
|
+
"model.use": "用于当前会话",
|
|
2888
|
+
"model.openSession": "先在 DSH 新建或打开一个会话,再选择模型。",
|
|
2889
|
+
"model.noContextWindow": "团队模型「{name}」没有配置上下文窗口(contextWindow),暂时不能使用。请团队管理员在控制台补充后重新同步。",
|
|
2890
|
+
"plugin.ready": "已启用",
|
|
2891
|
+
"plugin.missing": "未安装",
|
|
2892
|
+
"plugin.disabled": "已安装未启用",
|
|
2893
|
+
"plugin.versionMismatch": "本地版本不符",
|
|
2894
|
+
"plugin.failed": "加载失败",
|
|
2895
|
+
"plugin.pending": "等待加载",
|
|
2896
|
+
"plugin.unknown": "无法确认",
|
|
2897
|
+
"plugin.catalogChanged": "团队已更改版本",
|
|
2898
|
+
"plugin.local": "本地 {version}",
|
|
2899
|
+
"plugin.install": "安装",
|
|
2900
|
+
"plugin.managed": "在 DSH 插件管理器中管理",
|
|
2901
|
+
"plugin.confirmTitle": "安装并启用 {spec}?",
|
|
2902
|
+
"plugin.confirmBody": "这会在你的电脑上运行该插件的代码。版本由团队固定;已经装过的同名插件不会被覆盖。",
|
|
2903
|
+
"plugin.confirm": "安装并启用",
|
|
2904
|
+
"budget.loading": "预算加载中…",
|
|
2905
|
+
"budget.unavailable": "预算暂不可用",
|
|
2906
|
+
"budget.exhausted": "预算已用尽",
|
|
2907
|
+
"budget.unconfirmed": "预算待核实",
|
|
2908
|
+
"budget.remaining": "预算剩余 {points} 积分",
|
|
2909
|
+
"budget.tokenLimited": "已设 Token 上限",
|
|
2910
|
+
"budget.unlimited": "未设预算上限",
|
|
2911
|
+
"budget.hint": "所选团队中我的预算;模型或上游仍可能有其他限制。切换浏览的团队不改变当前会话。",
|
|
2912
|
+
"account.title": "我的账号",
|
|
2913
|
+
"account.body": "管理你的 Teamwork 个人资料和这台 DSH 的连接。",
|
|
2914
|
+
"account.profile": "个人资料",
|
|
2915
|
+
"account.readFailed": "暂时无法读取个人资料",
|
|
2916
|
+
"account.unnamed": "Teamwork 用户",
|
|
2917
|
+
"account.noEmail": "未设置邮箱",
|
|
2918
|
+
"account.name": "显示名称",
|
|
2919
|
+
"account.language": "语言",
|
|
2920
|
+
"account.languageHint": "用于这里、Teamwork 网页和手机 App。",
|
|
2921
|
+
"account.unsaved": "有未保存的修改,切换页面时会保留草稿。",
|
|
2922
|
+
"account.save": "保存资料",
|
|
2923
|
+
"account.saved": "个人资料已保存",
|
|
2924
|
+
"account.discard": "撤销修改",
|
|
2925
|
+
"account.connection": "账号与连接",
|
|
2926
|
+
"account.restartNote": "重启 DSH 后需要重新授权。退出会移除当前团队配置并断开手机中转;本地会话与已安装插件保留。",
|
|
2927
|
+
"account.signOut": "退出此 DSH 的 Teamwork",
|
|
2928
|
+
"account.signOutTitle": "退出 Teamwork?",
|
|
2929
|
+
"account.signOutBody": "运行中的团队模型请求可能受影响。手机将无法通过当前连接访问此 DSH。",
|
|
2930
|
+
"account.signOutConfirm": "确认退出",
|
|
2931
|
+
"account.signedOut": "已退出 Teamwork",
|
|
2932
|
+
"signIn.title": "登录 Teamwork",
|
|
2933
|
+
"signIn.reconnect": "重新连接 Teamwork",
|
|
2934
|
+
"signIn.lede": "团队的预设、模型和插件,一处发布,每位成员的 DSH 自动保持一致。",
|
|
2935
|
+
"signIn.step1": "在浏览器中登录",
|
|
2936
|
+
"signIn.step2Paste": "确认授权,把网页上显示的那一行粘贴到下方(两分钟内有效)",
|
|
2937
|
+
"signIn.step2Auto": "确认授权,这里会自动完成登录",
|
|
2938
|
+
"signIn.waiting": "等待浏览器确认授权,完成后这里会自动进入团队资源。",
|
|
2939
|
+
"signIn.openPage": "打开授权页面",
|
|
2940
|
+
"signIn.useCode": "没有自动完成?使用授权码",
|
|
2941
|
+
"signIn.restart": "重新开始登录",
|
|
2942
|
+
"signIn.expiredTitle": "本次登录等待已超时",
|
|
2943
|
+
"signIn.expiredBody": "请重新打开授权页面,旧页面的授权码不能用于新的登录请求。",
|
|
2944
|
+
"signIn.start": "在浏览器中登录",
|
|
2945
|
+
"signIn.pasteAuto": "没有自动完成?粘贴网页上显示的那一行",
|
|
2946
|
+
"signIn.paste": "网页上显示的那一行",
|
|
2947
|
+
"signIn.finish": "完成授权",
|
|
2948
|
+
"signIn.done": "已授权,团队配置已同步",
|
|
2949
|
+
"signIn.keysTitle": "密钥留在服务器",
|
|
2950
|
+
"signIn.keysBody": "团队模型由服务器代为调用,provider 密钥不会下发到这台电脑。",
|
|
2951
|
+
"signIn.sideTitle": "与本地配置并存",
|
|
2952
|
+
"signIn.sideBody": "团队配置作为独立条目加入,不覆盖你自己的模型和预设。",
|
|
2953
|
+
"signIn.syncTitle": "自动保持最新",
|
|
2954
|
+
"signIn.syncBody": "每分钟同步一次;被移出团队后,下一次请求即失效。",
|
|
2955
|
+
"server.label": "服务器",
|
|
2956
|
+
"server.change": "更改",
|
|
2957
|
+
"server.field": "服务器地址",
|
|
2958
|
+
"server.hint": "自建团队或本地开发时填写你的 DSH Teamwork 地址,例如 http://localhost:3800。更改后需要重新登录。",
|
|
2959
|
+
"server.saveSignOut": "退出并更换服务器",
|
|
2960
|
+
"server.save": "保存",
|
|
2961
|
+
"server.reset": "恢复为 {host}",
|
|
2962
|
+
"server.wasReset": "已恢复为默认服务器",
|
|
2963
|
+
"server.changed": "服务器已更改",
|
|
2964
|
+
"phones.title": "手机连接",
|
|
2965
|
+
"phones.body": "手机连接的是这台电脑上的 DSH,与当前浏览的团队无关。",
|
|
2966
|
+
"relay.offTitle": "手机连接尚未开启",
|
|
2967
|
+
"relay.offBody": "请确认服务器提供手机中转服务,并且当前账号已加入团队。",
|
|
2968
|
+
"relay.connectingTitle": "正在连接中转服务…",
|
|
2969
|
+
"relay.connectingBody": "连上之后就可以在这里配对手机。",
|
|
2970
|
+
"relay.refusedTitle": "中转服务拒绝了这台电脑",
|
|
2971
|
+
"relay.refusedBody": "登录可能已失效,或另一个 DSH 正以这台电脑的身份连接。退出后重新登录即可重试。",
|
|
2972
|
+
"phones.failed": "手机操作未完成",
|
|
2973
|
+
"phones.expiredTitle": "配对码已过期",
|
|
2974
|
+
"phones.expiredBody": "配对码只能使用一次。重新生成后,请在手机上扫描新码。",
|
|
2975
|
+
"phones.newCode": "重新生成配对码",
|
|
2976
|
+
"phones.emptyTitle": "在手机上操作这台电脑的 DSH",
|
|
2977
|
+
"phones.pair": "配对新手机",
|
|
2978
|
+
"phones.emptyBody": "手机和电脑须登录同一个 Teamwork 账号。配对后可访问本机 DSH 有权限的个人与各团队会话,目前不能只授权一个团队;配对不会增加团队权限,任一端都可解除。",
|
|
2979
|
+
"phones.requested": "{time} 申请配对",
|
|
2980
|
+
"phones.waiting": "等待你确认",
|
|
2981
|
+
"phones.safetyCode": "安全码:{code}。请核对手机上的安全码一致,并在手机上确认。",
|
|
2982
|
+
"phones.handshake": "等待手机完成加密握手,暂时无法确认。",
|
|
2983
|
+
"phones.grant": "确认后,手机可查看本机 DSH 可访问的个人与各团队会话,发送消息、回答 Agent 提问和处理审批。目前不能只授权一个团队;配对不会增加团队权限,任一端都可解除。手机与电脑须登录同一账号。",
|
|
2984
|
+
"phones.reject": "拒绝",
|
|
2985
|
+
"phones.rejected": "已拒绝",
|
|
2986
|
+
"phones.accept": "安全码一致,确认配对",
|
|
2987
|
+
"phones.accepted": "{device} 已配对",
|
|
2988
|
+
"phones.paired": "已配对手机",
|
|
2989
|
+
"phones.none": "尚无已配对手机。配对是可选功能,不影响团队资源的使用。",
|
|
2990
|
+
"phones.lastUsed": "最近使用 {time}",
|
|
2991
|
+
"phones.pairedAt": "配对于 {time}",
|
|
2992
|
+
"phones.verified": "已验证加密设备",
|
|
2993
|
+
"phones.repair": "需要重新配对",
|
|
2994
|
+
"phones.unpair": "解除配对",
|
|
2995
|
+
"phones.unpairTitle": "解除与 {device} 的配对?",
|
|
2996
|
+
"phones.unpairBody": "这台手机会立即断开,之后需要重新扫码配对才能再连到这台电脑。",
|
|
2997
|
+
"phones.unpaired": "已解除配对",
|
|
2998
|
+
"phones.scan": "用 DSH Teamwork App 扫码",
|
|
2999
|
+
"phones.manual": "也可以在 App 里手动输入配对码:",
|
|
3000
|
+
"phones.expires": "{time} 后失效,只能使用一次。扫码后请回到这里确认。",
|
|
3001
|
+
"phones.collapsedNote": "收起后,配对码在到期前仍然有效;手机提交后需在本机确认。",
|
|
3002
|
+
"phones.hide": "收起配对码",
|
|
3003
|
+
"phones.qr": "配对二维码"
|
|
2463
3004
|
};
|
|
3005
|
+
var catalogs = { en, "zh-CN": zhCN };
|
|
3006
|
+
function words(locale) {
|
|
3007
|
+
return Object.assign(translator(catalogs, locale), { locale });
|
|
3008
|
+
}
|
|
3009
|
+
var Words = (0, import_react4.createContext)(words("en"));
|
|
3010
|
+
function useT() {
|
|
3011
|
+
return (0, import_react4.useContext)(Words);
|
|
3012
|
+
}
|
|
2464
3013
|
|
|
2465
3014
|
// src/web/TeamworkPanel.tsx
|
|
2466
3015
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2467
3016
|
var REFRESH_MS = 5e3;
|
|
3017
|
+
var SUMMARY_MS = 3e4;
|
|
2468
3018
|
var views = /* @__PURE__ */ new Map();
|
|
2469
3019
|
var profileDrafts = /* @__PURE__ */ new Map();
|
|
2470
3020
|
var pluginText = {
|
|
2471
|
-
ready: ["
|
|
2472
|
-
missing: ["
|
|
2473
|
-
disabled: ["
|
|
2474
|
-
"version-mismatch": ["
|
|
2475
|
-
failed: ["
|
|
2476
|
-
pending: ["
|
|
2477
|
-
unknown: ["
|
|
2478
|
-
"catalog-changed": ["
|
|
3021
|
+
ready: ["plugin.ready", "success"],
|
|
3022
|
+
missing: ["plugin.missing", "warning"],
|
|
3023
|
+
disabled: ["plugin.disabled", "warning"],
|
|
3024
|
+
"version-mismatch": ["plugin.versionMismatch", "warning"],
|
|
3025
|
+
failed: ["plugin.failed", "danger"],
|
|
3026
|
+
pending: ["plugin.pending", "warning"],
|
|
3027
|
+
unknown: ["plugin.unknown", "neutral"],
|
|
3028
|
+
"catalog-changed": ["plugin.catalogChanged", "warning"]
|
|
2479
3029
|
};
|
|
2480
3030
|
var toolText = {
|
|
2481
|
-
available: ["
|
|
2482
|
-
conditional: ["
|
|
2483
|
-
missing: ["
|
|
2484
|
-
unknown: ["
|
|
3031
|
+
available: ["tool.available", "success"],
|
|
3032
|
+
conditional: ["tool.conditional", "neutral"],
|
|
3033
|
+
missing: ["tool.missing", "warning"],
|
|
3034
|
+
unknown: ["tool.unknown", "neutral"]
|
|
2485
3035
|
};
|
|
2486
3036
|
var host = (server) => server.replace(/^https?:\/\//, "");
|
|
2487
3037
|
var missingTools = (preset) => preset.tools.filter((t) => t.required && (t.state === "missing" || t.state === "unknown"));
|
|
2488
3038
|
var pluginsNotReady = (preset) => preset.plugins.filter((p) => p.state !== "ready");
|
|
2489
|
-
|
|
2490
|
-
|
|
3039
|
+
var role = (t, value) => t(value === "admin" ? "common.admin" : "common.member");
|
|
3040
|
+
var open = (url) => window.open(url, "_blank", "noopener");
|
|
3041
|
+
function describe(t, error) {
|
|
3042
|
+
if (error instanceof HostUnreachable) {
|
|
3043
|
+
return error.reason === "offline" ? t("error.offline") : error.reason === "not-loaded" ? t("error.notLoaded") : t("error.status", { status: error.status ?? "" });
|
|
3044
|
+
}
|
|
3045
|
+
return error.message;
|
|
3046
|
+
}
|
|
3047
|
+
function synced(t, iso) {
|
|
3048
|
+
if (!iso) return t("sync.never");
|
|
2491
3049
|
const seconds = Math.max(0, Math.round((Date.now() - Date.parse(iso)) / 1e3));
|
|
2492
|
-
if (seconds < 60) return "
|
|
2493
|
-
if (seconds < 3600) return
|
|
2494
|
-
return
|
|
3050
|
+
if (seconds < 60) return t("sync.justNow");
|
|
3051
|
+
if (seconds < 3600) return t("sync.minutes", { minutes: Math.round(seconds / 60) });
|
|
3052
|
+
return t("sync.at", { time: new Date(iso).toLocaleTimeString(t.locale) });
|
|
3053
|
+
}
|
|
3054
|
+
function useSummary(team, revision) {
|
|
3055
|
+
const [summary, setSummary] = (0, import_react5.useState)();
|
|
3056
|
+
(0, import_react5.useEffect)(() => {
|
|
3057
|
+
setSummary(void 0);
|
|
3058
|
+
if (!team) return;
|
|
3059
|
+
let active = true;
|
|
3060
|
+
let timer;
|
|
3061
|
+
const load = async () => {
|
|
3062
|
+
let next = null;
|
|
3063
|
+
try {
|
|
3064
|
+
next = await api.summary(team);
|
|
3065
|
+
} catch {
|
|
3066
|
+
}
|
|
3067
|
+
if (active) {
|
|
3068
|
+
setSummary(next);
|
|
3069
|
+
timer = setTimeout(load, SUMMARY_MS);
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
3072
|
+
void load();
|
|
3073
|
+
return () => {
|
|
3074
|
+
active = false;
|
|
3075
|
+
clearTimeout(timer);
|
|
3076
|
+
};
|
|
3077
|
+
}, [team, revision]);
|
|
3078
|
+
return summary;
|
|
2495
3079
|
}
|
|
2496
3080
|
function TeamworkPanel({ host: dsh }) {
|
|
2497
|
-
const currentSession = (0,
|
|
2498
|
-
const sessionId = (0,
|
|
2499
|
-
const [snapshot, setState] = (0,
|
|
2500
|
-
const [loadedSession, setLoadedSession] = (0,
|
|
3081
|
+
const currentSession = (0, import_react5.useRef)(dsh.currentSession ?? currentSessionTracker(dsh.sessions.list)).current;
|
|
3082
|
+
const sessionId = (0, import_react5.useSyncExternalStore)(dsh.sessions.list.subscribe, currentSession);
|
|
3083
|
+
const [snapshot, setState] = (0, import_react5.useState)();
|
|
3084
|
+
const [loadedSession, setLoadedSession] = (0, import_react5.useState)();
|
|
2501
3085
|
const state = snapshot && (loadedSession === sessionId ? snapshot : { ...snapshot, session: null });
|
|
2502
|
-
const [loadError, setLoadError] = (0,
|
|
2503
|
-
const [tab, setTab] = (0,
|
|
2504
|
-
const [page, setPage] = (0,
|
|
2505
|
-
const [team, setTeam] = (0,
|
|
2506
|
-
const [query, setQuery] = (0,
|
|
2507
|
-
const [profile, setProfile] = (0,
|
|
2508
|
-
const [profileError, setProfileError] = (0,
|
|
2509
|
-
const [profileAttempt, setProfileAttempt] = (0,
|
|
2510
|
-
const identity = (0,
|
|
2511
|
-
const touched = (0,
|
|
2512
|
-
const browsing = (0,
|
|
3086
|
+
const [loadError, setLoadError] = (0, import_react5.useState)();
|
|
3087
|
+
const [tab, setTab] = (0, import_react5.useState)("presets");
|
|
3088
|
+
const [page, setPage] = (0, import_react5.useState)("resources");
|
|
3089
|
+
const [team, setTeam] = (0, import_react5.useState)("all");
|
|
3090
|
+
const [query, setQuery] = (0, import_react5.useState)("");
|
|
3091
|
+
const [profile, setProfile] = (0, import_react5.useState)();
|
|
3092
|
+
const [profileError, setProfileError] = (0, import_react5.useState)();
|
|
3093
|
+
const [profileAttempt, setProfileAttempt] = (0, import_react5.useState)(0);
|
|
3094
|
+
const identity = (0, import_react5.useRef)();
|
|
3095
|
+
const touched = (0, import_react5.useRef)(false);
|
|
3096
|
+
const browsing = (0, import_react5.useRef)({ team, tab, query });
|
|
2513
3097
|
browsing.current = { team, tab, query };
|
|
2514
|
-
const latest = (0,
|
|
3098
|
+
const latest = (0, import_react5.useRef)(state);
|
|
2515
3099
|
latest.current = state;
|
|
2516
|
-
const request = (0,
|
|
2517
|
-
const context = (0,
|
|
3100
|
+
const request = (0, import_react5.useRef)();
|
|
3101
|
+
const context = (0, import_react5.useRef)(sessionId);
|
|
2518
3102
|
context.current = sessionId;
|
|
2519
|
-
const [toast, setToast] = (0,
|
|
2520
|
-
const toastTimer = (0,
|
|
2521
|
-
const
|
|
3103
|
+
const [toast, setToast] = (0, import_react5.useState)();
|
|
3104
|
+
const toastTimer = (0, import_react5.useRef)();
|
|
3105
|
+
const locale = state?.locale ?? (navigator.language?.toLowerCase().startsWith("zh") ? "zh-CN" : "en");
|
|
3106
|
+
const t = (0, import_react5.useMemo)(() => words(locale), [locale]);
|
|
3107
|
+
const refresh = (0, import_react5.useCallback)(() => {
|
|
2522
3108
|
if (request.current) return request.current;
|
|
2523
3109
|
const session = context.current;
|
|
2524
3110
|
request.current = (async () => {
|
|
@@ -2530,14 +3116,14 @@ function TeamworkPanel({ host: dsh }) {
|
|
|
2530
3116
|
setLoadError(void 0);
|
|
2531
3117
|
}
|
|
2532
3118
|
} catch (error) {
|
|
2533
|
-
setLoadError(error
|
|
3119
|
+
setLoadError(error);
|
|
2534
3120
|
} finally {
|
|
2535
3121
|
request.current = void 0;
|
|
2536
3122
|
}
|
|
2537
3123
|
})();
|
|
2538
3124
|
return request.current;
|
|
2539
3125
|
}, []);
|
|
2540
|
-
(0,
|
|
3126
|
+
(0, import_react5.useEffect)(() => {
|
|
2541
3127
|
let disposed = false;
|
|
2542
3128
|
let timer;
|
|
2543
3129
|
const poll = async () => {
|
|
@@ -2552,8 +3138,8 @@ function TeamworkPanel({ host: dsh }) {
|
|
|
2552
3138
|
clearTimeout(timer);
|
|
2553
3139
|
};
|
|
2554
3140
|
}, [refresh, sessionId]);
|
|
2555
|
-
const authenticated = state?.authenticated, server = state?.server;
|
|
2556
|
-
(0,
|
|
3141
|
+
const authenticated = state?.authenticated && !state.shared, server = state?.server;
|
|
3142
|
+
(0, import_react5.useEffect)(() => {
|
|
2557
3143
|
identity.current = void 0;
|
|
2558
3144
|
touched.current = false;
|
|
2559
3145
|
setProfile(void 0);
|
|
@@ -2561,13 +3147,14 @@ function TeamworkPanel({ host: dsh }) {
|
|
|
2561
3147
|
setTeam("all");
|
|
2562
3148
|
setQuery("");
|
|
2563
3149
|
}, [authenticated, server]);
|
|
2564
|
-
(0,
|
|
3150
|
+
(0, import_react5.useEffect)(() => {
|
|
2565
3151
|
setProfileError(void 0);
|
|
2566
3152
|
if (!authenticated) return;
|
|
2567
3153
|
let cancelled = false;
|
|
2568
3154
|
void api.profile().then((next) => {
|
|
2569
3155
|
if (cancelled) return;
|
|
2570
3156
|
setProfile(next);
|
|
3157
|
+
void refresh();
|
|
2571
3158
|
const key = `teamwork:team:${server}:${next.id}`;
|
|
2572
3159
|
if (identity.current === key) return;
|
|
2573
3160
|
identity.current = key;
|
|
@@ -2588,17 +3175,17 @@ function TeamworkPanel({ host: dsh }) {
|
|
|
2588
3175
|
}
|
|
2589
3176
|
saved ?? (saved = view?.team ?? null);
|
|
2590
3177
|
const teams = latest.current?.teams ?? [];
|
|
2591
|
-
const selected = saved && (saved === "all" || teams.some((
|
|
3178
|
+
const selected = saved && (saved === "all" || teams.some((t2) => t2.id === saved)) ? saved : teams.length === 1 ? teams[0].id : "all";
|
|
2592
3179
|
setTeam(selected);
|
|
2593
3180
|
if (saved === null && teams.length > 1) setPage("choose");
|
|
2594
3181
|
}).catch((error) => {
|
|
2595
|
-
if (!cancelled) setProfileError(error
|
|
3182
|
+
if (!cancelled) setProfileError(error);
|
|
2596
3183
|
});
|
|
2597
3184
|
return () => {
|
|
2598
3185
|
cancelled = true;
|
|
2599
3186
|
};
|
|
2600
3187
|
}, [authenticated, server, profileAttempt]);
|
|
2601
|
-
(0,
|
|
3188
|
+
(0, import_react5.useEffect)(() => {
|
|
2602
3189
|
if (profile && identity.current) views.set(identity.current, { team, tab, query });
|
|
2603
3190
|
}, [profile, team, tab, query]);
|
|
2604
3191
|
const navigate = (next) => {
|
|
@@ -2615,88 +3202,113 @@ function TeamworkPanel({ host: dsh }) {
|
|
|
2615
3202
|
} catch {
|
|
2616
3203
|
}
|
|
2617
3204
|
};
|
|
2618
|
-
(0,
|
|
2619
|
-
if (state && team !== "all" && !state.teams.some((
|
|
3205
|
+
(0, import_react5.useEffect)(() => {
|
|
3206
|
+
if (state && team !== "all" && !state.teams.some((t2) => t2.id === team)) {
|
|
2620
3207
|
setTeam("all");
|
|
2621
3208
|
setQuery("");
|
|
2622
3209
|
if (profile) try {
|
|
2623
3210
|
localStorage.setItem(`teamwork:team:${server}:${profile.id}`, "all");
|
|
2624
3211
|
} catch {
|
|
2625
3212
|
}
|
|
2626
|
-
notify("
|
|
3213
|
+
notify(t("team.gone"));
|
|
2627
3214
|
}
|
|
2628
3215
|
}, [state?.teams, team]);
|
|
2629
|
-
const notify = (0,
|
|
3216
|
+
const notify = (0, import_react5.useCallback)((message, tone = "neutral") => {
|
|
2630
3217
|
clearTimeout(toastTimer.current);
|
|
2631
3218
|
setToast({ message, tone });
|
|
2632
3219
|
toastTimer.current = setTimeout(() => setToast(void 0), tone === "danger" ? 6e3 : 3e3);
|
|
2633
3220
|
}, []);
|
|
2634
|
-
(0,
|
|
2635
|
-
const run = (0,
|
|
3221
|
+
(0, import_react5.useEffect)(() => () => clearTimeout(toastTimer.current), []);
|
|
3222
|
+
const run = (0, import_react5.useCallback)(async (action, done) => {
|
|
2636
3223
|
try {
|
|
2637
3224
|
const result = await action();
|
|
2638
3225
|
const message = typeof done === "function" ? done(result) : done;
|
|
2639
3226
|
if (message) notify(message);
|
|
2640
3227
|
return true;
|
|
2641
3228
|
} catch (error) {
|
|
2642
|
-
notify(error
|
|
3229
|
+
notify(describe(t, error), "danger");
|
|
2643
3230
|
return false;
|
|
2644
3231
|
} finally {
|
|
2645
3232
|
await request.current;
|
|
2646
3233
|
await refresh();
|
|
2647
3234
|
}
|
|
2648
|
-
}, [notify, refresh]);
|
|
3235
|
+
}, [notify, refresh, t]);
|
|
3236
|
+
const browsed = state?.authenticated ? state.teams.find((x) => x.id === team) : void 0;
|
|
3237
|
+
const summary = useSummary(browsed?.id, `${state?.server}:${state?.authRevision}`);
|
|
2649
3238
|
const toastNode = toast && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toast, { tone: toast.tone, children: toast.message });
|
|
3239
|
+
const retry = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", icon: "refresh", onClick: () => void refresh(), children: t("common.retry") });
|
|
2650
3240
|
if (!state) {
|
|
2651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Panel, { label: "Teamwork", header: loadError ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderSkeleton, {}), children: loadError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "danger", title: "
|
|
3241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Words.Provider, { value: t, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Panel, { label: "Teamwork", header: loadError ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderSkeleton, {}), children: loadError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "danger", title: t("load.failed"), action: retry, children: describe(t, loadError) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ListSkeleton, {}) }) });
|
|
3242
|
+
}
|
|
3243
|
+
if (state.shared && !state.authenticated) {
|
|
3244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Words.Provider, { value: t, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Panel, { label: "Teamwork", children: [
|
|
3245
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Shared, { shared: state.shared, run }),
|
|
3246
|
+
toastNode
|
|
3247
|
+
] }) });
|
|
2652
3248
|
}
|
|
2653
3249
|
if (!state.authenticated) {
|
|
2654
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Panel, { label: "Teamwork", centered: true, children: [
|
|
3250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Words.Provider, { value: t, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Panel, { label: "Teamwork", centered: true, children: [
|
|
2655
3251
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SignIn, { state, run }),
|
|
2656
3252
|
toastNode
|
|
2657
|
-
] });
|
|
3253
|
+
] }) });
|
|
2658
3254
|
}
|
|
2659
3255
|
const inTeam = (item) => team === "all" || item.teamId === team;
|
|
2660
3256
|
const matches = (item) => `${item.name} ${item.description ?? ""}`.toLocaleLowerCase().includes(query.toLocaleLowerCase());
|
|
2661
3257
|
const presets = state.presets.filter(inTeam), models = state.models.filter(inTeam), plugins = state.plugins.filter(inTeam);
|
|
2662
|
-
const
|
|
3258
|
+
const assistants = query ? [] : presets.filter((p) => p.assistant);
|
|
3259
|
+
const listed = (tab === "presets" ? presets.filter((p) => !assistants.includes(p)) : tab === "models" ? models : plugins).filter(matches);
|
|
3260
|
+
const tabs = [{ id: "presets", label: t("tabs.presets"), count: presets.length }, { id: "models", label: t("tabs.models"), count: models.length }, { id: "plugins", label: t("tabs.plugins"), count: plugins.length }];
|
|
2663
3261
|
const choosing = page === "choose" && state.teams.length > 1;
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2670
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2674
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
3262
|
+
const teamLabel = (name) => team === "all" && state.teams.length > 1 ? name : void 0;
|
|
3263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Words.Provider, { value: t, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3264
|
+
Panel,
|
|
3265
|
+
{
|
|
3266
|
+
label: "Teamwork",
|
|
3267
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Header, { state, page, team, reviews: browsed?.role === "admin" ? summary?.pendingReviews ?? 0 : 0, reviewUrl: browsed ? `${browsed.consoleUrl}/sharing` : "", selectTeam, navigate }),
|
|
3268
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Footer, { state, budget: browsed ? summary === void 0 ? void 0 : summary?.budget ?? null : false, run }),
|
|
3269
|
+
children: [
|
|
3270
|
+
loadError !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "danger", title: t("load.stale"), action: retry, children: describe(t, loadError) }),
|
|
3271
|
+
state.sync.lastError && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: t("sync.failedTitle"), action: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", icon: "refresh", onClick: () => run(() => api.sync(), t("sync.done")), children: t("common.retry") }), children: t("sync.failedBody") }),
|
|
3272
|
+
page !== "resources" && !choosing && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", onClick: () => navigate("resources"), children: t("common.back") }) }),
|
|
3273
|
+
choosing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TeamChooser, { state, select: selectTeam }) : (page === "resources" || page === "choose") && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: !state.teams.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EmptyState, { icon: "layers", title: t("noTeam.title"), action: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", children: [
|
|
3274
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { trailingIcon: "external", onClick: () => open(`${state.server}/teams`), children: t("noTeam.open") }),
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { icon: "refresh", onClick: () => run(() => api.sync(), t("noTeam.refreshed")), children: t("noTeam.refresh") })
|
|
3276
|
+
] }), children: t("noTeam.body") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-resource-toolbar", children: [
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tabs, { label: t("tabs.label"), items: tabs, value: tab, onChange: setTab }),
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Input, { "aria-label": t("search.label"), placeholder: t("search.placeholder"), value: query, onChange: (e) => setQuery(e.target.value) })
|
|
3280
|
+
] }),
|
|
3281
|
+
tab === "presets" && assistants.map((p) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantItem, { preset: p, team: teamLabel(p.teamName), state, dsh, run }, p.id)),
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-resource-list", children: [
|
|
3283
|
+
tab === "presets" && listed.map((p) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PresetItem, { preset: p, team: teamLabel(p.teamName), state, dsh, run, onInstall: () => setTab("plugins") }, p.id)),
|
|
3284
|
+
tab === "models" && listed.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModelItem, { model: m, team: teamLabel(m.teamName), state, run }, m.id)),
|
|
3285
|
+
tab === "plugins" && listed.map((p) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PluginItem, { plugin: p, team: teamLabel(p.teamName ?? ""), run }, p.id)),
|
|
3286
|
+
!listed.length && !(tab === "presets" && assistants.length) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EmptyState, { icon: "layers", title: query ? t("empty.noMatch") : t("empty.none"), children: query ? t("empty.noMatchBody") : t("empty.noneBody") })
|
|
3287
|
+
] }, `${team}:${tab}`)
|
|
3288
|
+
] }) }),
|
|
3289
|
+
page === "devices" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: t("phones.title"), children: t("phones.body") }),
|
|
3291
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Phones, { state, run })
|
|
3292
|
+
] }),
|
|
3293
|
+
page === "shared" && state.shared && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Shared, { shared: state.shared, run }),
|
|
3294
|
+
page === "teams" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: t("teams.title"), children: t("teams.body") }),
|
|
3296
|
+
state.teams.map((x) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Item, { icon: "layers", title: x.name, tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: x.role === "admin" ? "brand" : "neutral", children: role(t, x.role) }), actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { onClick: () => selectTeam(x.id), children: t("teams.browse") }),
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", trailingIcon: "external", onClick: () => open(x.consoleUrl), children: t(x.role === "admin" ? "teams.manage" : "teams.view") })
|
|
3299
|
+
] }) }, x.id)),
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { trailingIcon: "external", onClick: () => open(`${state.server}/teams`), children: t("teams.joinOrCreate") }) })
|
|
3301
|
+
] }),
|
|
3302
|
+
page === "profile" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Account, { state, profile, error: profileError, retry: () => setProfileAttempt((n) => n + 1), updated: (next) => {
|
|
3303
|
+
if (identity.current === `teamwork:team:${state.server}:${next.id}`) {
|
|
3304
|
+
setProfile(next);
|
|
3305
|
+
void refresh();
|
|
3306
|
+
}
|
|
3307
|
+
}, run }),
|
|
3308
|
+
toastNode
|
|
3309
|
+
]
|
|
3310
|
+
}
|
|
3311
|
+
) });
|
|
2700
3312
|
}
|
|
2701
3313
|
function PageTitle({ title, children }) {
|
|
2702
3314
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-stack", children: [
|
|
@@ -2705,25 +3317,27 @@ function PageTitle({ title, children }) {
|
|
|
2705
3317
|
] });
|
|
2706
3318
|
}
|
|
2707
3319
|
function TeamChooser({ state, select }) {
|
|
3320
|
+
const t = useT();
|
|
2708
3321
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2709
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: "
|
|
2710
|
-
state.teams.map((
|
|
2711
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", onClick: () => select("all"), children: "
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: t("choose.title"), children: t("choose.body") }),
|
|
3323
|
+
state.teams.map((x) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Item, { icon: "layers", title: x.name, tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: x.role === "admin" ? "brand" : "neutral", children: role(t, x.role) }), actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { onClick: () => select(x.id), children: t("choose.pick") }) }, x.id)),
|
|
3324
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", onClick: () => select("all"), children: t("choose.all") }) })
|
|
2712
3325
|
] });
|
|
2713
3326
|
}
|
|
2714
3327
|
function Account({ state, profile, error, retry, updated, run }) {
|
|
2715
|
-
const
|
|
2716
|
-
const [
|
|
2717
|
-
const [
|
|
2718
|
-
const [
|
|
2719
|
-
const [
|
|
2720
|
-
const
|
|
3328
|
+
const t = useT();
|
|
3329
|
+
const [name, setName] = (0, import_react5.useState)("");
|
|
3330
|
+
const [locale, setLocale] = (0, import_react5.useState)(t.locale);
|
|
3331
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
3332
|
+
const [logoutConfirm, setLogoutConfirm] = (0, import_react5.useState)(false);
|
|
3333
|
+
const [saveError, setSaveError] = (0, import_react5.useState)();
|
|
3334
|
+
const saving = (0, import_react5.useRef)(false);
|
|
2721
3335
|
const key = profile ? `${state.server}:${profile.id}` : void 0;
|
|
2722
|
-
const dirty = !!profile && (name.trim() !== (profile.name ?? "") || locale !== (profile.locale ??
|
|
2723
|
-
(0,
|
|
3336
|
+
const dirty = !!profile && (name.trim() !== (profile.name ?? "") || locale !== (profile.locale ?? t.locale));
|
|
3337
|
+
(0, import_react5.useEffect)(() => {
|
|
2724
3338
|
const draft = key ? profileDrafts.get(key) : void 0;
|
|
2725
3339
|
setName(draft?.name ?? profile?.name ?? "");
|
|
2726
|
-
setLocale(draft?.locale ?? profile?.locale ??
|
|
3340
|
+
setLocale(draft?.locale ?? profile?.locale ?? t.locale);
|
|
2727
3341
|
}, [key, profile?.name, profile?.locale]);
|
|
2728
3342
|
const edit = (nextName, nextLocale) => {
|
|
2729
3343
|
setName(nextName);
|
|
@@ -2742,51 +3356,52 @@ function Account({ state, profile, error, retry, updated, run }) {
|
|
|
2742
3356
|
profileDrafts.delete(key);
|
|
2743
3357
|
updated(next);
|
|
2744
3358
|
} catch (error2) {
|
|
2745
|
-
setSaveError(error2
|
|
3359
|
+
setSaveError(error2);
|
|
2746
3360
|
throw error2;
|
|
2747
3361
|
}
|
|
2748
|
-
}, "
|
|
3362
|
+
}, words(locale)("account.saved"));
|
|
2749
3363
|
saving.current = false;
|
|
2750
3364
|
setBusy(false);
|
|
2751
3365
|
};
|
|
2752
3366
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2753
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: "
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: t("account.title"), children: t("account.body") }),
|
|
2754
3368
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-account-grid", children: [
|
|
2755
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("section", { className: "twui-stack", "aria-label": "
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("section", { className: "twui-stack", "aria-label": t("account.profile"), children: error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: t("account.readFailed"), action: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { onClick: retry, children: t("common.retry") }), children: describe(t, error) }) : !profile ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ListSkeleton, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2756
3370
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", style: { gap: 14 }, children: [
|
|
2757
3371
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Monogram, { text: profile.name || profile.email || "T", size: 44 }),
|
|
2758
3372
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
2759
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: profile.name || "
|
|
2760
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: profile.email || "
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: profile.name || t("account.unnamed") }),
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: profile.email || t("account.noEmail") })
|
|
2761
3375
|
] })
|
|
2762
3376
|
] }),
|
|
2763
3377
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "twui-stack", onSubmit: (e) => {
|
|
2764
3378
|
e.preventDefault();
|
|
2765
3379
|
void save();
|
|
2766
3380
|
}, children: [
|
|
2767
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: "
|
|
2768
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: "
|
|
2769
|
-
dirty && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-subtle", children: "
|
|
2770
|
-
saveError && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "danger", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { role: "alert", children: saveError }) }),
|
|
3381
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: t("account.name"), htmlFor: "teamwork-name", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Input, { id: "teamwork-name", value: name, maxLength: 80, disabled: busy, onChange: (e) => edit(e.target.value, locale), autoComplete: "name" }) }),
|
|
3382
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: t("account.language"), htmlFor: "teamwork-locale", hint: t("account.languageHint"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Select, { id: "teamwork-locale", label: t("account.language"), value: locale, disabled: busy, onChange: (value) => edit(name, value), options: [{ value: "en", label: "English" }, { value: "zh-CN", label: "简体中文" }] }) }),
|
|
3383
|
+
dirty && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-subtle", children: t("account.unsaved") }),
|
|
3384
|
+
saveError !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "danger", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { role: "alert", children: describe(t, saveError) }) }),
|
|
2771
3385
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", children: [
|
|
2772
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", variant: "primary", busy, disabled: !dirty, children: "
|
|
3386
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", variant: "primary", busy, disabled: !dirty, children: t("account.save") }),
|
|
2773
3387
|
dirty && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", disabled: busy, onClick: () => {
|
|
2774
3388
|
if (key) profileDrafts.delete(key);
|
|
2775
3389
|
setName(profile.name ?? "");
|
|
2776
|
-
setLocale(profile.locale ??
|
|
3390
|
+
setLocale(profile.locale ?? t.locale);
|
|
2777
3391
|
setSaveError(void 0);
|
|
2778
|
-
}, children: "
|
|
3392
|
+
}, children: t("account.discard") })
|
|
2779
3393
|
] })
|
|
2780
3394
|
] })
|
|
2781
3395
|
] }) }),
|
|
2782
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "twui-stack", "aria-label": "
|
|
2783
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: "
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "twui-stack", "aria-label": t("account.connection"), children: [
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: t("account.connection") }),
|
|
2784
3398
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ServerSetting, { state, run }),
|
|
2785
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: "
|
|
2786
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", icon: "logout", onClick: () => setLogoutConfirm(true), children: "
|
|
2787
|
-
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: t("account.restartNote") }),
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", icon: "logout", onClick: () => setLogoutConfirm(true), children: t("account.signOut") }) }),
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ShareEnable, { run, signedIn: true }),
|
|
3402
|
+
logoutConfirm && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Confirm, { title: t("account.signOutTitle"), description: t("account.signOutBody"), confirmLabel: t("account.signOutConfirm"), cancelLabel: t("common.cancel"), busy, onCancel: () => setLogoutConfirm(false), onConfirm: async () => {
|
|
2788
3403
|
setBusy(true);
|
|
2789
|
-
await run(() => api.logout(), "
|
|
3404
|
+
await run(() => api.logout(), t("account.signedOut"));
|
|
2790
3405
|
setBusy(false);
|
|
2791
3406
|
} })
|
|
2792
3407
|
] })
|
|
@@ -2794,18 +3409,19 @@ function Account({ state, profile, error, retry, updated, run }) {
|
|
|
2794
3409
|
] });
|
|
2795
3410
|
}
|
|
2796
3411
|
function SignIn({ state, run }) {
|
|
2797
|
-
const
|
|
2798
|
-
const [
|
|
2799
|
-
const [
|
|
2800
|
-
const [
|
|
2801
|
-
const [
|
|
2802
|
-
const
|
|
2803
|
-
(0,
|
|
3412
|
+
const t = useT();
|
|
3413
|
+
const [opened, setOpened] = (0, import_react5.useState)(null);
|
|
3414
|
+
const [code, setCode] = (0, import_react5.useState)("");
|
|
3415
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
3416
|
+
const [error, setError] = (0, import_react5.useState)();
|
|
3417
|
+
const [expired, setExpired] = (0, import_react5.useState)(false);
|
|
3418
|
+
const locked = (0, import_react5.useRef)(false);
|
|
3419
|
+
(0, import_react5.useEffect)(() => {
|
|
2804
3420
|
if (!opened) return;
|
|
2805
3421
|
const timer = setTimeout(() => setExpired(true), Math.max(0, opened.expiresAt - Date.now()));
|
|
2806
3422
|
return () => clearTimeout(timer);
|
|
2807
3423
|
}, [opened]);
|
|
2808
|
-
const
|
|
3424
|
+
const begin = async () => {
|
|
2809
3425
|
if (locked.current) return;
|
|
2810
3426
|
locked.current = true;
|
|
2811
3427
|
setBusy(true);
|
|
@@ -2817,9 +3433,9 @@ function SignIn({ state, run }) {
|
|
|
2817
3433
|
setOpened({ automatic, url, expiresAt: Date.now() + 10 * 60 * 1e3 });
|
|
2818
3434
|
setExpired(false);
|
|
2819
3435
|
setCode("");
|
|
2820
|
-
|
|
3436
|
+
open(url);
|
|
2821
3437
|
} catch (failure) {
|
|
2822
|
-
setError(failure
|
|
3438
|
+
setError(failure);
|
|
2823
3439
|
throw failure;
|
|
2824
3440
|
}
|
|
2825
3441
|
});
|
|
@@ -2838,10 +3454,10 @@ function SignIn({ state, run }) {
|
|
|
2838
3454
|
try {
|
|
2839
3455
|
await api.authorize(code.trim());
|
|
2840
3456
|
} catch (failure) {
|
|
2841
|
-
setError(failure
|
|
3457
|
+
setError(failure);
|
|
2842
3458
|
throw failure;
|
|
2843
3459
|
}
|
|
2844
|
-
}, "
|
|
3460
|
+
}, t("signIn.done"));
|
|
2845
3461
|
} finally {
|
|
2846
3462
|
locked.current = false;
|
|
2847
3463
|
setBusy(false);
|
|
@@ -2851,7 +3467,7 @@ function SignIn({ state, run }) {
|
|
|
2851
3467
|
e.preventDefault();
|
|
2852
3468
|
if (code.trim()) void authorize();
|
|
2853
3469
|
}, children: [
|
|
2854
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: opened?.automatic ? "
|
|
3470
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: opened?.automatic ? t("signIn.pasteAuto") : t("signIn.paste"), htmlFor: "teamwork-code", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2855
3471
|
Input,
|
|
2856
3472
|
{
|
|
2857
3473
|
id: "teamwork-code",
|
|
@@ -2865,38 +3481,39 @@ function SignIn({ state, run }) {
|
|
|
2865
3481
|
autoFocus: !opened?.automatic
|
|
2866
3482
|
}
|
|
2867
3483
|
) }),
|
|
2868
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", variant: opened?.automatic ? "secondary" : "primary", size: "lg", block: true, busy, disabled: !code.trim() || expired, children: "
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", variant: opened?.automatic ? "secondary" : "primary", size: "lg", block: true, busy, disabled: !code.trim() || expired, children: t("signIn.finish") })
|
|
2869
3485
|
] });
|
|
2870
3486
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { width: "100%", maxWidth: 440, margin: "0 auto", display: "grid", gap: 24, padding: "24px 0" }, children: [
|
|
2871
3487
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "grid", justifyItems: "center", gap: 12, textAlign: "center" }, children: [
|
|
2872
3488
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BrandMark, { size: 56, title: "DSH Teamwork" }),
|
|
2873
3489
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "grid", gap: 6 }, children: [
|
|
2874
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { style: { fontSize: 20, fontWeight: 650, letterSpacing: "-0.01em" }, children: state.teams.length ? "
|
|
2875
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: "
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { style: { fontSize: 20, fontWeight: 650, letterSpacing: "-0.01em" }, children: state.teams.length ? t("signIn.reconnect") : t("signIn.title") }),
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: t("signIn.lede") })
|
|
2876
3492
|
] })
|
|
2877
3493
|
] }),
|
|
2878
3494
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Card, { padding: 20, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "grid", gap: 16 }, children: [
|
|
2879
3495
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("ol", { style: { listStyle: "none", margin: 0, padding: 0, display: "grid", gap: 10 }, children: [
|
|
2880
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Step, { n: 1, state: opened ? "done" : "active", children: "
|
|
2881
|
-
opened?.automatic === false ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Step, { n: 2, state: "active", children: "
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Step, { n: 1, state: opened ? "done" : "active", children: t("signIn.step1") }),
|
|
3497
|
+
opened?.automatic === false ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Step, { n: 2, state: "active", children: t("signIn.step2Paste") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Step, { n: 2, state: opened ? "active" : "todo", children: t("signIn.step2Auto") })
|
|
2882
3498
|
] }),
|
|
2883
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "danger", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { role: "alert", children: error }) }),
|
|
2884
|
-
expired ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: "
|
|
2885
|
-
opened.automatic && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", className: "twui-muted", children: "
|
|
2886
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: "twui-link", href: opened.url, target: "_blank", rel: "noopener noreferrer", children: "
|
|
3499
|
+
error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "danger", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { role: "alert", children: describe(t, error) }) }),
|
|
3500
|
+
expired ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: t("signIn.expiredTitle"), action: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { busy, onClick: () => void begin(), children: t("signIn.restart") }), children: t("signIn.expiredBody") }) : opened ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3501
|
+
opened.automatic && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", className: "twui-muted", children: t("signIn.waiting") }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: "twui-link", href: opened.url, target: "_blank", rel: "noopener noreferrer", children: t("signIn.openPage") }),
|
|
2887
3503
|
opened.automatic ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { children: [
|
|
2888
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("summary", { className: "twui-link", children: "
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("summary", { className: "twui-link", children: t("signIn.useCode") }),
|
|
2889
3505
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { paddingTop: 12 }, children: pasteForm })
|
|
2890
3506
|
] }) : pasteForm,
|
|
2891
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", busy, onClick: () => void
|
|
2892
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", size: "lg", block: true, trailingIcon: "external", busy, onClick: () => void
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", busy, onClick: () => void begin(), children: t("signIn.restart") })
|
|
3508
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", size: "lg", block: true, trailingIcon: "external", busy, onClick: () => void begin(), children: t("signIn.start") })
|
|
2893
3509
|
] }) }),
|
|
2894
3510
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "grid", gap: 12 }, children: [
|
|
2895
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Point, { icon: "shield", title: "
|
|
2896
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Point, { icon: "layers", title: "
|
|
2897
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Point, { icon: "sync", title: "
|
|
3511
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Point, { icon: "shield", title: t("signIn.keysTitle"), children: t("signIn.keysBody") }),
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Point, { icon: "layers", title: t("signIn.sideTitle"), children: t("signIn.sideBody") }),
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Point, { icon: "sync", title: t("signIn.syncTitle"), children: t("signIn.syncBody") })
|
|
2898
3514
|
] }),
|
|
2899
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ServerSetting, { state, run })
|
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ServerSetting, { state, run }),
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ShareEnable, { run, signedIn: false })
|
|
2900
3517
|
] });
|
|
2901
3518
|
}
|
|
2902
3519
|
function Step({ n, state, children }) {
|
|
@@ -2928,10 +3545,11 @@ function Point({ icon, title, children }) {
|
|
|
2928
3545
|
] });
|
|
2929
3546
|
}
|
|
2930
3547
|
function ServerSetting({ state, run }) {
|
|
2931
|
-
const
|
|
2932
|
-
const [
|
|
2933
|
-
const [
|
|
2934
|
-
const [
|
|
3548
|
+
const t = useT();
|
|
3549
|
+
const [editing, setEditing] = (0, import_react5.useState)(false);
|
|
3550
|
+
const [value, setValue] = (0, import_react5.useState)(state.server);
|
|
3551
|
+
const [error, setError] = (0, import_react5.useState)();
|
|
3552
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
2935
3553
|
const isDefault = state.server === state.defaultServer;
|
|
2936
3554
|
const save = async (server) => {
|
|
2937
3555
|
setBusy(true);
|
|
@@ -2939,9 +3557,9 @@ function ServerSetting({ state, run }) {
|
|
|
2939
3557
|
try {
|
|
2940
3558
|
await api.setServer(server);
|
|
2941
3559
|
setEditing(false);
|
|
2942
|
-
await run(async () => void 0, server === null ? "
|
|
3560
|
+
await run(async () => void 0, server === null ? t("server.wasReset") : t("server.changed"));
|
|
2943
3561
|
} catch (e) {
|
|
2944
|
-
setError(e
|
|
3562
|
+
setError(e);
|
|
2945
3563
|
} finally {
|
|
2946
3564
|
setBusy(false);
|
|
2947
3565
|
}
|
|
@@ -2950,16 +3568,16 @@ function ServerSetting({ state, run }) {
|
|
|
2950
3568
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-card", style: { display: "flex", alignItems: "center", gap: 12, padding: "12px 16px", boxShadow: "none" }, children: [
|
|
2951
3569
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "var(--twui-fg-subtle)" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "server", size: 16 }) }),
|
|
2952
3570
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "grid" }, children: [
|
|
2953
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: "
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: t("server.label") }),
|
|
2954
3572
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "twui-row", style: { gap: 6 }, children: [
|
|
2955
3573
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-mono", style: { overflowWrap: "anywhere" }, children: host(state.server) }),
|
|
2956
|
-
isDefault && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "accent", children: "
|
|
3574
|
+
isDefault && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "accent", children: t("common.officialService") })
|
|
2957
3575
|
] })
|
|
2958
3576
|
] }),
|
|
2959
3577
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", onClick: () => {
|
|
2960
3578
|
setValue(state.server);
|
|
2961
3579
|
setEditing(true);
|
|
2962
|
-
}, children: "
|
|
3580
|
+
}, children: t("server.change") })
|
|
2963
3581
|
] });
|
|
2964
3582
|
}
|
|
2965
3583
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
@@ -2972,180 +3590,193 @@ function ServerSetting({ state, run }) {
|
|
|
2972
3590
|
void save(value);
|
|
2973
3591
|
},
|
|
2974
3592
|
children: [
|
|
2975
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2976
|
-
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: t("server.field"), htmlFor: "teamwork-server", error: error === void 0 ? void 0 : describe(t, error), hint: t("server.hint"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3594
|
+
Input,
|
|
2977
3595
|
{
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
className: "twui-mono",
|
|
2987
|
-
value,
|
|
2988
|
-
onChange: (e) => setValue(e.target.value),
|
|
2989
|
-
"aria-invalid": error ? true : void 0,
|
|
2990
|
-
autoComplete: "off",
|
|
2991
|
-
spellCheck: false,
|
|
2992
|
-
autoFocus: true
|
|
2993
|
-
}
|
|
2994
|
-
)
|
|
3596
|
+
id: "teamwork-server",
|
|
3597
|
+
className: "twui-mono",
|
|
3598
|
+
value,
|
|
3599
|
+
onChange: (e) => setValue(e.target.value),
|
|
3600
|
+
"aria-invalid": error !== void 0 ? true : void 0,
|
|
3601
|
+
autoComplete: "off",
|
|
3602
|
+
spellCheck: false,
|
|
3603
|
+
autoFocus: true
|
|
2995
3604
|
}
|
|
2996
|
-
),
|
|
3605
|
+
) }),
|
|
2997
3606
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", children: [
|
|
2998
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", variant: "primary", size: "sm", busy, disabled: !value.trim() || value.trim() === state.server, children: state.authenticated ? "
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", variant: "primary", size: "sm", busy, disabled: !value.trim() || value.trim() === state.server, children: state.authenticated ? t("server.saveSignOut") : t("server.save") }),
|
|
2999
3608
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => {
|
|
3000
3609
|
setEditing(false);
|
|
3001
3610
|
setError(void 0);
|
|
3002
|
-
}, children: "
|
|
3003
|
-
!isDefault && /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
3004
|
-
"恢复为 ",
|
|
3005
|
-
host(state.defaultServer)
|
|
3006
|
-
] })
|
|
3611
|
+
}, children: t("common.cancel") }),
|
|
3612
|
+
!isDefault && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "twui-link", style: { marginLeft: "auto", fontSize: 12 }, disabled: busy, onClick: () => void save(null), children: t("server.reset", { host: host(state.defaultServer) }) })
|
|
3007
3613
|
] })
|
|
3008
3614
|
]
|
|
3009
3615
|
}
|
|
3010
3616
|
);
|
|
3011
3617
|
}
|
|
3012
|
-
function Header({ state, page, team, selectTeam, navigate }) {
|
|
3618
|
+
function Header({ state, page, team, reviews, reviewUrl, selectTeam, navigate }) {
|
|
3619
|
+
const t = useT();
|
|
3013
3620
|
const pending = state.phones.filter((p) => p.status === "pending").length;
|
|
3014
3621
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3015
3622
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-brand-lockup", children: [
|
|
3016
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "twui-brand-home", "aria-label": "
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "twui-brand-home", "aria-label": t("nav.home"), onClick: () => navigate("resources"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BrandMark, { size: 32, title: "DSH Teamwork" }) }),
|
|
3017
3624
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row twui-team-scope", children: [
|
|
3018
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", onClick: () => navigate("teams"), children: "
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", onClick: () => navigate("teams"), children: t("nav.teams") }),
|
|
3019
3626
|
!!state.teams.length && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3020
3627
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevronRight", size: 14 }),
|
|
3021
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Select, { label: "
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Select, { label: t("nav.chooseTeam"), value: team, onActivate: () => navigate("resources"), onChange: selectTeam, options: [{ value: "all", label: t("common.allTeams") }, ...state.teams.map((x) => ({ value: x.id, label: x.name, description: role(t, x.role) }))] })
|
|
3022
3629
|
] }),
|
|
3023
|
-
state.teams.find((
|
|
3630
|
+
state.teams.find((x) => x.id === team)?.role === "admin" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "brand", children: t("common.admin") })
|
|
3024
3631
|
] })
|
|
3025
3632
|
] }),
|
|
3026
3633
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row twui-header-actions", children: [
|
|
3027
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "ghost",
|
|
3028
|
-
"
|
|
3029
|
-
|
|
3030
|
-
` · ${pending}`,
|
|
3031
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-signal-dot", "aria-hidden": "true" })
|
|
3032
|
-
] }) : null
|
|
3634
|
+
reviews > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "ghost", trailingIcon: "external", title: t("nav.reviewsHint"), onClick: () => open(reviewUrl), children: [
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-signal-dot", "aria-hidden": "true" }),
|
|
3636
|
+
t("nav.reviews", { count: reviews })
|
|
3033
3637
|
] }),
|
|
3034
|
-
|
|
3638
|
+
state.shared ? (
|
|
3639
|
+
// A shared DSH has no person signed in and no phones of its own: its members, invites and key are on one page.
|
|
3640
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "ghost", icon: "server", "aria-current": page === "shared" ? "page" : void 0, onClick: () => navigate("shared"), children: [
|
|
3641
|
+
t("nav.shared"),
|
|
3642
|
+
state.shared.auditKey ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-signal-dot", "aria-hidden": "true" })
|
|
3643
|
+
] })
|
|
3644
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "ghost", icon: "smartphone", "aria-current": page === "devices" ? "page" : void 0, onClick: () => navigate("devices"), children: [
|
|
3646
|
+
t("nav.phones"),
|
|
3647
|
+
pending ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3648
|
+
` · ${pending}`,
|
|
3649
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-signal-dot", "aria-hidden": "true" })
|
|
3650
|
+
] }) : null
|
|
3651
|
+
] }),
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", icon: "settings", "aria-current": page === "profile" ? "page" : void 0, onClick: () => navigate("profile"), children: t("nav.account") })
|
|
3653
|
+
] })
|
|
3035
3654
|
] })
|
|
3036
3655
|
] });
|
|
3037
3656
|
}
|
|
3038
|
-
function
|
|
3039
|
-
const
|
|
3040
|
-
const
|
|
3041
|
-
(0,
|
|
3042
|
-
|
|
3043
|
-
let timer;
|
|
3044
|
-
const load = async () => {
|
|
3045
|
-
let next = "预算暂不可用";
|
|
3046
|
-
let out = false;
|
|
3047
|
-
try {
|
|
3048
|
-
const q = await api.quota(team);
|
|
3049
|
-
out = q.exhausted;
|
|
3050
|
-
next = q.exhausted ? "预算已用尽" : q.state === "unconfirmed" ? "预算待核实" : q.state === "known" && q.remaining !== null ? `预算剩余 ${q.remaining} 积分` : q.tokenLimited ? "已设 Token 上限" : "未设预算上限";
|
|
3051
|
-
} catch {
|
|
3052
|
-
}
|
|
3053
|
-
if (active) {
|
|
3054
|
-
setLabel(next);
|
|
3055
|
-
setExhausted(out);
|
|
3056
|
-
timer = setTimeout(load, 3e4);
|
|
3057
|
-
}
|
|
3058
|
-
};
|
|
3059
|
-
void load();
|
|
3060
|
-
return () => {
|
|
3061
|
-
active = false;
|
|
3062
|
-
clearTimeout(timer);
|
|
3063
|
-
};
|
|
3064
|
-
}, [team]);
|
|
3065
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "twui-footer-service", role: "status", title: "所选团队中我的预算;模型或上游仍可能有其他限制。切换资源团队不改变当前会话。", children: [
|
|
3066
|
-
exhausted && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-signal-dot", "aria-hidden": "true" }),
|
|
3657
|
+
function Budget({ budget }) {
|
|
3658
|
+
const t = useT();
|
|
3659
|
+
const label = budget === void 0 ? t("budget.loading") : budget === null ? t("budget.unavailable") : budget.exhausted ? t("budget.exhausted") : budget.state === "unconfirmed" ? t("budget.unconfirmed") : budget.state === "known" && budget.remaining !== null ? t("budget.remaining", { points: budget.remaining }) : budget.tokenLimited ? t("budget.tokenLimited") : t("budget.unlimited");
|
|
3660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "twui-footer-service", role: "status", title: t("budget.hint"), children: [
|
|
3661
|
+
budget?.exhausted && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-signal-dot", "aria-hidden": "true" }),
|
|
3067
3662
|
label
|
|
3068
3663
|
] });
|
|
3069
3664
|
}
|
|
3070
|
-
function Footer({ state,
|
|
3071
|
-
const
|
|
3665
|
+
function Footer({ state, budget, run }) {
|
|
3666
|
+
const t = useT();
|
|
3667
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
3072
3668
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3073
3669
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-footer-identity", children: [
|
|
3074
3670
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-footer-name", children: "Teamwork" }),
|
|
3075
3671
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "twui-footer-service", title: state.server, children: [
|
|
3076
|
-
state.server === state.defaultServer ? "
|
|
3077
|
-
" ·
|
|
3672
|
+
state.server === state.defaultServer ? t("common.officialService") : host(state.server),
|
|
3673
|
+
" · ",
|
|
3674
|
+
t("common.thisDsh")
|
|
3078
3675
|
] })
|
|
3079
3676
|
] }),
|
|
3080
3677
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row twui-footer-actions", children: [
|
|
3081
|
-
|
|
3082
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: state.sync.lastError ? "warning" : "success", dot: true, children: state.sync.running ? "
|
|
3678
|
+
budget !== false && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Budget, { budget }),
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: state.sync.lastError ? "warning" : "success", dot: true, children: state.sync.running ? t("sync.running") : state.sync.lastError ? t("sync.failed") : synced(t, state.sync.lastSuccess) }) }),
|
|
3083
3680
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", icon: "refresh", busy: busy || state.sync.running, onClick: async () => {
|
|
3084
3681
|
setBusy(true);
|
|
3085
|
-
await run(() => api.sync(), "
|
|
3682
|
+
await run(() => api.sync(), t("sync.done"));
|
|
3086
3683
|
setBusy(false);
|
|
3087
|
-
}, children: "
|
|
3684
|
+
}, children: t("sync.refresh") })
|
|
3088
3685
|
] })
|
|
3089
3686
|
] });
|
|
3090
3687
|
}
|
|
3091
|
-
function
|
|
3092
|
-
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
3688
|
+
function presetState(t, preset, state) {
|
|
3093
3689
|
const missing = missingTools(preset);
|
|
3094
3690
|
const plugins = pluginsNotReady(preset);
|
|
3095
3691
|
const active = state.session?.preset?.id === preset.id;
|
|
3096
|
-
const
|
|
3097
|
-
const
|
|
3098
|
-
const
|
|
3692
|
+
const list = (names) => names.join(t("list.separator"));
|
|
3693
|
+
const blocked = !preset.modelAvailable ? preset.contextWindowMissing ? t("model.noContextWindow", { name: preset.model ?? "" }) : t("preset.modelGone") : plugins.length ? t("preset.pluginsNotReady", { plugins: list(plugins.map((p) => p.name)) }) : missing.length && state.session ? t("preset.toolsMissing", { tools: list(missing.map((x) => x.name)) }) : void 0;
|
|
3694
|
+
const useBlocked = blocked ?? (state.session?.started && !active ? t("preset.sessionStarted") : void 0);
|
|
3695
|
+
const blank = !!state.session && !state.session.started && !active;
|
|
3696
|
+
return { missing, plugins, active, blocked, useBlocked, blank };
|
|
3697
|
+
}
|
|
3698
|
+
function startSession(dsh, preset) {
|
|
3699
|
+
dsh.uiWorkspace.startSession(void 0, { agentPreset: `team:${preset.teamId}:${preset.id}` });
|
|
3700
|
+
dsh.layout.selectPanel(null);
|
|
3701
|
+
}
|
|
3702
|
+
function AssistantItem({ preset, team, state, dsh, run }) {
|
|
3703
|
+
const t = useT();
|
|
3704
|
+
const { active, blocked, useBlocked, blank } = presetState(t, preset, state);
|
|
3705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "twui-featured", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3706
|
+
Item,
|
|
3707
|
+
{
|
|
3708
|
+
icon: "session",
|
|
3709
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3710
|
+
preset.name,
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "brand", children: t("assistant.label") })
|
|
3712
|
+
] }),
|
|
3713
|
+
subtitle: team,
|
|
3714
|
+
description: t("assistant.body"),
|
|
3715
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: t("assistant.examples") }),
|
|
3717
|
+
["assistant.example1", "assistant.example2", "assistant.example3"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { outline: true, children: t(key) }, key))
|
|
3718
|
+
] }),
|
|
3719
|
+
actions: active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "accent", dot: true, children: t("preset.inUse") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3720
|
+
blank && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", disabled: useBlocked !== void 0, onClick: () => run(() => api.use(state.session.id, preset.id), t("preset.selected", { name: preset.name })), children: t("preset.useHere") }),
|
|
3721
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", size: "sm", icon: "plus", disabled: !!blocked, onClick: () => startSession(dsh, preset), children: t("assistant.ask") })
|
|
3722
|
+
] }),
|
|
3723
|
+
notice: blocked ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "warning", children: blocked }) : void 0
|
|
3724
|
+
}
|
|
3725
|
+
) });
|
|
3726
|
+
}
|
|
3727
|
+
function PresetItem({ preset, team, state, dsh, run, onInstall }) {
|
|
3728
|
+
const t = useT();
|
|
3729
|
+
const [expanded, setExpanded] = (0, import_react5.useState)(false);
|
|
3730
|
+
const { missing, plugins, active, blocked, useBlocked, blank } = presetState(t, preset, state);
|
|
3731
|
+
const model = preset.model ?? t("preset.sessionModel");
|
|
3099
3732
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3100
3733
|
Item,
|
|
3101
3734
|
{
|
|
3102
3735
|
icon: "layers",
|
|
3103
3736
|
title: preset.name,
|
|
3104
|
-
subtitle:
|
|
3737
|
+
subtitle: team,
|
|
3105
3738
|
description: preset.description || void 0,
|
|
3106
3739
|
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3107
3740
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Badge, { children: [
|
|
3108
3741
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "cpu", size: 12 }),
|
|
3109
|
-
|
|
3742
|
+
model
|
|
3110
3743
|
] }),
|
|
3111
|
-
active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "accent", dot: true, children: "
|
|
3744
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "accent", dot: true, children: t("preset.inUse") }) : !blocked ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: !state.session && missing.length ? "neutral" : "success", dot: true, children: !state.session && missing.length ? t("preset.checkOnStart") : t("preset.ready") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "warning", dot: true, children: t("preset.notReady") })
|
|
3112
3745
|
] }),
|
|
3113
3746
|
actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3114
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", trailingIcon:
|
|
3115
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm",
|
|
3116
|
-
|
|
3117
|
-
dsh.layout.selectPanel(null);
|
|
3118
|
-
}, children: "新建会话" }),
|
|
3119
|
-
!active && state.session && !state.session.started && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", size: "sm", disabled: useBlocked !== void 0, onClick: () => run(() => api.use(state.session.id, preset.id), (r) => r.message), children: "用于当前空白会话" })
|
|
3747
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", trailingIcon: expanded ? "chevronDown" : "chevronRight", "aria-expanded": expanded, onClick: () => setExpanded(!expanded), children: t("preset.details") }),
|
|
3748
|
+
blank && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "primary", size: "sm", disabled: useBlocked !== void 0, onClick: () => run(() => api.use(state.session.id, preset.id), t("preset.selected", { name: preset.name })), children: t("preset.useHere") }),
|
|
3749
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", icon: "plus", disabled: !!blocked, onClick: () => startSession(dsh, preset), children: t("preset.newSession") })
|
|
3120
3750
|
] }),
|
|
3121
3751
|
notice: useBlocked && !active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", style: { gap: 6 }, children: [
|
|
3122
3752
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: blocked ? "warning" : "neutral", children: useBlocked }),
|
|
3123
|
-
plugins.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "twui-link", style: { fontSize: 12 }, onClick: onInstall, children: "
|
|
3753
|
+
plugins.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "twui-link", style: { fontSize: 12 }, onClick: onInstall, children: t("preset.goInstall") })
|
|
3124
3754
|
] }) : void 0,
|
|
3125
|
-
children:
|
|
3755
|
+
children: expanded && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ItemBody, { children: [
|
|
3126
3756
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DefinitionList, { items: [
|
|
3127
|
-
["
|
|
3128
|
-
["
|
|
3129
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-mono", children:
|
|
3130
|
-
|
|
3757
|
+
[t("preset.model"), model],
|
|
3758
|
+
[t("preset.tools"), preset.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-row", style: { gap: 6 }, children: preset.tools.map((x) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Badge, { tone: toolText[x.state][1], title: x.required ? t("preset.required") : t("preset.optional"), children: [
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-mono", children: x.name }),
|
|
3760
|
+
x.required ? "" : ` · ${t("preset.optional")}`,
|
|
3131
3761
|
" · ",
|
|
3132
|
-
toolText[
|
|
3133
|
-
] },
|
|
3134
|
-
["
|
|
3762
|
+
t(toolText[x.state][0])
|
|
3763
|
+
] }, x.name)) }) : t("preset.noTools")],
|
|
3764
|
+
[t("preset.plugins"), preset.plugins.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-row", style: { gap: 6 }, children: preset.plugins.map((p) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Badge, { tone: pluginText[p.state][1], children: [
|
|
3135
3765
|
p.name,
|
|
3136
3766
|
" @",
|
|
3137
3767
|
p.version,
|
|
3138
3768
|
" · ",
|
|
3139
|
-
pluginText[p.state][0]
|
|
3140
|
-
] }, p.id)) }) : "
|
|
3141
|
-
["
|
|
3769
|
+
t(pluginText[p.state][0])
|
|
3770
|
+
] }, p.id)) }) : t("preset.noPlugins")],
|
|
3771
|
+
[t("preset.version"), t("preset.versionValue", { version: preset.version })]
|
|
3142
3772
|
] }),
|
|
3143
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-subtle", children: "
|
|
3773
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-subtle", children: t("preset.toolsNote") })
|
|
3144
3774
|
] })
|
|
3145
3775
|
}
|
|
3146
3776
|
);
|
|
3147
3777
|
}
|
|
3148
|
-
function ModelItem({ model, state, run }) {
|
|
3778
|
+
function ModelItem({ model, team, state, run }) {
|
|
3779
|
+
const t = useT();
|
|
3149
3780
|
const s = state.session;
|
|
3150
3781
|
const active = !!s?.model?.team && s.model.model === model.id;
|
|
3151
3782
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -3153,17 +3784,21 @@ function ModelItem({ model, state, run }) {
|
|
|
3153
3784
|
{
|
|
3154
3785
|
icon: "cpu",
|
|
3155
3786
|
title: model.name,
|
|
3156
|
-
subtitle:
|
|
3157
|
-
description: "
|
|
3158
|
-
tags: /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
3159
|
-
|
|
3160
|
-
|
|
3787
|
+
subtitle: team,
|
|
3788
|
+
description: t("model.body"),
|
|
3789
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3790
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-mono", children: model.upstream }) }),
|
|
3791
|
+
model.contextWindowMissing && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "warning", dot: true, children: t("preset.notReady") })
|
|
3792
|
+
] }),
|
|
3793
|
+
actions: active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "accent", dot: true, children: t("preset.inUse") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", disabled: !s || model.contextWindowMissing, onClick: () => run(() => api.use(s.id, model.id), t("preset.selected", { name: model.name })), children: t("model.use") }),
|
|
3794
|
+
notice: model.contextWindowMissing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "warning", children: t("model.noContextWindow", { name: model.name }) }) : !s ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { children: t("model.openSession") }) : void 0
|
|
3161
3795
|
}
|
|
3162
3796
|
);
|
|
3163
3797
|
}
|
|
3164
|
-
function PluginItem({ plugin, run }) {
|
|
3165
|
-
const
|
|
3166
|
-
const [
|
|
3798
|
+
function PluginItem({ plugin, team, run }) {
|
|
3799
|
+
const t = useT();
|
|
3800
|
+
const [confirming, setConfirming] = (0, import_react5.useState)(false);
|
|
3801
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
3167
3802
|
const [label, tone] = pluginText[plugin.state];
|
|
3168
3803
|
const spec = `${plugin.package ?? plugin.name}@${plugin.version}`;
|
|
3169
3804
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -3171,24 +3806,21 @@ function PluginItem({ plugin, run }) {
|
|
|
3171
3806
|
{
|
|
3172
3807
|
icon: "puzzle",
|
|
3173
3808
|
title: plugin.name,
|
|
3174
|
-
subtitle:
|
|
3809
|
+
subtitle: team || void 0,
|
|
3175
3810
|
description: plugin.description || void 0,
|
|
3176
3811
|
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3177
3812
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle twui-mono", children: spec }),
|
|
3178
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone, dot: true, children: label }),
|
|
3179
|
-
plugin.localVersion && plugin.localVersion !== plugin.version && /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
3180
|
-
"本地 ",
|
|
3181
|
-
plugin.localVersion
|
|
3182
|
-
] })
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone, dot: true, children: t(label) }),
|
|
3814
|
+
plugin.localVersion && plugin.localVersion !== plugin.version && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { children: t("plugin.local", { version: plugin.localVersion }) })
|
|
3183
3815
|
] }),
|
|
3184
|
-
actions: plugin.state === "missing" ? !confirming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, {
|
|
3816
|
+
actions: plugin.state === "missing" ? !confirming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", onClick: () => setConfirming(true), children: t("plugin.install") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: t("plugin.managed") }),
|
|
3185
3817
|
children: confirming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3186
3818
|
Confirm,
|
|
3187
3819
|
{
|
|
3188
|
-
title:
|
|
3189
|
-
description: "
|
|
3190
|
-
confirmLabel: "
|
|
3191
|
-
cancelLabel: "
|
|
3820
|
+
title: t("plugin.confirmTitle", { spec }),
|
|
3821
|
+
description: t("plugin.confirmBody"),
|
|
3822
|
+
confirmLabel: t("plugin.confirm"),
|
|
3823
|
+
cancelLabel: t("common.cancel"),
|
|
3192
3824
|
busy,
|
|
3193
3825
|
onCancel: () => setConfirming(false),
|
|
3194
3826
|
onConfirm: async () => {
|
|
@@ -3222,29 +3854,30 @@ function ListSkeleton() {
|
|
|
3222
3854
|
] }, i)) });
|
|
3223
3855
|
}
|
|
3224
3856
|
var relayText = {
|
|
3225
|
-
off: ["
|
|
3226
|
-
connecting: ["
|
|
3227
|
-
refused: ["
|
|
3857
|
+
off: ["relay.offTitle", "relay.offBody"],
|
|
3858
|
+
connecting: ["relay.connectingTitle", "relay.connectingBody"],
|
|
3859
|
+
refused: ["relay.refusedTitle", "relay.refusedBody"]
|
|
3228
3860
|
};
|
|
3229
|
-
var shortTime = (iso) => new Date(iso).toLocaleString(
|
|
3861
|
+
var shortTime = (t, iso) => new Date(iso).toLocaleString(t.locale, { month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
3230
3862
|
function Phones({ state, run }) {
|
|
3231
|
-
const
|
|
3232
|
-
const [
|
|
3233
|
-
const [
|
|
3234
|
-
const [
|
|
3235
|
-
const [
|
|
3236
|
-
const
|
|
3863
|
+
const t = useT();
|
|
3864
|
+
const [offer, setOffer] = (0, import_react5.useState)();
|
|
3865
|
+
const [revoking, setRevoking] = (0, import_react5.useState)();
|
|
3866
|
+
const [busy, setBusy] = (0, import_react5.useState)();
|
|
3867
|
+
const [error, setError] = (0, import_react5.useState)();
|
|
3868
|
+
const [expired, setExpired] = (0, import_react5.useState)(false);
|
|
3869
|
+
const locked = (0, import_react5.useRef)(false);
|
|
3237
3870
|
const pending = state.phones.filter((p) => p.status === "pending");
|
|
3238
3871
|
const paired = state.phones.filter((p) => p.status === "confirmed");
|
|
3239
|
-
const seen = (0,
|
|
3240
|
-
(0,
|
|
3872
|
+
const seen = (0, import_react5.useRef)(new Set(pending.map((p) => p.id)));
|
|
3873
|
+
(0, import_react5.useEffect)(() => {
|
|
3241
3874
|
if (pending.some((p) => !seen.current.has(p.id))) {
|
|
3242
3875
|
setOffer(void 0);
|
|
3243
3876
|
setExpired(false);
|
|
3244
3877
|
}
|
|
3245
3878
|
seen.current = new Set(pending.map((p) => p.id));
|
|
3246
3879
|
}, [state.phones]);
|
|
3247
|
-
(0,
|
|
3880
|
+
(0, import_react5.useEffect)(() => {
|
|
3248
3881
|
if (state.relay !== "connected") {
|
|
3249
3882
|
setOffer(void 0);
|
|
3250
3883
|
setExpired(false);
|
|
@@ -3260,7 +3893,7 @@ function Phones({ state, run }) {
|
|
|
3260
3893
|
try {
|
|
3261
3894
|
return await action();
|
|
3262
3895
|
} catch (failure) {
|
|
3263
|
-
setError(failure
|
|
3896
|
+
setError(failure);
|
|
3264
3897
|
throw failure;
|
|
3265
3898
|
}
|
|
3266
3899
|
}, done);
|
|
@@ -3275,11 +3908,11 @@ function Phones({ state, run }) {
|
|
|
3275
3908
|
});
|
|
3276
3909
|
if (state.relay !== "connected") {
|
|
3277
3910
|
const [title, body] = relayText[state.relay];
|
|
3278
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EmptyState, { icon: "smartphone", title, children: body }) });
|
|
3911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EmptyState, { icon: "smartphone", title: t(title), children: t(body) }) });
|
|
3279
3912
|
}
|
|
3280
3913
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3281
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: "
|
|
3282
|
-
expired && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: "
|
|
3914
|
+
error !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: t("phones.failed"), children: describe(t, error) }),
|
|
3915
|
+
expired && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: t("phones.expiredTitle"), action: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { busy: busy === "pair", disabled: !!busy, onClick: () => void pair(), children: t("phones.newCode") }), children: t("phones.expiredBody") }),
|
|
3283
3916
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Card, { children: offer ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PairingCode, { offer, onDone: () => setOffer(void 0), onExpire: () => {
|
|
3284
3917
|
setOffer(void 0);
|
|
3285
3918
|
setExpired(true);
|
|
@@ -3287,9 +3920,9 @@ function Phones({ state, run }) {
|
|
|
3287
3920
|
EmptyState,
|
|
3288
3921
|
{
|
|
3289
3922
|
icon: "smartphone",
|
|
3290
|
-
title: "
|
|
3291
|
-
action: !expired && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { icon: "plus", busy: busy === "pair", disabled: !!busy, onClick: () => void pair(), children: "
|
|
3292
|
-
children: "
|
|
3923
|
+
title: t("phones.emptyTitle"),
|
|
3924
|
+
action: !expired && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { icon: "plus", busy: busy === "pair", disabled: !!busy, onClick: () => void pair(), children: t("phones.pair") }),
|
|
3925
|
+
children: t("phones.emptyBody")
|
|
3293
3926
|
}
|
|
3294
3927
|
) }),
|
|
3295
3928
|
pending.map((phone) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -3297,77 +3930,175 @@ function Phones({ state, run }) {
|
|
|
3297
3930
|
{
|
|
3298
3931
|
icon: "smartphone",
|
|
3299
3932
|
title: phone.deviceName,
|
|
3300
|
-
subtitle:
|
|
3301
|
-
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "warning", dot: true, children: "
|
|
3302
|
-
description: `${phone.safetyCode ?
|
|
3933
|
+
subtitle: t("phones.requested", { time: shortTime(t, phone.createdAt) }),
|
|
3934
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "warning", dot: true, children: t("phones.waiting") }),
|
|
3935
|
+
description: `${phone.safetyCode ? t("phones.safetyCode", { code: phone.safetyCode }) : t("phones.handshake")} ${t("phones.grant")}`,
|
|
3303
3936
|
actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3304
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", busy: busy === `reject:${phone.id}`, disabled: !!busy, onClick: () => void perform(`reject:${phone.id}`, () => api.decidePhone(phone.id, false), "
|
|
3305
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", busy: busy === `accept:${phone.id}`, disabled: !!busy || !phone.safetyCode || !phone.phoneConfirmed, onClick: () => void perform(`accept:${phone.id}`, () => api.decidePhone(phone.id, true),
|
|
3937
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", busy: busy === `reject:${phone.id}`, disabled: !!busy, onClick: () => void perform(`reject:${phone.id}`, () => api.decidePhone(phone.id, false), t("phones.rejected")), children: t("phones.reject") }),
|
|
3938
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", busy: busy === `accept:${phone.id}`, disabled: !!busy || !phone.safetyCode || !phone.phoneConfirmed, onClick: () => void perform(`accept:${phone.id}`, () => api.decidePhone(phone.id, true), t("phones.accepted", { device: phone.deviceName })), children: t("phones.accept") })
|
|
3306
3939
|
] })
|
|
3307
3940
|
},
|
|
3308
3941
|
phone.id
|
|
3309
3942
|
)),
|
|
3310
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { style: { fontSize: 15, fontWeight: 500 }, children: "
|
|
3311
|
-
!paired.length && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: "
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { style: { fontSize: 15, fontWeight: 500 }, children: t("phones.paired") }),
|
|
3944
|
+
!paired.length && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: t("phones.none") }),
|
|
3312
3945
|
paired.map((phone) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3313
3946
|
Item,
|
|
3314
3947
|
{
|
|
3315
3948
|
icon: "smartphone",
|
|
3316
3949
|
title: phone.deviceName,
|
|
3317
|
-
subtitle: phone.lastUsedAt ?
|
|
3318
|
-
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: phone.verified ? "success" : "warning", dot: true, children: phone.verified ? "
|
|
3319
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", disabled: !!busy, onClick: () => setRevoking(phone), children: "
|
|
3950
|
+
subtitle: phone.lastUsedAt ? t("phones.lastUsed", { time: shortTime(t, phone.lastUsedAt) }) : t("phones.pairedAt", { time: shortTime(t, phone.createdAt) }),
|
|
3951
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: phone.verified ? "success" : "warning", dot: true, children: phone.verified ? t("phones.verified") : t("phones.repair") }),
|
|
3952
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", disabled: !!busy, onClick: () => setRevoking(phone), children: t("phones.unpair") })
|
|
3320
3953
|
},
|
|
3321
3954
|
phone.id
|
|
3322
3955
|
)),
|
|
3323
3956
|
revoking && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3324
3957
|
Confirm,
|
|
3325
3958
|
{
|
|
3326
|
-
title:
|
|
3327
|
-
description: "
|
|
3328
|
-
confirmLabel: "
|
|
3329
|
-
cancelLabel: "
|
|
3959
|
+
title: t("phones.unpairTitle", { device: revoking.deviceName }),
|
|
3960
|
+
description: t("phones.unpairBody"),
|
|
3961
|
+
confirmLabel: t("phones.unpair"),
|
|
3962
|
+
cancelLabel: t("common.cancel"),
|
|
3330
3963
|
busy: !!busy,
|
|
3331
3964
|
onCancel: () => setRevoking(void 0),
|
|
3332
3965
|
onConfirm: async () => {
|
|
3333
|
-
if (await perform(`revoke:${revoking.id}`, () => api.revokePhone(revoking.id), "
|
|
3966
|
+
if (await perform(`revoke:${revoking.id}`, () => api.revokePhone(revoking.id), t("phones.unpaired"))) setRevoking(void 0);
|
|
3334
3967
|
}
|
|
3335
3968
|
}
|
|
3336
3969
|
)
|
|
3337
3970
|
] });
|
|
3338
3971
|
}
|
|
3339
3972
|
function PairingCode({ offer, onDone, onExpire }) {
|
|
3340
|
-
const
|
|
3341
|
-
(0,
|
|
3973
|
+
const t = useT();
|
|
3974
|
+
const [now, setNow] = (0, import_react5.useState)(Date.now());
|
|
3975
|
+
(0, import_react5.useEffect)(() => {
|
|
3342
3976
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
3343
3977
|
return () => clearInterval(timer);
|
|
3344
3978
|
}, []);
|
|
3345
3979
|
const left = Math.max(0, Math.round((Date.parse(offer.expiresAt) - now) / 1e3));
|
|
3346
|
-
(0,
|
|
3980
|
+
(0, import_react5.useEffect)(() => {
|
|
3347
3981
|
if (left === 0) onExpire();
|
|
3348
3982
|
}, [left, onExpire]);
|
|
3349
3983
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", gap: 20, alignItems: "center", flexWrap: "wrap" }, children: [
|
|
3350
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(QrCode, { value: offer.link, size: 168 }),
|
|
3984
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(QrCode, { value: offer.link, size: 168, label: t("phones.qr") }),
|
|
3351
3985
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "grid", gap: 8, minWidth: 200, flex: "1 1 200px" }, children: [
|
|
3352
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { style: { fontSize: 15, fontWeight: 650 }, children: "
|
|
3353
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: "
|
|
3986
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { style: { fontSize: 15, fontWeight: 650 }, children: t("phones.scan") }),
|
|
3987
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: t("phones.manual") }),
|
|
3354
3988
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "twui-mono", style: { fontSize: 20, letterSpacing: "0.12em" }, children: [
|
|
3355
3989
|
offer.code.slice(0, 3),
|
|
3356
3990
|
" ",
|
|
3357
3991
|
offer.code.slice(3)
|
|
3358
3992
|
] }),
|
|
3359
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3993
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: t("phones.expires", { time: `${Math.floor(left / 60)}:${String(left % 60).padStart(2, "0")}` }) }),
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "twui-subtle", children: t("phones.collapsedNote") }),
|
|
3995
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", onClick: onDone, children: t("phones.hide") }) })
|
|
3996
|
+
] })
|
|
3997
|
+
] });
|
|
3998
|
+
}
|
|
3999
|
+
function ShareEnable({ run, signedIn }) {
|
|
4000
|
+
const t = useT();
|
|
4001
|
+
const [key, setKey] = (0, import_react5.useState)("");
|
|
4002
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
4003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { children: [
|
|
4004
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("summary", { className: "twui-link", children: t("shared.enableTitle") }),
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "twui-stack", style: { paddingTop: 12 }, onSubmit: async (e) => {
|
|
4006
|
+
e.preventDefault();
|
|
4007
|
+
setBusy(true);
|
|
4008
|
+
if (await run(() => api.shareEnable(key.trim()), t("shared.enabled"))) setKey("");
|
|
4009
|
+
setBusy(false);
|
|
4010
|
+
}, children: [
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: t(signedIn ? "shared.enableBodySignedIn" : "shared.enableBody") }),
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: t("shared.hostKey"), htmlFor: "teamwork-host-key", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Input, { id: "teamwork-host-key", className: "twui-mono", value: key, onChange: (e) => setKey(e.target.value), placeholder: "dshh_…", autoComplete: "off", spellCheck: false }) }),
|
|
4013
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", busy, disabled: !key.trim(), children: t("shared.enable") }) })
|
|
4014
|
+
] })
|
|
4015
|
+
] });
|
|
4016
|
+
}
|
|
4017
|
+
function Shared({ shared, run }) {
|
|
4018
|
+
const t = useT();
|
|
4019
|
+
const [auditKey, setAuditKey] = (0, import_react5.useState)("");
|
|
4020
|
+
const [busy, setBusy] = (0, import_react5.useState)();
|
|
4021
|
+
const [invite, setInvite] = (0, import_react5.useState)();
|
|
4022
|
+
const [disabling, setDisabling] = (0, import_react5.useState)(false);
|
|
4023
|
+
const perform = async (id, action, done) => {
|
|
4024
|
+
setBusy(id);
|
|
4025
|
+
try {
|
|
4026
|
+
return await run(action, done);
|
|
4027
|
+
} finally {
|
|
4028
|
+
setBusy(void 0);
|
|
4029
|
+
}
|
|
4030
|
+
};
|
|
4031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
4032
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageTitle, { title: shared.name ?? t("shared.title"), children: shared.teamName ? t("shared.bodyTeam", { team: shared.teamName }) : t("shared.body") }),
|
|
4033
|
+
shared.error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "danger", title: t("shared.keyFailed"), children: shared.error }),
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "twui-stack", "aria-label": t("shared.auditTitle"), children: [
|
|
4035
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: t("shared.auditTitle") }),
|
|
4036
|
+
shared.auditKey ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "twui-muted", children: [
|
|
4037
|
+
t("shared.auditSet"),
|
|
4038
|
+
" ",
|
|
4039
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "twui-mono", children: [
|
|
4040
|
+
shared.auditKey.slice(0, 16),
|
|
4041
|
+
"…"
|
|
4042
|
+
] })
|
|
4043
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, { tone: "warning", title: t("shared.auditMissingTitle"), children: t("shared.auditMissingBody") }),
|
|
4044
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "twui-row", onSubmit: async (e) => {
|
|
4045
|
+
e.preventDefault();
|
|
4046
|
+
if (await perform("audit", () => api.shareAuditKey(auditKey.trim()), t("shared.auditSaved"))) setAuditKey("");
|
|
4047
|
+
}, children: [
|
|
4048
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Input, { "aria-label": t("shared.auditKey"), className: "twui-mono", value: auditKey, onChange: (e) => setAuditKey(e.target.value), placeholder: t("shared.auditPlaceholder"), autoComplete: "off", spellCheck: false }),
|
|
4049
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "submit", busy: busy === "audit", disabled: !!busy || !auditKey.trim(), children: shared.auditKey ? t("shared.auditReplace") : t("shared.auditSave") })
|
|
4050
|
+
] })
|
|
4051
|
+
] }),
|
|
4052
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "twui-stack", "aria-label": t("shared.membersTitle"), children: [
|
|
4053
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: t("shared.membersTitle") }),
|
|
4054
|
+
!shared.members.length && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: t("shared.noMembers") }),
|
|
4055
|
+
shared.members.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4056
|
+
Item,
|
|
4057
|
+
{
|
|
4058
|
+
icon: "smartphone",
|
|
4059
|
+
title: m.email ?? m.userId,
|
|
4060
|
+
subtitle: m.devices.length ? m.devices.join(", ") : t("shared.noDevice"),
|
|
4061
|
+
tags: m.locked ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { tone: "warning", dot: true, children: t("shared.locked") }) : void 0,
|
|
4062
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
4063
|
+
m.locked && m.email && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", busy: busy === `unlock:${m.userId}`, disabled: !!busy, onClick: () => void perform(`unlock:${m.userId}`, () => api.shareUnlock(m.email), t("shared.unlocked", { email: m.email })), children: t("shared.unlock") }),
|
|
4064
|
+
m.email && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", busy: busy === `invite:${m.userId}`, disabled: !!busy || !shared.auditKey, onClick: () => void perform(`invite:${m.userId}`, async () => setInvite({ email: m.email, ...await api.shareInvite(m.email) })), children: t("shared.invite") })
|
|
4065
|
+
] })
|
|
4066
|
+
},
|
|
4067
|
+
m.userId
|
|
4068
|
+
))
|
|
4069
|
+
] }),
|
|
4070
|
+
invite && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Card, { padding: 16, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", style: { alignItems: "flex-start", gap: 16 }, children: [
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(QrCode, { value: invite.link, size: 168, label: t("shared.inviteQr") }),
|
|
4072
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-stack", children: [
|
|
4073
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: t("shared.inviteTitle", { email: invite.email }) }),
|
|
4074
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "twui-muted", children: t("shared.inviteBody") }),
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className: "twui-mono", style: { wordBreak: "break-all", fontSize: 12 }, children: invite.link }),
|
|
4076
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "twui-row", children: [
|
|
4077
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", onClick: () => void navigator.clipboard?.writeText(invite.link).then(() => run(async () => void 0, t("shared.copied"))), children: t("shared.copy") }),
|
|
4078
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => setInvite(void 0), children: t("phones.hide") })
|
|
4079
|
+
] })
|
|
4080
|
+
] })
|
|
4081
|
+
] }) }),
|
|
4082
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "twui-stack", children: [
|
|
4083
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", icon: "logout", disabled: !!busy, onClick: () => setDisabling(true), children: t("shared.disable") }) }),
|
|
4084
|
+
disabling && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4085
|
+
Confirm,
|
|
4086
|
+
{
|
|
4087
|
+
title: t("shared.disableTitle"),
|
|
4088
|
+
description: t("shared.disableBody"),
|
|
4089
|
+
confirmLabel: t("shared.disable"),
|
|
4090
|
+
cancelLabel: t("common.cancel"),
|
|
4091
|
+
busy: busy === "disable",
|
|
4092
|
+
onCancel: () => setDisabling(false),
|
|
4093
|
+
onConfirm: async () => {
|
|
4094
|
+
if (await perform("disable", () => api.shareDisable(), t("shared.disabled"))) setDisabling(false);
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
)
|
|
3367
4098
|
] })
|
|
3368
4099
|
] });
|
|
3369
4100
|
}
|
|
3370
|
-
function QrCode({ value, size }) {
|
|
4101
|
+
function QrCode({ value, size, label }) {
|
|
3371
4102
|
const qr = qrcode_default(0, "M");
|
|
3372
4103
|
qr.addData(value);
|
|
3373
4104
|
qr.make();
|
|
@@ -3375,7 +4106,7 @@ function QrCode({ value, size }) {
|
|
|
3375
4106
|
let d = "";
|
|
3376
4107
|
for (let row = 0; row < count; row++) for (let col = 0; col < count; col++) if (qr.isDark(row, col)) d += `M${col + 4} ${row + 4}h1v1h-1z`;
|
|
3377
4108
|
const extent = count + 8;
|
|
3378
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { role: "img", "aria-label":
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { role: "img", "aria-label": label, width: size, height: size, viewBox: `0 0 ${extent} ${extent}`, shapeRendering: "crispEdges", style: { borderRadius: 8, flex: "none" }, children: [
|
|
3379
4110
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { width: extent, height: extent, fill: "#ffffff" }),
|
|
3380
4111
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d, fill: "#000000" })
|
|
3381
4112
|
] });
|