diff --git a/models/love/package.json b/models/love/package.json index df1350d72ed..459084a8003 100644 --- a/models/love/package.json +++ b/models/love/package.json @@ -56,6 +56,7 @@ "@hcengineering/time": "^0.7.0", "@hcengineering/ui": "^0.7.0", "@hcengineering/view": "^0.7.0", - "@hcengineering/workbench": "^0.7.0" + "@hcengineering/workbench": "^0.7.0", + "@hcengineering/card": "^0.7.0" } } diff --git a/models/love/src/index.ts b/models/love/src/index.ts index cb7139738f9..701c299b87a 100644 --- a/models/love/src/index.ts +++ b/models/love/src/index.ts @@ -13,6 +13,7 @@ // limitations under the License. // +import card from '@hcengineering/card' import contact, { type Employee, type Person } from '@hcengineering/contact' import { AccountRole, @@ -439,6 +440,18 @@ export function createModel (builder: Builder): void { } }) + createAction(builder, { + action: love.actionImpl.StartMeeting, + label: love.string.StartMeeting, + icon: love.icon.Cam, + input: 'focus', + category: love.category.Office, + target: card.class.Card, + context: { + mode: ['context'] + } + }) + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { ofClass: love.class.Room, components: { input: { component: chunter.component.ChatMessageInput, props: { collection: 'messages' } } } diff --git a/models/love/src/plugin.ts b/models/love/src/plugin.ts index 1c549226796..08d78e07e8a 100644 --- a/models/love/src/plugin.ts +++ b/models/love/src/plugin.ts @@ -45,7 +45,8 @@ export default mergeIds(loveId, love, { ToggleMic: '' as ViewAction, ToggleVideo: '' as ViewAction, ShowRoomSettings: '' as ViewAction, - CopyGuestLink: '' as ViewAction + CopyGuestLink: '' as ViewAction, + StartMeeting: '' as ViewAction }, ids: { Settings: '' as Ref, diff --git a/plugins/love-resources/package.json b/plugins/love-resources/package.json index d2f33564b9c..b906631bb27 100644 --- a/plugins/love-resources/package.json +++ b/plugins/love-resources/package.json @@ -42,6 +42,7 @@ "@hcengineering/ai-bot-resources": "^0.7.0", "@hcengineering/analytics": "^0.7.5", "@hcengineering/calendar": "^0.7.0", + "@hcengineering/card": "^0.7.0", "@hcengineering/chunter": "^0.7.0", "@hcengineering/chunter-resources": "^0.7.0", "@hcengineering/contact": "^0.7.0", diff --git a/plugins/love-resources/src/components/EditRoom.svelte b/plugins/love-resources/src/components/EditRoom.svelte index e079c679607..60c68d41dc6 100644 --- a/plugins/love-resources/src/components/EditRoom.svelte +++ b/plugins/love-resources/src/components/EditRoom.svelte @@ -20,9 +20,10 @@ import love from '../plugin' import { getRoomName } from '../utils' - import { infos, myOffice, currentRoom } from '../stores' + import { infos, myOffice } from '../stores' import { lkSessionConnected } from '../liveKitClient' - import { createMeeting, joinMeeting } from '../meetings' + import { activeMeeting, createMeeting, joinMeeting } from '../meetings' + import { ActiveMeeting } from '../types' export let object: Room @@ -48,8 +49,9 @@ await createMeeting(object) } } - - $: connecting = tryConnecting || ($currentRoom?._id === object._id && !$lkSessionConnected) + $: connecting = + tryConnecting || + ($activeMeeting?.type === 'room' && $activeMeeting.document.attachedTo === object._id && !$lkSessionConnected) let connectLabel: IntlString = $infos.some(({ room }) => room === object._id) ? love.string.JoinMeeting @@ -67,7 +69,7 @@ isConnected: boolean, info: ParticipantInfo[], myOffice?: Room, - currentRoom?: Room + currentMeeting?: ActiveMeeting ): boolean { if (isOffice(object)) { // Do not show connect button in own office @@ -83,8 +85,9 @@ // Show during connecting with spinner if (connecting) return true + if (currentMeeting?.type !== 'room') return true // Do not show connect button if we are already connected to the room - if (isConnected && currentRoom?._id === object._id) return false + if (isConnected && currentMeeting.document?.attachedTo === object._id) return false return true } @@ -95,7 +98,7 @@
- {#if showConnectionButton(object, connecting, $lkSessionConnected, $infos, $myOffice, $currentRoom)} + {#if showConnectionButton(object, connecting, $lkSessionConnected, $infos, $myOffice, $activeMeeting)} {/if} diff --git a/plugins/love-resources/src/components/MediaPopupItemExt.svelte b/plugins/love-resources/src/components/MediaPopupItemExt.svelte index a02a2119c66..94a886aaccd 100644 --- a/plugins/love-resources/src/components/MediaPopupItemExt.svelte +++ b/plugins/love-resources/src/components/MediaPopupItemExt.svelte @@ -1,16 +1,13 @@ -{#if $lkSessionConnected && $currentRoom != null} - {@const overLimit = participants.length > limit} - +{#if $lkSessionConnected && $activeMeeting !== undefined}
- +
- {#if overLimit} -
- {#each participants.slice(0, limit) as participant, i (participant._id)} -
- -
- {/each} -
- {:else} -
- {#each participants as participant (participant._id)} - - {/each} -
- {/if} -
{#if allowLeave || leaving} diff --git a/plugins/love-resources/src/components/ParticipantsList.svelte b/plugins/love-resources/src/components/ParticipantsList.svelte index 8b987398ca4..27f677d922f 100644 --- a/plugins/love-resources/src/components/ParticipantsList.svelte +++ b/plugins/love-resources/src/components/ParticipantsList.svelte @@ -14,32 +14,30 @@ --> - {#each items as participant (participant.person)} + {#each items as item} + {@const person = $personByRefStore.get(item)} +
participant.onclick?.(e)} + class:cursor-pointer={item.onclick !== undefined} + on:click={(e) => item.onclick?.(e)} >
- +
- {formatName(participant.name)} + {formatName(person?.name ?? '')}
{/each}
diff --git a/plugins/love-resources/src/components/Room.svelte b/plugins/love-resources/src/components/Room.svelte index ff7c0bff190..3ff3f87f6b2 100644 --- a/plugins/love-resources/src/components/Room.svelte +++ b/plugins/love-resources/src/components/Room.svelte @@ -14,20 +14,18 @@ --> -{#if $currentRoom !== undefined} +{#if $activeMeeting !== undefined} dispatch('close')} > - {$currentRoom.name} + {$activeMeeting?.document.title} - + {/if} diff --git a/plugins/love-resources/src/components/RoomPopup.svelte b/plugins/love-resources/src/components/RoomPopup.svelte index df32a6e3d7b..dfa76dd9b39 100644 --- a/plugins/love-resources/src/components/RoomPopup.svelte +++ b/plugins/love-resources/src/components/RoomPopup.svelte @@ -13,53 +13,48 @@ // limitations under the License. -->
- +
- {#each info as inf} - {#await getPerson(inf) then person} + {#each meetingInfo?.persons ?? [] as personRef} + {#await getPersonByPersonRef(personRef) then person} {#if person}
{/if} @@ -102,7 +97,7 @@
- {#if joined && $lkSessionConnected} + {#if myMeeting && $lkSessionConnected}
@@ -110,7 +105,7 @@
{/if}
- {#if canGoBack(joined, $location, $currentMeetingMinutes)} + {#if canGoBack(myMeeting, $location, $activeMeeting)} {/if} - {#if joined} - dispatch('close')} /> + {#if myMeeting} + dispatch('close')} /> {:else} import { getCurrentEmployee, Person } from '@hcengineering/contact' import { Avatar, myEmployeeStore, getPersonByPersonRef } from '@hcengineering/contact-resources' - import { ParticipantInfo, Room, RoomAccess, RoomType, MeetingStatus } from '@hcengineering/love' + import { ParticipantInfo, Room, RoomAccess, RoomType } from '@hcengineering/love' import { Icon, Label, eventToHTMLElement, showPopup } from '@hcengineering/ui' import { createEventDispatcher } from 'svelte' import { getClient } from '@hcengineering/presentation' import { openDoc } from '@hcengineering/view-resources' import love from '../plugin' - import { myInfo, selectedRoomPlace, currentRoom, currentMeetingMinutes } from '../stores' + import { myInfo, selectedRoomPlace } from '../stores' import { getRoomLabel } from '../utils' import PersonActionPopup from './PersonActionPopup.svelte' import { IntlString } from '@hcengineering/platform' import { lkSessionConnected } from '../liveKitClient' + import { activeMeeting } from '../meetings' export let room: Room export let info: ParticipantInfo[] @@ -72,19 +73,8 @@ async function openRoom (x: number, y: number): Promise { const client = getClient() const hierarchy = client.getHierarchy() - if ($lkSessionConnected && $currentRoom?._id === room._id) { - let meeting = $currentMeetingMinutes - if (meeting?.attachedTo !== room._id || meeting?.status !== MeetingStatus.Active) { - meeting = await client.findOne(love.class.MeetingMinutes, { - attachedTo: room._id, - status: MeetingStatus.Active - }) - } - if (meeting === undefined) { - await openDoc(hierarchy, room) - } else { - await openDoc(hierarchy, meeting) - } + if ($lkSessionConnected && $activeMeeting?.type === 'room' && $activeMeeting.document?.attachedTo === room._id) { + await openDoc(hierarchy, $activeMeeting.document) } else { selectedRoomPlace.set({ _id: room._id, x, y }) await openDoc(hierarchy, room) diff --git a/plugins/love-resources/src/components/VideoPopup.svelte b/plugins/love-resources/src/components/VideoPopup.svelte index d264f5b6ccf..a0058b52023 100644 --- a/plugins/love-resources/src/components/VideoPopup.svelte +++ b/plugins/love-resources/src/components/VideoPopup.svelte @@ -13,8 +13,6 @@ // limitations under the License. --> diff --git a/plugins/love-resources/src/components/meeting/ControlBar.svelte b/plugins/love-resources/src/components/meeting/ControlBar.svelte index 76d2ba5fc97..dc91bf9d785 100644 --- a/plugins/love-resources/src/components/meeting/ControlBar.svelte +++ b/plugins/love-resources/src/components/meeting/ControlBar.svelte @@ -13,11 +13,9 @@ // limitations under the License. -->
- {#if room._id !== love.ids.Reception && $lkSessionConnected} - + {#if $lkSessionConnected} + - - + + {:else} - + {/if} @@ -102,10 +96,8 @@ on:click={maximize} /> {/if} - - {#if allowLeave} - - {/if} + + diff --git a/plugins/love-resources/src/components/meeting/ControlExt.svelte b/plugins/love-resources/src/components/meeting/ControlExt.svelte index 7a990fc4d3a..ecc01778e97 100644 --- a/plugins/love-resources/src/components/meeting/ControlExt.svelte +++ b/plugins/love-resources/src/components/meeting/ControlExt.svelte @@ -13,111 +13,48 @@ // limitations under the License. -->
- {#if activeRooms.length > 0} - - {#each activeRooms as active} - {#await getRoomName(active) then name} + {#if $ongoingMeetings.length > 0} + {#each $ongoingMeetings as ongoingMeeting} + {#await getMeetingName(ongoingMeeting.meeting) then name} r._id === active._id) != null} - on:click={openRoom(active)} + active={$activeMeeting?.document._id === ongoingMeeting.meeting.document._id} + on:click={openMeeting(ongoingMeeting)} + participants={ongoingMeeting.persons.map((person) => ({ + person + }))} /> {/await} {/each} {/if} {#if reception !== undefined && receptionParticipants.length > 0} - {#if activeRooms.length > 0} + {#if $ongoingMeetings.length > 0}
{/if} {#await getRoomName(reception) then name} ({ ...p, onclick: getParticipantClickHandler(p) }))} + participants={receptionParticipants.map((p) => ({ + person: p.person, + onclick: getParticipantClickHandler(p.person) + }))} /> {/await} {/if} diff --git a/plugins/love-resources/src/components/meeting/MeetingHeader.svelte b/plugins/love-resources/src/components/meeting/MeetingHeader.svelte index 9c25cbd0750..0cde79bb04e 100644 --- a/plugins/love-resources/src/components/meeting/MeetingHeader.svelte +++ b/plugins/love-resources/src/components/meeting/MeetingHeader.svelte @@ -1,24 +1,9 @@ -{#if currentMeetingMinutes !== undefined} +{#if meeting !== undefined}
- - {room.name} + + {meeting.document.title ?? ''} - {#if currentMeetingMinutes?.createdOn !== undefined} - {@const elapsed = now - currentMeetingMinutes.createdOn} + {#if meeting.type === 'room' && meeting.document.createdOn !== undefined} + {@const elapsed = now - meeting.document.createdOn}
{formatElapsedTime(elapsed)}
{/if}
{/if} - -
- - {#if currentMeetingMinutes !== undefined} - - {currentMeetingMinutes.title} - - {:else} - - {room.name} - - {/if} -
diff --git a/plugins/love-resources/src/components/meeting/ParticipantsListView.svelte b/plugins/love-resources/src/components/meeting/ParticipantsListView.svelte index a916c120feb..4161fbade92 100644 --- a/plugins/love-resources/src/components/meeting/ParticipantsListView.svelte +++ b/plugins/love-resources/src/components/meeting/ParticipantsListView.svelte @@ -1,16 +1,9 @@ -{#if $lkSessionConnected && moreItems.length > 0} +{#if room !== undefined && $lkSessionConnected && moreItems.length > 0} import { AccountRole, getCurrentAccount, hasAccountRole } from '@hcengineering/core' import { ButtonBaseSize, ModernButton } from '@hcengineering/ui' - import { isRecording, isRecordingAvailable, loveClient } from '../../../utils' + import { isRecording, isRecordingAvailable, toggleRecording } from '../../../utils' import love from '../../../plugin' import { lkSessionConnected } from '../../../liveKitClient' - import { Room } from '@hcengineering/love' - export let room: Room export let size: ButtonBaseSize = 'large' export let kind: 'primary' | 'secondary' | 'tertiary' | 'negative' = 'secondary' @@ -18,6 +16,6 @@ disabled={!$lkSessionConnected} {kind} {size} - on:click={() => loveClient.record(room)} + on:click={() => toggleRecording()} /> {/if} diff --git a/plugins/love-resources/src/components/meeting/controls/RoomAccessButton.svelte b/plugins/love-resources/src/components/meeting/controls/RoomAccessButton.svelte index 23720213edc..681e189488a 100644 --- a/plugins/love-resources/src/components/meeting/controls/RoomAccessButton.svelte +++ b/plugins/love-resources/src/components/meeting/controls/RoomAccessButton.svelte @@ -5,31 +5,34 @@ import RoomAccessPopup from '../../RoomAccessPopup.svelte' import { getCurrentEmployee } from '@hcengineering/contact' - export let room: Room + export let room: Room | undefined export let size: ButtonBaseSize = 'large' export let kind: 'primary' | 'secondary' | 'tertiary' | 'negative' = 'secondary' const me = getCurrentEmployee() function setAccess (e: MouseEvent): void { + if (room === undefined) return if (isOffice(room) && room.person !== me) return showPopup(RoomAccessPopup, { room }, eventToHTMLElement(e)) } - +{#if room !== undefined} + +{/if} diff --git a/plugins/love-resources/src/components/meeting/controls/TranscriptionButton.svelte b/plugins/love-resources/src/components/meeting/controls/TranscriptionButton.svelte index 5c38fd840db..883b7e9a3cb 100644 --- a/plugins/love-resources/src/components/meeting/controls/TranscriptionButton.svelte +++ b/plugins/love-resources/src/components/meeting/controls/TranscriptionButton.svelte @@ -5,9 +5,7 @@ import love from '../../../plugin' import view from '@hcengineering/view' import { ButtonBaseSize, ModernButton } from '@hcengineering/ui' - import { Room } from '@hcengineering/love' - export let room: Room export let size: ButtonBaseSize = 'large' export let kind: 'primary' | 'secondary' | 'tertiary' | 'negative' = 'secondary' @@ -21,9 +19,9 @@ {size} on:click={() => { if ($isTranscription) { - void stopTranscription(room) + void stopTranscription() } else { - void startTranscription(room) + void startTranscription() } }} /> diff --git a/plugins/love-resources/src/components/meeting/invites/InviteEmployeeButton.svelte b/plugins/love-resources/src/components/meeting/invites/InviteEmployeeButton.svelte index c9263b26523..d9ec173e64e 100644 --- a/plugins/love-resources/src/components/meeting/invites/InviteEmployeeButton.svelte +++ b/plugins/love-resources/src/components/meeting/invites/InviteEmployeeButton.svelte @@ -15,13 +15,13 @@ - tab.id === 'chat')?.data?.thread} - collection="messages" - on:channel={closeThread} - onReply={replyToThread} - on:close -> +{#if meetingMinutes !== undefined} + tab.id === 'chat')?.data?.thread} + collection="messages" + on:channel={closeThread} + onReply={replyToThread} + on:close + > +{/if} diff --git a/plugins/love-resources/src/components/meeting/widget/MeetingWidget.svelte b/plugins/love-resources/src/components/meeting/widget/MeetingWidget.svelte index 9be5eea2377..f9d5be5e19b 100644 --- a/plugins/love-resources/src/components/meeting/widget/MeetingWidget.svelte +++ b/plugins/love-resources/src/components/meeting/widget/MeetingWidget.svelte @@ -13,17 +13,12 @@ // limitations under the License. --> -{#if widgetState !== undefined && room} +{#if widgetState !== undefined && $activeMeeting !== undefined}
- +
{#if widgetState.tab === 'video'} - + {:else if widgetState.tab === 'chat'} - {#if !isMeetingMinutesLoaded} + {#if $activeMeeting === undefined} - {:else if meetingMinutes} - + {:else} + {/if} {:else if widgetState.tab === 'transcription'} - {#if !isMeetingMinutesLoaded} + {#if $activeMeeting === undefined} - {:else if meetingMinutes} + {:else} - + {/if} diff --git a/plugins/love-resources/src/components/meeting/widget/MeetingWidgetHeader.svelte b/plugins/love-resources/src/components/meeting/widget/MeetingWidgetHeader.svelte index 29a119db3dc..dbe1c2c96de 100644 --- a/plugins/love-resources/src/components/meeting/widget/MeetingWidgetHeader.svelte +++ b/plugins/love-resources/src/components/meeting/widget/MeetingWidgetHeader.svelte @@ -22,18 +22,17 @@ showPopup, PopupResult } from '@hcengineering/ui' - import { MeetingMinutes, Room } from '@hcengineering/love' import { onDestroy } from 'svelte' import RoomModal from '../../RoomModal.svelte' - import { currentRoom } from '../../../stores' import MeetingOptionsButton from '../controls/MeetingOptionsButton.svelte' import RecordingButton from '../controls/RecordingButton.svelte' import TranscriptionButton from '../controls/TranscriptionButton.svelte' import RoomAccessButton from '../controls/RoomAccessButton.svelte' + import { activeMeeting, currentMeetingRoom } from '../../../meetings' + import { ActiveMeeting } from '../../../types' - export let room: Room - export let doc: MeetingMinutes | undefined = undefined + export let meeting: ActiveMeeting | undefined = undefined let breadcrumbs: BreadcrumbItem[] let popup: PopupResult | undefined @@ -41,12 +40,12 @@ $: breadcrumbs = [ { id: 'meeting', - title: doc?.title ?? room.name + title: meeting?.document.title ?? '' } ] function maximize (): void { - popup = showPopup(RoomModal, { room }, 'full-centered') + popup = showPopup(RoomModal, {}, 'full-centered') } onDestroy(() => { @@ -57,11 +56,11 @@
- {#if $currentRoom !== undefined} - - - - + {#if $activeMeeting !== undefined} + + + + {/if} diff --git a/plugins/love-resources/src/components/meeting/widget/TranscriptionTab.svelte b/plugins/love-resources/src/components/meeting/widget/TranscriptionTab.svelte index cea431f7275..774e1fe20be 100644 --- a/plugins/love-resources/src/components/meeting/widget/TranscriptionTab.svelte +++ b/plugins/love-resources/src/components/meeting/widget/TranscriptionTab.svelte @@ -13,23 +13,24 @@ // limitations under the License. --> - +{#if meetingMinutes !== undefined} + +{/if} diff --git a/plugins/love-resources/src/components/meeting/widget/VideoTab.svelte b/plugins/love-resources/src/components/meeting/widget/VideoTab.svelte index c2a5b89e0b0..fe161d8124b 100644 --- a/plugins/love-resources/src/components/meeting/widget/VideoTab.svelte +++ b/plugins/love-resources/src/components/meeting/widget/VideoTab.svelte @@ -13,16 +13,11 @@ // limitations under the License. -->
- +