@nivaro/react 0.2.56 → 0.3.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/dist/components/slots/TasksSlot.js +31 -29
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +515 -505
- package/dist/shared/components/ItemEditForm.js +666 -658
- package/dist/shared/components/MyWorkView.js +47 -37
- package/dist/shared/components/ProfileView.js +163 -144
- package/dist/shared/components/ai/AiPlanCard.js +427 -0
- package/dist/shared/components/ai/AiPlanChanges.js +117 -0
- package/dist/shared/components/ai/TaskDo.js +1022 -0
- package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
- package/dist/shared/components/chat/ChatPanel.js +1356 -1317
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
- package/dist/shared/components/chat/chat-core.js +273 -264
- package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
- package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
- package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
- package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
- package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
- package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
- package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
- package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
- package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
- package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
- package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
- package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
- package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
- package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
- package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
- package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
- package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
- package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
- package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
- package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
- package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
- package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
- package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
- package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
- package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
- package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
- package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
- package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
- package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
- package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
- package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
- package/dist/shared/components/item-edit/GroupSection.js +1 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
- package/dist/shared/components/item-edit/UserChip.js +145 -142
- package/dist/shared/components/panels/TaskPanel.js +51 -49
- package/dist/shared/components/support/TicketDetailSheet.js +57 -42
- package/dist/shared/lib/notification-sound.js +25 -16
- package/package.json +2 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { Headphones as H, MicOff as M, Mic as j, ScreenShare as L, PhoneOff as P, MoreHorizontal as W, ChevronLeft as O, UserPlus as B, Hand as R, Presentation as I, PictureInPicture2 as A, Keyboard as D } from "lucide-react";
|
|
3
|
+
import { useRef as w, useState as g, useEffect as y } from "react";
|
|
4
|
+
import { cn as b } from "../../../lib/utils.js";
|
|
5
|
+
import { Popover as z, PopoverTrigger as E, PopoverContent as T } from "../../ui/popover.js";
|
|
6
|
+
import { DeviceSettingsButton as U, ShortcutSheetAnchor as F } from "./HuddleAudioUi.js";
|
|
7
|
+
import { HuddleCameraButton as K } from "./HuddleCamera.js";
|
|
8
|
+
import { useHuddleCollab as V, HuddleNotesButton as q } from "./HuddleCollab.js";
|
|
9
|
+
import { HuddleInviteButton as G, HuddleInviteList as J } from "./HuddlePeoplePicker.js";
|
|
10
|
+
import { HuddleStageTools as Q } from "./HuddleStageTools.js";
|
|
11
|
+
import { raiseHand as X } from "./huddle-reactions.js";
|
|
12
|
+
import { huddleShortcuts as Y } from "./huddle-shortcuts.js";
|
|
13
|
+
import { formatElapsed as Z } from "./huddle-store.js";
|
|
14
|
+
import { useHuddleSpeaking as _, useHuddleShortcuts as $ } from "./useHuddleAudio.js";
|
|
15
|
+
const k = "flex h-6 w-6 shrink-0 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40", N = "text-slate-500 hover:bg-slate-200/70 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100", S = "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100";
|
|
16
|
+
function ee(s) {
|
|
17
|
+
const [d, a] = g(0);
|
|
18
|
+
return y(() => {
|
|
19
|
+
const o = s.current;
|
|
20
|
+
if (!o || typeof ResizeObserver > "u") return;
|
|
21
|
+
const r = new ResizeObserver(([t]) => a(Math.round(t.contentRect.width)));
|
|
22
|
+
return r.observe(o), () => r.disconnect();
|
|
23
|
+
}, [s]), d;
|
|
24
|
+
}
|
|
25
|
+
function te({ since: s }) {
|
|
26
|
+
const [, d] = g(0);
|
|
27
|
+
return y(() => {
|
|
28
|
+
const a = setInterval(() => d((o) => o + 1), 1e3);
|
|
29
|
+
return () => clearInterval(a);
|
|
30
|
+
}, []), s ? /* @__PURE__ */ e("span", { className: "tabular-nums text-slate-500 dark:text-slate-400", "data-huddle-elapsed": !0, children: Z(Date.now() - s) }) : null;
|
|
31
|
+
}
|
|
32
|
+
function v({
|
|
33
|
+
icon: s,
|
|
34
|
+
children: d,
|
|
35
|
+
onClick: a,
|
|
36
|
+
disabled: o,
|
|
37
|
+
active: r,
|
|
38
|
+
tip: t,
|
|
39
|
+
data: p
|
|
40
|
+
}) {
|
|
41
|
+
return /* @__PURE__ */ i(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
role: "menuitem",
|
|
46
|
+
onClick: a,
|
|
47
|
+
disabled: o,
|
|
48
|
+
className: "flex min-h-8 w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted focus-visible:bg-muted focus-visible:outline-none disabled:opacity-50 disabled:hover:bg-transparent dark:text-slate-200",
|
|
49
|
+
"data-tip": t,
|
|
50
|
+
"data-huddle-menu": p,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ e(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
className: b(
|
|
56
|
+
"grid w-4 shrink-0 place-items-center [&>svg]:h-3.5 [&>svg]:w-3.5",
|
|
57
|
+
r ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-500 dark:text-slate-400"
|
|
58
|
+
),
|
|
59
|
+
children: s
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: d })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function ae({
|
|
68
|
+
room: s,
|
|
69
|
+
huddle: d,
|
|
70
|
+
pip: a,
|
|
71
|
+
fold: o,
|
|
72
|
+
followAction: r,
|
|
73
|
+
renderAvatar: t
|
|
74
|
+
}) {
|
|
75
|
+
const [p, u] = g(!1), [f, l] = g("menu"), h = w(!1), x = d.state.status === "joining", m = !!d.state.handAt, c = (n) => () => {
|
|
76
|
+
u(!1), n();
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ i(
|
|
79
|
+
z,
|
|
80
|
+
{
|
|
81
|
+
open: p,
|
|
82
|
+
onOpenChange: (n) => {
|
|
83
|
+
u(n), n || l("menu");
|
|
84
|
+
},
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
className: b(k, p ? S : N),
|
|
91
|
+
"aria-label": "More huddle actions",
|
|
92
|
+
"data-tip": "More",
|
|
93
|
+
"data-huddle-more": !0,
|
|
94
|
+
children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5", strokeWidth: 2 })
|
|
95
|
+
}
|
|
96
|
+
) }),
|
|
97
|
+
/* @__PURE__ */ e(
|
|
98
|
+
T,
|
|
99
|
+
{
|
|
100
|
+
align: "end",
|
|
101
|
+
className: b(
|
|
102
|
+
"p-1",
|
|
103
|
+
f === "invite" ? "w-[280px] max-w-[calc(100vw-16px)]" : "w-[232px]"
|
|
104
|
+
),
|
|
105
|
+
onCloseAutoFocus: (n) => {
|
|
106
|
+
h.current && (h.current = !1, n.preventDefault(), Y.setHelpOpen(!0));
|
|
107
|
+
},
|
|
108
|
+
"data-huddle-more-menu": !0,
|
|
109
|
+
children: f === "invite" ? /* @__PURE__ */ i("div", { children: [
|
|
110
|
+
/* @__PURE__ */ i(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: () => l("menu"),
|
|
115
|
+
className: "mb-1 flex items-center gap-1 rounded px-1 py-0.5 text-[11.5px] font-medium text-slate-500 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-400 dark:hover:text-slate-100",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ e(O, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
|
|
118
|
+
"Back"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ e(
|
|
123
|
+
J,
|
|
124
|
+
{
|
|
125
|
+
room: s,
|
|
126
|
+
renderAvatar: t,
|
|
127
|
+
onDone: () => u(!1)
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] }) : /* @__PURE__ */ i("div", { role: "menu", "aria-label": "More huddle actions", className: "flex flex-col", children: [
|
|
131
|
+
o && !x && /* @__PURE__ */ e(v, { icon: /* @__PURE__ */ e(B, {}), onClick: () => l("invite"), data: "invite", children: "Add people…" }),
|
|
132
|
+
o && /* @__PURE__ */ e(
|
|
133
|
+
v,
|
|
134
|
+
{
|
|
135
|
+
icon: /* @__PURE__ */ e(R, {}),
|
|
136
|
+
onClick: c(() => X(!m)),
|
|
137
|
+
disabled: x,
|
|
138
|
+
active: m,
|
|
139
|
+
data: "hand",
|
|
140
|
+
children: m ? "Lower your hand" : "Raise your hand"
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
r && /* @__PURE__ */ e(
|
|
144
|
+
v,
|
|
145
|
+
{
|
|
146
|
+
icon: /* @__PURE__ */ e(I, {}),
|
|
147
|
+
onClick: c(r.run),
|
|
148
|
+
disabled: r.disabled,
|
|
149
|
+
active: r.active,
|
|
150
|
+
tip: r.tip,
|
|
151
|
+
data: "follow",
|
|
152
|
+
children: r.label
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
a.supported && /* @__PURE__ */ e(
|
|
156
|
+
v,
|
|
157
|
+
{
|
|
158
|
+
icon: /* @__PURE__ */ e(A, {}),
|
|
159
|
+
onClick: c(a.toggle),
|
|
160
|
+
active: a.open,
|
|
161
|
+
tip: a.open ? void 0 : "A small window that stays on top of other windows",
|
|
162
|
+
data: "pip",
|
|
163
|
+
children: a.open ? "Close the mini-player" : "Pop out a mini-player"
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
/* @__PURE__ */ e(
|
|
167
|
+
v,
|
|
168
|
+
{
|
|
169
|
+
icon: /* @__PURE__ */ e(D, {}),
|
|
170
|
+
onClick: () => {
|
|
171
|
+
h.current = !0, u(!1);
|
|
172
|
+
},
|
|
173
|
+
data: "shortcuts",
|
|
174
|
+
children: /* @__PURE__ */ i("span", { className: "flex items-center justify-between gap-2", children: [
|
|
175
|
+
"Keyboard shortcuts",
|
|
176
|
+
/* @__PURE__ */ e("kbd", { className: "inline-flex h-5 min-w-5 items-center justify-center rounded border border-slate-200 bg-slate-50 px-1 font-sans text-[10.5px] font-medium text-slate-600 dark:border-border dark:bg-muted dark:text-slate-300", children: "?" })
|
|
177
|
+
] })
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] })
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
function ve({
|
|
188
|
+
room: s,
|
|
189
|
+
me: d,
|
|
190
|
+
huddle: a,
|
|
191
|
+
pip: o,
|
|
192
|
+
renderAvatar: r
|
|
193
|
+
}) {
|
|
194
|
+
const { state: t, support: p } = a, u = w(null), f = ee(u), l = f >= 460, h = f > 0 && f < 340, x = _(), { talking: m } = $(), c = V(s, a), n = t.status === "joining";
|
|
195
|
+
return /* @__PURE__ */ i("div", { ref: u, className: "flex min-w-0 items-center gap-1.5 text-[11px]", "data-huddle-callbar": !0, children: [
|
|
196
|
+
/* @__PURE__ */ i(
|
|
197
|
+
"span",
|
|
198
|
+
{
|
|
199
|
+
className: "inline-flex min-w-0 items-center gap-1 font-medium text-slate-700 dark:text-slate-200",
|
|
200
|
+
"data-tip": l || n ? void 0 : "Huddle — time since it started",
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ e(H, { className: "h-3.5 w-3.5 shrink-0 text-nvr-cyan", strokeWidth: 2, "aria-hidden": !0 }),
|
|
203
|
+
n ? /* @__PURE__ */ e("span", { className: "truncate", children: "Connecting…" }) : /* @__PURE__ */ i(C, { children: [
|
|
204
|
+
/* @__PURE__ */ e("span", { className: l ? void 0 : "sr-only", children: "Huddle" }),
|
|
205
|
+
/* @__PURE__ */ e(te, { since: t.startedAt })
|
|
206
|
+
] })
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
/* @__PURE__ */ i(
|
|
211
|
+
"div",
|
|
212
|
+
{
|
|
213
|
+
role: "toolbar",
|
|
214
|
+
"aria-label": "Huddle controls",
|
|
215
|
+
className: "ml-auto flex shrink-0 items-center gap-0.5",
|
|
216
|
+
"data-huddle-controls": !0,
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ i("span", { className: "inline-flex items-center rounded", children: [
|
|
219
|
+
/* @__PURE__ */ e(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
onClick: a.toggleMute,
|
|
224
|
+
disabled: n,
|
|
225
|
+
className: b(
|
|
226
|
+
k,
|
|
227
|
+
t.muted ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : m || x.selfSpeaking ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300" : "text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-white/10"
|
|
228
|
+
),
|
|
229
|
+
"aria-pressed": t.muted,
|
|
230
|
+
"aria-label": t.muted ? "Unmute microphone" : "Mute microphone",
|
|
231
|
+
"data-tip": m ? "Talking — let go of Space to mute" : t.muted ? "Unmute (M)" : "Mute (M)",
|
|
232
|
+
"data-huddle-mute": t.muted ? "on" : "off",
|
|
233
|
+
"data-huddle-ptt": m ? "on" : void 0,
|
|
234
|
+
children: t.muted ? /* @__PURE__ */ e(M, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ e(j, { className: "h-3.5 w-3.5", strokeWidth: 2 })
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
!n && /* @__PURE__ */ e(U, { muted: t.muted, variant: "chevron" })
|
|
238
|
+
] }),
|
|
239
|
+
/* @__PURE__ */ e(K, { disabled: n }),
|
|
240
|
+
p.screen && /* @__PURE__ */ e(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
type: "button",
|
|
244
|
+
onClick: a.toggleShare,
|
|
245
|
+
disabled: n,
|
|
246
|
+
className: b(k, t.sharing ? S : N),
|
|
247
|
+
"aria-pressed": t.sharing,
|
|
248
|
+
"aria-label": t.sharing ? "Stop sharing your screen" : "Share your screen",
|
|
249
|
+
"data-tip": t.sharing ? "Stop sharing (Shift+S)" : "Share screen (Shift+S)",
|
|
250
|
+
"data-huddle-share": t.sharing ? "on" : "off",
|
|
251
|
+
children: /* @__PURE__ */ e(L, { className: "h-3.5 w-3.5", strokeWidth: 2 })
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
/* @__PURE__ */ e("span", { className: "mx-1 h-3.5 w-px bg-slate-200 dark:bg-border", "aria-hidden": !0 }),
|
|
255
|
+
/* @__PURE__ */ i(Q, { me: d, handAt: t.handAt, disabled: n, showHand: !h, children: [
|
|
256
|
+
c.live && /* @__PURE__ */ e(q, { open: c.notes.open, unseen: c.notes.unseen }),
|
|
257
|
+
!h && !n && /* @__PURE__ */ e(G, { room: s, renderAvatar: r })
|
|
258
|
+
] }),
|
|
259
|
+
/* @__PURE__ */ e(
|
|
260
|
+
ae,
|
|
261
|
+
{
|
|
262
|
+
room: s,
|
|
263
|
+
huddle: a,
|
|
264
|
+
pip: o,
|
|
265
|
+
fold: h,
|
|
266
|
+
followAction: c.followAction,
|
|
267
|
+
renderAvatar: r
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ e(F, {}),
|
|
271
|
+
/* @__PURE__ */ i(
|
|
272
|
+
"button",
|
|
273
|
+
{
|
|
274
|
+
type: "button",
|
|
275
|
+
onClick: a.leave,
|
|
276
|
+
className: b(
|
|
277
|
+
"ml-1 flex h-6 shrink-0 items-center justify-center gap-1 rounded bg-red-50 text-[11px] font-medium text-red-700 transition-colors hover:bg-red-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:bg-red-500/15 dark:text-red-300 dark:hover:bg-red-500/25",
|
|
278
|
+
l ? "px-2" : "w-7"
|
|
279
|
+
),
|
|
280
|
+
"aria-label": "Leave the huddle",
|
|
281
|
+
"data-tip": l ? "Leave (L)" : "Leave the huddle (L)",
|
|
282
|
+
"data-huddle-leave": !0,
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ e(P, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
|
|
285
|
+
l && "Leave"
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] });
|
|
293
|
+
}
|
|
294
|
+
export {
|
|
295
|
+
ve as HuddleCallBar
|
|
296
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as w } from "@tanstack/react-query";
|
|
3
|
+
import { CalendarClock as C, PhoneIncoming as _, PhoneOff as R, Headphones as S } from "lucide-react";
|
|
4
|
+
import { useRef as I, useCallback as W, useEffect as u, useSyncExternalStore as $ } from "react";
|
|
5
|
+
import { createPortal as j } from "react-dom";
|
|
6
|
+
import { toast as D } from "sonner";
|
|
7
|
+
import { useOptionalNivaroClient as O } from "../../../context.js";
|
|
8
|
+
import { get as x } from "../../../lib/commands.js";
|
|
9
|
+
import { isDndActive as A } from "../../../lib/dnd.js";
|
|
10
|
+
import { playNotificationSound as g, soundForCategory as v } from "../../../lib/notification-sound.js";
|
|
11
|
+
import { useOptionalRealtime as M } from "../../../lib/realtime.js";
|
|
12
|
+
import { cn as q } from "../../../lib/utils.js";
|
|
13
|
+
import { UserAvatar as E } from "../../UserAvatar.js";
|
|
14
|
+
import { chatInitials as H, chatAvatarColor as P, canOpenChatRoom as F, openChatRoom as G } from "../chat-core.js";
|
|
15
|
+
import { huddleCalls as d, INCOMING_TTL_MS as L } from "./huddle-calls.js";
|
|
16
|
+
import { watchHuddleForRelease as T, onHeldRelease as X, heldSummary as z } from "./huddle-hold.js";
|
|
17
|
+
import { huddleStore as y } from "./huddle-store.js";
|
|
18
|
+
let f = 0;
|
|
19
|
+
function ue() {
|
|
20
|
+
return f > 0;
|
|
21
|
+
}
|
|
22
|
+
const K = 2500;
|
|
23
|
+
function Q(e) {
|
|
24
|
+
return e.startsWith("dm:") ? "Direct message" : e === "global" ? "General" : e.startsWith("ch:") ? `#${e.slice(3)}` : "Record room";
|
|
25
|
+
}
|
|
26
|
+
function U({
|
|
27
|
+
call: e,
|
|
28
|
+
onAccept: a,
|
|
29
|
+
onDecline: i,
|
|
30
|
+
index: l
|
|
31
|
+
}) {
|
|
32
|
+
const s = e.name ?? "Someone", c = /* @__PURE__ */ r(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
className: "flex h-10 w-10 items-center justify-center rounded-full text-[14px] font-semibold text-[#04263b]",
|
|
36
|
+
style: { backgroundColor: P(e.from) },
|
|
37
|
+
"aria-hidden": !0,
|
|
38
|
+
children: H(s)
|
|
39
|
+
}
|
|
40
|
+
), h = Math.max(0, L - (Date.now() - e.at));
|
|
41
|
+
return /* @__PURE__ */ o(
|
|
42
|
+
"section",
|
|
43
|
+
{
|
|
44
|
+
className: q(
|
|
45
|
+
"w-[328px] max-w-[calc(100vw-32px)] overflow-hidden rounded-lg border border-slate-200 bg-white text-slate-900 shadow-[0_4px_16px_rgba(0,0,0,0.10),0_1px_4px_rgba(0,0,0,0.06)] dark:border-border dark:bg-card dark:text-slate-100",
|
|
46
|
+
"motion-safe:animate-in motion-safe:slide-in-from-top-2 motion-safe:fade-in motion-safe:duration-200"
|
|
47
|
+
),
|
|
48
|
+
style: { animationDelay: `${l * 40}ms` },
|
|
49
|
+
role: "alertdialog",
|
|
50
|
+
"aria-labelledby": `huddle-call-${e.room}`,
|
|
51
|
+
"data-huddle-call": e.room,
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-3 px-3.5 pt-3.5", children: [
|
|
54
|
+
/* @__PURE__ */ o("span", { className: "relative shrink-0", children: [
|
|
55
|
+
/* @__PURE__ */ r(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
className: "absolute -inset-1 rounded-full border-2 border-nvr-cyan/60 motion-safe:animate-ping",
|
|
59
|
+
"aria-hidden": !0
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ r(E, { userId: e.from, fallback: c, className: "h-10 w-10 rounded-full" })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: [
|
|
65
|
+
/* @__PURE__ */ r("p", { id: `huddle-call-${e.room}`, className: "truncate text-[13px] font-semibold", children: e.scheduled != null ? "Scheduled huddle starting" : `${s} is calling` }),
|
|
66
|
+
/* @__PURE__ */ o("p", { className: "mt-0.5 flex items-center gap-1 truncate text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
67
|
+
e.scheduled != null ? /* @__PURE__ */ r(C, { className: "h-3 w-3 shrink-0", strokeWidth: 2 }) : /* @__PURE__ */ r(_, { className: "h-3 w-3 shrink-0", strokeWidth: 2 }),
|
|
68
|
+
/* @__PURE__ */ o("span", { className: "truncate", children: [
|
|
69
|
+
e.scheduled != null ? `${s} · ` : "",
|
|
70
|
+
Q(e.room)
|
|
71
|
+
] })
|
|
72
|
+
] })
|
|
73
|
+
] })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 px-3.5 pb-3.5 pt-3", children: [
|
|
76
|
+
/* @__PURE__ */ o(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick: i,
|
|
81
|
+
className: "flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border border-slate-200 text-[12.5px] font-medium text-slate-700 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:border-border dark:text-slate-200 dark:hover:bg-white/5",
|
|
82
|
+
"data-huddle-call-decline": !0,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ r(R, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
|
|
85
|
+
"Decline"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ o(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
onClick: a,
|
|
94
|
+
className: "flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md bg-nvr-cyan text-[12.5px] font-medium text-white transition-colors hover:bg-[#00b8e0] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan focus-visible:ring-offset-2 dark:ring-offset-card",
|
|
95
|
+
"data-huddle-call-accept": !0,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ r(S, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
|
|
98
|
+
"Accept"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ r("div", { className: "h-0.5 w-full bg-slate-100 dark:bg-white/10", "aria-hidden": !0, children: /* @__PURE__ */ r(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: "h-full origin-left bg-nvr-cyan motion-reduce:hidden",
|
|
107
|
+
style: {
|
|
108
|
+
animation: `nvr-huddle-drain ${h}ms linear forwards`
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
function fe() {
|
|
117
|
+
const e = M(), a = O(), { data: i } = w({
|
|
118
|
+
queryKey: ["nvr-profile-prefs"],
|
|
119
|
+
queryFn: () => a.request(x("/users/me")).then((t) => {
|
|
120
|
+
var n;
|
|
121
|
+
return ((n = t.data) == null ? void 0 : n.preferences) ?? {};
|
|
122
|
+
}),
|
|
123
|
+
enabled: !!a,
|
|
124
|
+
staleTime: 6e4
|
|
125
|
+
}), l = I(i);
|
|
126
|
+
l.current = i;
|
|
127
|
+
const s = W(
|
|
128
|
+
(t) => a ? a.request(x("/chat/huddle/ice", { room: t })).then((n) => n.data) : Promise.resolve({ enabled: !0, iceServers: [], ttl_s: 0, max_participants: 8 }),
|
|
129
|
+
[a]
|
|
130
|
+
);
|
|
131
|
+
u(() => {
|
|
132
|
+
e && (d.attach(e), y.attach(e, s));
|
|
133
|
+
}, [e, s]), u(() => {
|
|
134
|
+
f++;
|
|
135
|
+
const t = T(), n = X((k) => {
|
|
136
|
+
const b = z(k);
|
|
137
|
+
b && (D(b, { description: "Open the bell or the chat to see them." }), g(v(l.current, "other")));
|
|
138
|
+
});
|
|
139
|
+
return () => {
|
|
140
|
+
f--, t(), n();
|
|
141
|
+
};
|
|
142
|
+
}, []);
|
|
143
|
+
const c = $(d.subscribe, d.getSnapshot), m = A(i) ? [] : c.incoming, p = m.length > 0;
|
|
144
|
+
if (u(() => {
|
|
145
|
+
if (!p) return;
|
|
146
|
+
const t = () => g(v(l.current, "huddle"));
|
|
147
|
+
t();
|
|
148
|
+
const n = setInterval(t, K);
|
|
149
|
+
return () => clearInterval(n);
|
|
150
|
+
}, [p]), !m.length || typeof document > "u") return null;
|
|
151
|
+
const N = (t) => {
|
|
152
|
+
d.answer(t.room, !0), F() && G(t.room), y.join(t.room);
|
|
153
|
+
};
|
|
154
|
+
return j(
|
|
155
|
+
/* @__PURE__ */ o(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: "pointer-events-none fixed inset-x-0 top-3 z-[60] flex flex-col items-center gap-2 px-4 sm:items-end sm:pr-4",
|
|
159
|
+
"data-huddle-call-layer": !0,
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ r("style", { children: "@keyframes nvr-huddle-drain{from{transform:scaleX(1)}to{transform:scaleX(0)}}" }),
|
|
162
|
+
m.map((t, n) => /* @__PURE__ */ r("div", { className: "pointer-events-auto", children: /* @__PURE__ */ r(
|
|
163
|
+
U,
|
|
164
|
+
{
|
|
165
|
+
call: t,
|
|
166
|
+
index: n,
|
|
167
|
+
onAccept: () => N(t),
|
|
168
|
+
onDecline: () => d.answer(t.room, !1)
|
|
169
|
+
}
|
|
170
|
+
) }, t.room))
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
document.body
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
fe as HuddleCallLayer,
|
|
179
|
+
ue as huddleCallLayerMounted
|
|
180
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { Video as N, MicOff as j } from "lucide-react";
|
|
3
|
+
import { useSyncExternalStore as b, useRef as v, useState as C, useEffect as k, useMemo as w } from "react";
|
|
4
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
5
|
+
import { cameraStore as c, pausedCameras as O, cameraSupported as R, videoLayout as H } from "./huddle-camera.js";
|
|
6
|
+
import { useHuddleSpeaking as M } from "./useHuddleAudio.js";
|
|
7
|
+
function G({ disabled: n }) {
|
|
8
|
+
const a = b(c.subscribe, c.getSnapshot);
|
|
9
|
+
if (!w(R, [])) return null;
|
|
10
|
+
const e = !!a.stream;
|
|
11
|
+
return /* @__PURE__ */ r(
|
|
12
|
+
"button",
|
|
13
|
+
{
|
|
14
|
+
type: "button",
|
|
15
|
+
onClick: () => c.toggle(),
|
|
16
|
+
disabled: n || a.starting,
|
|
17
|
+
className: u(
|
|
18
|
+
"flex h-6 w-6 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40",
|
|
19
|
+
e ? "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100" : "text-slate-500 hover:bg-slate-200/70 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100"
|
|
20
|
+
),
|
|
21
|
+
"aria-pressed": e,
|
|
22
|
+
"aria-label": e ? "Turn your camera off" : "Turn your camera on",
|
|
23
|
+
"data-tip": e ? "Camera off" : "Camera on",
|
|
24
|
+
"data-huddle-camera": e ? "on" : "off",
|
|
25
|
+
children: /* @__PURE__ */ r(N, { className: "h-3.5 w-3.5", strokeWidth: 2 })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function g({
|
|
30
|
+
stream: n,
|
|
31
|
+
name: a,
|
|
32
|
+
muted: l,
|
|
33
|
+
mirror: e,
|
|
34
|
+
note: o,
|
|
35
|
+
speaking: i
|
|
36
|
+
}) {
|
|
37
|
+
const d = v(null);
|
|
38
|
+
return k(() => {
|
|
39
|
+
const s = d.current;
|
|
40
|
+
if (s)
|
|
41
|
+
return s.srcObject = n, s.play().catch(() => null), () => {
|
|
42
|
+
s.srcObject = null;
|
|
43
|
+
};
|
|
44
|
+
}, [n]), /* @__PURE__ */ p(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: u(
|
|
48
|
+
"relative aspect-video overflow-hidden rounded-lg bg-[#0f172a] ring-2 transition-[box-shadow] duration-200",
|
|
49
|
+
i ? "ring-emerald-500 dark:ring-emerald-400" : "ring-transparent"
|
|
50
|
+
),
|
|
51
|
+
"data-huddle-tile": e ? "mine" : "peer",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ r(
|
|
54
|
+
"video",
|
|
55
|
+
{
|
|
56
|
+
ref: d,
|
|
57
|
+
muted: !0,
|
|
58
|
+
playsInline: !0,
|
|
59
|
+
className: u("h-full w-full object-cover", e && "-scale-x-100")
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
o && /* @__PURE__ */ r("span", { className: "absolute inset-0 flex items-center justify-center bg-[#0f172a]/75 px-3 text-center text-[11px] font-medium text-white", children: o }),
|
|
63
|
+
/* @__PURE__ */ p("span", { className: "absolute bottom-1.5 left-2 inline-flex max-w-[calc(100%-1rem)] items-center gap-1 rounded bg-black/55 px-1.5 py-0.5 text-[10.5px] font-medium text-white", children: [
|
|
64
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: a }),
|
|
65
|
+
l && /* @__PURE__ */ r(j, { className: "h-3 w-3 shrink-0", strokeWidth: 2, "aria-label": "muted" })
|
|
66
|
+
] })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function I({
|
|
72
|
+
peers: n,
|
|
73
|
+
roster: a,
|
|
74
|
+
muted: l
|
|
75
|
+
}) {
|
|
76
|
+
const e = b(c.subscribe, c.getSnapshot), o = M(), i = v(null), [d, s] = C(0);
|
|
77
|
+
k(() => {
|
|
78
|
+
const t = i.current;
|
|
79
|
+
if (!t || typeof ResizeObserver > "u") return;
|
|
80
|
+
const x = new ResizeObserver(([S]) => s(Math.round(S.contentRect.width)));
|
|
81
|
+
return x.observe(t), () => x.disconnect();
|
|
82
|
+
}, []);
|
|
83
|
+
const y = w(() => O(a), [a]), f = n.filter((t) => t.camera && !y.has(t.socket)), h = f.length + (e.stream ? 1 : 0);
|
|
84
|
+
if (!h) return /* @__PURE__ */ r("div", { ref: i });
|
|
85
|
+
const m = H(h, d);
|
|
86
|
+
return /* @__PURE__ */ p(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
ref: i,
|
|
90
|
+
className: u(
|
|
91
|
+
"mt-1.5",
|
|
92
|
+
m === "strip" ? "flex snap-x gap-1.5 overflow-x-auto pb-0.5 [&>*]:w-[148px] [&>*]:shrink-0 [&>*]:snap-start" : m === "two" ? "grid max-w-[560px] grid-cols-2 gap-1.5" : "grid max-w-[320px] grid-cols-1"
|
|
93
|
+
),
|
|
94
|
+
"data-huddle-video": m,
|
|
95
|
+
children: [
|
|
96
|
+
e.stream && /* @__PURE__ */ r(
|
|
97
|
+
g,
|
|
98
|
+
{
|
|
99
|
+
stream: e.stream,
|
|
100
|
+
name: "You",
|
|
101
|
+
muted: l,
|
|
102
|
+
mirror: !0,
|
|
103
|
+
speaking: o.selfSpeaking,
|
|
104
|
+
note: e.paused ? "Video paused to keep the call smooth" : void 0
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
f.map((t) => /* @__PURE__ */ r(
|
|
108
|
+
g,
|
|
109
|
+
{
|
|
110
|
+
stream: t.camera,
|
|
111
|
+
name: t.name ?? "Someone",
|
|
112
|
+
muted: t.muted,
|
|
113
|
+
speaking: !!o.speaking[t.socket]
|
|
114
|
+
},
|
|
115
|
+
t.socket
|
|
116
|
+
))
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
G as HuddleCameraButton,
|
|
123
|
+
I as HuddleVideoGrid
|
|
124
|
+
};
|