From 2af4a50003d59de3f8aee0232b220af875f77754 Mon Sep 17 00:00:00 2001 From: Anton Alexeyev Date: Wed, 24 Sep 2025 13:58:51 +0700 Subject: [PATCH] Office: refactor meeting creation (#9905) Signed-off-by: Anton Alexeyev --- models/love/src/index.ts | 6 + models/love/src/plugin.ts | 3 +- .../src/components/DirectMessageButton.svelte | 28 +- .../person/EmployeePreviewPopup.svelte | 10 +- plugins/love-assets/assets/icons.svg | 6 +- plugins/love-resources/package.json | 1 + .../src/components/EditRoom.svelte | 24 +- .../love-resources/src/components/Hall.svelte | 49 +- .../love-resources/src/components/Main.svelte | 31 +- .../src/components/MediaPopupItemExt.svelte | 21 +- .../src/components/PersonActionPopup.svelte | 12 +- .../love-resources/src/components/Room.svelte | 32 +- .../components/RoomLanguageSelector.svelte | 2 - .../src/components/RoomModal.svelte | 2 +- .../src/components/RoomPopup.svelte | 6 +- .../src/components/ShareSettingPopup.svelte | 7 +- .../components/SharingStateIndicator.svelte | 12 +- .../src/components/WorkbenchExtension.svelte | 8 +- .../src/components/meeting/ControlBar.svelte | 25 +- .../meeting/ControlBarContainer.svelte | 109 ++-- .../src/components/meeting/ControlExt.svelte | 77 +-- .../LastParticipantNotification.svelte | 11 +- .../meeting/controls/LeaveRoomButton.svelte | 10 +- .../meeting/controls/RecordingButton.svelte | 11 +- .../meeting/controls/RoomAccessButton.svelte | 7 +- .../meeting/controls/ShareScreenButton.svelte | 16 +- .../controls/TranscriptionButton.svelte | 7 +- .../invites}/ActiveInvitesPopup.svelte | 20 +- .../invites/InviteEmployeeButton.svelte | 79 +++ .../{ => meeting/invites}/InvitePopup.svelte | 28 +- .../{ => meeting/invites}/RequestPopup.svelte | 24 +- .../invites}/RequestingPopup.svelte | 15 +- .../meeting/widget/MeetingWidget.svelte | 26 +- .../meeting/widget/MeetingWidgetHeader.svelte | 10 +- .../meeting/widget/WidgetSwitcher.svelte | 7 +- plugins/love-resources/src/index.ts | 4 +- plugins/love-resources/src/liveKitClient.ts | 125 ++++- plugins/love-resources/src/loveClient.ts | 109 ++++ plugins/love-resources/src/meetings.ts | 311 +++++++++++ plugins/love-resources/src/utils.ts | 511 +----------------- 40 files changed, 909 insertions(+), 893 deletions(-) rename plugins/love-resources/src/components/{ => meeting/invites}/ActiveInvitesPopup.svelte (76%) create mode 100644 plugins/love-resources/src/components/meeting/invites/InviteEmployeeButton.svelte rename plugins/love-resources/src/components/{ => meeting/invites}/InvitePopup.svelte (69%) rename plugins/love-resources/src/components/{ => meeting/invites}/RequestPopup.svelte (69%) rename plugins/love-resources/src/components/{ => meeting/invites}/RequestingPopup.svelte (80%) create mode 100644 plugins/love-resources/src/loveClient.ts create mode 100644 plugins/love-resources/src/meetings.ts diff --git a/models/love/src/index.ts b/models/love/src/index.ts index b185597208..775e5d556b 100644 --- a/models/love/src/index.ts +++ b/models/love/src/index.ts @@ -719,6 +719,12 @@ export function createModel (builder: Builder): void { love.completion.MeetingMinutesCategory ) + // Extensions + builder.createDoc(presentation.class.ComponentPointExtension, core.space.Model, { + extension: contact.extension.EmployeePopupActions, + component: love.component.InviteEmployeeButton + }) + createAttributePresenter( builder, view.component.DateTimePresenter, diff --git a/models/love/src/plugin.ts b/models/love/src/plugin.ts index e7ef324548..1c54922679 100644 --- a/models/love/src/plugin.ts +++ b/models/love/src/plugin.ts @@ -32,7 +32,8 @@ export default mergeIds(loveId, love, { WidgetSwitcher: '' as AnyComponent, RoomLanguageEditor: '' as AnyComponent, MediaPopupItemExt: '' as AnyComponent, - SharingStateIndicator: '' as AnyComponent + SharingStateIndicator: '' as AnyComponent, + InviteEmployeeButton: '' as AnyComponent }, app: { Love: '' as Ref diff --git a/plugins/chunter-resources/src/components/DirectMessageButton.svelte b/plugins/chunter-resources/src/components/DirectMessageButton.svelte index e0cfbff3df..dc10f34e69 100644 --- a/plugins/chunter-resources/src/components/DirectMessageButton.svelte +++ b/plugins/chunter-resources/src/components/DirectMessageButton.svelte @@ -44,12 +44,22 @@ } - +
+ +
+ + diff --git a/plugins/contact-resources/src/components/person/EmployeePreviewPopup.svelte b/plugins/contact-resources/src/components/person/EmployeePreviewPopup.svelte index e2989784e9..c94722ad8a 100644 --- a/plugins/contact-resources/src/components/person/EmployeePreviewPopup.svelte +++ b/plugins/contact-resources/src/components/person/EmployeePreviewPopup.svelte @@ -133,12 +133,10 @@
{#if !disabled}
-
- -
+
diff --git a/plugins/love-assets/assets/icons.svg b/plugins/love-assets/assets/icons.svg index 8d16937101..798e12b651 100644 --- a/plugins/love-assets/assets/icons.svg +++ b/plugins/love-assets/assets/icons.svg @@ -82,10 +82,8 @@ - - - - + + diff --git a/plugins/love-resources/package.json b/plugins/love-resources/package.json index 99783a4f51..a2782eea1e 100644 --- a/plugins/love-resources/package.json +++ b/plugins/love-resources/package.json @@ -64,6 +64,7 @@ "@hcengineering/emoji": "^0.6.0", "@hcengineering/emoji-resources": "^0.6.0", "@hcengineering/theme": "^0.6.5", + "@hcengineering/account-client": "^0.6.0", "@livekit/krisp-noise-filter": "^0.3.0", "@livekit/track-processors": "^0.5.6", "livekit-client": "^2.15.6", diff --git a/plugins/love-resources/src/components/EditRoom.svelte b/plugins/love-resources/src/components/EditRoom.svelte index b5a941e7e0..e079c67960 100644 --- a/plugins/love-resources/src/components/EditRoom.svelte +++ b/plugins/love-resources/src/components/EditRoom.svelte @@ -19,9 +19,10 @@ import { IntlString } from '@hcengineering/platform' import love from '../plugin' - import { getRoomName, tryConnect } from '../utils' - import { infos, invites, myInfo, myRequests, selectedRoomPlace, myOffice, currentRoom } from '../stores' + import { getRoomName } from '../utils' + import { infos, myOffice, currentRoom } from '../stores' import { lkSessionConnected } from '../liveKitClient' + import { createMeeting, joinMeeting } from '../meetings' export let object: Room @@ -38,21 +39,14 @@ dispatch('open', { ignoreKeys: ['name'] }) }) - let tryConnecting = false + const tryConnecting = false async function connect (): Promise { - tryConnecting = true - const place = $selectedRoomPlace - await tryConnect( - $myInfo, - object, - $infos, - $myRequests, - $invites, - place?._id === object._id ? { x: place.x, y: place.y } : undefined - ) - tryConnecting = false - selectedRoomPlace.set(undefined) + if ($infos.some(({ room }) => room === object._id)) { + await joinMeeting(object) + } else { + await createMeeting(object) + } } $: connecting = tryConnecting || ($currentRoom?._id === object._id && !$lkSessionConnected) diff --git a/plugins/love-resources/src/components/Hall.svelte b/plugins/love-resources/src/components/Hall.svelte index 88437afec3..b57f95339e 100644 --- a/plugins/love-resources/src/components/Hall.svelte +++ b/plugins/love-resources/src/components/Hall.svelte @@ -15,22 +15,10 @@
diff --git a/plugins/love-resources/src/components/Main.svelte b/plugins/love-resources/src/components/Main.svelte index 27d7e6703b..ae87fec615 100644 --- a/plugins/love-resources/src/components/Main.svelte +++ b/plugins/love-resources/src/components/Main.svelte @@ -14,15 +14,8 @@ -->
diff --git a/plugins/love-resources/src/components/MediaPopupItemExt.svelte b/plugins/love-resources/src/components/MediaPopupItemExt.svelte index fe7d6c0cd9..a02a2119c6 100644 --- a/plugins/love-resources/src/components/MediaPopupItemExt.svelte +++ b/plugins/love-resources/src/components/MediaPopupItemExt.svelte @@ -1,14 +1,14 @@
@@ -22,7 +20,7 @@ label={love.string.Kick} icon={love.icon.Kick} action={() => { - kick(person, $rooms, $infos) + void kick(person) }} /> {/if} @@ -32,7 +30,7 @@ label={love.string.Invite} icon={love.icon.Invite} action={() => { - invite(person, $myInfo?.room) + void sendInvites([person]) }} /> {#if room.access === RoomAccess.Knock} @@ -41,7 +39,7 @@ label={love.string.KnockAction} icon={love.icon.Knock} action={() => { - tryConnect($myInfo, room, info, $myRequests, $invites) + void joinMeeting(room) }} /> {/if} diff --git a/plugins/love-resources/src/components/Room.svelte b/plugins/love-resources/src/components/Room.svelte index a1c769a54e..ff7c0bff19 100644 --- a/plugins/love-resources/src/components/Room.svelte +++ b/plugins/love-resources/src/components/Room.svelte @@ -13,21 +13,19 @@ // limitations under the License. -->
@@ -11,8 +12,8 @@ on={$isShareWithSound} on:change={(e) => { $isShareWithSound = e.detail - if ($isSharingEnabled) { - void liveKitClient.setScreenShareEnabled($isSharingEnabled, e.detail) + if ($screenSharingState === ScreenSharingState.Local) { + void liveKitClient.setScreenShareEnabled(true, e.detail) } }} /> diff --git a/plugins/love-resources/src/components/SharingStateIndicator.svelte b/plugins/love-resources/src/components/SharingStateIndicator.svelte index 5aab12e21e..c605160954 100644 --- a/plugins/love-resources/src/components/SharingStateIndicator.svelte +++ b/plugins/love-resources/src/components/SharingStateIndicator.svelte @@ -16,13 +16,12 @@ import { tooltip, eventToHTMLElement, showPopup } from '@hcengineering/ui' import love from '../plugin' - import { isSharingEnabled, isShareWithSound, screenSharing, liveKitClient } from '../utils' + import { isShareWithSound, liveKitClient } from '../utils' import SharingStatePopup from './SharingStatePopup.svelte' import IconShare from './icons/Share.svelte' - import { lkSessionConnected } from '../liveKitClient' + import { lkSessionConnected, ScreenSharingState, screenSharingState } from '../liveKitClient' - let disabled: boolean = false let pressed: boolean = false function handleShowPopup (ev: MouseEvent): void { @@ -33,15 +32,13 @@ } function handleShare (): void { - if (disabled) return + if ($screenSharingState !== ScreenSharingState.Inactive) return void liveKitClient.setScreenShareEnabled(true, $isShareWithSound) } - - $: disabled = !$screenSharing && !$lkSessionConnected {#if $lkSessionConnected} - {#if $isSharingEnabled} + {#if $screenSharingState === ScreenSharingState.Local}