// Copyright 2024 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useState } from 'react'; import type { CallHistoryGroup } from '../types/CallDisposition'; import type { LocalizerType } from '../types/I18N'; import { CallHistoryGroupPanelSection } from './conversation/conversation-details/CallHistoryGroupPanelSection'; import { PanelSection } from './conversation/conversation-details/PanelSection'; import { ConversationDetailsIcon, IconType, } from './conversation/conversation-details/ConversationDetailsIcon'; import { PanelRow } from './conversation/conversation-details/PanelRow'; import type { CallLinkRestrictions, CallLinkType } from '../types/CallLink'; import { linkCallRoute } from '../util/signalRoutes'; import { drop } from '../util/drop'; import { Avatar, AvatarSize } from './Avatar'; import { Button, ButtonSize, ButtonVariant } from './Button'; import { copyCallLink } from '../util/copyLinksWithToast'; import { getColorForCallLink } from '../util/getColorForCallLink'; import { isCallLinkAdmin } from '../types/CallLink'; import { CallLinkRestrictionsSelect } from './CallLinkRestrictionsSelect'; import { ConfirmationDialog } from './ConfirmationDialog'; import { InAnotherCallTooltip } from './conversation/InAnotherCallTooltip'; function toUrlWithoutProtocol(url: URL): string { return `${url.hostname}${url.pathname}${url.search}${url.hash}`; } export type CallLinkDetailsProps = Readonly<{ callHistoryGroup: CallHistoryGroup; callLink: CallLinkType; hasActiveCall: boolean; i18n: LocalizerType; onDeleteCallLink: () => void; onOpenCallLinkAddNameModal: () => void; onStartCallLinkLobby: () => void; onShareCallLinkViaSignal: () => void; onUpdateCallLinkRestrictions: (restrictions: CallLinkRestrictions) => void; }>; export function CallLinkDetails({ callHistoryGroup, callLink, i18n, hasActiveCall, onDeleteCallLink, onOpenCallLinkAddNameModal, onStartCallLinkLobby, onShareCallLinkViaSignal, onUpdateCallLinkRestrictions, }: CallLinkDetailsProps): JSX.Element { const [isDeleteCallLinkModalOpen, setIsDeleteCallLinkModalOpen] = useState(false); const webUrl = linkCallRoute.toWebUrl({ key: callLink.rootKey, }); const joinButton = ( ); return (
{toUrlWithoutProtocol(webUrl)}