@decentnetwork/beagle-ui 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/dist/beagle-ui.js +20 -5
  2. package/package.json +1 -1
package/dist/beagle-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- export const BEAGLE_UI_VERSION = "0.2.11";
1
+ export const BEAGLE_UI_VERSION = "0.2.12";
2
2
  // src/icons.jsx
3
3
  var ICON_PATHS = {
4
4
  // ---- tab bar (the four must feel like one set) ----
@@ -545,6 +545,10 @@ function PeerSidebar({ T, peers, requests, activeId, onSelect, onAct, onAdd, pre
545
545
  setFromDeepLink(true);
546
546
  }
547
547
  }, [prefillAddr]);
548
+ const dismissDeepLink = () => {
549
+ setFromDeepLink(false);
550
+ onPrefillConsumed && onPrefillConsumed();
551
+ };
548
552
  const submitAddr = () => {
549
553
  const v = addr.trim();
550
554
  if (!v || addState && addState.kind === "sending")
@@ -557,9 +561,11 @@ function PeerSidebar({ T, peers, requests, activeId, onSelect, onAct, onAdd, pre
557
561
  onPrefillConsumed && onPrefillConsumed();
558
562
  setAddState({ kind: "ok", msg: T.addSent });
559
563
  } else {
564
+ dismissDeepLink();
560
565
  setAddState({ kind: "err", msg: r && r.error ? `${T.addFailed}: ${r.error}` : T.addFailed });
561
566
  }
562
567
  }).catch((e) => {
568
+ dismissDeepLink();
563
569
  setAddState({ kind: "err", msg: `${T.addFailed}: ${e && e.message || e}` });
564
570
  }).finally(() => {
565
571
  setTimeout(() => setAddState((s) => s && s.kind !== "sending" ? null : s), 6e3);
@@ -585,8 +591,11 @@ function PeerSidebar({ T, peers, requests, activeId, onSelect, onAct, onAdd, pre
585
591
  background: "color-mix(in oklab, var(--accent), transparent 88%)",
586
592
  border: "1px solid var(--accent)",
587
593
  borderRadius: 8,
588
- padding: "7px 10px"
589
- } }, T.deepLinkConfirm || "\u901A\u8FC7\u94FE\u63A5\u6DFB\u52A0\u8FD9\u4F4D\u597D\u53CB? \u70B9\u300C\u6DFB\u52A0\u300D\u53D1\u9001\u597D\u53CB\u8BF7\u6C42 / Add this contact from the link? Tap Add to send a friend request."), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 7 } }, /* @__PURE__ */ React.createElement(
594
+ padding: "7px 10px",
595
+ display: "flex",
596
+ alignItems: "flex-start",
597
+ gap: 8
598
+ } }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1 } }, T.deepLinkConfirm || "\u901A\u8FC7\u94FE\u63A5\u6DFB\u52A0\u8FD9\u4F4D\u597D\u53CB? \u70B9\u300C\u6DFB\u52A0\u300D\u53D1\u9001\u597D\u53CB\u8BF7\u6C42 / Add this contact from the link? Tap Add to send a friend request."), /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "x", title: T.cancel || "Dismiss", onClick: dismissDeepLink, style: { flexShrink: 0 } })), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 7 } }, /* @__PURE__ */ React.createElement(
590
599
  "input",
591
600
  {
592
601
  value: addr,
@@ -5195,10 +5204,16 @@ function DkApp() {
5195
5204
  window.addEventListener("hashchange", onHash);
5196
5205
  return () => window.removeEventListener("hashchange", onHash);
5197
5206
  }, []);
5207
+ const jumpedFor = React.useRef("");
5198
5208
  React.useEffect(() => {
5199
- if (!pendingAddr)
5209
+ if (!pendingAddr) {
5210
+ jumpedFor.current = "";
5200
5211
  return;
5201
- setTab("chat");
5212
+ }
5213
+ if (jumpedFor.current !== pendingAddr) {
5214
+ jumpedFor.current = pendingAddr;
5215
+ setTab("chat");
5216
+ }
5202
5217
  if (!peers || !peers.length)
5203
5218
  return;
5204
5219
  const hit = peers.find((p) => p.address && p.address === pendingAddr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/beagle-ui",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "The Beagle chat UI, minus the machine it runs on — shared by the desktop install and the browser build.",
5
5
  "license": "MIT",
6
6
  "type": "module",