({ project, hotkey = false, ...buttonProps }: Props)
| 12 | } |
| 13 | |
| 14 | export function ProjectCallButton({ project, hotkey = false, ...buttonProps }: Props) { |
| 15 | // TODO: Support calls in post projects. |
| 16 | // https://linear.app/campsite/project/calls-in-channels-9f829815473a/overview |
| 17 | const { data: thread } = useGetThread({ threadId: project?.message_thread_id }) |
| 18 | const { joinCall, canJoin, onCall } = useJoinMessageThreadCall({ thread }) |
| 19 | const label = onCall ? 'Already joined call' : 'Start call' |
| 20 | |
| 21 | if (!canJoin && !onCall) return null |
| 22 | |
| 23 | return ( |
| 24 | <> |
| 25 | {hotkey && ( |
| 26 | <LayeredHotkeys |
| 27 | keys='mod+shift+h' |
| 28 | callback={joinCall} |
| 29 | options={{ preventDefault: true, enableOnContentEditable: true }} |
| 30 | /> |
| 31 | )} |
| 32 | |
| 33 | <Button |
| 34 | accessibilityLabel='Start call' |
| 35 | tooltip={buttonProps?.iconOnly ? label : undefined} |
| 36 | tooltipShortcut={hotkey ? '⌘+shift+H' : undefined} |
| 37 | onClick={joinCall} |
| 38 | disabled={onCall} |
| 39 | {...buttonProps} |
| 40 | > |
| 41 | {buttonProps.children || (!buttonProps.iconOnly && label)} |
| 42 | </Button> |
| 43 | </> |
| 44 | ) |
| 45 | } |
| 46 | |
| 47 | export function BreadcrumbProjectCallButton({ project }: Props) { |
| 48 | return <ProjectCallButton project={project} variant='plain' hotkey iconOnly={<VideoCameraIcon size={24} />} /> |
nothing calls this directly
no test coverage detected