@celljs/ta-nearby 4.15.2 → 4.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extension/index.mjs +9 -0
- package/host/index.mjs +1073 -1018
- package/package.json +4 -4
- package/web/index.js +370 -362
package/web/index.js
CHANGED
|
@@ -504,39 +504,6 @@ function Face({ seed, face, look, size }) {
|
|
|
504
504
|
size
|
|
505
505
|
});
|
|
506
506
|
}
|
|
507
|
-
function Looking({ peers }) {
|
|
508
|
-
const shown = peers.slice(0, 5);
|
|
509
|
-
const spots = [
|
|
510
|
-
[0.2, 0.3],
|
|
511
|
-
[0.78, 0.26],
|
|
512
|
-
[0.86, 0.68],
|
|
513
|
-
[0.16, 0.74],
|
|
514
|
-
[0.5, 0.12]
|
|
515
|
-
];
|
|
516
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
517
|
-
className: "tnb-looking",
|
|
518
|
-
"aria-hidden": "true"
|
|
519
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
520
|
-
className: "tnb-ring"
|
|
521
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
522
|
-
className: "tnb-ring tnb-ring-2"
|
|
523
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
524
|
-
className: "tnb-ring tnb-ring-3"
|
|
525
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
526
|
-
className: "tnb-me"
|
|
527
|
-
}, pi.ui.Avatar ? /* @__PURE__ */ React.createElement(pi.ui.Avatar, {
|
|
528
|
-
size: 44
|
|
529
|
-
}) : null), shown.map((peer, index) => /* @__PURE__ */ React.createElement("span", {
|
|
530
|
-
key: peer.e,
|
|
531
|
-
className: "tnb-spot",
|
|
532
|
-
style: { left: `${spots[index][0] * 100}%`, top: `${spots[index][1] * 100}%` }
|
|
533
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
534
|
-
seed: peer.friend?.id ?? peer.e,
|
|
535
|
-
face: peer.face,
|
|
536
|
-
look: peer.look,
|
|
537
|
-
size: 30
|
|
538
|
-
}))));
|
|
539
|
-
}
|
|
540
507
|
function Busy({ children, onClick, primary }) {
|
|
541
508
|
const [busy, run] = pi.ui.useBusy ? pi.ui.useBusy() : [false, async (action) => action()];
|
|
542
509
|
return /* @__PURE__ */ React.createElement("button", {
|
|
@@ -564,50 +531,6 @@ async function makeRoom(people) {
|
|
|
564
531
|
pi.ui.notify([result.invited.length ? t("made", { names: names(result.invited) }) : "", result.missed.length ? t("missed", { names: names(result.missed) }) : ""].filter(Boolean).join(" "));
|
|
565
532
|
pi.ui.showView(ROOMS_VIEW);
|
|
566
533
|
}
|
|
567
|
-
function PeerTile({ peer, chosen, toggle }) {
|
|
568
|
-
return /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
|
|
569
|
-
type: "button",
|
|
570
|
-
className: `tnb-peer${chosen ? " tnb-chosen" : ""}`,
|
|
571
|
-
"aria-pressed": chosen,
|
|
572
|
-
onClick: toggle
|
|
573
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
574
|
-
className: "tnb-peer-face"
|
|
575
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
576
|
-
seed: peer.friend?.id ?? peer.e,
|
|
577
|
-
face: peer.face,
|
|
578
|
-
look: peer.look,
|
|
579
|
-
size: 52
|
|
580
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
581
|
-
className: "tnb-check"
|
|
582
|
-
}, pi.ui.SelectCheck ? /* @__PURE__ */ React.createElement(pi.ui.SelectCheck, {
|
|
583
|
-
checked: chosen
|
|
584
|
-
}) : null)), /* @__PURE__ */ React.createElement("span", {
|
|
585
|
-
className: "tnb-peer-name tnb-ellipsis"
|
|
586
|
-
}, who(peer)), peer.friend && /* @__PURE__ */ React.createElement("span", {
|
|
587
|
-
className: "tnb-tag tnb-tag-friend"
|
|
588
|
-
}, t("friend"))));
|
|
589
|
-
}
|
|
590
|
-
function InviteRow({ invite }) {
|
|
591
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
592
|
-
className: "tnb-invite"
|
|
593
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
594
|
-
seed: invite.friend?.id ?? invite.e,
|
|
595
|
-
face: invite.face,
|
|
596
|
-
look: invite.look,
|
|
597
|
-
size: 40
|
|
598
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
599
|
-
className: "tnb-invite-text"
|
|
600
|
-
}, /* @__PURE__ */ React.createElement("span", null, t("invited", { name: who(invite), title: invite.title })), invite.why && /* @__PURE__ */ React.createElement("span", {
|
|
601
|
-
className: "tnb-quiet"
|
|
602
|
-
}, invite.why)), /* @__PURE__ */ React.createElement("div", {
|
|
603
|
-
className: "tnb-actions"
|
|
604
|
-
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
605
|
-
onClick: () => answer(invite.k, false)
|
|
606
|
-
}, t("notNow")), /* @__PURE__ */ React.createElement(Busy, {
|
|
607
|
-
primary: true,
|
|
608
|
-
onClick: () => answer(invite.k, true)
|
|
609
|
-
}, t("join"))));
|
|
610
|
-
}
|
|
611
534
|
async function answer(k, accept) {
|
|
612
535
|
store.set(await call({ kind: "answer", k, accept }));
|
|
613
536
|
if (accept) {
|
|
@@ -622,239 +545,6 @@ function useNow(ms) {
|
|
|
622
545
|
}, [ms]);
|
|
623
546
|
return now;
|
|
624
547
|
}
|
|
625
|
-
function NearbyPage() {
|
|
626
|
-
const status = useStatus();
|
|
627
|
-
const now = useNow(30000);
|
|
628
|
-
const [left, setLeft] = React.useState(new Set);
|
|
629
|
-
const chosen = status.peers.filter((peer) => !left.has(peer.e));
|
|
630
|
-
const toggle = (e) => setLeft((before) => {
|
|
631
|
-
const next = new Set(before);
|
|
632
|
-
if (!next.delete(e)) {
|
|
633
|
-
next.add(e);
|
|
634
|
-
}
|
|
635
|
-
return next;
|
|
636
|
-
});
|
|
637
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
638
|
-
className: "tnb-page"
|
|
639
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
640
|
-
className: "tnb-body"
|
|
641
|
-
}, status.invites.length > 0 && /* @__PURE__ */ React.createElement("section", {
|
|
642
|
-
className: "tnb-section"
|
|
643
|
-
}, /* @__PURE__ */ React.createElement("h3", null, t("invites")), /* @__PURE__ */ React.createElement("ul", {
|
|
644
|
-
className: "tnb-card"
|
|
645
|
-
}, status.invites.map((invite) => /* @__PURE__ */ React.createElement(InviteRow, {
|
|
646
|
-
key: invite.k,
|
|
647
|
-
invite
|
|
648
|
-
})))), (status.greets ?? []).length > 0 && /* @__PURE__ */ React.createElement("section", {
|
|
649
|
-
className: "tnb-section"
|
|
650
|
-
}, /* @__PURE__ */ React.createElement("h3", null, t("greets")), /* @__PURE__ */ React.createElement("ul", {
|
|
651
|
-
className: "tnb-card"
|
|
652
|
-
}, (status.greets ?? []).map((greet) => /* @__PURE__ */ React.createElement(GreetRow, {
|
|
653
|
-
key: greet.k,
|
|
654
|
-
greet
|
|
655
|
-
})))), !status.visible ? /* @__PURE__ */ React.createElement("div", {
|
|
656
|
-
className: "tnb-off"
|
|
657
|
-
}, /* @__PURE__ */ React.createElement(Looking, {
|
|
658
|
-
peers: []
|
|
659
|
-
}), /* @__PURE__ */ React.createElement("h2", null, t("offTitle")), /* @__PURE__ */ React.createElement("p", {
|
|
660
|
-
className: "tnb-quiet"
|
|
661
|
-
}, t("offHint")), /* @__PURE__ */ React.createElement("div", {
|
|
662
|
-
className: "tnb-durations"
|
|
663
|
-
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
664
|
-
primary: true,
|
|
665
|
-
onClick: () => visible(60)
|
|
666
|
-
}, t("hour")), /* @__PURE__ */ React.createElement(Busy, {
|
|
667
|
-
onClick: () => visible(restOfDay())
|
|
668
|
-
}, t("today")), /* @__PURE__ */ React.createElement(Busy, {
|
|
669
|
-
onClick: () => visible()
|
|
670
|
-
}, t("always")))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
671
|
-
className: "tnb-on"
|
|
672
|
-
}, /* @__PURE__ */ React.createElement(Looking, {
|
|
673
|
-
peers: status.peers
|
|
674
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
675
|
-
className: "tnb-on-line"
|
|
676
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
677
|
-
className: "tnb-dot"
|
|
678
|
-
}), /* @__PURE__ */ React.createElement("span", null, t("on"), " · ", leftText(status.until, now)), /* @__PURE__ */ React.createElement("button", {
|
|
679
|
-
type: "button",
|
|
680
|
-
className: "tnb-link",
|
|
681
|
-
onClick: () => void call({ kind: "visible", on: false }).then((next) => store.set(next), (error) => pi.ui.notify(message(error), "error"))
|
|
682
|
-
}, t("turnOff"))), status.error && /* @__PURE__ */ React.createElement("p", {
|
|
683
|
-
className: "tnb-error"
|
|
684
|
-
}, t("error", { error: status.error }))), status.peers.length === 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
685
|
-
className: "tnb-nobody"
|
|
686
|
-
}, /* @__PURE__ */ React.createElement("strong", null, t("nobody")), /* @__PURE__ */ React.createElement("span", {
|
|
687
|
-
className: "tnb-quiet"
|
|
688
|
-
}, t("nobodyHint"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("ul", {
|
|
689
|
-
className: "tnb-peers"
|
|
690
|
-
}, status.peers.map((peer) => /* @__PURE__ */ React.createElement(PeerTile, {
|
|
691
|
-
key: peer.e,
|
|
692
|
-
peer,
|
|
693
|
-
chosen: !left.has(peer.e),
|
|
694
|
-
toggle: () => toggle(peer.e)
|
|
695
|
-
}))), /* @__PURE__ */ React.createElement("div", {
|
|
696
|
-
className: "tnb-make"
|
|
697
|
-
}, chosen.length > 0 && /* @__PURE__ */ React.createElement(Busy, {
|
|
698
|
-
primary: true,
|
|
699
|
-
onClick: () => makeRoom(chosen)
|
|
700
|
-
}, chosen.length === status.peers.length ? t("makeRoomAll") : t("makeRoom", { n: chosen.length })), /* @__PURE__ */ React.createElement("p", {
|
|
701
|
-
className: "tnb-quiet"
|
|
702
|
-
}, t("sayIt")))), /* @__PURE__ */ React.createElement(SpotRow, {
|
|
703
|
-
status,
|
|
704
|
-
now
|
|
705
|
-
}), /* @__PURE__ */ React.createElement(MeetRow, {
|
|
706
|
-
status
|
|
707
|
-
}), /* @__PURE__ */ React.createElement("p", {
|
|
708
|
-
className: "tnb-self"
|
|
709
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
710
|
-
className: "tnb-quiet"
|
|
711
|
-
}, t("youAre")), /* @__PURE__ */ React.createElement("span", null, status.self.name || t("someone"))))));
|
|
712
|
-
}
|
|
713
|
-
function spot(action, code) {
|
|
714
|
-
return call({ kind: "spot", action, ...code ? { code } : {} }).then((status) => store.set(status));
|
|
715
|
-
}
|
|
716
|
-
function SpotRow({ status, now }) {
|
|
717
|
-
const current = status.spot;
|
|
718
|
-
if (current) {
|
|
719
|
-
const minutes = Math.min(10, Math.ceil((current.until - Math.max(now, Date.now())) / 60000));
|
|
720
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
721
|
-
className: "tnb-code-card"
|
|
722
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
723
|
-
className: "tnb-quiet"
|
|
724
|
-
}, t("spotCode")), /* @__PURE__ */ React.createElement("strong", {
|
|
725
|
-
className: "tnb-code"
|
|
726
|
-
}, current.code.slice(0, 3), " ", current.code.slice(3)), /* @__PURE__ */ React.createElement("span", {
|
|
727
|
-
className: "tnb-quiet"
|
|
728
|
-
}, minutes > 0 ? current.mine ? t("spotShare", { n: minutes }) : t("spotIn") : t("spotClosed")), /* @__PURE__ */ React.createElement("button", {
|
|
729
|
-
type: "button",
|
|
730
|
-
className: "tnb-link",
|
|
731
|
-
onClick: () => void spot("leave").catch((error) => pi.ui.notify(message(error), "error"))
|
|
732
|
-
}, t("spotLeave")));
|
|
733
|
-
}
|
|
734
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
735
|
-
className: "tnb-code-row"
|
|
736
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
737
|
-
className: "tnb-quiet"
|
|
738
|
-
}, t("spotHint")), /* @__PURE__ */ React.createElement("div", {
|
|
739
|
-
className: "tnb-actions"
|
|
740
|
-
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
741
|
-
onClick: () => spot("open")
|
|
742
|
-
}, t("spotOpen")), /* @__PURE__ */ React.createElement("button", {
|
|
743
|
-
type: "button",
|
|
744
|
-
className: "ta-button",
|
|
745
|
-
onClick: () => void pi.ui.input(t("spotJoinTitle"), "000000").then((code) => code?.trim() ? spot("join", code.replace(/\s/g, "")) : undefined).catch((error) => pi.ui.notify(message(error), "error"))
|
|
746
|
-
}, t("spotJoin"))));
|
|
747
|
-
}
|
|
748
|
-
function ShowContent({ content }) {
|
|
749
|
-
if (content.kind === "html") {
|
|
750
|
-
return /* @__PURE__ */ React.createElement("iframe", {
|
|
751
|
-
className: "tnb-show-frame",
|
|
752
|
-
title: content.title,
|
|
753
|
-
sandbox: "allow-scripts allow-popups",
|
|
754
|
-
referrerPolicy: "no-referrer",
|
|
755
|
-
srcDoc: content.data
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
if (content.kind === "image") {
|
|
759
|
-
return /* @__PURE__ */ React.createElement("img", {
|
|
760
|
-
className: "tnb-show-image",
|
|
761
|
-
alt: content.title,
|
|
762
|
-
src: content.data
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
if (content.kind === "markdown") {
|
|
766
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
767
|
-
className: "tnb-show-text"
|
|
768
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
769
|
-
text: content.data
|
|
770
|
-
}));
|
|
771
|
-
}
|
|
772
|
-
return /* @__PURE__ */ React.createElement("pre", {
|
|
773
|
-
className: "tnb-show-text tnb-show-pre"
|
|
774
|
-
}, content.data);
|
|
775
|
-
}
|
|
776
|
-
function ShowOverlay({ shown, close }) {
|
|
777
|
-
const status = useStatus();
|
|
778
|
-
const current = status.shown?.k === shown.k ? status.shown : undefined;
|
|
779
|
-
const [content, setContent] = React.useState();
|
|
780
|
-
React.useEffect(() => {
|
|
781
|
-
if (!current) {
|
|
782
|
-
close();
|
|
783
|
-
} else if (!current.ask && !content) {
|
|
784
|
-
call({ kind: "shown", k: shown.k }).then(setContent, () => close());
|
|
785
|
-
}
|
|
786
|
-
}, [current, content, shown.k, close]);
|
|
787
|
-
const finish = () => void call({ kind: "show", k: shown.k, action: "close" }).then((next) => store.set(next), close);
|
|
788
|
-
if (!current) {
|
|
789
|
-
return null;
|
|
790
|
-
}
|
|
791
|
-
if (current.ask) {
|
|
792
|
-
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
793
|
-
title: t("title"),
|
|
794
|
-
onClose: finish
|
|
795
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
796
|
-
className: "tnb-dialog"
|
|
797
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
798
|
-
className: "tnb-dialog-head"
|
|
799
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
800
|
-
seed: current.friend?.id ?? current.k,
|
|
801
|
-
face: current.face,
|
|
802
|
-
look: current.look,
|
|
803
|
-
size: 48
|
|
804
|
-
}), /* @__PURE__ */ React.createElement("strong", null, t("wantsToShow", { name: who(current), title: current.title }))), /* @__PURE__ */ React.createElement("p", {
|
|
805
|
-
className: "tnb-quiet"
|
|
806
|
-
}, [t("showNote"), current.friend ? "" : t("inviteStranger")].filter(Boolean).join(TaLanguageUtil.cjk(pi.ui.language) ? "" : " ")), /* @__PURE__ */ React.createElement("div", {
|
|
807
|
-
className: "tnb-actions tnb-dialog-actions"
|
|
808
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
809
|
-
type: "button",
|
|
810
|
-
className: "ta-button",
|
|
811
|
-
onClick: finish
|
|
812
|
-
}, t("notNow")), /* @__PURE__ */ React.createElement(Busy, {
|
|
813
|
-
primary: true,
|
|
814
|
-
onClick: () => call({ kind: "show", k: shown.k, action: "accept" }).then((next) => store.set(next))
|
|
815
|
-
}, t("showIt")))));
|
|
816
|
-
}
|
|
817
|
-
return /* @__PURE__ */ React.createElement(pi.ui.FullScreen, {
|
|
818
|
-
className: "tnb-show"
|
|
819
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
820
|
-
className: "tnb-show-bar"
|
|
821
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
822
|
-
seed: current.friend?.id ?? current.k,
|
|
823
|
-
face: current.face,
|
|
824
|
-
look: current.look,
|
|
825
|
-
size: 26
|
|
826
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
827
|
-
className: "tnb-show-title tnb-ellipsis"
|
|
828
|
-
}, current.title), /* @__PURE__ */ React.createElement("span", {
|
|
829
|
-
className: "tnb-quiet tnb-ellipsis"
|
|
830
|
-
}, t("from", { name: who(current) })), /* @__PURE__ */ React.createElement("button", {
|
|
831
|
-
type: "button",
|
|
832
|
-
className: "ta-button",
|
|
833
|
-
onClick: finish
|
|
834
|
-
}, t("close"))), /* @__PURE__ */ React.createElement("div", {
|
|
835
|
-
className: "tnb-show-body"
|
|
836
|
-
}, content ? /* @__PURE__ */ React.createElement(ShowContent, {
|
|
837
|
-
content
|
|
838
|
-
}) : /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
|
|
839
|
-
rows: 4
|
|
840
|
-
})));
|
|
841
|
-
}
|
|
842
|
-
var showing;
|
|
843
|
-
function openShown(shown) {
|
|
844
|
-
if (showing === shown.k || !pi.ui.custom) {
|
|
845
|
-
return;
|
|
846
|
-
}
|
|
847
|
-
showing = shown.k;
|
|
848
|
-
pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(ShowOverlay, {
|
|
849
|
-
shown,
|
|
850
|
-
close: () => {
|
|
851
|
-
if (showing === shown.k) {
|
|
852
|
-
showing = undefined;
|
|
853
|
-
}
|
|
854
|
-
close();
|
|
855
|
-
}
|
|
856
|
-
}));
|
|
857
|
-
}
|
|
858
548
|
function useSettings() {
|
|
859
549
|
const settings = useStatus().settings ?? {};
|
|
860
550
|
const change = async (next) => {
|
|
@@ -866,31 +556,10 @@ function useSettings() {
|
|
|
866
556
|
};
|
|
867
557
|
return [settings, change];
|
|
868
558
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
["ask", "showAsk"],
|
|
874
|
-
["auto", "showAuto"]
|
|
875
|
-
];
|
|
876
|
-
return /* @__PURE__ */ React.createElement("select", {
|
|
877
|
-
className: "tnb-select",
|
|
878
|
-
"aria-label": t("settingsShow"),
|
|
879
|
-
value: settings.show ?? "ask",
|
|
880
|
-
onChange: (event) => void change({ show: event.target.value })
|
|
881
|
-
}, modes.map(([mode, word]) => /* @__PURE__ */ React.createElement("option", {
|
|
882
|
-
key: mode,
|
|
883
|
-
value: mode
|
|
884
|
-
}, t(word))));
|
|
885
|
-
}
|
|
886
|
-
function WorkSetting() {
|
|
887
|
-
const [settings, change] = useSettings();
|
|
888
|
-
return /* @__PURE__ */ React.createElement(pi.ui.Switch, {
|
|
889
|
-
checked: settings.work === true,
|
|
890
|
-
label: t("settingsWork"),
|
|
891
|
-
onChange: (on) => change({ work: on })
|
|
892
|
-
});
|
|
893
|
-
}
|
|
559
|
+
var join = (items) => TaLanguageUtil.list(pi.ui.language, items);
|
|
560
|
+
var split = (text) => text.split(/[,,、;\n]/).map((item) => item.trim()).filter(Boolean);
|
|
561
|
+
|
|
562
|
+
// web-src/nearby-meet-view.tsx
|
|
894
563
|
function GreetRow({ greet }) {
|
|
895
564
|
const answer2 = async (accept) => {
|
|
896
565
|
store.set(await call({ kind: "greet", k: greet.k, accept }));
|
|
@@ -918,8 +587,6 @@ function GreetRow({ greet }) {
|
|
|
918
587
|
onClick: () => answer2(true)
|
|
919
588
|
}, t("greetYes"))));
|
|
920
589
|
}
|
|
921
|
-
var join = (items) => TaLanguageUtil.list(pi.ui.language, items);
|
|
922
|
-
var split = (text) => text.split(/[,,、;\n]/).map((item) => item.trim()).filter(Boolean);
|
|
923
590
|
function CardDialog({ close }) {
|
|
924
591
|
const status = useStatus();
|
|
925
592
|
const start = status.cards?.draft ?? status.cards?.card;
|
|
@@ -1040,46 +707,145 @@ function CardSetting() {
|
|
|
1040
707
|
onClick: openCard
|
|
1041
708
|
}, t("cardEdit")));
|
|
1042
709
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
710
|
+
|
|
711
|
+
// web-src/nearby-show-view.tsx
|
|
712
|
+
function ShowContent({ content }) {
|
|
713
|
+
if (content.kind === "html") {
|
|
714
|
+
return /* @__PURE__ */ React.createElement("iframe", {
|
|
715
|
+
className: "tnb-show-frame",
|
|
716
|
+
title: content.title,
|
|
717
|
+
sandbox: "allow-scripts allow-popups",
|
|
718
|
+
referrerPolicy: "no-referrer",
|
|
719
|
+
srcDoc: content.data
|
|
720
|
+
});
|
|
1047
721
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
722
|
+
if (content.kind === "image") {
|
|
723
|
+
return /* @__PURE__ */ React.createElement("img", {
|
|
724
|
+
className: "tnb-show-image",
|
|
725
|
+
alt: content.title,
|
|
726
|
+
src: content.data
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
if (content.kind === "markdown") {
|
|
730
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
731
|
+
className: "tnb-show-text"
|
|
732
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
733
|
+
text: content.data
|
|
734
|
+
}));
|
|
735
|
+
}
|
|
736
|
+
return /* @__PURE__ */ React.createElement("pre", {
|
|
737
|
+
className: "tnb-show-text tnb-show-pre"
|
|
738
|
+
}, content.data);
|
|
739
|
+
}
|
|
740
|
+
function ShowOverlay({ shown, close }) {
|
|
741
|
+
const status = useStatus();
|
|
742
|
+
const current = status.shown?.k === shown.k ? status.shown : undefined;
|
|
743
|
+
const [content, setContent] = React.useState();
|
|
744
|
+
React.useEffect(() => {
|
|
745
|
+
if (!current) {
|
|
1052
746
|
close();
|
|
1053
|
-
}
|
|
747
|
+
} else if (!current.ask && !content) {
|
|
748
|
+
call({ kind: "shown", k: shown.k }).then(setContent, () => close());
|
|
749
|
+
}
|
|
750
|
+
}, [current, content, shown.k, close]);
|
|
751
|
+
const finish = () => void call({ kind: "show", k: shown.k, action: "close" }).then((next) => store.set(next), close);
|
|
752
|
+
if (!current) {
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
if (current.ask) {
|
|
1054
756
|
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1055
757
|
title: t("title"),
|
|
1056
|
-
onClose:
|
|
758
|
+
onClose: finish
|
|
1057
759
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1058
760
|
className: "tnb-dialog"
|
|
1059
761
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1060
762
|
className: "tnb-dialog-head"
|
|
1061
763
|
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1062
|
-
seed:
|
|
1063
|
-
face:
|
|
1064
|
-
look:
|
|
764
|
+
seed: current.friend?.id ?? current.k,
|
|
765
|
+
face: current.face,
|
|
766
|
+
look: current.look,
|
|
1065
767
|
size: 48
|
|
1066
|
-
}), /* @__PURE__ */ React.createElement("
|
|
1067
|
-
className: "tnb-invite-text"
|
|
1068
|
-
}, /* @__PURE__ */ React.createElement("strong", null, t("invited", { name: who(invite), title: invite.title })), invite.friend ? /* @__PURE__ */ React.createElement("span", {
|
|
1069
|
-
className: "tnb-tag tnb-tag-friend"
|
|
1070
|
-
}, t("friend")) : null)), invite.why && /* @__PURE__ */ React.createElement("p", null, invite.why), /* @__PURE__ */ React.createElement("p", {
|
|
768
|
+
}), /* @__PURE__ */ React.createElement("strong", null, t("wantsToShow", { name: who(current), title: current.title }))), /* @__PURE__ */ React.createElement("p", {
|
|
1071
769
|
className: "tnb-quiet"
|
|
1072
|
-
}, [t("
|
|
770
|
+
}, [t("showNote"), current.friend ? "" : t("inviteStranger")].filter(Boolean).join(TaLanguageUtil.cjk(pi.ui.language) ? "" : " ")), /* @__PURE__ */ React.createElement("div", {
|
|
1073
771
|
className: "tnb-actions tnb-dialog-actions"
|
|
1074
|
-
}, /* @__PURE__ */ React.createElement(
|
|
1075
|
-
|
|
772
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
773
|
+
type: "button",
|
|
774
|
+
className: "ta-button",
|
|
775
|
+
onClick: finish
|
|
1076
776
|
}, t("notNow")), /* @__PURE__ */ React.createElement(Busy, {
|
|
1077
777
|
primary: true,
|
|
1078
|
-
onClick: () =>
|
|
1079
|
-
}, t("
|
|
778
|
+
onClick: () => call({ kind: "show", k: shown.k, action: "accept" }).then((next) => store.set(next))
|
|
779
|
+
}, t("showIt")))));
|
|
780
|
+
}
|
|
781
|
+
return /* @__PURE__ */ React.createElement(pi.ui.FullScreen, {
|
|
782
|
+
className: "tnb-show"
|
|
783
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
784
|
+
className: "tnb-show-bar"
|
|
785
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
786
|
+
seed: current.friend?.id ?? current.k,
|
|
787
|
+
face: current.face,
|
|
788
|
+
look: current.look,
|
|
789
|
+
size: 26
|
|
790
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
791
|
+
className: "tnb-show-title tnb-ellipsis"
|
|
792
|
+
}, current.title), /* @__PURE__ */ React.createElement("span", {
|
|
793
|
+
className: "tnb-quiet tnb-ellipsis"
|
|
794
|
+
}, t("from", { name: who(current) })), /* @__PURE__ */ React.createElement("button", {
|
|
795
|
+
type: "button",
|
|
796
|
+
className: "ta-button",
|
|
797
|
+
onClick: finish
|
|
798
|
+
}, t("close"))), /* @__PURE__ */ React.createElement("div", {
|
|
799
|
+
className: "tnb-show-body"
|
|
800
|
+
}, content ? /* @__PURE__ */ React.createElement(ShowContent, {
|
|
801
|
+
content
|
|
802
|
+
}) : /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
|
|
803
|
+
rows: 4
|
|
804
|
+
})));
|
|
805
|
+
}
|
|
806
|
+
var showing;
|
|
807
|
+
function openShown(shown) {
|
|
808
|
+
if (showing === shown.k || !pi.ui.custom) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
showing = shown.k;
|
|
812
|
+
pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(ShowOverlay, {
|
|
813
|
+
shown,
|
|
814
|
+
close: () => {
|
|
815
|
+
if (showing === shown.k) {
|
|
816
|
+
showing = undefined;
|
|
817
|
+
}
|
|
818
|
+
close();
|
|
819
|
+
}
|
|
820
|
+
}));
|
|
821
|
+
}
|
|
822
|
+
function ShowSetting() {
|
|
823
|
+
const [settings, change] = useSettings();
|
|
824
|
+
const modes = [
|
|
825
|
+
["off", "showOff"],
|
|
826
|
+
["ask", "showAsk"],
|
|
827
|
+
["auto", "showAuto"]
|
|
828
|
+
];
|
|
829
|
+
return /* @__PURE__ */ React.createElement("select", {
|
|
830
|
+
className: "tnb-select",
|
|
831
|
+
"aria-label": t("settingsShow"),
|
|
832
|
+
value: settings.show ?? "ask",
|
|
833
|
+
onChange: (event) => void change({ show: event.target.value })
|
|
834
|
+
}, modes.map(([mode, word]) => /* @__PURE__ */ React.createElement("option", {
|
|
835
|
+
key: mode,
|
|
836
|
+
value: mode
|
|
837
|
+
}, t(word))));
|
|
838
|
+
}
|
|
839
|
+
function WorkSetting() {
|
|
840
|
+
const [settings, change] = useSettings();
|
|
841
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Switch, {
|
|
842
|
+
checked: settings.work === true,
|
|
843
|
+
label: t("settingsWork"),
|
|
844
|
+
onChange: (on) => change({ work: on })
|
|
1080
845
|
});
|
|
1081
846
|
}
|
|
1082
847
|
|
|
848
|
+
// web-src/nearby-home.tsx
|
|
1083
849
|
class NearbyHome {
|
|
1084
850
|
current = [];
|
|
1085
851
|
signature = "";
|
|
@@ -1141,6 +907,7 @@ function nearbySettings() {
|
|
|
1141
907
|
return {
|
|
1142
908
|
title: () => t("title"),
|
|
1143
909
|
icon: icon("Radar"),
|
|
910
|
+
group: "privacy",
|
|
1144
911
|
rows: [
|
|
1145
912
|
{ key: "name", label: () => t("settingsName"), description: () => t("settingsNameHint"), render: NameSwitch },
|
|
1146
913
|
{ key: "show", label: () => t("settingsShow"), description: () => t("settingsShowHint"), render: ShowSetting },
|
|
@@ -1151,12 +918,253 @@ function nearbySettings() {
|
|
|
1151
918
|
};
|
|
1152
919
|
}
|
|
1153
920
|
|
|
921
|
+
// web-src/nearby-page.tsx
|
|
922
|
+
function Looking({ peers }) {
|
|
923
|
+
const shown = peers.slice(0, 5);
|
|
924
|
+
const spots = [
|
|
925
|
+
[0.2, 0.3],
|
|
926
|
+
[0.78, 0.26],
|
|
927
|
+
[0.86, 0.68],
|
|
928
|
+
[0.16, 0.74],
|
|
929
|
+
[0.5, 0.12]
|
|
930
|
+
];
|
|
931
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
932
|
+
className: "tnb-looking",
|
|
933
|
+
"aria-hidden": "true"
|
|
934
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
935
|
+
className: "tnb-ring"
|
|
936
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
937
|
+
className: "tnb-ring tnb-ring-2"
|
|
938
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
939
|
+
className: "tnb-ring tnb-ring-3"
|
|
940
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
941
|
+
className: "tnb-me"
|
|
942
|
+
}, pi.ui.Avatar ? /* @__PURE__ */ React.createElement(pi.ui.Avatar, {
|
|
943
|
+
size: 44
|
|
944
|
+
}) : null), shown.map((peer, index) => /* @__PURE__ */ React.createElement("span", {
|
|
945
|
+
key: peer.e,
|
|
946
|
+
className: "tnb-spot",
|
|
947
|
+
style: { left: `${spots[index][0] * 100}%`, top: `${spots[index][1] * 100}%` }
|
|
948
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
949
|
+
seed: peer.friend?.id ?? peer.e,
|
|
950
|
+
face: peer.face,
|
|
951
|
+
look: peer.look,
|
|
952
|
+
size: 30
|
|
953
|
+
}))));
|
|
954
|
+
}
|
|
955
|
+
function PeerTile({ peer, chosen, toggle }) {
|
|
956
|
+
return /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
|
|
957
|
+
type: "button",
|
|
958
|
+
className: `tnb-peer${chosen ? " tnb-chosen" : ""}`,
|
|
959
|
+
"aria-pressed": chosen,
|
|
960
|
+
onClick: toggle
|
|
961
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
962
|
+
className: "tnb-peer-face"
|
|
963
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
964
|
+
seed: peer.friend?.id ?? peer.e,
|
|
965
|
+
face: peer.face,
|
|
966
|
+
look: peer.look,
|
|
967
|
+
size: 52
|
|
968
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
969
|
+
className: "tnb-check"
|
|
970
|
+
}, pi.ui.SelectCheck ? /* @__PURE__ */ React.createElement(pi.ui.SelectCheck, {
|
|
971
|
+
checked: chosen
|
|
972
|
+
}) : null)), /* @__PURE__ */ React.createElement("span", {
|
|
973
|
+
className: "tnb-peer-name tnb-ellipsis"
|
|
974
|
+
}, who(peer)), peer.friend && /* @__PURE__ */ React.createElement("span", {
|
|
975
|
+
className: "tnb-tag tnb-tag-friend"
|
|
976
|
+
}, t("friend"))));
|
|
977
|
+
}
|
|
978
|
+
function InviteRow({ invite }) {
|
|
979
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
980
|
+
className: "tnb-invite"
|
|
981
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
982
|
+
seed: invite.friend?.id ?? invite.e,
|
|
983
|
+
face: invite.face,
|
|
984
|
+
look: invite.look,
|
|
985
|
+
size: 40
|
|
986
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
987
|
+
className: "tnb-invite-text"
|
|
988
|
+
}, /* @__PURE__ */ React.createElement("span", null, t("invited", { name: who(invite), title: invite.title })), invite.why && /* @__PURE__ */ React.createElement("span", {
|
|
989
|
+
className: "tnb-quiet"
|
|
990
|
+
}, invite.why)), /* @__PURE__ */ React.createElement("div", {
|
|
991
|
+
className: "tnb-actions"
|
|
992
|
+
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
993
|
+
onClick: () => answer(invite.k, false)
|
|
994
|
+
}, t("notNow")), /* @__PURE__ */ React.createElement(Busy, {
|
|
995
|
+
primary: true,
|
|
996
|
+
onClick: () => answer(invite.k, true)
|
|
997
|
+
}, t("join"))));
|
|
998
|
+
}
|
|
999
|
+
function NearbyPage() {
|
|
1000
|
+
const status = useStatus();
|
|
1001
|
+
const now = useNow(30000);
|
|
1002
|
+
const [left, setLeft] = React.useState(new Set);
|
|
1003
|
+
const chosen = status.peers.filter((peer) => !left.has(peer.e));
|
|
1004
|
+
const toggle = (e) => setLeft((before) => {
|
|
1005
|
+
const next = new Set(before);
|
|
1006
|
+
if (!next.delete(e)) {
|
|
1007
|
+
next.add(e);
|
|
1008
|
+
}
|
|
1009
|
+
return next;
|
|
1010
|
+
});
|
|
1011
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1012
|
+
className: "tnb-page"
|
|
1013
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1014
|
+
className: "tnb-body"
|
|
1015
|
+
}, status.invites.length > 0 && /* @__PURE__ */ React.createElement("section", {
|
|
1016
|
+
className: "tnb-section"
|
|
1017
|
+
}, /* @__PURE__ */ React.createElement("h3", null, t("invites")), /* @__PURE__ */ React.createElement("ul", {
|
|
1018
|
+
className: "tnb-card"
|
|
1019
|
+
}, status.invites.map((invite) => /* @__PURE__ */ React.createElement(InviteRow, {
|
|
1020
|
+
key: invite.k,
|
|
1021
|
+
invite
|
|
1022
|
+
})))), (status.greets ?? []).length > 0 && /* @__PURE__ */ React.createElement("section", {
|
|
1023
|
+
className: "tnb-section"
|
|
1024
|
+
}, /* @__PURE__ */ React.createElement("h3", null, t("greets")), /* @__PURE__ */ React.createElement("ul", {
|
|
1025
|
+
className: "tnb-card"
|
|
1026
|
+
}, (status.greets ?? []).map((greet) => /* @__PURE__ */ React.createElement(GreetRow, {
|
|
1027
|
+
key: greet.k,
|
|
1028
|
+
greet
|
|
1029
|
+
})))), !status.visible ? /* @__PURE__ */ React.createElement("div", {
|
|
1030
|
+
className: "tnb-off"
|
|
1031
|
+
}, /* @__PURE__ */ React.createElement(Looking, {
|
|
1032
|
+
peers: []
|
|
1033
|
+
}), /* @__PURE__ */ React.createElement("h2", null, t("offTitle")), /* @__PURE__ */ React.createElement("p", {
|
|
1034
|
+
className: "tnb-quiet"
|
|
1035
|
+
}, t("offHint")), /* @__PURE__ */ React.createElement("div", {
|
|
1036
|
+
className: "tnb-durations"
|
|
1037
|
+
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
1038
|
+
primary: true,
|
|
1039
|
+
onClick: () => visible(60)
|
|
1040
|
+
}, t("hour")), /* @__PURE__ */ React.createElement(Busy, {
|
|
1041
|
+
onClick: () => visible(restOfDay())
|
|
1042
|
+
}, t("today")), /* @__PURE__ */ React.createElement(Busy, {
|
|
1043
|
+
onClick: () => visible()
|
|
1044
|
+
}, t("always")))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
1045
|
+
className: "tnb-on"
|
|
1046
|
+
}, /* @__PURE__ */ React.createElement(Looking, {
|
|
1047
|
+
peers: status.peers
|
|
1048
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1049
|
+
className: "tnb-on-line"
|
|
1050
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1051
|
+
className: "tnb-dot"
|
|
1052
|
+
}), /* @__PURE__ */ React.createElement("span", null, t("on"), " · ", leftText(status.until, now)), /* @__PURE__ */ React.createElement("button", {
|
|
1053
|
+
type: "button",
|
|
1054
|
+
className: "tnb-link",
|
|
1055
|
+
onClick: () => void call({ kind: "visible", on: false }).then((next) => store.set(next), (error) => pi.ui.notify(message(error), "error"))
|
|
1056
|
+
}, t("turnOff"))), status.error && /* @__PURE__ */ React.createElement("p", {
|
|
1057
|
+
className: "tnb-error"
|
|
1058
|
+
}, t("error", { error: status.error }))), status.peers.length === 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
1059
|
+
className: "tnb-nobody"
|
|
1060
|
+
}, /* @__PURE__ */ React.createElement("strong", null, t("nobody")), /* @__PURE__ */ React.createElement("span", {
|
|
1061
|
+
className: "tnb-quiet"
|
|
1062
|
+
}, t("nobodyHint"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("ul", {
|
|
1063
|
+
className: "tnb-peers"
|
|
1064
|
+
}, status.peers.map((peer) => /* @__PURE__ */ React.createElement(PeerTile, {
|
|
1065
|
+
key: peer.e,
|
|
1066
|
+
peer,
|
|
1067
|
+
chosen: !left.has(peer.e),
|
|
1068
|
+
toggle: () => toggle(peer.e)
|
|
1069
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
1070
|
+
className: "tnb-make"
|
|
1071
|
+
}, chosen.length > 0 && /* @__PURE__ */ React.createElement(Busy, {
|
|
1072
|
+
primary: true,
|
|
1073
|
+
onClick: () => makeRoom(chosen)
|
|
1074
|
+
}, chosen.length === status.peers.length ? t("makeRoomAll") : t("makeRoom", { n: chosen.length })), /* @__PURE__ */ React.createElement("p", {
|
|
1075
|
+
className: "tnb-quiet"
|
|
1076
|
+
}, t("sayIt")))), /* @__PURE__ */ React.createElement(SpotRow, {
|
|
1077
|
+
status,
|
|
1078
|
+
now
|
|
1079
|
+
}), /* @__PURE__ */ React.createElement(MeetRow, {
|
|
1080
|
+
status
|
|
1081
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
1082
|
+
className: "tnb-self"
|
|
1083
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1084
|
+
className: "tnb-quiet"
|
|
1085
|
+
}, t("youAre")), /* @__PURE__ */ React.createElement("span", null, status.self.name || t("someone"))))));
|
|
1086
|
+
}
|
|
1087
|
+
function spot(action, code) {
|
|
1088
|
+
return call({ kind: "spot", action, ...code ? { code } : {} }).then((status) => store.set(status));
|
|
1089
|
+
}
|
|
1090
|
+
function SpotRow({ status, now }) {
|
|
1091
|
+
const current = status.spot;
|
|
1092
|
+
if (current) {
|
|
1093
|
+
const minutes = Math.min(10, Math.ceil((current.until - Math.max(now, Date.now())) / 60000));
|
|
1094
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1095
|
+
className: "tnb-code-card"
|
|
1096
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1097
|
+
className: "tnb-quiet"
|
|
1098
|
+
}, t("spotCode")), /* @__PURE__ */ React.createElement("strong", {
|
|
1099
|
+
className: "tnb-code"
|
|
1100
|
+
}, current.code.slice(0, 3), " ", current.code.slice(3)), /* @__PURE__ */ React.createElement("span", {
|
|
1101
|
+
className: "tnb-quiet"
|
|
1102
|
+
}, minutes > 0 ? current.mine ? t("spotShare", { n: minutes }) : t("spotIn") : t("spotClosed")), /* @__PURE__ */ React.createElement("button", {
|
|
1103
|
+
type: "button",
|
|
1104
|
+
className: "tnb-link",
|
|
1105
|
+
onClick: () => void spot("leave").catch((error) => pi.ui.notify(message(error), "error"))
|
|
1106
|
+
}, t("spotLeave")));
|
|
1107
|
+
}
|
|
1108
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1109
|
+
className: "tnb-code-row"
|
|
1110
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1111
|
+
className: "tnb-quiet"
|
|
1112
|
+
}, t("spotHint")), /* @__PURE__ */ React.createElement("div", {
|
|
1113
|
+
className: "tnb-actions"
|
|
1114
|
+
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
1115
|
+
onClick: () => spot("open")
|
|
1116
|
+
}, t("spotOpen")), /* @__PURE__ */ React.createElement("button", {
|
|
1117
|
+
type: "button",
|
|
1118
|
+
className: "ta-button",
|
|
1119
|
+
onClick: () => void pi.ui.input(t("spotJoinTitle"), "000000").then((code) => code?.trim() ? spot("join", code.replace(/\s/g, "")) : undefined).catch((error) => pi.ui.notify(message(error), "error"))
|
|
1120
|
+
}, t("spotJoin"))));
|
|
1121
|
+
}
|
|
1122
|
+
var inviting;
|
|
1123
|
+
function openInvite(invite) {
|
|
1124
|
+
if (inviting || !pi.ui.custom) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
inviting = invite.k;
|
|
1128
|
+
pi.ui.custom(({ close }) => {
|
|
1129
|
+
const done = () => {
|
|
1130
|
+
inviting = undefined;
|
|
1131
|
+
close();
|
|
1132
|
+
};
|
|
1133
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1134
|
+
title: t("title"),
|
|
1135
|
+
onClose: done
|
|
1136
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1137
|
+
className: "tnb-dialog"
|
|
1138
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1139
|
+
className: "tnb-dialog-head"
|
|
1140
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1141
|
+
seed: invite.friend?.id ?? invite.e,
|
|
1142
|
+
face: invite.face,
|
|
1143
|
+
look: invite.look,
|
|
1144
|
+
size: 48
|
|
1145
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1146
|
+
className: "tnb-invite-text"
|
|
1147
|
+
}, /* @__PURE__ */ React.createElement("strong", null, t("invited", { name: who(invite), title: invite.title })), invite.friend ? /* @__PURE__ */ React.createElement("span", {
|
|
1148
|
+
className: "tnb-tag tnb-tag-friend"
|
|
1149
|
+
}, t("friend")) : null)), invite.why && /* @__PURE__ */ React.createElement("p", null, invite.why), /* @__PURE__ */ React.createElement("p", {
|
|
1150
|
+
className: "tnb-quiet"
|
|
1151
|
+
}, [t("inviteNote"), invite.friend ? "" : t("inviteStranger")].filter(Boolean).join(TaLanguageUtil.cjk(pi.ui.language) ? "" : " ")), /* @__PURE__ */ React.createElement("div", {
|
|
1152
|
+
className: "tnb-actions tnb-dialog-actions"
|
|
1153
|
+
}, /* @__PURE__ */ React.createElement(Busy, {
|
|
1154
|
+
onClick: () => answer(invite.k, false).finally(done)
|
|
1155
|
+
}, t("notNow")), /* @__PURE__ */ React.createElement(Busy, {
|
|
1156
|
+
primary: true,
|
|
1157
|
+
onClick: () => answer(invite.k, true).finally(done)
|
|
1158
|
+
}, t("join")))));
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1154
1162
|
// web-src/style.ts
|
|
1155
1163
|
var STYLE = `
|
|
1156
1164
|
.tnb-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1157
1165
|
.tnb-quiet { color: var(--ta-muted); }
|
|
1158
1166
|
.tnb-page { flex: 1; min-height: 0; height: 100%; overflow-y: auto; overscroll-behavior: none; }
|
|
1159
|
-
.tnb-body { display: flex; flex-direction: column; gap: 18px; max-width:
|
|
1167
|
+
.tnb-body { display: flex; flex-direction: column; gap: 18px; max-width: var(--ta-page-width); margin: 0 auto; padding: 12px 16px calc(28px + env(safe-area-inset-bottom)); box-sizing: border-box; }
|
|
1160
1168
|
.tnb-section h3 { margin: 0 0 6px; padding: 0 4px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }
|
|
1161
1169
|
.tnb-card { margin: 0; padding: 2px 10px; list-style: none; border-radius: 14px; background: var(--ta-raised); }
|
|
1162
1170
|
.tnb-invite { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 0; }
|
|
@@ -1244,7 +1252,7 @@ function activate(pi2) {
|
|
|
1244
1252
|
bind(pi2.React);
|
|
1245
1253
|
bindPage(pi2);
|
|
1246
1254
|
const removeStyle = injectStyle();
|
|
1247
|
-
pi2.registerView("nearby", { title: () => t("title"), icon: icon("Radar"), render: NearbyPage, discover: true, order: 82 });
|
|
1255
|
+
pi2.registerView("nearby", { title: () => t("title"), icon: icon("Radar"), render: NearbyPage, discover: true, group: "people", order: 82 });
|
|
1248
1256
|
pi2.registerSettings(nearbySettings());
|
|
1249
1257
|
const home = new NearbyHome;
|
|
1250
1258
|
const stopHome = home.start();
|