@poolse/react-ui 2.22.0 → 2.24.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/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CallParticipant, CallMedia, LiveKitModule, CallDevice, CallDeviceKind, Uuid, Message, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, SVGProps, ReactElement } from 'react';
5
- import { UploadItem, ReactionMap } from '@poolse/react';
5
+ import { UseRoom, UploadItem, ReactionMap } from '@poolse/react';
6
6
 
7
7
  interface CallVideoGridProps {
8
8
  participants: CallParticipant[];
@@ -664,6 +664,34 @@ interface LiveCallBannerProps {
664
664
  }
665
665
  declare function LiveCallBanner({ call, inCall, onJoin }: LiveCallBannerProps): react_jsx_runtime.JSX.Element;
666
666
 
667
+ interface RoomJoinBarProps {
668
+ room: UseRoom;
669
+ /**
670
+ * Offer to start a room when none is live. Off, the bar shows only
671
+ * while a room (or call) is running — a pure "Join" banner.
672
+ */
673
+ allowStart?: boolean;
674
+ }
675
+ /**
676
+ * "Video room · 2 in the room · Join" while one runs; "Start a room ·
677
+ * Voice · Video" when none does. Renders nothing once you are in.
678
+ */
679
+ declare function RoomJoinBar({ room, allowStart }: RoomJoinBarProps): react_jsx_runtime.JSX.Element | null;
680
+ interface RoomStageProps {
681
+ room: UseRoom;
682
+ /** The conversation's name, shown at the top. */
683
+ title?: string;
684
+ labelFor?: (userId: string) => string;
685
+ className?: string;
686
+ }
687
+ /**
688
+ * The room you are in: everyone's video (or their initial while their
689
+ * camera is off), and the controls — microphone, camera and output, each
690
+ * with a device picker, and Leave. Fills its container: give it the
691
+ * space your layout has for the stage.
692
+ */
693
+ declare function RoomStage({ room, title, labelFor, className }: RoomStageProps): react_jsx_runtime.JSX.Element;
694
+
667
695
  interface EditableMessageBubbleProps {
668
696
  message: Message;
669
697
  currentUserId: string | null;
@@ -1011,4 +1039,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
1011
1039
  */
1012
1040
  declare function PoolseFonts(): null;
1013
1041
 
1014
- export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallLogRow, type CallLogRowProps, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
1042
+ export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallLogRow, type CallLogRowProps, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CallParticipant, CallMedia, LiveKitModule, CallDevice, CallDeviceKind, Uuid, Message, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, SVGProps, ReactElement } from 'react';
5
- import { UploadItem, ReactionMap } from '@poolse/react';
5
+ import { UseRoom, UploadItem, ReactionMap } from '@poolse/react';
6
6
 
7
7
  interface CallVideoGridProps {
8
8
  participants: CallParticipant[];
@@ -664,6 +664,34 @@ interface LiveCallBannerProps {
664
664
  }
665
665
  declare function LiveCallBanner({ call, inCall, onJoin }: LiveCallBannerProps): react_jsx_runtime.JSX.Element;
666
666
 
667
+ interface RoomJoinBarProps {
668
+ room: UseRoom;
669
+ /**
670
+ * Offer to start a room when none is live. Off, the bar shows only
671
+ * while a room (or call) is running — a pure "Join" banner.
672
+ */
673
+ allowStart?: boolean;
674
+ }
675
+ /**
676
+ * "Video room · 2 in the room · Join" while one runs; "Start a room ·
677
+ * Voice · Video" when none does. Renders nothing once you are in.
678
+ */
679
+ declare function RoomJoinBar({ room, allowStart }: RoomJoinBarProps): react_jsx_runtime.JSX.Element | null;
680
+ interface RoomStageProps {
681
+ room: UseRoom;
682
+ /** The conversation's name, shown at the top. */
683
+ title?: string;
684
+ labelFor?: (userId: string) => string;
685
+ className?: string;
686
+ }
687
+ /**
688
+ * The room you are in: everyone's video (or their initial while their
689
+ * camera is off), and the controls — microphone, camera and output, each
690
+ * with a device picker, and Leave. Fills its container: give it the
691
+ * space your layout has for the stage.
692
+ */
693
+ declare function RoomStage({ room, title, labelFor, className }: RoomStageProps): react_jsx_runtime.JSX.Element;
694
+
667
695
  interface EditableMessageBubbleProps {
668
696
  message: Message;
669
697
  currentUserId: string | null;
@@ -1011,4 +1039,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
1011
1039
  */
1012
1040
  declare function PoolseFonts(): null;
1013
1041
 
1014
- export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallLogRow, type CallLogRowProps, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
1042
+ export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallLogRow, type CallLogRowProps, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { createContext, forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useMemo, Fragment as Fragment$1, useContext } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, sameDay, formatDayLabel, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl, useCalls, useCallRoom, useVoiceRoom } from '@poolse/react';
4
+ import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, canEditOwnMessage, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl, useCalls, useCallRoom, useVoiceRoom } from '@poolse/react';
5
5
  import ReactMarkdown from 'react-markdown';
6
6
  import remarkGfm from 'remark-gfm';
7
7
 
@@ -365,7 +365,9 @@ function CallVideoTile({
365
365
  className: "callgrid__avatar",
366
366
  style: { background: userColor(participant.userId) },
367
367
  "aria-hidden": "true",
368
- children: initialsOf(name)
368
+ children: initialsOf(
369
+ participant.isSelf ? participant.name ?? label(participant.userId) : name
370
+ )
369
371
  }
370
372
  ) }),
371
373
  !hideName && /* @__PURE__ */ jsxs("div", { className: "callgrid__caption", children: [
@@ -844,8 +846,8 @@ function PoolseFonts() {
844
846
  return null;
845
847
  }
846
848
  function LiveCallBanner({ call, inCall, onJoin }) {
847
- const what = call.media === "video" ? "Video call in progress" : "Voice call in progress";
848
- const who = inCall > 0 ? `${inCall} on the call` : "Ringing";
849
+ const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
850
+ const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
849
851
  return /* @__PURE__ */ jsxs("div", { className: "poolse-live-call", role: "status", "aria-label": `${what}, ${who}`, children: [
850
852
  /* @__PURE__ */ jsx(
851
853
  PoolseIcon,
@@ -2757,8 +2759,10 @@ function ConversationView({
2757
2759
  () => messages.filter((m) => isMessageVisibleTo(m, meIdForFeed)),
2758
2760
  [messages, meIdForFeed]
2759
2761
  );
2762
+ const receiptsVisible = receiptsOf(me).visible;
2763
+ const showReadState = readReceipts && receiptsVisible;
2760
2764
  const maxReadByOthers = useMemo(() => {
2761
- if (!readReceipts || !me) return null;
2765
+ if (!showReadState || !me) return null;
2762
2766
  let max = 0;
2763
2767
  let any = false;
2764
2768
  for (const m of members) {
@@ -2773,7 +2777,7 @@ function ConversationView({
2773
2777
  any = true;
2774
2778
  }
2775
2779
  return any ? max : null;
2776
- }, [readReceipts, me, members, messages]);
2780
+ }, [showReadState, me, members, messages]);
2777
2781
  const [editingId, setEditingId] = useState(null);
2778
2782
  const [threadRootId, setThreadRootId] = useState(null);
2779
2783
  const threadRoot = useMemo(
@@ -2926,7 +2930,7 @@ function ConversationView({
2926
2930
  };
2927
2931
  })() : msg;
2928
2932
  const isSelf = me !== null && msg.sender_id === me.id;
2929
- const readState = readReceipts && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
2933
+ const readState = showReadState && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
2930
2934
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2931
2935
  showDaySeparator && /* @__PURE__ */ jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsx("span", { children: formatDayLabel(msg.inserted_at) }) }),
2932
2936
  /* @__PURE__ */ jsx(
@@ -2947,7 +2951,13 @@ function ConversationView({
2947
2951
  ...readState ? { readState } : {},
2948
2952
  ...labelFor ? { labelFor } : {},
2949
2953
  editing: editingId === msg.id,
2950
- onStartEdit: () => setEditingId(msg.id),
2954
+ ...canEditOwnMessage({
2955
+ isSelf,
2956
+ deleted: !!msg.deleted_at,
2957
+ receiptsVisible,
2958
+ readState,
2959
+ insertedAt: msg.inserted_at
2960
+ }) ? { onStartEdit: () => setEditingId(msg.id) } : {},
2951
2961
  onCancelEdit: () => setEditingId(null),
2952
2962
  onSaveEdit: async (body) => {
2953
2963
  await edit(msg.id, body);
@@ -3628,6 +3638,206 @@ var PoolseInbox = forwardRef(function PoolseInbox2({
3628
3638
  ) : null
3629
3639
  ] });
3630
3640
  });
3641
+ function RoomJoinBar({ room, allowStart = true }) {
3642
+ if (room.joined) return null;
3643
+ const live = room.live;
3644
+ if (live) {
3645
+ const isRoom = live.kind === "room";
3646
+ const what = isRoom ? live.media === "video" ? "Video room" : "Voice room" : live.media === "video" ? "Video call in progress" : "Call in progress";
3647
+ const n = room.presentIds.length;
3648
+ return /* @__PURE__ */ jsxs("div", { className: "poolse-roombar poolse-roombar--live", role: "status", children: [
3649
+ /* @__PURE__ */ jsx("span", { className: "poolse-roombar__dot", "aria-hidden": "true" }),
3650
+ /* @__PURE__ */ jsxs("span", { className: "poolse-roombar__text", children: [
3651
+ /* @__PURE__ */ jsx("strong", { children: what }),
3652
+ /* @__PURE__ */ jsx("span", { children: n > 0 ? ` \xB7 ${n} in the room` : " \xB7 starting" })
3653
+ ] }),
3654
+ /* @__PURE__ */ jsxs("span", { className: "poolse-roombar__actions", children: [
3655
+ /* @__PURE__ */ jsxs(
3656
+ "button",
3657
+ {
3658
+ type: "button",
3659
+ className: "poolse-roombar__btn",
3660
+ onClick: () => void room.join("audio"),
3661
+ disabled: room.joining,
3662
+ children: [
3663
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
3664
+ " Join"
3665
+ ]
3666
+ }
3667
+ ),
3668
+ /* @__PURE__ */ jsxs(
3669
+ "button",
3670
+ {
3671
+ type: "button",
3672
+ className: "poolse-roombar__btn poolse-roombar__btn--primary",
3673
+ onClick: () => void room.join("video"),
3674
+ disabled: room.joining,
3675
+ children: [
3676
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "video", size: 15, label: null }),
3677
+ " Join with video"
3678
+ ]
3679
+ }
3680
+ )
3681
+ ] })
3682
+ ] });
3683
+ }
3684
+ if (!allowStart) return null;
3685
+ return /* @__PURE__ */ jsxs("div", { className: "poolse-roombar", children: [
3686
+ /* @__PURE__ */ jsx("span", { className: "poolse-roombar__text", children: "Start a room \u2014 nobody is rung, anyone here can drop in" }),
3687
+ /* @__PURE__ */ jsxs("span", { className: "poolse-roombar__actions", children: [
3688
+ /* @__PURE__ */ jsxs(
3689
+ "button",
3690
+ {
3691
+ type: "button",
3692
+ className: "poolse-roombar__btn",
3693
+ onClick: () => void room.join("audio"),
3694
+ disabled: room.joining,
3695
+ children: [
3696
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
3697
+ " Voice"
3698
+ ]
3699
+ }
3700
+ ),
3701
+ /* @__PURE__ */ jsxs(
3702
+ "button",
3703
+ {
3704
+ type: "button",
3705
+ className: "poolse-roombar__btn poolse-roombar__btn--primary",
3706
+ onClick: () => void room.join("video"),
3707
+ disabled: room.joining,
3708
+ children: [
3709
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "video", size: 15, label: null }),
3710
+ " Video"
3711
+ ]
3712
+ }
3713
+ )
3714
+ ] })
3715
+ ] });
3716
+ }
3717
+ function RoomStage({ room, title, labelFor, className }) {
3718
+ const media = room.media;
3719
+ const [menu, setMenu] = useState(null);
3720
+ const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
3721
+ const openMenu = useCallback(
3722
+ (kind) => {
3723
+ media.refreshDevices();
3724
+ setMenu((current) => current === kind ? null : kind);
3725
+ },
3726
+ [media]
3727
+ );
3728
+ const count = media.participants.length;
3729
+ const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3730
+ return /* @__PURE__ */ jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3731
+ /* @__PURE__ */ jsxs("header", { className: "poolse-room__head", children: [
3732
+ /* @__PURE__ */ jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3733
+ /* @__PURE__ */ jsx("span", { className: "poolse-room__status", children: status })
3734
+ ] }),
3735
+ /* @__PURE__ */ jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsx(
3736
+ CallVideoGrid,
3737
+ {
3738
+ participants: media.participants,
3739
+ ...labelFor ? { labelFor } : {},
3740
+ onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3741
+ }
3742
+ ) : /* @__PURE__ */ jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3743
+ room.error && /* @__PURE__ */ jsx("p", { className: "poolse-room__error", children: room.error.message }),
3744
+ /* @__PURE__ */ jsxs("div", { className: "poolse-room__bar", children: [
3745
+ /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3746
+ /* @__PURE__ */ jsx(
3747
+ CallControlButton,
3748
+ {
3749
+ icon: media.micEnabled ? "mic" : "mic-off",
3750
+ active: !media.micEnabled,
3751
+ label: media.micEnabled ? "Mute" : "Unmute",
3752
+ onClick: () => void media.toggleMic(),
3753
+ hasMenu: media.devices.audioinput.length > 0,
3754
+ onMenuClick: () => openMenu("audioinput")
3755
+ }
3756
+ ),
3757
+ menu === "audioinput" && /* @__PURE__ */ jsx(
3758
+ CallDeviceMenu,
3759
+ {
3760
+ title: "Microphone",
3761
+ devices: media.devices.audioinput,
3762
+ activeId: media.activeDevices.audioinput,
3763
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3764
+ onClose: () => setMenu(null)
3765
+ }
3766
+ )
3767
+ ] }),
3768
+ /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3769
+ /* @__PURE__ */ jsx(
3770
+ CallControlButton,
3771
+ {
3772
+ icon: media.cameraEnabled ? "video" : "video-off",
3773
+ active: !media.cameraEnabled,
3774
+ label: media.cameraEnabled ? "Camera" : "Camera off",
3775
+ onClick: () => void media.toggleCamera(),
3776
+ disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3777
+ hasMenu: media.devices.videoinput.length > 0,
3778
+ onMenuClick: () => openMenu("videoinput")
3779
+ }
3780
+ ),
3781
+ menu === "videoinput" && /* @__PURE__ */ jsx(
3782
+ CallDeviceMenu,
3783
+ {
3784
+ title: "Camera",
3785
+ devices: media.devices.videoinput,
3786
+ activeId: media.activeDevices.videoinput,
3787
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3788
+ onClose: () => setMenu(null)
3789
+ }
3790
+ )
3791
+ ] }),
3792
+ media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3793
+ /* @__PURE__ */ jsx(
3794
+ CallControlButton,
3795
+ {
3796
+ icon: "speaker",
3797
+ label: "Speaker",
3798
+ onClick: () => openMenu("audiooutput")
3799
+ }
3800
+ ),
3801
+ menu === "audiooutput" && /* @__PURE__ */ jsx(
3802
+ CallDeviceMenu,
3803
+ {
3804
+ title: "Speaker",
3805
+ devices: media.devices.audiooutput,
3806
+ activeId: media.activeDevices.audiooutput,
3807
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3808
+ onClose: () => setMenu(null)
3809
+ }
3810
+ )
3811
+ ] }),
3812
+ /* @__PURE__ */ jsx(
3813
+ CallControlButton,
3814
+ {
3815
+ icon: "phone-off",
3816
+ tone: "danger",
3817
+ large: true,
3818
+ label: "Leave",
3819
+ onClick: room.leave
3820
+ }
3821
+ )
3822
+ ] })
3823
+ ] });
3824
+ }
3825
+ function useElapsed(startedAt, running) {
3826
+ const [, tick] = useState(0);
3827
+ useEffect(() => {
3828
+ if (!running) return;
3829
+ const id = setInterval(() => tick((n) => n + 1), 1e3);
3830
+ return () => clearInterval(id);
3831
+ }, [running]);
3832
+ if (!running || !startedAt) return null;
3833
+ const start = Date.parse(startedAt);
3834
+ if (!Number.isFinite(start)) return null;
3835
+ const total = Math.max(0, Math.floor((Date.now() - start) / 1e3));
3836
+ const h = Math.floor(total / 3600);
3837
+ const m = Math.floor(total % 3600 / 60);
3838
+ const s = String(total % 60).padStart(2, "0");
3839
+ return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`;
3840
+ }
3631
3841
  var MARK_PATHS = /* @__PURE__ */ jsxs(Fragment, { children: [
3632
3842
  /* @__PURE__ */ jsx(
3633
3843
  "path",
@@ -3736,6 +3946,6 @@ function PoolseLogo({
3736
3946
  );
3737
3947
  }
3738
3948
 
3739
- export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, CallProvider, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useCallInvite, useDisplayName, usePoolseFonts };
3949
+ export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, CallProvider, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, RoomJoinBar, RoomStage, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useCallInvite, useDisplayName, usePoolseFonts };
3740
3950
  //# sourceMappingURL=index.js.map
3741
3951
  //# sourceMappingURL=index.js.map