// Copyright 2024 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React 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 { 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'; function toUrlWithoutProtocol(url: URL): string { return `${url.hostname}${url.pathname}${url.search}${url.hash}`; } export type CallLinkDetailsProps = Readonly<{ callHistoryGroup: CallHistoryGroup; callLink: CallLinkType; i18n: LocalizerType; onStartCallLinkLobby: () => void; onShareCallLinkViaSignal: () => void; }>; export function CallLinkDetails({ callHistoryGroup, callLink, i18n, onStartCallLinkLobby, onShareCallLinkViaSignal, }: CallLinkDetailsProps): JSX.Element { const webUrl = linkCallRoute.toWebUrl({ key: callLink.rootKey, }); return (

{callLink.name === '' ? i18n('icu:calling__call-link-default-title') : callLink.name}

{toUrlWithoutProtocol(webUrl)}

} label={i18n('icu:CallLinkDetails__CopyLink')} onClick={() => { drop(copyCallLink(webUrl.toString())); }} /> } label={i18n('icu:CallLinkDetails__ShareLinkViaSignal')} onClick={onShareCallLinkViaSignal} />
); }