@decentnetwork/beagle-ui 0.2.13 → 0.2.15
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/dist/beagle-ui.js +318 -85
- package/package.json +1 -1
package/dist/beagle-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const BEAGLE_UI_VERSION = "0.2.
|
|
1
|
+
export const BEAGLE_UI_VERSION = "0.2.15";
|
|
2
2
|
// src/icons.jsx
|
|
3
3
|
var ICON_PATHS = {
|
|
4
4
|
// ---- tab bar (the four must feel like one set) ----
|
|
@@ -119,11 +119,13 @@ var H = {};
|
|
|
119
119
|
var hostNeedsWelcome = false;
|
|
120
120
|
var hostPrefersRtcFile = false;
|
|
121
121
|
var hostHasKeyBackup = false;
|
|
122
|
+
var hostEnsWrite = true;
|
|
122
123
|
function setUiHost(host) {
|
|
123
124
|
H = host || {};
|
|
124
125
|
hostNeedsWelcome = !!H.hostNeedsWelcome;
|
|
125
126
|
hostPrefersRtcFile = !!H.hostPrefersRtcFile;
|
|
126
127
|
hostHasKeyBackup = !!H.hostHasKeyBackup;
|
|
128
|
+
hostEnsWrite = H.hostEnsWrite !== void 0 ? !!H.hostEnsWrite : !H.hostNeedsWelcome;
|
|
127
129
|
}
|
|
128
130
|
function fileUrl(name) {
|
|
129
131
|
return H.fileUrl ? H.fileUrl(name) : "/api/file-download?name=" + encodeURIComponent(name);
|
|
@@ -522,7 +524,7 @@ function PeerRow({ peer, T, active, onClick, muted }) {
|
|
|
522
524
|
whiteSpace: "nowrap",
|
|
523
525
|
overflow: "hidden",
|
|
524
526
|
textOverflow: "ellipsis"
|
|
525
|
-
} }, peer.alias || shortKey(peer.userId, 8, 5)), peer.agent && /* @__PURE__ */ React.createElement(Icon, { name: "bot", size: 13, color: "var(--faint)", stroke: 2 }), muted && /* @__PURE__ */ React.createElement(Icon, { name: "bellOff", size: 12, color: "var(--faint)", stroke: 2, title: T && T.mutedTag || "sound muted" }), peer.wire === "64" && /* @__PURE__ */ React.createElement(Tag, { tone: "off", style: { height: 15, fontSize: 9.5, padding: "0 4px" } }, "w64")), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6, marginTop: 2 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)" } }, peer.ip), /* @__PURE__ */ React.createElement("span", { style: { color: "var(--line)", fontSize: 11 } }, "\xB7"), /* @__PURE__ */ React.createElement("span", { style: {
|
|
527
|
+
} }, peer.alias || shortKey(peer.userId, 8, 5)), peer.agent && /* @__PURE__ */ React.createElement(Icon, { name: "bot", size: 13, color: "var(--faint)", stroke: 2 }), muted && /* @__PURE__ */ React.createElement(Icon, { name: "bellOff", size: 12, color: "var(--faint)", stroke: 2, title: T && T.mutedTag || "sound muted" }), peer.wire === "64" && /* @__PURE__ */ React.createElement(Tag, { tone: "off", style: { height: 15, fontSize: 9.5, padding: "0 4px" } }, "w64")), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6, marginTop: 2 } }, peer.ip ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)" } }, peer.ip), /* @__PURE__ */ React.createElement("span", { style: { color: "var(--line)", fontSize: 11 } }, "\xB7")) : null, /* @__PURE__ */ React.createElement("span", { style: {
|
|
526
528
|
fontSize: 11,
|
|
527
529
|
color: "var(--dim)",
|
|
528
530
|
whiteSpace: "nowrap",
|
|
@@ -530,12 +532,12 @@ function PeerRow({ peer, T, active, onClick, muted }) {
|
|
|
530
532
|
textOverflow: "ellipsis",
|
|
531
533
|
flex: 1,
|
|
532
534
|
minWidth: 0
|
|
533
|
-
} },
|
|
535
|
+
} }, dkRowPreview(peer.lastMsg)))), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: 4, flexShrink: 0 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--faint)" } }, peer.lastTime), peer.unread ? /* @__PURE__ */ React.createElement(Unread, { n: peer.unread }) : peer.pending ? /* @__PURE__ */ React.createElement(Icon, { name: "clock", size: 11, stroke: 2.2, color: "var(--warn, #d29922)", title: "friend request pending" }) : /* @__PURE__ */ React.createElement(StatusDot, { online: peer.online })));
|
|
534
536
|
}
|
|
535
537
|
function dkActivityTs(p) {
|
|
536
538
|
return Math.max(p.lastTs || 0, p.acceptedAt || 0, p.requestedAt || 0);
|
|
537
539
|
}
|
|
538
|
-
function PeerSidebar({ T, peers, requests, activeId, onSelect, onAct, onAdd, prefillAddr, onPrefillConsumed, muted }) {
|
|
540
|
+
function PeerSidebar({ T, peers, requests, activeId, onSelect, onAct, onAdd, prefillAddr, onPrefillConsumed, muted, wide }) {
|
|
539
541
|
const [q, setQ] = React.useState("");
|
|
540
542
|
const [addr, setAddr] = React.useState("");
|
|
541
543
|
const [addState, setAddState] = React.useState(null);
|
|
@@ -584,7 +586,7 @@ function PeerSidebar({ T, peers, requests, activeId, onSelect, onAct, onAdd, pre
|
|
|
584
586
|
return String(a.alias || a.userId || "").localeCompare(String(b.alias || b.userId || ""));
|
|
585
587
|
});
|
|
586
588
|
const online = peers.filter((p) => p.online).length;
|
|
587
|
-
return /* @__PURE__ */ React.createElement("div", { style: { width: 320, flexShrink: 0, borderRight: "1px solid var(--line)", display: "flex", flexDirection: "column", background: "var(--panel)" } }, /* @__PURE__ */ React.createElement("div", { style: { padding: "12px 12px 10px", borderBottom: "1px solid var(--line)", display: "flex", flexDirection: "column", gap: 8 } }, fromDeepLink && /* @__PURE__ */ React.createElement("div", { style: {
|
|
589
|
+
return /* @__PURE__ */ React.createElement("div", { style: wide ? { flex: 1, minWidth: 0, minHeight: 0, display: "flex", flexDirection: "column", background: "var(--panel)" } : { width: 320, flexShrink: 0, borderRight: "1px solid var(--line)", display: "flex", flexDirection: "column", background: "var(--panel)" } }, /* @__PURE__ */ React.createElement("div", { style: { padding: "12px 12px 10px", borderBottom: "1px solid var(--line)", display: "flex", flexDirection: "column", gap: 8 } }, fromDeepLink && /* @__PURE__ */ React.createElement("div", { style: {
|
|
588
590
|
fontFamily: "var(--ui)",
|
|
589
591
|
fontSize: 12,
|
|
590
592
|
lineHeight: 1.4,
|
|
@@ -777,6 +779,17 @@ function dkEncodeBeagleContact(p) {
|
|
|
777
779
|
const link = "\n\n[Open name card](https://app.beagle.chat/#/chat?address=" + encodeURIComponent(p.address || "") + ")";
|
|
778
780
|
return head + bio + link + "\n\n```beagle-contact\n" + JSON.stringify(j) + "\n```\n";
|
|
779
781
|
}
|
|
782
|
+
function dkRowPreview(text) {
|
|
783
|
+
const card = dkContactPreview(text);
|
|
784
|
+
if (card)
|
|
785
|
+
return card;
|
|
786
|
+
const s = String(text == null ? "" : text);
|
|
787
|
+
const mine = /^you:\s*/i.test(s);
|
|
788
|
+
const cgp = dkParseCGP1(s.replace(/^you:\s*/i, ""));
|
|
789
|
+
if (cgp)
|
|
790
|
+
return (mine ? "you: " : "") + cgp.sender + ": " + cgp.body.replace(/\s+/g, " ");
|
|
791
|
+
return s;
|
|
792
|
+
}
|
|
780
793
|
function dkContactPreview(text) {
|
|
781
794
|
const s = String(text == null ? "" : text);
|
|
782
795
|
if (!/beagle-contact|BCR1\s*\{/i.test(s))
|
|
@@ -1419,6 +1432,8 @@ function Msg({ m, peer, T, onTheater, onDelete, onCancel, onRetry, onRetryMsg, o
|
|
|
1419
1432
|
background: mine ? "var(--bub-me)" : "var(--bub-them)",
|
|
1420
1433
|
border: "1px solid " + (mine ? "transparent" : "var(--line)"),
|
|
1421
1434
|
minWidth: 200,
|
|
1435
|
+
maxWidth: "100%",
|
|
1436
|
+
boxSizing: "border-box",
|
|
1422
1437
|
textDecoration: "none",
|
|
1423
1438
|
cursor: mine ? "default" : "pointer"
|
|
1424
1439
|
};
|
|
@@ -1602,7 +1617,7 @@ function Msg({ m, peer, T, onTheater, onDelete, onCancel, onRetry, onRetryMsg, o
|
|
|
1602
1617
|
) : mine && m.status === "sent" && m.confirmed === false ? /* @__PURE__ */ React.createElement(Icon, { name: "check", size: 12, stroke: 2.2, color: "var(--faint)", title: T.sentUnconfirmed || "sent \u2014 not confirmed by the peer" }) : mine && m.status && /* @__PURE__ */ React.createElement(Icon, { name: "checkCheck", size: 12, stroke: 2.2, color: m.status === "read" ? "var(--accent)" : "var(--faint)" })))
|
|
1603
1618
|
);
|
|
1604
1619
|
}
|
|
1605
|
-
function Conversation({ T, peer, lang, peers, onOpenChat, thread: threadProp, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, muted, onToggleMute }) {
|
|
1620
|
+
function Conversation({ T, peer, lang, peers, onOpenChat, thread: threadProp, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, muted, onToggleMute, phone, onBack }) {
|
|
1606
1621
|
const scrollRef = React.useRef(null);
|
|
1607
1622
|
const isGroup = React.useMemo(() => dkThreadIsGroup(threadProp), [threadProp]);
|
|
1608
1623
|
const followScrollRef = React.useRef(true);
|
|
@@ -1875,7 +1890,16 @@ function Conversation({ T, peer, lang, peers, onOpenChat, thread: threadProp, on
|
|
|
1875
1890
|
onDrop
|
|
1876
1891
|
},
|
|
1877
1892
|
dragOver && /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", inset: 0, zIndex: 30, background: "rgba(91,140,255,0.10)", border: "2px dashed var(--accent)", borderRadius: 12, display: "flex", alignItems: "center", justifyContent: "center", pointerEvents: "none", fontFamily: "var(--mono)", fontSize: 14, color: "var(--accent)" } }, lang === "zh" ? "\u677E\u5F00\u53D1\u9001\u6587\u4EF6" : "Drop to send file"),
|
|
1878
|
-
/* @__PURE__ */ React.createElement("div", { style: { height:
|
|
1893
|
+
/* @__PURE__ */ React.createElement("div", { style: { height: phone ? 56 : 60, boxSizing: "content-box", paddingTop: phone ? "env(safe-area-inset-top, 0px)" : 0, flexShrink: 0, borderBottom: "1px solid var(--line)", display: "flex", alignItems: "center", gap: phone ? 8 : 12, paddingLeft: phone ? 4 : 16, paddingRight: phone ? 8 : 16, background: "var(--panel)" } }, phone && onBack && /* @__PURE__ */ React.createElement(
|
|
1894
|
+
"button",
|
|
1895
|
+
{
|
|
1896
|
+
onClick: onBack,
|
|
1897
|
+
title: T && T.back || "Back",
|
|
1898
|
+
"aria-label": T && T.back || "Back",
|
|
1899
|
+
style: { width: 40, height: 44, flexShrink: 0, border: "none", background: "transparent", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", padding: 0 }
|
|
1900
|
+
},
|
|
1901
|
+
/* @__PURE__ */ React.createElement(Icon, { name: "chevronLeft", size: 26, stroke: 2.2, color: "var(--accent)" })
|
|
1902
|
+
), /* @__PURE__ */ React.createElement("div", { onClick: () => setPubProfile(true), title: T && T.pubOpen || "View public profile", style: { cursor: "pointer", flexShrink: 0 } }, /* @__PURE__ */ React.createElement(DkAvatar, { peer, size: 34, radius: 8 })), /* @__PURE__ */ React.createElement("div", { style: { minWidth: 0, flex: phone ? 1 : void 0 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 } }, /* @__PURE__ */ React.createElement("span", { onClick: () => setPubProfile(true), style: { fontFamily: peer.alias ? "var(--ui)" : "var(--mono)", fontSize: 15, fontWeight: 700, color: "var(--text)", cursor: "pointer", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", minWidth: 0 } }, peer.alias || shortKey(peer.userId, phone ? 6 : 10, phone ? 4 : 6)), peer.agent && !phone && /* @__PURE__ */ React.createElement(Tag, { tone: "accent" }, "agent"), isGroup && !phone && /* @__PURE__ */ React.createElement(Tag, null, T && T.groupTag || "group"), !phone && /* @__PURE__ */ React.createElement(RouteTag, { peer })), phone ? /* @__PURE__ */ React.createElement("div", { style: { marginTop: 2, display: "flex" } }, /* @__PURE__ */ React.createElement(RouteTag, { peer })) : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, marginTop: 2 } }, /* @__PURE__ */ React.createElement(Mono, { size: 11.5, dim: true, copy: peer.userId, title: peer.userId }, shortKey(peer.userId, 10, 6)), /* @__PURE__ */ React.createElement("span", { style: { color: "var(--line)" } }, "\xB7"), /* @__PURE__ */ React.createElement("button", { onClick: () => onOpenNet(peer), title: T && T.openNet || "Network view", style: { background: "none", border: "none", cursor: "pointer", padding: 0, color: "var(--accent)", display: "inline-flex", alignItems: "center" } }, /* @__PURE__ */ React.createElement(Icon, { name: "network", size: 12, stroke: 2 })), /* @__PURE__ */ React.createElement(Mono, { size: 11.5, dim: true, copy: peer.ip, title: peer.ip }, peer.ip), peer.address && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { color: "var(--line)" } }, "\xB7"), /* @__PURE__ */ React.createElement(
|
|
1879
1903
|
Mono,
|
|
1880
1904
|
{
|
|
1881
1905
|
size: 11.5,
|
|
@@ -1886,7 +1910,7 @@ function Conversation({ T, peer, lang, peers, onOpenChat, thread: threadProp, on
|
|
|
1886
1910
|
${peer.address}`
|
|
1887
1911
|
},
|
|
1888
1912
|
shortKey(peer.address, 8, 6)
|
|
1889
|
-
)))), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), onToggleMute && /* @__PURE__ */ React.createElement(
|
|
1913
|
+
)))), !phone && /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), onToggleMute && !phone && /* @__PURE__ */ React.createElement(
|
|
1890
1914
|
Btn,
|
|
1891
1915
|
{
|
|
1892
1916
|
icon: muted ? "bellOff" : "bell",
|
|
@@ -1904,7 +1928,16 @@ ${peer.address}`
|
|
|
1904
1928
|
e.target.value = "";
|
|
1905
1929
|
}
|
|
1906
1930
|
}
|
|
1907
|
-
), /* @__PURE__ */ React.createElement(Btn, { icon: "file", title: T && T.sendWebrtcFile || "Send file via WebRTC", onClick: () => rtcFileRef.current && rtcFileRef.current.click() })), /* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React.createElement(Btn, { icon: "more", onClick: () => setMenu((v) => !v) }), menu && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { onClick: () => setMenu(false), style: { position: "fixed", inset: 0, zIndex: 40 } }), /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", right: 0, top: 36, zIndex: 50, width: 180, background: "var(--panel-2)", border: "1px solid var(--line)", borderRadius: 9, padding: 6, boxShadow: "0 14px 40px rgba(0,0,0,0.4)" } }, /* @__PURE__ */ React.createElement(MenuItem, { icon: "
|
|
1931
|
+
), !phone && /* @__PURE__ */ React.createElement(Btn, { icon: "file", title: T && T.sendWebrtcFile || "Send file via WebRTC", onClick: () => rtcFileRef.current && rtcFileRef.current.click() })), /* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React.createElement(Btn, { icon: "more", onClick: () => setMenu((v) => !v) }), menu && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { onClick: () => setMenu(false), style: { position: "fixed", inset: 0, zIndex: 40 } }), /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", right: 0, top: 36, zIndex: 50, width: 180, background: "var(--panel-2)", border: "1px solid var(--line)", borderRadius: 9, padding: 6, boxShadow: "0 14px 40px rgba(0,0,0,0.4)" } }, phone && onToggleMute && /* @__PURE__ */ React.createElement(MenuItem, { icon: muted ? "bell" : "bellOff", label: muted ? T && T.unmuteSound || "Turn sound back on" : T && T.muteSound || "Mute sound", onClick: () => {
|
|
1932
|
+
setMenu(false);
|
|
1933
|
+
onToggleMute(peer.id);
|
|
1934
|
+
} }), phone && onSendRtcFile && /* @__PURE__ */ React.createElement(MenuItem, { icon: "file", label: T && T.sendWebrtcFile || "Send file via WebRTC", onClick: () => {
|
|
1935
|
+
setMenu(false);
|
|
1936
|
+
rtcFileRef.current && rtcFileRef.current.click();
|
|
1937
|
+
} }), phone && /* @__PURE__ */ React.createElement(MenuItem, { icon: "network", label: T && T.openNet || "Network view", onClick: () => {
|
|
1938
|
+
setMenu(false);
|
|
1939
|
+
onOpenNet(peer);
|
|
1940
|
+
} }), /* @__PURE__ */ React.createElement(MenuItem, { icon: "hash", label: T.alias, onClick: () => {
|
|
1908
1941
|
setMenu(false);
|
|
1909
1942
|
onAlias(peer);
|
|
1910
1943
|
} }), /* @__PURE__ */ React.createElement(MenuItem, { icon: "check", label: T.selectDelete || "Select & delete", onClick: () => {
|
|
@@ -1925,7 +1958,7 @@ ${peer.address}`
|
|
|
1925
1958
|
fontSize: 12.5,
|
|
1926
1959
|
color: "var(--text)"
|
|
1927
1960
|
} }, /* @__PURE__ */ React.createElement(Icon, { name: "clock", size: 13, stroke: 2.2, color: "#d29922" }), /* @__PURE__ */ React.createElement("span", null, T.pendingFriend || "Waiting for them to accept your friend request \u2014 messages will queue and deliver once they do.")),
|
|
1928
|
-
/* @__PURE__ */ React.createElement("div", { ref: scrollRef, onScroll: updateFollowScroll, style: { flex: 1, overflow: "auto", padding: "18px 22px" } }, /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto" } }, thread.filter((m) => m.day || !hidden.has(m.id)).map((m, i) => m.day ? /* @__PURE__ */ React.createElement("div", { key: i, style: { display: "flex", justifyContent: "center", margin: "14px 0" } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 10.5, fontWeight: 600, color: "var(--faint)", background: "var(--chip)", padding: "3px 10px", borderRadius: 999 } }, m.day)) : /* @__PURE__ */ React.createElement(
|
|
1961
|
+
/* @__PURE__ */ React.createElement("div", { ref: scrollRef, onScroll: updateFollowScroll, style: { flex: 1, overflow: "auto", padding: phone ? "12px 10px" : "18px 22px", WebkitOverflowScrolling: "touch" } }, /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto" } }, thread.filter((m) => m.day || !hidden.has(m.id)).map((m, i) => m.day ? /* @__PURE__ */ React.createElement("div", { key: i, style: { display: "flex", justifyContent: "center", margin: "14px 0" } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 10.5, fontWeight: 600, color: "var(--faint)", background: "var(--chip)", padding: "3px 10px", borderRadius: 999 } }, m.day)) : /* @__PURE__ */ React.createElement(
|
|
1929
1962
|
Msg,
|
|
1930
1963
|
{
|
|
1931
1964
|
key: m.id || i,
|
|
@@ -1954,7 +1987,7 @@ ${peer.address}`
|
|
|
1954
1987
|
setSelMode(false);
|
|
1955
1988
|
setSel(/* @__PURE__ */ new Set());
|
|
1956
1989
|
} }, T.cancel || "Cancel"), /* @__PURE__ */ React.createElement(Btn, { size: "sm", tone: "danger", icon: "trash", onClick: () => doDelete([...sel]) }, T.delete || "Delete")),
|
|
1957
|
-
/* @__PURE__ */ React.createElement("div", { style: { flexShrink: 0, borderTop: "1px solid var(--line)", padding: "12px 16px", background: "var(--panel)" } }, flash && /* @__PURE__ */ React.createElement("div", { style: {
|
|
1990
|
+
/* @__PURE__ */ React.createElement("div", { style: { flexShrink: 0, borderTop: "1px solid var(--line)", padding: phone ? "8px 8px calc(8px + env(safe-area-inset-bottom, 0px))" : "12px 16px", background: "var(--panel)" } }, flash && /* @__PURE__ */ React.createElement("div", { style: {
|
|
1958
1991
|
maxWidth: 1200,
|
|
1959
1992
|
margin: "0 auto 8px",
|
|
1960
1993
|
display: "flex",
|
|
@@ -1971,7 +2004,7 @@ ${peer.address}`
|
|
|
1971
2004
|
stroke: 2.2,
|
|
1972
2005
|
color: flash.kind === "err" ? "var(--danger)" : "var(--accent)"
|
|
1973
2006
|
}
|
|
1974
|
-
), flash.msg), sending && /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto 8px", display: "flex", alignItems: "center", gap: 8, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "paperclip", size: 13, stroke: 2, color: "var(--accent)" }), (lang === "zh" ? "\u53D1\u9001\u4E2D: " : "Sending: ") + (sending.via === "webrtc" ? "WebRTC \xB7 " : "") + sending.name + (sending.size ? " \xB7 " + dkFileSize(sending.sent || 0) + " / " + dkFileSize(sending.size) : "") + (sending.pct != null ? " \xB7 " + Math.min(100, Math.max(0, sending.pct)).toFixed(1) + "%" : "") + (sending.kbps != null ? " \xB7 " + dkSpeed(sending.kbps) : "")), /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto", display: "flex", alignItems: "center", gap: 10 } }, /* @__PURE__ */ React.createElement(
|
|
2007
|
+
), flash.msg), sending && /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto 8px", display: "flex", alignItems: "center", gap: 8, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "paperclip", size: 13, stroke: 2, color: "var(--accent)" }), (lang === "zh" ? "\u53D1\u9001\u4E2D: " : "Sending: ") + (sending.via === "webrtc" ? "WebRTC \xB7 " : "") + sending.name + (sending.size ? " \xB7 " + dkFileSize(sending.sent || 0) + " / " + dkFileSize(sending.size) : "") + (sending.pct != null ? " \xB7 " + Math.min(100, Math.max(0, sending.pct)).toFixed(1) + "%" : "") + (sending.kbps != null ? " \xB7 " + dkSpeed(sending.kbps) : "")), /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto", display: "flex", alignItems: "center", gap: phone ? 6 : 10 } }, /* @__PURE__ */ React.createElement(
|
|
1975
2008
|
"input",
|
|
1976
2009
|
{
|
|
1977
2010
|
ref: fileRef,
|
|
@@ -1993,7 +2026,7 @@ ${peer.address}`
|
|
|
1993
2026
|
sendDraft();
|
|
1994
2027
|
}
|
|
1995
2028
|
},
|
|
1996
|
-
placeholder: `${T.message} ${peer.alias || shortKey(peer.userId, 6, 4)}\u2026`,
|
|
2029
|
+
placeholder: phone ? `${T.message}\u2026` : `${T.message} ${peer.alias || shortKey(peer.userId, 6, 4)}\u2026`,
|
|
1997
2030
|
style: { flex: 1, height: 38, borderRadius: 9, border: "1px solid var(--line)", background: "var(--panel-2)", color: "var(--text)", fontFamily: "var(--ui)", fontSize: 13.5, padding: "0 14px", outline: "none", minWidth: 0 }
|
|
1998
2031
|
}
|
|
1999
2032
|
), /* @__PURE__ */ React.createElement(Btn, { tone: "solid", icon: "arrowUp", title: T.send, onClick: sendDraft }))),
|
|
@@ -2085,8 +2118,11 @@ function MenuItem({ icon, label, onClick, danger }) {
|
|
|
2085
2118
|
function ChatEmpty({ T }) {
|
|
2086
2119
|
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 12, color: "var(--faint)", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "message", size: 40, stroke: 1.4, color: "var(--line)" }), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 13 } }, T.pickPeer));
|
|
2087
2120
|
}
|
|
2088
|
-
function ChatTab({ T, lang, peers, requests, activeId, thread, onSelect, onAct, onAdd, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, prefillAddr, onPrefillConsumed, muted, onToggleMute }) {
|
|
2121
|
+
function ChatTab({ T, lang, peers, requests, activeId, thread, onSelect, onAct, onAdd, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, prefillAddr, onPrefillConsumed, muted, onToggleMute, phone, onBack }) {
|
|
2089
2122
|
const peer = peers.find((p) => p.id === activeId);
|
|
2123
|
+
if (phone) {
|
|
2124
|
+
return peer ? /* @__PURE__ */ React.createElement(Conversation, { T, peer, lang, peers, onOpenChat: onSelect, thread, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, muted: !!muted && muted.includes(peer.id), onToggleMute, phone: true, onBack }) : /* @__PURE__ */ React.createElement(PeerSidebar, { T, peers, requests, activeId, onSelect, onAct, onAdd, prefillAddr, onPrefillConsumed, muted, wide: true });
|
|
2125
|
+
}
|
|
2090
2126
|
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, display: "flex", minWidth: 0, minHeight: 0 } }, /* @__PURE__ */ React.createElement(PeerSidebar, { T, peers, requests, activeId, onSelect, onAct, onAdd, prefillAddr, onPrefillConsumed, muted }), peer ? /* @__PURE__ */ React.createElement(Conversation, { T, peer, lang, peers, onOpenChat: onSelect, thread, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, muted: !!muted && muted.includes(peer.id), onToggleMute }) : /* @__PURE__ */ React.createElement(ChatEmpty, { T }));
|
|
2091
2127
|
}
|
|
2092
2128
|
Object.assign(window, { ChatTab });
|
|
@@ -2125,14 +2161,14 @@ function CopyBtn({ value, copiedText = "Copied", copyFailedText = "Copy failed",
|
|
|
2125
2161
|
));
|
|
2126
2162
|
}
|
|
2127
2163
|
function FieldRow({ T, label, value, mono = true, copy, qr, onQr, last }) {
|
|
2128
|
-
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14, padding: "13px 16px", borderBottom: last ? "none" : "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("span", { style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, label), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: mono ? "var(--mono)" : "var(--ui)", fontSize: 13.5, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, value), copy && /* @__PURE__ */ React.createElement(CopyBtn, { value, copiedText: T.copied, copyFailedText: T.copyFailed, copyTitle: T.copy }), qr && /* @__PURE__ */ React.createElement(Btn, { icon: "qr", size: "sm", onClick: () => onQr && onQr(value, label) }));
|
|
2164
|
+
return /* @__PURE__ */ React.createElement("div", { className: "dk-row", style: { display: "flex", alignItems: "center", gap: 14, padding: "13px 16px", borderBottom: last ? "none" : "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, label), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: mono ? "var(--mono)" : "var(--ui)", fontSize: 13.5, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, value), copy && /* @__PURE__ */ React.createElement(CopyBtn, { value, copiedText: T.copied, copyFailedText: T.copyFailed, copyTitle: T.copy }), qr && /* @__PURE__ */ React.createElement(Btn, { icon: "qr", size: "sm", onClick: () => onQr && onQr(value, label) }));
|
|
2129
2165
|
}
|
|
2130
2166
|
function DkVersionRow({ T, me }) {
|
|
2131
2167
|
const unsure = me.verFromBackend === false;
|
|
2132
2168
|
const pill = (name, ver, mark) => /* @__PURE__ */ React.createElement("span", { key: name, style: { display: "inline-flex", alignItems: "baseline", gap: 5 } }, /* @__PURE__ */ React.createElement("span", { style: { color: "var(--faint)" } }, name), /* @__PURE__ */ React.createElement("span", { title: mark && unsure ? T.verInstalledHint : void 0 }, ver || "\u2014", mark && unsure && ver ? /* @__PURE__ */ React.createElement("span", { style: { color: "var(--faint)" } }, " ?") : null));
|
|
2133
2169
|
const line = (label, items) => /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "baseline", gap: 10, flexWrap: "wrap" } }, /* @__PURE__ */ React.createElement("span", { style: { width: 52, flexShrink: 0, fontSize: 11, color: "var(--faint)" } }, label), /* @__PURE__ */ React.createElement("span", { style: { display: "flex", gap: 12, flexWrap: "wrap" } }, items));
|
|
2134
2170
|
const embedded = me.backend === "embedded";
|
|
2135
|
-
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: 14, padding: "13px 16px", borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("span", { style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.version), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 6, fontFamily: "var(--mono)", fontSize: 13, color: "var(--text)" } }, line(T.verApp || "app", [
|
|
2171
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: 14, padding: "13px 16px", borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.version), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 6, fontFamily: "var(--mono)", fontSize: 13, color: "var(--text)" } }, line(T.verApp || "app", [
|
|
2136
2172
|
pill("beagle", me.beagleVer),
|
|
2137
2173
|
pill("peer-webrtc", me.webrtcVer),
|
|
2138
2174
|
...embedded ? [pill("peer", me.peerVer)] : []
|
|
@@ -2436,6 +2472,47 @@ function DkPublicProfile({ T, userid, fallbackName, onClose, isFriend, isMe, onM
|
|
|
2436
2472
|
recState[p.id] === "sent" ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--online)" } }, T.pubRecSent || "sent \u2713") : recState[p.id] === "busy" ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--faint)" } }, "\u2026") : recState[p.id] ? /* @__PURE__ */ React.createElement("span", { title: recState[p.id], style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--warn, #f59e0b)" } }, T.addFailed || "failed") : /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--accent)" } }, T.send || "Send")
|
|
2437
2473
|
))))));
|
|
2438
2474
|
}
|
|
2475
|
+
function dkAvatarDataUrl(file) {
|
|
2476
|
+
return new Promise((resolve, reject) => {
|
|
2477
|
+
const img = new Image();
|
|
2478
|
+
const url = URL.createObjectURL(file);
|
|
2479
|
+
img.onload = () => {
|
|
2480
|
+
URL.revokeObjectURL(url);
|
|
2481
|
+
try {
|
|
2482
|
+
const S = 256;
|
|
2483
|
+
const c = document.createElement("canvas");
|
|
2484
|
+
c.width = S;
|
|
2485
|
+
c.height = S;
|
|
2486
|
+
const ctx = c.getContext("2d");
|
|
2487
|
+
const side = Math.min(img.width, img.height);
|
|
2488
|
+
ctx.drawImage(img, (img.width - side) / 2, (img.height - side) / 2, side, side, 0, 0, S, S);
|
|
2489
|
+
const enc = (q) => {
|
|
2490
|
+
let d = c.toDataURL("image/webp", q);
|
|
2491
|
+
if (!d.startsWith("data:image/webp"))
|
|
2492
|
+
d = c.toDataURL("image/jpeg", q);
|
|
2493
|
+
return d;
|
|
2494
|
+
};
|
|
2495
|
+
let dataUrl = null;
|
|
2496
|
+
for (const q of [0.9, 0.75, 0.55, 0.4]) {
|
|
2497
|
+
dataUrl = enc(q);
|
|
2498
|
+
if (dataUrl.length < 13e4)
|
|
2499
|
+
break;
|
|
2500
|
+
}
|
|
2501
|
+
if (!dataUrl || dataUrl.length >= 13e4)
|
|
2502
|
+
reject(new Error("too-big"));
|
|
2503
|
+
else
|
|
2504
|
+
resolve(dataUrl);
|
|
2505
|
+
} catch (err) {
|
|
2506
|
+
reject(err);
|
|
2507
|
+
}
|
|
2508
|
+
};
|
|
2509
|
+
img.onerror = () => {
|
|
2510
|
+
URL.revokeObjectURL(url);
|
|
2511
|
+
reject(new Error("bad-image"));
|
|
2512
|
+
};
|
|
2513
|
+
img.src = url;
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2439
2516
|
function DkEnsCard({ T, me, onRecord }) {
|
|
2440
2517
|
const [st, setSt] = React.useState({ loading: true });
|
|
2441
2518
|
const [label, setLabel] = React.useState("");
|
|
@@ -2518,12 +2595,12 @@ function DkEnsCard({ T, me, onRecord }) {
|
|
|
2518
2595
|
var _a;
|
|
2519
2596
|
const saved = (st.record && st.record.texts || {})["com." + k] || "";
|
|
2520
2597
|
const cur = (_a = draft[k]) != null ? _a : "";
|
|
2521
|
-
return /* @__PURE__ */ React.createElement("div", { key: k, style: { ...row, borderBottom: last ? "none" : row.borderBottom } }, /* @__PURE__ */ React.createElement("span", { style: rowLbl }, k), /* @__PURE__ */ React.createElement(
|
|
2598
|
+
return /* @__PURE__ */ React.createElement("div", { key: k, className: "dk-row", style: { ...row, borderBottom: last ? "none" : row.borderBottom } }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: rowLbl }, k), /* @__PURE__ */ React.createElement(
|
|
2522
2599
|
"input",
|
|
2523
2600
|
{
|
|
2524
2601
|
value: cur,
|
|
2525
2602
|
onChange: (e) => setDraft({ ...draft, [k]: e.target.value }),
|
|
2526
|
-
disabled: busy || !
|
|
2603
|
+
disabled: busy || !canWrite,
|
|
2527
2604
|
placeholder: T.linkPlaceholder || "username or profile URL",
|
|
2528
2605
|
onKeyDown: (e) => {
|
|
2529
2606
|
if (e.key === "Enter")
|
|
@@ -2545,6 +2622,7 @@ function DkEnsCard({ T, me, onRecord }) {
|
|
|
2545
2622
|
};
|
|
2546
2623
|
const [picking, setPicking] = React.useState(false);
|
|
2547
2624
|
const fileRef = React.useRef(null);
|
|
2625
|
+
const canWrite = hostEnsWrite && !!st.mineOwned;
|
|
2548
2626
|
const rec = st.record;
|
|
2549
2627
|
const boundEth = rec && rec.addresses && rec.addresses["60"];
|
|
2550
2628
|
const boundSol = rec && rec.addresses && rec.addresses["501"];
|
|
@@ -2561,51 +2639,14 @@ function DkEnsCard({ T, me, onRecord }) {
|
|
|
2561
2639
|
return;
|
|
2562
2640
|
setBusy(true);
|
|
2563
2641
|
setMsg(null);
|
|
2564
|
-
|
|
2565
|
-
const url = URL.createObjectURL(f);
|
|
2566
|
-
const fail = (text) => {
|
|
2642
|
+
dkAvatarDataUrl(f).then((dataUrl) => post("/api/ens-avatar-upload", { dataUrl })).catch((err) => {
|
|
2567
2643
|
setBusy(false);
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
URL.revokeObjectURL(url);
|
|
2572
|
-
try {
|
|
2573
|
-
const S = 256;
|
|
2574
|
-
const c = document.createElement("canvas");
|
|
2575
|
-
c.width = S;
|
|
2576
|
-
c.height = S;
|
|
2577
|
-
const ctx = c.getContext("2d");
|
|
2578
|
-
const side = Math.min(img.width, img.height);
|
|
2579
|
-
ctx.drawImage(img, (img.width - side) / 2, (img.height - side) / 2, side, side, 0, 0, S, S);
|
|
2580
|
-
const enc = (q) => {
|
|
2581
|
-
let d = c.toDataURL("image/webp", q);
|
|
2582
|
-
if (!d.startsWith("data:image/webp"))
|
|
2583
|
-
d = c.toDataURL("image/jpeg", q);
|
|
2584
|
-
return d;
|
|
2585
|
-
};
|
|
2586
|
-
let dataUrl = null;
|
|
2587
|
-
for (const q of [0.9, 0.75, 0.55, 0.4]) {
|
|
2588
|
-
dataUrl = enc(q);
|
|
2589
|
-
if (dataUrl.length < 13e4)
|
|
2590
|
-
break;
|
|
2591
|
-
}
|
|
2592
|
-
if (!dataUrl || dataUrl.length >= 13e4) {
|
|
2593
|
-
fail(T.ensTooBig || "image too large even after scaling");
|
|
2594
|
-
return;
|
|
2595
|
-
}
|
|
2596
|
-
post("/api/ens-avatar-upload", { dataUrl });
|
|
2597
|
-
} catch (err) {
|
|
2598
|
-
fail(String(err && err.message || err));
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
img.onerror = () => {
|
|
2602
|
-
URL.revokeObjectURL(url);
|
|
2603
|
-
fail(T.ensBadImage || "cannot read that image");
|
|
2604
|
-
};
|
|
2605
|
-
img.src = url;
|
|
2644
|
+
const m = err && err.message;
|
|
2645
|
+
setMsg({ tone: "err", text: m === "too-big" ? T.ensTooBig || "image too large even after scaling" : m === "bad-image" ? T.ensBadImage || "cannot read that image" : String(m || err) });
|
|
2646
|
+
});
|
|
2606
2647
|
};
|
|
2607
|
-
const walletRow = (lbl, chain, bound, onBind, last) => /* @__PURE__ */ React.createElement("div", { style: { ...row, borderBottom: last ? "none" : row.borderBottom } }, /* @__PURE__ */ React.createElement("span", { style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, lbl), bound ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, bound), /* @__PURE__ */ React.createElement(CopyBtn, { value: bound, copiedText: T.copied, copyFailedText: T.copyFailed, copyTitle: T.copy }), /* @__PURE__ */ React.createElement(Btn, { size: "sm", tone: "danger", disabled: busy || !
|
|
2608
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Card, { label: T.ensCard || "Name \xB7 beagles.eth" }, st.loading ? /* @__PURE__ */ React.createElement("div", { style: { padding: "14px 16px", fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: row }, /* @__PURE__ */ React.createElement("span", { style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.ensName || "name"), /* @__PURE__ */ React.createElement(
|
|
2648
|
+
const walletRow = (lbl, chain, bound, onBind, last) => /* @__PURE__ */ React.createElement("div", { className: "dk-row", style: { ...row, borderBottom: last ? "none" : row.borderBottom } }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, lbl), bound ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, bound), /* @__PURE__ */ React.createElement(CopyBtn, { value: bound, copiedText: T.copied, copyFailedText: T.copyFailed, copyTitle: T.copy }), /* @__PURE__ */ React.createElement(Btn, { size: "sm", tone: "danger", disabled: busy || !canWrite, onClick: () => bind(chain, "") }, T.ensUnbind || "unbind")) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { flex: 1, fontFamily: "var(--ui)", fontSize: 12, color: "var(--faint)" } }, T.ensNotBound || "not bound"), /* @__PURE__ */ React.createElement(Btn, { size: "sm", disabled: busy || !canWrite, onClick: onBind }, T.ensBind || "bind")));
|
|
2649
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Card, { label: T.ensCard || "Name \xB7 beagles.eth" }, st.loading ? /* @__PURE__ */ React.createElement("div", { style: { padding: "14px 16px", fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : /* @__PURE__ */ React.createElement(React.Fragment, null, !hostEnsWrite ? /* @__PURE__ */ React.createElement("div", { className: "dk-row dk-wrap", style: row }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.ensName || "name"), st.registered && rec && rec.name ? /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 13, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, rec.name) : /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--ui)", fontSize: 12, lineHeight: 1.5, color: "var(--faint)" } }, T.ensWebOnly || "Registering a beagles.eth name needs the Beagle phone or desktop app. Your avatar can be set above without one.")) : /* @__PURE__ */ React.createElement("div", { className: "dk-row dk-wrap", style: row }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.ensName || "name"), /* @__PURE__ */ React.createElement(
|
|
2609
2650
|
"input",
|
|
2610
2651
|
{
|
|
2611
2652
|
value: label,
|
|
@@ -2616,9 +2657,9 @@ function DkEnsCard({ T, me, onRecord }) {
|
|
|
2616
2657
|
if (e.key === "Enter")
|
|
2617
2658
|
register();
|
|
2618
2659
|
},
|
|
2619
|
-
style: field
|
|
2660
|
+
style: { ...field, minWidth: 110 }
|
|
2620
2661
|
}
|
|
2621
|
-
), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--dim)", flexShrink: 0 } }, ".beagles.eth"), /* @__PURE__ */ React.createElement(Btn, { tone: "accent", size: "sm", disabled: busy || !label.trim(), onClick: register }, busy ? "\u2026" : st.registered && st.mineOwned ? T.ensUpdate || "update" : T.ensRegister || "register")), st.registered && !st.mineOwned && /* @__PURE__ */ React.createElement("div", { style: { padding: "10px 16px", borderBottom: "1px solid var(--line)", fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--faint)" } }, (T.ensWalletOwned || "registered via your mobile wallet as") + " ", /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)" } }, rec && rec.name)), st.registered && /* @__PURE__ */ React.createElement("div", { style: row }, /* @__PURE__ */ React.createElement("span", { style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.ensAvatar || "avatar"), upAvatar ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("img", { src: upAvatar, alt: "", width: 34, height: 34, style: { width: 34, height: 34, borderRadius: 9, objectFit: "cover", flexShrink: 0, background: "var(--panel-2)" } }), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--text)" } }, T.ensCustom || "custom image"), /* @__PURE__ */ React.createElement(Btn, { size: "sm", tone: "danger", disabled: busy || !
|
|
2662
|
+
), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--dim)", flexShrink: 0 } }, ".beagles.eth"), /* @__PURE__ */ React.createElement(Btn, { tone: "accent", size: "sm", disabled: busy || !label.trim(), onClick: register }, busy ? "\u2026" : st.registered && st.mineOwned ? T.ensUpdate || "update" : T.ensRegister || "register")), st.registered && !st.mineOwned && /* @__PURE__ */ React.createElement("div", { style: { padding: "10px 16px", borderBottom: "1px solid var(--line)", fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--faint)" } }, (T.ensWalletOwned || "registered via your mobile wallet as") + " ", /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)" } }, rec && rec.name)), st.registered && /* @__PURE__ */ React.createElement("div", { className: "dk-row dk-wrap", style: row }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.ensAvatar || "avatar"), upAvatar ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("img", { src: upAvatar, alt: "", width: 34, height: 34, style: { width: 34, height: 34, borderRadius: 9, objectFit: "cover", flexShrink: 0, background: "var(--panel-2)" } }), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--text)" } }, T.ensCustom || "custom image"), /* @__PURE__ */ React.createElement(Btn, { size: "sm", tone: "danger", disabled: busy || !canWrite, onClick: () => post("/api/ens-avatar", { nftid: null }) }, T.ensClear || "clear")) : punkId != null ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: punkId, size: 34, radius: 9, fallbackSeed: me.userId }), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)" } }, `CryptoPunk #${punkId}`), /* @__PURE__ */ React.createElement(Btn, { size: "sm", tone: "danger", disabled: busy || !canWrite, onClick: () => post("/api/ens-avatar", { nftid: null }) }, T.ensClear || "clear")) : /* @__PURE__ */ React.createElement("span", { style: { flex: 1, fontFamily: "var(--ui)", fontSize: 12, color: "var(--faint)" } }, T.ensNotSet || "not set"), /* @__PURE__ */ React.createElement(Btn, { size: "sm", disabled: busy || !canWrite, onClick: () => fileRef.current && fileRef.current.click() }, T.ensUpload || "upload"), /* @__PURE__ */ React.createElement(Btn, { size: "sm", disabled: busy || !canWrite, onClick: () => setPicking(true) }, T.ensChoose || "choose"), /* @__PURE__ */ React.createElement("input", { ref: fileRef, type: "file", accept: "image/*", onChange: onUploadFile, style: { display: "none" } })), walletRow(T.ensEth || "ethereum", "eth", boundEth, bindEth, false), walletRow(T.ensSol || "solana", "sol", boundSol, bindSol, !msg), msg && /* @__PURE__ */ React.createElement("div", { style: { padding: "10px 16px", fontFamily: "var(--ui)", fontSize: 12, color: msg.tone === "ok" ? "var(--online)" : "var(--danger)" } }, msg.text)), picking && /* @__PURE__ */ React.createElement(DkPunkPicker, { T, onPick: pickPunk, onClose: () => setPicking(false) })), !st.loading && st.registered && /* @__PURE__ */ React.createElement(Card, { label: T.linksCard || "Links" }, SOCIALS.map((s, i) => socialRow(s, i === SOCIALS.length - 1))));
|
|
2622
2663
|
}
|
|
2623
2664
|
function DkUpdateCheck({ T }) {
|
|
2624
2665
|
const [st, setSt] = React.useState("idle");
|
|
@@ -2634,7 +2675,7 @@ function DkUpdateCheck({ T }) {
|
|
|
2634
2675
|
setSt("latest");
|
|
2635
2676
|
}).catch(() => setSt("idle"));
|
|
2636
2677
|
};
|
|
2637
|
-
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14, padding: "13px 16px" } }, /* @__PURE__ */ React.createElement("span", { style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.updCheckLabel || "updates"), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, fontFamily: "var(--ui)", fontSize: 12, color: st === "latest" ? "var(--online)" : "var(--faint)" } }, st === "latest" ? T.updLatest || "up to date \u2713" : ""), /* @__PURE__ */ React.createElement(Btn, { size: "sm", disabled: st === "busy", onClick: check }, st === "busy" ? "\u2026" : T.updCheck || "check for updates"), info && /* @__PURE__ */ React.createElement(DkUpdateModal, { T, info, onClose: () => setInfo(null) }));
|
|
2678
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14, padding: "13px 16px" } }, /* @__PURE__ */ React.createElement("span", { className: "dk-lbl", style: { width: 130, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11.5, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 } }, T.updCheckLabel || "updates"), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, fontFamily: "var(--ui)", fontSize: 12, color: st === "latest" ? "var(--online)" : "var(--faint)" } }, st === "latest" ? T.updLatest || "up to date \u2713" : ""), /* @__PURE__ */ React.createElement(Btn, { size: "sm", disabled: st === "busy", onClick: check }, st === "busy" ? "\u2026" : T.updCheck || "check for updates"), info && /* @__PURE__ */ React.createElement(DkUpdateModal, { T, info, onClose: () => setInfo(null) }));
|
|
2638
2679
|
}
|
|
2639
2680
|
function DkKeyBackup({ t }) {
|
|
2640
2681
|
const zh = t && t.lang === "zh";
|
|
@@ -2747,7 +2788,7 @@ function DkDisplaySettings({ t, setTweak }) {
|
|
|
2747
2788
|
},
|
|
2748
2789
|
label
|
|
2749
2790
|
)));
|
|
2750
|
-
return /* @__PURE__ */ React.createElement(Card, { label: zh ? "\u663E\u793A" : "Display" }, /* @__PURE__ */ React.createElement("div", { style: { ...row, borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("span", { style: name }, zh ? "\u8BED\u8A00" : "Language"), seg("lang", t.lang, (v) => setTweak("lang", v), [["en", "EN"], ["zh", "\u4E2D\u6587"]])), /* @__PURE__ */ React.createElement("div", { style: row }, /* @__PURE__ */ React.createElement("span", { style: name }, zh ? "\u4E3B\u9898" : "Theme"), seg("theme", t.theme, (v) => setTweak("theme", v), [["dark", zh ? "\u6DF1\u8272" : "Dark"], ["light", zh ? "\u6D45\u8272" : "Light"]])));
|
|
2791
|
+
return /* @__PURE__ */ React.createElement(Card, { label: zh ? "\u663E\u793A" : "Display" }, /* @__PURE__ */ React.createElement("div", { style: { ...row, borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("span", { style: name }, zh ? "\u8BED\u8A00" : "Language"), seg("lang", t.lang, (v) => setTweak("lang", v), [["en", "EN"], ["zh", "\u4E2D\u6587"]])), /* @__PURE__ */ React.createElement("div", { className: "dk-row dk-wrap", style: row }, /* @__PURE__ */ React.createElement("span", { style: name }, zh ? "\u4E3B\u9898" : "Theme"), seg("theme", t.theme, (v) => setTweak("theme", v), [["dark", zh ? "\u6DF1\u8272" : "Dark"], ["light", zh ? "\u6D45\u8272" : "Light"]])));
|
|
2751
2792
|
}
|
|
2752
2793
|
function DkAlertSettings({ t, setTweak }) {
|
|
2753
2794
|
const zh = t.lang === "zh";
|
|
@@ -2778,8 +2819,67 @@ function DkAlertSettings({ t, setTweak }) {
|
|
|
2778
2819
|
true
|
|
2779
2820
|
));
|
|
2780
2821
|
}
|
|
2781
|
-
function
|
|
2822
|
+
function DkAvatarSheet({ T, me, zh, onSet, onClose }) {
|
|
2823
|
+
const [picking, setPicking] = React.useState(false);
|
|
2824
|
+
const [busy, setBusy] = React.useState(false);
|
|
2825
|
+
const [err, setErr] = React.useState(null);
|
|
2826
|
+
const fileRef = React.useRef(null);
|
|
2827
|
+
const canUpload = Object.prototype.hasOwnProperty.call(me, "avatarDataUrl");
|
|
2828
|
+
const save = (p) => {
|
|
2829
|
+
setBusy(true);
|
|
2830
|
+
setErr(null);
|
|
2831
|
+
return Promise.resolve(onSet(p)).then((r) => {
|
|
2832
|
+
setBusy(false);
|
|
2833
|
+
if (r && r.ok === false)
|
|
2834
|
+
setErr(r.error || "failed");
|
|
2835
|
+
else
|
|
2836
|
+
onClose();
|
|
2837
|
+
}).catch((e) => {
|
|
2838
|
+
setBusy(false);
|
|
2839
|
+
setErr(String(e && e.message || e));
|
|
2840
|
+
});
|
|
2841
|
+
};
|
|
2842
|
+
const pickPunk = (id) => {
|
|
2843
|
+
setPicking(false);
|
|
2844
|
+
save(canUpload ? { punkId: id, avatarDataUrl: null } : { punkId: id });
|
|
2845
|
+
};
|
|
2846
|
+
const onFile = (e) => {
|
|
2847
|
+
const f = e.target.files && e.target.files[0];
|
|
2848
|
+
e.target.value = "";
|
|
2849
|
+
if (!f)
|
|
2850
|
+
return;
|
|
2851
|
+
setBusy(true);
|
|
2852
|
+
setErr(null);
|
|
2853
|
+
dkAvatarDataUrl(f).then((dataUrl) => save({ avatarDataUrl: dataUrl })).catch((x) => {
|
|
2854
|
+
setBusy(false);
|
|
2855
|
+
const m = x && x.message;
|
|
2856
|
+
setErr(m === "too-big" ? T.ensTooBig || "image too large even after scaling" : m === "bad-image" ? T.ensBadImage || "cannot read that image" : String(m || x));
|
|
2857
|
+
});
|
|
2858
|
+
};
|
|
2859
|
+
const has = me.punkId != null || !!(canUpload && me.avatarDataUrl);
|
|
2860
|
+
const item = (icon, label, onClick, danger) => /* @__PURE__ */ React.createElement("button", { onClick, disabled: busy, style: {
|
|
2861
|
+
display: "flex",
|
|
2862
|
+
alignItems: "center",
|
|
2863
|
+
gap: 12,
|
|
2864
|
+
width: "100%",
|
|
2865
|
+
padding: "13px 14px",
|
|
2866
|
+
border: "none",
|
|
2867
|
+
borderRadius: 10,
|
|
2868
|
+
background: "var(--panel-2)",
|
|
2869
|
+
cursor: busy ? "default" : "pointer",
|
|
2870
|
+
opacity: busy ? 0.6 : 1,
|
|
2871
|
+
fontFamily: "var(--ui)",
|
|
2872
|
+
fontSize: 14,
|
|
2873
|
+
color: danger ? "var(--danger)" : "var(--text)",
|
|
2874
|
+
textAlign: "left"
|
|
2875
|
+
} }, /* @__PURE__ */ React.createElement(Icon, { name: icon, size: 18, stroke: 2, color: danger ? "var(--danger)" : "var(--accent)" }), label);
|
|
2876
|
+
if (picking)
|
|
2877
|
+
return /* @__PURE__ */ React.createElement(DkPunkPicker, { T, onPick: pickPunk, onClose: () => setPicking(false) });
|
|
2878
|
+
return /* @__PURE__ */ React.createElement("div", { onClick: onClose, style: { position: "fixed", inset: 0, zIndex: 90, background: "color-mix(in oklab, #000, transparent 38%)", display: "flex", alignItems: "center", justifyContent: "center", padding: 16 } }, /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation(), style: { width: 360, maxWidth: "100%", background: "var(--panel)", border: "1px solid var(--line)", borderRadius: 16, padding: 16, display: "flex", flexDirection: "column", gap: 8 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, marginBottom: 4 } }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: { ...me, id: me.userId, agent: false }, size: 40, radius: 10, dot: false }), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, fontFamily: "var(--mono)", fontSize: 13.5, fontWeight: 700, color: "var(--text)" } }, zh ? "\u66F4\u6362\u5934\u50CF" : "Change avatar"), /* @__PURE__ */ React.createElement(Btn, { icon: "x", size: "sm", onClick: onClose })), item("sparkles", zh ? "\u9009\u4E00\u4E2A CryptoPunk" : "Choose a CryptoPunk", () => setPicking(true)), canUpload && item("image", zh ? "\u4E0A\u4F20\u7167\u7247" : "Upload a photo", () => fileRef.current && fileRef.current.click()), has && item("trash", zh ? "\u79FB\u9664\u5934\u50CF" : "Remove avatar", () => save(canUpload ? { punkId: null, avatarDataUrl: null } : { punkId: null }), true), /* @__PURE__ */ React.createElement("input", { ref: fileRef, type: "file", accept: "image/*", onChange: onFile, style: { display: "none" } }), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--faint)", lineHeight: 1.5, marginTop: 2 } }, zh ? "\u4E0D\u9700\u8981\u6CE8\u518C beagles.eth \u540D\u5B57\u3002\u597D\u53CB\u4F1A\u5728\u4E0B\u6B21\u6536\u5230\u4F60\u7684\u8D44\u6599\u65F6\u770B\u5230\u65B0\u5934\u50CF\u3002" : "No beagles.eth name needed. Friends see it the next time your profile reaches them."), err && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--danger)" } }, err)));
|
|
2879
|
+
}
|
|
2880
|
+
function ProfileTab({ T, me, onEdit, t, setTweak, onSetAvatar }) {
|
|
2782
2881
|
var _a;
|
|
2882
|
+
const [avatarSheet, setAvatarSheet] = React.useState(false);
|
|
2783
2883
|
const [qr, setQr] = React.useState(null);
|
|
2784
2884
|
const [editing, setEditing] = React.useState(false);
|
|
2785
2885
|
const [ensRec, setEnsRec] = React.useState(null);
|
|
@@ -2787,7 +2887,17 @@ function ProfileTab({ T, me, onEdit, t, setTweak }) {
|
|
|
2787
2887
|
const pubAvatar = ensRec && ensRec.texts && ensRec.texts.avatar || null;
|
|
2788
2888
|
const punkId = (_a = me.punkId) != null ? _a : pubPunk;
|
|
2789
2889
|
const upAvatar = me.avatarUrl || pubAvatar;
|
|
2790
|
-
|
|
2890
|
+
const canSetAvatar = !!onSetAvatar && !ensRec;
|
|
2891
|
+
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { className: "dk-page", style: { maxWidth: 760, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 24 } }, /* @__PURE__ */ React.createElement("div", { className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 18, rowGap: 12, padding: "20px 22px", borderRadius: 14, background: "var(--panel)", border: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(
|
|
2892
|
+
"div",
|
|
2893
|
+
{
|
|
2894
|
+
style: { position: "relative", cursor: canSetAvatar ? "pointer" : "default" },
|
|
2895
|
+
onClick: canSetAvatar ? () => setAvatarSheet(true) : void 0,
|
|
2896
|
+
title: canSetAvatar ? t && t.lang === "zh" ? "\u66F4\u6362\u5934\u50CF" : "Change avatar" : void 0
|
|
2897
|
+
},
|
|
2898
|
+
upAvatar ? /* @__PURE__ */ React.createElement("img", { src: upAvatar, alt: "", width: 68, height: 68, style: { width: 68, height: 68, borderRadius: 16, objectFit: "cover", background: "var(--panel-2)" } }) : punkId != null ? /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: punkId, size: 68, radius: 16, fallbackSeed: me.userId }) : /* @__PURE__ */ React.createElement(DkIdenticon, { seed: me.userId, size: 68, radius: 16 }),
|
|
2899
|
+
canSetAvatar ? /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", right: -5, bottom: -5, width: 24, height: 24, borderRadius: 999, background: "var(--accent)", border: "3px solid var(--panel)", display: "flex", alignItems: "center", justifyContent: "center", boxSizing: "border-box" } }, /* @__PURE__ */ React.createElement(Icon, { name: "camera", size: 12, stroke: 2.2, color: "#fff" })) : /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", right: -3, bottom: -3, width: 18, height: 18, borderRadius: 999, background: "var(--online)", border: "3px solid var(--panel)" } })
|
|
2900
|
+
), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 10, rowGap: 4 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 22, fontWeight: 700, letterSpacing: -0.5, color: "var(--text)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", minWidth: 0, maxWidth: "100%" } }, me.name), /* @__PURE__ */ React.createElement(Tag, { tone: "ok" }, "online"), me.isExit && /* @__PURE__ */ React.createElement(Tag, { tone: "warn" }, "exit", me.exitRegion ? ` \xB7 ${me.exitRegion.toUpperCase()}` : "")), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 13, color: "var(--dim)", marginTop: 4, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, me.handle), me.description ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)", marginTop: 3 } }, me.description) : null), /* @__PURE__ */ React.createElement(Btn, { icon: "edit", onClick: () => setEditing(true) }, T.editProfile)), /* @__PURE__ */ React.createElement(Card, { label: T.identity }, /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.userId, value: me.userId, copy: true, qr: true, onQr: (v, l) => setQr({ value: v, label: l }) }), /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.carrierAddr, value: me.carrier, copy: true, qr: true, onQr: (v, l) => setQr({ value: v, label: l }) }), /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.netKey, value: me.netKey, copy: true, last: true })), /* @__PURE__ */ React.createElement(DkEnsCard, { T, me, onRecord: setEnsRec }), typeof me.autoAccept === "boolean" && /* @__PURE__ */ React.createElement(Card, { label: T && T.friendsSettings || "Friends" }, /* @__PURE__ */ React.createElement("label", { style: { display: "flex", alignItems: "center", gap: 13, padding: "14px 16px", cursor: "pointer" } }, /* @__PURE__ */ React.createElement(
|
|
2791
2901
|
"input",
|
|
2792
2902
|
{
|
|
2793
2903
|
type: "checkbox",
|
|
@@ -2799,7 +2909,7 @@ function ProfileTab({ T, me, onEdit, t, setTweak }) {
|
|
|
2799
2909
|
},
|
|
2800
2910
|
style: { width: 16, height: 16, accentColor: "var(--accent)" }
|
|
2801
2911
|
}
|
|
2802
|
-
), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 13.5, fontWeight: 600, color: "var(--text)" } }, T && T.autoAcceptLabel || "Auto-accept friend requests"), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--dim)", marginTop: 2 } }, T && T.autoAcceptSub || "Off: requests wait in the sidebar for your approval.")))), hostHasKeyBackup && /* @__PURE__ */ React.createElement(DkKeyBackup, { t: t || {} }), t && setTweak && /* @__PURE__ */ React.createElement(DkAlertSettings, { t, setTweak }), t && setTweak && /* @__PURE__ */ React.createElement(DkDisplaySettings, { t, setTweak }), /* @__PURE__ */ React.createElement(Card, { label: T.network }, /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.virtualIp, value: me.ip, copy: true }), /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.wireLabel, value: `${me.wire} \xB7 lossless`, mono: false }), /* @__PURE__ */ React.createElement(DkVersionRow, { T, me }), /* @__PURE__ */ React.createElement(DkUpdateCheck, { T })), /* @__PURE__ */ React.createElement(Card, { label: T.dangerZone }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 13, padding: "14px 16px" } }, /* @__PURE__ */ React.createElement("div", { style: { width: 34, height: 34, borderRadius: 8, flexShrink: 0, background: "color-mix(in oklab, var(--danger), transparent 86%)", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--danger)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "trash", size: 17, stroke: 2 })), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 13.5, fontWeight: 600, color: "var(--danger)" } }, T.deleteNode), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12, color: "var(--faint)", marginTop: 1 } }, T.deleteSub)), /* @__PURE__ */ React.createElement(Btn, { tone: "danger", size: "sm" }, T.delete)))), qr && /* @__PURE__ */ React.createElement(DkQrModal, { T, value: qr.value, label: qr.label, onClose: () => setQr(null) }), editing && /* @__PURE__ */ React.createElement(DkEditModal, { T, me, onClose: () => setEditing(false), onSave: (name, description) => {
|
|
2912
|
+
), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 13.5, fontWeight: 600, color: "var(--text)" } }, T && T.autoAcceptLabel || "Auto-accept friend requests"), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--dim)", marginTop: 2 } }, T && T.autoAcceptSub || "Off: requests wait in the sidebar for your approval.")))), hostHasKeyBackup && /* @__PURE__ */ React.createElement(DkKeyBackup, { t: t || {} }), t && setTweak && /* @__PURE__ */ React.createElement(DkAlertSettings, { t, setTweak }), t && setTweak && /* @__PURE__ */ React.createElement(DkDisplaySettings, { t, setTweak }), /* @__PURE__ */ React.createElement(Card, { label: T.network }, /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.virtualIp, value: me.ip, copy: true }), /* @__PURE__ */ React.createElement(FieldRow, { T, label: T.wireLabel, value: `${me.wire} \xB7 lossless`, mono: false }), /* @__PURE__ */ React.createElement(DkVersionRow, { T, me }), /* @__PURE__ */ React.createElement(DkUpdateCheck, { T })), /* @__PURE__ */ React.createElement(Card, { label: T.dangerZone }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 13, padding: "14px 16px" } }, /* @__PURE__ */ React.createElement("div", { style: { width: 34, height: 34, borderRadius: 8, flexShrink: 0, background: "color-mix(in oklab, var(--danger), transparent 86%)", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--danger)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "trash", size: 17, stroke: 2 })), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 13.5, fontWeight: 600, color: "var(--danger)" } }, T.deleteNode), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12, color: "var(--faint)", marginTop: 1 } }, T.deleteSub)), /* @__PURE__ */ React.createElement(Btn, { tone: "danger", size: "sm" }, T.delete)))), qr && /* @__PURE__ */ React.createElement(DkQrModal, { T, value: qr.value, label: qr.label, onClose: () => setQr(null) }), avatarSheet && /* @__PURE__ */ React.createElement(DkAvatarSheet, { T, me, zh: t && t.lang === "zh", onSet: onSetAvatar, onClose: () => setAvatarSheet(false) }), editing && /* @__PURE__ */ React.createElement(DkEditModal, { T, me, onClose: () => setEditing(false), onSave: (name, description) => {
|
|
2803
2913
|
if (onEdit)
|
|
2804
2914
|
onEdit(name, description);
|
|
2805
2915
|
setEditing(false);
|
|
@@ -2808,6 +2918,43 @@ function ProfileTab({ T, me, onEdit, t, setTweak }) {
|
|
|
2808
2918
|
Object.assign(window, { ProfileTab, DkPunkAvatar, DkEnsAvatar, DkPublicProfile });
|
|
2809
2919
|
|
|
2810
2920
|
// src/ui.jsx
|
|
2921
|
+
var DK_PHONE_MQ = "(max-width: 700px)";
|
|
2922
|
+
function useIsPhone() {
|
|
2923
|
+
const mq = React.useMemo(() => typeof window !== "undefined" && window.matchMedia ? window.matchMedia(DK_PHONE_MQ) : null, []);
|
|
2924
|
+
const [phone, setPhone] = React.useState(() => !!(mq && mq.matches));
|
|
2925
|
+
React.useEffect(() => {
|
|
2926
|
+
if (!mq)
|
|
2927
|
+
return void 0;
|
|
2928
|
+
const on = () => setPhone(mq.matches);
|
|
2929
|
+
on();
|
|
2930
|
+
if (mq.addEventListener)
|
|
2931
|
+
mq.addEventListener("change", on);
|
|
2932
|
+
else
|
|
2933
|
+
mq.addListener(on);
|
|
2934
|
+
return () => {
|
|
2935
|
+
if (mq.removeEventListener)
|
|
2936
|
+
mq.removeEventListener("change", on);
|
|
2937
|
+
else
|
|
2938
|
+
mq.removeListener(on);
|
|
2939
|
+
};
|
|
2940
|
+
}, [mq]);
|
|
2941
|
+
return phone;
|
|
2942
|
+
}
|
|
2943
|
+
var DK_PHONE_CSS = `
|
|
2944
|
+
@media ${DK_PHONE_MQ} {
|
|
2945
|
+
.dk-page { padding: 14px 12px 40px !important; gap: 18px !important; }
|
|
2946
|
+
.dk-lbl { width: 78px !important; font-size: 10px !important; letter-spacing: 0.3px !important; }
|
|
2947
|
+
.dk-row { padding: 11px 12px !important; gap: 9px !important; }
|
|
2948
|
+
.dk-wrap { flex-wrap: wrap !important; }
|
|
2949
|
+
.dk-grid2 { grid-template-columns: 1fr 1fr !important; }
|
|
2950
|
+
.dk-grid1 { grid-template-columns: 1fr !important; }
|
|
2951
|
+
.dk-no-phone { display: none !important; }
|
|
2952
|
+
/* iOS zooms the page into any focused field under 16px and never zooms back. */
|
|
2953
|
+
input:not([type=checkbox]):not([type=radio]), textarea, select { font-size: 16px !important; }
|
|
2954
|
+
}`;
|
|
2955
|
+
function DkPhoneStyles() {
|
|
2956
|
+
return /* @__PURE__ */ React.createElement("style", null, DK_PHONE_CSS);
|
|
2957
|
+
}
|
|
2811
2958
|
function DkIdenticon({ seed, size = 30, radius = 7 }) {
|
|
2812
2959
|
const { cells, hue } = dkIdenticon(seed);
|
|
2813
2960
|
const cell = size / 5;
|
|
@@ -2947,7 +3094,7 @@ function Unread({ n }) {
|
|
|
2947
3094
|
textAlign: "center"
|
|
2948
3095
|
} }, n);
|
|
2949
3096
|
}
|
|
2950
|
-
function Btn({ children, icon, tone = "ghost", onClick, size = "md", title, style }) {
|
|
3097
|
+
function Btn({ children, icon, tone = "ghost", onClick, size = "md", title, style, disabled }) {
|
|
2951
3098
|
const tones = {
|
|
2952
3099
|
ghost: { bg: "transparent", fg: "var(--text)", bd: "var(--line)" },
|
|
2953
3100
|
solid: { bg: "var(--accent)", fg: "#fff", bd: "transparent" },
|
|
@@ -2957,12 +3104,13 @@ function Btn({ children, icon, tone = "ghost", onClick, size = "md", title, styl
|
|
|
2957
3104
|
};
|
|
2958
3105
|
const t = tones[tone] || tones.ghost;
|
|
2959
3106
|
const h = size === "sm" ? 26 : size === "lg" ? 36 : 30;
|
|
2960
|
-
return /* @__PURE__ */ React.createElement("button", { onClick, title, style: {
|
|
3107
|
+
return /* @__PURE__ */ React.createElement("button", { onClick, title, disabled, style: {
|
|
3108
|
+
opacity: disabled ? 0.45 : 1,
|
|
2961
3109
|
height: h,
|
|
2962
3110
|
padding: icon && !children ? 0 : "0 11px",
|
|
2963
3111
|
minWidth: icon && !children ? h : "auto",
|
|
2964
3112
|
borderRadius: 6,
|
|
2965
|
-
cursor: "pointer",
|
|
3113
|
+
cursor: disabled ? "default" : "pointer",
|
|
2966
3114
|
fontFamily: "var(--mono)",
|
|
2967
3115
|
fontWeight: 600,
|
|
2968
3116
|
fontSize: size === "sm" ? 12 : 12.5,
|
|
@@ -2981,7 +3129,7 @@ function Btn({ children, icon, tone = "ghost", onClick, size = "md", title, styl
|
|
|
2981
3129
|
function Section({ label, count, trailing, style }) {
|
|
2982
3130
|
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "0 2px", ...style } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, fontWeight: 700, letterSpacing: 1, textTransform: "uppercase", color: "var(--faint)" } }, label), count != null && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, fontWeight: 700, color: "var(--faint)" } }, count), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, height: 1, background: "var(--line)" } }), trailing);
|
|
2983
3131
|
}
|
|
2984
|
-
Object.assign(window, { DkIdenticon, DkBot, DkAvatar, DkImgAvatar, StatusDot, Mono, shortKey, RouteTag, Tag, Unread, Btn, Section });
|
|
3132
|
+
Object.assign(window, { useIsPhone, DkPhoneStyles, DkIdenticon, DkBot, DkAvatar, DkImgAvatar, StatusDot, Mono, shortKey, RouteTag, Tag, Unread, Btn, Section });
|
|
2985
3133
|
|
|
2986
3134
|
// src/apps.jsx
|
|
2987
3135
|
var APPS = [
|
|
@@ -3831,9 +3979,9 @@ function DiscoverTab({ T, kind, peers, meId, onAdd, onOpenChat }) {
|
|
|
3831
3979
|
value: q,
|
|
3832
3980
|
onChange: (e) => setQ(e.target.value),
|
|
3833
3981
|
placeholder: T.dirSearch || "search name / userid",
|
|
3834
|
-
style: { flex: 1, background: "transparent", border: "none", outline: "none", color: "var(--text)", fontFamily: "var(--ui)", fontSize: 13 }
|
|
3982
|
+
style: { flex: 1, minWidth: 0, background: "transparent", border: "none", outline: "none", color: "var(--text)", fontFamily: "var(--ui)", fontSize: 13 }
|
|
3835
3983
|
}
|
|
3836
|
-
), kind === "bridge" && (meta == null ? void 0 : meta.bridge) && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, String(meta.bridge).replace(/^https?:\/\//, ""), meta.online ? ` \xB7 ${meta.online} online` : ""), list && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, shown.length, "/", list.length)), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minHeight: 0, overflowY: "auto" } }, err ? /* @__PURE__ */ React.createElement("div", { style: { padding: 22, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, (T.dirError || "Could not load the directory:") + " " + err) : !list ? /* @__PURE__ */ React.createElement("div", { style: { padding: 22, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : shown.length === 0 ? /* @__PURE__ */ React.createElement("div", { style: { padding: 22, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, kind === "bridge" && (meta == null ? void 0 : meta.pending) ? T.bridgePending || "Not verified on this bridge yet \u2014 it may still be running the older protocol." : kind === "bridge" ? T.bridgeEmpty || "Nobody else is listed on this bridge yet." : T.dirEmpty || "nobody here") : shown.map((p) => /* @__PURE__ */ React.createElement(
|
|
3984
|
+
), kind === "bridge" && (meta == null ? void 0 : meta.bridge) && /* @__PURE__ */ React.createElement("span", { className: "dk-no-phone", style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)", whiteSpace: "nowrap" } }, String(meta.bridge).replace(/^https?:\/\//, ""), meta.online ? ` \xB7 ${meta.online} online` : ""), list && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)", whiteSpace: "nowrap", flexShrink: 0 } }, shown.length, "/", list.length)), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minHeight: 0, overflowY: "auto" } }, err ? /* @__PURE__ */ React.createElement("div", { style: { padding: 22, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, (T.dirError || "Could not load the directory:") + " " + err) : !list ? /* @__PURE__ */ React.createElement("div", { style: { padding: 22, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : shown.length === 0 ? /* @__PURE__ */ React.createElement("div", { style: { padding: 22, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, kind === "bridge" && (meta == null ? void 0 : meta.pending) ? T.bridgePending || "Not verified on this bridge yet \u2014 it may still be running the older protocol." : kind === "bridge" ? T.bridgeEmpty || "Nobody else is listed on this bridge yet." : T.dirEmpty || "nobody here") : shown.map((p) => /* @__PURE__ */ React.createElement(
|
|
3837
3985
|
DkDirRow,
|
|
3838
3986
|
{
|
|
3839
3987
|
key: p.userid,
|
|
@@ -4226,14 +4374,20 @@ Object.assign(window, { useRtcFileController, RtcFileInbox });
|
|
|
4226
4374
|
|
|
4227
4375
|
// src/network.jsx
|
|
4228
4376
|
function StatTile({ label, value, sub, tone }) {
|
|
4229
|
-
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, padding: "13px 15px", borderRadius: 10, background: "var(--panel)", border: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 10.5, fontWeight: 700, letterSpacing: 1, textTransform: "uppercase", color: "var(--faint)" } }, label), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 21, fontWeight: 700, letterSpacing: -0.5, marginTop: 5, color: tone || "var(--text)" } }, value), sub && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--dim)", marginTop: 2 } }, sub));
|
|
4377
|
+
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, padding: "13px 15px", borderRadius: 10, background: "var(--panel)", border: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 10.5, fontWeight: 700, letterSpacing: 1, textTransform: "uppercase", color: "var(--faint)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, label), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 21, fontWeight: 700, letterSpacing: -0.5, marginTop: 5, color: tone || "var(--text)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, value), sub && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--dim)", marginTop: 2 } }, sub));
|
|
4230
4378
|
}
|
|
4231
4379
|
function MyNode({ T, me, activeExit, peers, reqCount = 0 }) {
|
|
4232
4380
|
const online = peers.filter((p) => p.online).length;
|
|
4233
4381
|
const direct = peers.filter((p) => p.online && p.via === "direct").length;
|
|
4234
|
-
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14, padding: "16px 18px", borderRadius: 12, background: "var(--panel)", border: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(
|
|
4382
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement("div", { className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 14, padding: "16px 18px", borderRadius: 12, background: "var(--panel)", border: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: { ...me, id: me.userId, agent: false }, size: 46, radius: 11 }), /* @__PURE__ */ React.createElement("div", { style: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ React.createElement("div", { className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 9 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 17, fontWeight: 700, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", minWidth: 0 } }, me.name), /* @__PURE__ */ React.createElement(Tag, { tone: me.online ? "ok" : "off" }, me.online ? "online" : "offline"), /* @__PURE__ */ React.createElement(Tag, { tone: "accent" }, me.channel), me.isExit && /* @__PURE__ */ React.createElement(Tag, { tone: "warn" }, "exit", me.exitRegion ? ` \xB7 ${me.exitRegion.toUpperCase()}` : "")), /* @__PURE__ */ React.createElement("div", { className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 8, marginTop: 5, rowGap: 2 } }, me.ip ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, T.myIp), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: me.ip }, me.ip), /* @__PURE__ */ React.createElement("span", { style: { color: "var(--line)" } }, "\xB7")) : null, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, "wire ", me.wire), /* @__PURE__ */ React.createElement("span", { style: { color: "var(--line)" } }, "\xB7"), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)" } }, "lan ", me.lanVer, " / peer ", me.peerVer))), /* @__PURE__ */ React.createElement(Btn, { icon: "copy", onClick: () => dkCopy(me.carrier) }, T.copyAddr)), /* @__PURE__ */ React.createElement("div", { className: "dk-grid2", style: { display: "grid", gridTemplateColumns: "repeat(4, minmax(0, 1fr))", gap: 12 } }, /* @__PURE__ */ React.createElement(StatTile, { label: T.peersOnline, value: `${online}/${peers.length}`, sub: `${direct} ${T.direct}`, tone: "var(--online)" }), /* @__PURE__ */ React.createElement(StatTile, { label: T.activeEgress, value: activeExit ? activeExit : T.directEgress, sub: activeExit ? T.routing : T.noProxy, tone: activeExit ? "var(--warn)" : "var(--text)" }), /* @__PURE__ */ React.createElement(StatTile, { label: T.wireLabel, value: me.wire, sub: `${me.channel} \xB7 ${T.lossless}` }), /* @__PURE__ */ React.createElement(StatTile, { label: T.reqs, value: String(reqCount), sub: T.pending, tone: reqCount ? "var(--accent)" : "var(--text)" })));
|
|
4235
4383
|
}
|
|
4236
4384
|
function PeerTable({ T, peers, onOpenChat }) {
|
|
4385
|
+
const phone = useIsPhone();
|
|
4386
|
+
if (!peers.length)
|
|
4387
|
+
return null;
|
|
4388
|
+
if (phone) {
|
|
4389
|
+
return /* @__PURE__ */ React.createElement("div", { style: { borderRadius: 11, border: "1px solid var(--line)", overflow: "hidden", background: "var(--panel)" } }, peers.map((p, i) => /* @__PURE__ */ React.createElement("div", { key: p.id, onClick: () => onOpenChat(p.id), style: { display: "flex", alignItems: "center", gap: 10, padding: "10px 12px", cursor: "pointer", borderBottom: i < peers.length - 1 ? "1px solid var(--line)" : "none" } }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: p, size: 30, radius: 7 }), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 3 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6, minWidth: 0 } }, /* @__PURE__ */ React.createElement("span", { style: { fontFamily: p.alias ? "var(--ui)" : "var(--mono)", fontSize: 13.5, fontWeight: 600, color: "var(--text)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", minWidth: 0 } }, p.alias || shortKey(p.userId, 8, 5)), p.agent && /* @__PURE__ */ React.createElement(Icon, { name: "bot", size: 12, color: "var(--faint)", stroke: 2 })), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6, minWidth: 0 } }, /* @__PURE__ */ React.createElement(RouteTag, { peer: p }), p.ip ? /* @__PURE__ */ React.createElement(Mono, { size: 11.5, dim: true, copy: p.ip }, p.ip) : null)), /* @__PURE__ */ React.createElement(Icon, { name: "chevronRight", size: 16, color: "var(--faint)", stroke: 2 }))));
|
|
4390
|
+
}
|
|
4237
4391
|
return /* @__PURE__ */ React.createElement("div", { style: { borderRadius: 11, border: "1px solid var(--line)", overflow: "hidden", background: "var(--panel)" } }, /* @__PURE__ */ React.createElement("div", { style: { display: "grid", gridTemplateColumns: "1.4fr 1fr 1fr 0.8fr 90px", gap: 0, padding: "9px 16px", borderBottom: "1px solid var(--line)", background: "var(--panel-2)" } }, [T.colPeer, T.colVip, T.colPath, T.colWire, ""].map((h, i) => /* @__PURE__ */ React.createElement("span", { key: i, style: { fontFamily: "var(--mono)", fontSize: 10.5, fontWeight: 700, letterSpacing: 0.8, textTransform: "uppercase", color: "var(--faint)", textAlign: i === 4 ? "right" : "left" } }, h))), peers.map((p, i) => /* @__PURE__ */ React.createElement("div", { key: p.id, style: {
|
|
4238
4392
|
display: "grid",
|
|
4239
4393
|
gridTemplateColumns: "1.4fr 1fr 1fr 0.8fr 90px",
|
|
@@ -4251,7 +4405,7 @@ function ExitCard({ T, region, activeExit, onSetExit }) {
|
|
|
4251
4405
|
})()), /* @__PURE__ */ React.createElement("div", null, region.nodes.map((n, i) => {
|
|
4252
4406
|
const active = n.ip === activeExit;
|
|
4253
4407
|
const stuck = n.online && !n.reachable;
|
|
4254
|
-
return /* @__PURE__ */ React.createElement("div", { key: n.ip, style: { display: "flex", alignItems: "center", gap: 12, padding: "10px 14px", borderBottom: i < region.nodes.length - 1 ? "1px solid var(--line)" : "none", background: active ? "color-mix(in oklab, var(--accent), transparent 92%)" : "transparent" } }, /* @__PURE__ */ React.createElement(StatusDot, { online: n.reachable }), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: n.ip }, n.ip), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)" } }, n.host), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), n.reachable ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: n.ping > 200 ? "var(--warn)" : "var(--dim)" } }, n.ping, "ms") : stuck ? /* @__PURE__ */ React.createElement(Tag, { tone: "warn", title: "Announces online but IP won't pass \u2014 session desync or NAT-blocked" }, "online \xB7 no route") : /* @__PURE__ */ React.createElement(Tag, { tone: "off" }, "offline"), active ? /* @__PURE__ */ React.createElement(Btn, { tone: "ok", icon: "check", size: "sm", onClick: () => onSetExit(null) }, T.routing) : /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "route", onClick: () => n.reachable && onSetExit(n.ip), style: { opacity: n.reachable ? 1 : 0.4 } }, T.routeThru));
|
|
4408
|
+
return /* @__PURE__ */ React.createElement("div", { key: n.ip, className: "dk-wrap", style: { display: "flex", alignItems: "center", gap: 12, rowGap: 6, padding: "10px 14px", borderBottom: i < region.nodes.length - 1 ? "1px solid var(--line)" : "none", background: active ? "color-mix(in oklab, var(--accent), transparent 92%)" : "transparent" } }, /* @__PURE__ */ React.createElement(StatusDot, { online: n.reachable }), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: n.ip }, n.ip), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--faint)" } }, n.host), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), n.reachable ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 11.5, color: n.ping > 200 ? "var(--warn)" : "var(--dim)" } }, n.ping, "ms") : stuck ? /* @__PURE__ */ React.createElement(Tag, { tone: "warn", title: "Announces online but IP won't pass \u2014 session desync or NAT-blocked" }, "online \xB7 no route") : /* @__PURE__ */ React.createElement(Tag, { tone: "off" }, "offline"), active ? /* @__PURE__ */ React.createElement(Btn, { tone: "ok", icon: "check", size: "sm", onClick: () => onSetExit(null) }, T.routing) : /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "route", onClick: () => n.reachable && onSetExit(n.ip), style: { opacity: n.reachable ? 1 : 0.4 } }, T.routeThru));
|
|
4255
4409
|
})));
|
|
4256
4410
|
}
|
|
4257
4411
|
function LanEnableCard({ backend, onArm, onCancel }) {
|
|
@@ -4357,9 +4511,10 @@ function LanEnableCard({ backend, onArm, onCancel }) {
|
|
|
4357
4511
|
}
|
|
4358
4512
|
function NetworkTab({ T, me, peers, exits, activeExit, reqCount, onSetExit, onOpenChat, backend, onArmLan, onCancelLan }) {
|
|
4359
4513
|
if (backend && backend.switchable && !backend.hasVirtualLan) {
|
|
4360
|
-
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1040, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 26 } }, /* @__PURE__ */ React.createElement(MyNode, { T, me, activeExit, peers, reqCount }), /* @__PURE__ */ React.createElement(LanEnableCard, { backend, onArm: onArmLan, onCancel: onCancelLan })));
|
|
4514
|
+
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { className: "dk-page", style: { maxWidth: 1040, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 26 } }, /* @__PURE__ */ React.createElement(MyNode, { T, me, activeExit, peers, reqCount }), /* @__PURE__ */ React.createElement(LanEnableCard, { backend, onArm: onArmLan, onCancel: onCancelLan })));
|
|
4361
4515
|
}
|
|
4362
|
-
|
|
4516
|
+
const lanless = !!backend && backend.hasVirtualLan === false;
|
|
4517
|
+
return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, overflow: "auto", background: "var(--bg)" } }, /* @__PURE__ */ React.createElement("div", { className: "dk-page", style: { maxWidth: 1040, margin: "0 auto", padding: "24px 28px 60px", display: "flex", flexDirection: "column", gap: 26 } }, /* @__PURE__ */ React.createElement(MyNode, { T, me, activeExit, peers, reqCount }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement(Section, { label: T.peerRouting, count: peers.length }), /* @__PURE__ */ React.createElement(PeerTable, { T, peers, onOpenChat }), !peers.length && /* @__PURE__ */ React.createElement("div", { style: { padding: "14px 16px", borderRadius: 11, border: "1px dashed var(--line)", fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.noPeersYet || "No friends yet \u2014 add one from Chat and it shows up here with its route.")), lanless ? null : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ React.createElement(Section, { label: T.exitNodes, trailing: /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 6 } }, /* @__PURE__ */ React.createElement(Btn, { icon: "plus", size: "sm" }, T.addExit)) }), activeExit && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "11px 14px", borderRadius: 10, background: "color-mix(in oklab, var(--warn), transparent 90%)", border: "1px solid color-mix(in oklab, var(--warn), transparent 70%)" } }, /* @__PURE__ */ React.createElement(Icon, { name: "route", size: 17, color: "var(--warn)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--text)" } }, T.egressVia), /* @__PURE__ */ React.createElement(Mono, { size: 13, copy: activeExit }, activeExit), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React.createElement(Btn, { tone: "danger", icon: "unlink", size: "sm", onClick: () => onSetExit(null) }, T.stopRouting)), /* @__PURE__ */ React.createElement("div", { className: "dk-grid1", style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12 } }, exits.map((r) => /* @__PURE__ */ React.createElement(ExitCard, { key: r.region, T, region: r, activeExit, onSetExit }))))));
|
|
4363
4518
|
}
|
|
4364
4519
|
Object.assign(window, { NetworkTab });
|
|
4365
4520
|
|
|
@@ -4686,6 +4841,8 @@ var STR = {
|
|
|
4686
4841
|
recommended: "Discover",
|
|
4687
4842
|
registered: "Names",
|
|
4688
4843
|
here: "Here",
|
|
4844
|
+
people: "People",
|
|
4845
|
+
back: "Back",
|
|
4689
4846
|
dirAdd: "Add",
|
|
4690
4847
|
dirSent: "requested",
|
|
4691
4848
|
dirOpenChat: "chat",
|
|
@@ -4779,6 +4936,7 @@ var STR = {
|
|
|
4779
4936
|
ensBind: "bind",
|
|
4780
4937
|
ensUnbind: "unbind",
|
|
4781
4938
|
ensNotBound: "not bound",
|
|
4939
|
+
ensWebOnly: "Registering a beagles.eth name needs the Beagle phone or desktop app. Your avatar can be set above without one.",
|
|
4782
4940
|
ensAvatar: "avatar",
|
|
4783
4941
|
ensChoose: "choose",
|
|
4784
4942
|
ensClear: "clear",
|
|
@@ -4871,6 +5029,8 @@ var STR = {
|
|
|
4871
5029
|
recommended: "\u63A8\u8350",
|
|
4872
5030
|
registered: "\u540D\u5F55",
|
|
4873
5031
|
here: "\u5728\u573A",
|
|
5032
|
+
people: "\u53D1\u73B0",
|
|
5033
|
+
back: "\u8FD4\u56DE",
|
|
4874
5034
|
dirAdd: "\u52A0\u597D\u53CB",
|
|
4875
5035
|
dirSent: "\u5DF2\u8BF7\u6C42",
|
|
4876
5036
|
dirOpenChat: "\u4F1A\u8BDD",
|
|
@@ -4964,6 +5124,7 @@ var STR = {
|
|
|
4964
5124
|
ensBind: "\u7ED1\u5B9A",
|
|
4965
5125
|
ensUnbind: "\u89E3\u7ED1",
|
|
4966
5126
|
ensNotBound: "\u672A\u7ED1\u5B9A",
|
|
5127
|
+
ensWebOnly: "\u6CE8\u518C beagles.eth \u540D\u5B57\u9700\u8981 Beagle \u624B\u673A\u6216\u684C\u9762\u5E94\u7528\u3002\u5934\u50CF\u4E0D\u9700\u8981\u540D\u5B57\uFF0C\u53EF\u5728\u4E0A\u65B9\u76F4\u63A5\u8BBE\u7F6E\u3002",
|
|
4967
5128
|
ensAvatar: "\u5934\u50CF",
|
|
4968
5129
|
ensChoose: "\u9009\u62E9",
|
|
4969
5130
|
ensClear: "\u6E05\u9664",
|
|
@@ -5061,6 +5222,24 @@ function RailBtn({ icon, label, active, soon, onClick }) {
|
|
|
5061
5222
|
gap: 3
|
|
5062
5223
|
} }, /* @__PURE__ */ React.createElement(Icon, { name: icon, size: 20, stroke: active ? 2.1 : 1.8, color: active ? "var(--accent)" : "var(--dim)" }), /* @__PURE__ */ React.createElement("span", { style: { fontSize: 9, fontWeight: 600, letterSpacing: 0.2, color: active ? "var(--accent)" : "var(--faint)" } }, label), soon && /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", top: 5, right: 6, width: 6, height: 6, borderRadius: 999, background: "var(--warn)" } }));
|
|
5063
5224
|
}
|
|
5225
|
+
function TabBarBtn({ icon, label, active, badge, onClick }) {
|
|
5226
|
+
return /* @__PURE__ */ React.createElement("button", { onClick, style: {
|
|
5227
|
+
flex: 1,
|
|
5228
|
+
minWidth: 0,
|
|
5229
|
+
height: 54,
|
|
5230
|
+
border: "none",
|
|
5231
|
+
background: "transparent",
|
|
5232
|
+
cursor: "pointer",
|
|
5233
|
+
position: "relative",
|
|
5234
|
+
display: "flex",
|
|
5235
|
+
flexDirection: "column",
|
|
5236
|
+
alignItems: "center",
|
|
5237
|
+
justifyContent: "center",
|
|
5238
|
+
gap: 3,
|
|
5239
|
+
fontFamily: "var(--mono)"
|
|
5240
|
+
} }, /* @__PURE__ */ React.createElement(Icon, { name: icon, size: 22, stroke: active ? 2.1 : 1.8, color: active ? "var(--accent)" : "var(--dim)" }), /* @__PURE__ */ React.createElement("span", { style: { fontSize: 10, fontWeight: 600, color: active ? "var(--accent)" : "var(--faint)", whiteSpace: "nowrap" } }, label), badge ? /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", top: 4, left: "50%", marginLeft: 6 } }, /* @__PURE__ */ React.createElement(Unread, { n: badge })) : null);
|
|
5241
|
+
}
|
|
5242
|
+
var DK_PEOPLE_TABS = ["here", "recommended", "registered"];
|
|
5064
5243
|
function DkUpdateModal({ T, info, onClose }) {
|
|
5065
5244
|
const [phase, setPhase] = React.useState("idle");
|
|
5066
5245
|
const [err, setErr] = React.useState(null);
|
|
@@ -5298,10 +5477,34 @@ function DkApp() {
|
|
|
5298
5477
|
data.refresh();
|
|
5299
5478
|
});
|
|
5300
5479
|
});
|
|
5480
|
+
const phone = useIsPhone();
|
|
5301
5481
|
React.useEffect(() => {
|
|
5302
|
-
if (!activeId && peers.length)
|
|
5482
|
+
if (!phone && !activeId && peers.length)
|
|
5303
5483
|
setActiveId(peers[0].id);
|
|
5304
|
-
}, [peers, activeId]);
|
|
5484
|
+
}, [peers, activeId, phone]);
|
|
5485
|
+
React.useEffect(() => {
|
|
5486
|
+
if (!phone)
|
|
5487
|
+
return void 0;
|
|
5488
|
+
const onPop = () => setActiveId(null);
|
|
5489
|
+
window.addEventListener("popstate", onPop);
|
|
5490
|
+
return () => window.removeEventListener("popstate", onPop);
|
|
5491
|
+
}, [phone]);
|
|
5492
|
+
const openConversation = (id) => {
|
|
5493
|
+
setActiveId(id);
|
|
5494
|
+
if (phone && id) {
|
|
5495
|
+
try {
|
|
5496
|
+
window.history.pushState({ dkConv: id }, "");
|
|
5497
|
+
} catch (e) {
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
};
|
|
5501
|
+
const closeConversation = () => {
|
|
5502
|
+
const st = window.history.state;
|
|
5503
|
+
if (st && st.dkConv)
|
|
5504
|
+
window.history.back();
|
|
5505
|
+
else
|
|
5506
|
+
setActiveId(null);
|
|
5507
|
+
};
|
|
5305
5508
|
React.useEffect(() => {
|
|
5306
5509
|
if (!activeId)
|
|
5307
5510
|
return;
|
|
@@ -5313,7 +5516,7 @@ function DkApp() {
|
|
|
5313
5516
|
}, 2500);
|
|
5314
5517
|
return () => clearInterval(iv);
|
|
5315
5518
|
}, [activeId]);
|
|
5316
|
-
const onSelect = (id) =>
|
|
5519
|
+
const onSelect = (id) => openConversation(id);
|
|
5317
5520
|
const onAct = (id, kind) => {
|
|
5318
5521
|
const r = requests.find((x) => x.id === id);
|
|
5319
5522
|
const uid = r && r.userid || id;
|
|
@@ -5409,8 +5612,8 @@ function DkApp() {
|
|
|
5409
5612
|
const onSetExit = () => {
|
|
5410
5613
|
};
|
|
5411
5614
|
const onOpenChat = (id) => {
|
|
5412
|
-
setActiveId(id);
|
|
5413
5615
|
setTab("chat");
|
|
5616
|
+
openConversation(id);
|
|
5414
5617
|
};
|
|
5415
5618
|
const onOpenNet = () => setTab("network");
|
|
5416
5619
|
const nav = [
|
|
@@ -5421,14 +5624,44 @@ function DkApp() {
|
|
|
5421
5624
|
{ id: "network", icon: "network", label: T.network },
|
|
5422
5625
|
{ id: "apps", icon: "grid", label: T.apps }
|
|
5423
5626
|
];
|
|
5424
|
-
|
|
5627
|
+
const peopleTab = DK_PEOPLE_TABS.includes(tab);
|
|
5628
|
+
const lastPeople = React.useRef("here");
|
|
5629
|
+
if (peopleTab)
|
|
5630
|
+
lastPeople.current = tab;
|
|
5631
|
+
const unreadTotal = (peers || []).reduce((n, p) => n + (Number(p.unread) || 0), 0) + (requests || []).length;
|
|
5632
|
+
const phoneNav = [
|
|
5633
|
+
{ id: "chat", icon: "message", label: T.chat, active: tab === "chat", badge: unreadTotal, go: () => setTab("chat") },
|
|
5634
|
+
{ id: "people", icon: "users", label: T.people, active: peopleTab, go: () => setTab(lastPeople.current) },
|
|
5635
|
+
{ id: "network", icon: "network", label: T.network, active: tab === "network", go: () => setTab("network") },
|
|
5636
|
+
{ id: "apps", icon: "grid", label: T.apps, active: tab === "apps", go: () => setTab("apps") },
|
|
5637
|
+
{ id: "profile", icon: "userRound", label: T.profile, active: tab === "profile", go: () => setTab("profile") }
|
|
5638
|
+
];
|
|
5639
|
+
const inConversation = phone && tab === "chat" && !!activeId && (peers || []).some((p) => p.id === activeId);
|
|
5640
|
+
return /* @__PURE__ */ React.createElement("div", { style: { ...vars, "--row-pad": rowPad, position: "fixed", inset: 0, display: "flex", flexDirection: phone ? "column" : "row", background: "var(--bg)", color: "var(--text)", fontFamily: "var(--ui)" } }, /* @__PURE__ */ React.createElement(DkPhoneStyles, null), !phone && /* @__PURE__ */ React.createElement("div", { style: { width: 68, flexShrink: 0, borderRight: "1px solid var(--line)", background: "var(--rail)", display: "flex", flexDirection: "column", alignItems: "center", padding: "14px 0", gap: 8 } }, /* @__PURE__ */ React.createElement("div", { style: { width: 38, height: 38, borderRadius: 10, background: "var(--accent)", display: "flex", alignItems: "center", justifyContent: "center", marginBottom: 8 } }, /* @__PURE__ */ React.createElement(Icon, { name: "terminal", size: 20, color: "#fff", stroke: 2.2 })), nav.map((n) => /* @__PURE__ */ React.createElement(RailBtn, { key: n.id, icon: n.icon, label: n.label, active: tab === n.id, soon: n.soon, onClick: () => setTab(n.id) })), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React.createElement("button", { onClick: () => setTab("profile"), title: T.profile, style: {
|
|
5425
5641
|
padding: 4,
|
|
5426
5642
|
borderRadius: 12,
|
|
5427
5643
|
cursor: "pointer",
|
|
5428
5644
|
display: "flex",
|
|
5429
5645
|
border: "1px solid " + (tab === "profile" ? "var(--line)" : "transparent"),
|
|
5430
5646
|
background: tab === "profile" ? "var(--panel-2)" : "transparent"
|
|
5431
|
-
} }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: { ...me, id: me.userId, agent: false }, size: 36, radius: 9 }))), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, minHeight: 0, display: "flex", flexDirection: "column" } }, /* @__PURE__ */ React.createElement(DkBrowserNotice, { lang: t.lang }), /* @__PURE__ */ React.createElement("div", { style: { height: 46, flexShrink: 0, borderBottom: "1px solid var(--line)", background: "var(--panel)", display: "flex", alignItems: "center", gap: 12,
|
|
5647
|
+
} }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: { ...me, id: me.userId, agent: false }, size: 36, radius: 9 }))), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, minHeight: 0, display: "flex", flexDirection: "column" } }, !inConversation && /* @__PURE__ */ React.createElement(DkBrowserNotice, { lang: t.lang }), !inConversation && /* @__PURE__ */ React.createElement("div", { style: { height: 46, boxSizing: "content-box", paddingTop: phone ? "env(safe-area-inset-top, 0px)" : 0, flexShrink: 0, borderBottom: "1px solid var(--line)", background: "var(--panel)", display: "flex", alignItems: "center", gap: phone ? 8 : 12, paddingLeft: phone ? 12 : 16, paddingRight: phone ? 12 : 16 } }, /* @__PURE__ */ React.createElement("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "var(--accent)", strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", style: { display: "block", flexShrink: 0 } }, /* @__PURE__ */ React.createElement("path", { d: "m4.5 17 6-6-6-6" }), /* @__PURE__ */ React.createElement("path", { d: "M12 18.5h7.5" })), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 14, fontWeight: 700, letterSpacing: -0.3, color: "var(--text)" } }, "beagle"), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12, color: "var(--faint)", whiteSpace: "nowrap" } }, "\xB7 ", (nav.find((n) => n.id === tab) || { label: T.profile }).label.toLowerCase()), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), phone ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StatusDot, { online: me.online }), /* @__PURE__ */ React.createElement("button", { onClick: () => setTab("profile"), title: T.profile, style: { padding: 0, border: "none", background: "transparent", cursor: "pointer", display: "flex" } }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: { ...me, id: me.userId, agent: false }, size: 28, radius: 7, dot: false }))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tag, { tone: "accent" }, me.channel, " \xB7 lan ", me.lanVer), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 7, padding: "0 4px" } }, /* @__PURE__ */ React.createElement(StatusDot, { online: me.online }), /* @__PURE__ */ React.createElement(Mono, { size: 12.5, copy: me.ip }, me.ip)), /* @__PURE__ */ React.createElement("span", { style: { width: 1, height: 22, background: "var(--line)" } }), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8 } }, /* @__PURE__ */ React.createElement(DkAvatar, { peer: { ...me, id: me.userId, agent: false }, size: 26, radius: 7 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 12.5, fontWeight: 600, color: "var(--text)" } }, me.name)))), phone && peopleTab && /* @__PURE__ */ React.createElement("div", { style: { flexShrink: 0, display: "flex", gap: 6, padding: "8px 12px", borderBottom: "1px solid var(--line)", background: "var(--panel)", overflowX: "auto" } }, nav.filter((n) => DK_PEOPLE_TABS.includes(n.id)).map((n) => /* @__PURE__ */ React.createElement("button", { key: n.id, onClick: () => setTab(n.id), style: {
|
|
5648
|
+
display: "inline-flex",
|
|
5649
|
+
alignItems: "center",
|
|
5650
|
+
gap: 6,
|
|
5651
|
+
padding: "6px 12px",
|
|
5652
|
+
borderRadius: 999,
|
|
5653
|
+
cursor: "pointer",
|
|
5654
|
+
whiteSpace: "nowrap",
|
|
5655
|
+
border: "1px solid var(--line)",
|
|
5656
|
+
fontFamily: "var(--mono)",
|
|
5657
|
+
fontSize: 12,
|
|
5658
|
+
fontWeight: 600,
|
|
5659
|
+
background: tab === n.id ? "var(--accent)" : "transparent",
|
|
5660
|
+
color: tab === n.id ? "#fff" : "var(--dim)"
|
|
5661
|
+
} }, /* @__PURE__ */ React.createElement(Icon, { name: n.icon, size: 14, stroke: 2, color: tab === n.id ? "#fff" : "var(--dim)" }), n.label))), tab === "chat" && /* @__PURE__ */ React.createElement(ChatTab, { T, lang: t.lang, phone, onBack: closeConversation, peers, requests, activeId, thread: data.threads[activeId], onSelect, onAct, onAdd, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread: () => activeId && data.loadThread(activeId), prefillAddr: pendingAddr, onPrefillConsumed: () => setPendingAddr(""), muted: mutedIds, onToggleMute }), tab === "here" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "bridge", peers, meId: me.userId, onAdd, onOpenChat }), tab === "recommended" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "recommended", peers, meId: me.userId, onAdd, onOpenChat }), tab === "registered" && /* @__PURE__ */ React.createElement(DiscoverTab, { T, kind: "registered", peers, meId: me.userId, onAdd, onOpenChat }), tab === "network" && /* @__PURE__ */ React.createElement(NetworkTab, { T, me, peers, exits, activeExit, reqCount: requests.length, onSetExit, onOpenChat, backend, onArmLan: armLan, onCancelLan: cancelLan }), tab === "apps" && /* @__PURE__ */ React.createElement(AppsTab, { T, t }), tab === "profile" && /* @__PURE__ */ React.createElement(ProfileTab, { T, me, onEdit, t, setTweak, onSetAvatar: (p) => dkApi.setProfileFull(p).then((r) => {
|
|
5662
|
+
data.refresh();
|
|
5663
|
+
return r;
|
|
5664
|
+
}) })), phone && !inConversation && /* @__PURE__ */ React.createElement("div", { style: { flexShrink: 0, display: "flex", borderTop: "1px solid var(--line)", background: "var(--rail)", paddingBottom: "env(safe-area-inset-bottom, 0px)" } }, phoneNav.map((n) => /* @__PURE__ */ React.createElement(TabBarBtn, { key: n.id, icon: n.icon, label: n.label, active: n.active, badge: n.badge, onClick: n.go }))), data.locked && /* @__PURE__ */ React.createElement(
|
|
5432
5665
|
DkLockedOut,
|
|
5433
5666
|
{
|
|
5434
5667
|
compact: true,
|
package/package.json
CHANGED