mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00

Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
1 Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
100 lines
3.1 KiB
Svelte
100 lines
3.1 KiB
Svelte
<!--
|
|
// Copyright © 2024 Hardcore Engineering Inc.
|
|
//
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License. You may
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
//
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
-->
|
|
<script lang="ts">
|
|
import { closeWidget, minimizeSidebar, WidgetState } from '@hcengineering/workbench-resources'
|
|
import { createQuery } from '@hcengineering/presentation'
|
|
import { MeetingMinutes, MeetingStatus, Room } from '@hcengineering/love'
|
|
import { Loading } from '@hcengineering/ui'
|
|
|
|
import love from '../../plugin'
|
|
import VideoTab from './VideoTab.svelte'
|
|
import { isCurrentInstanceConnected, lk } from '../../utils'
|
|
import { currentMeetingMinutes, currentRoom } from '../../stores'
|
|
import ChatTab from './ChatTab.svelte'
|
|
import TranscriptionTab from './TranscriptionTab.svelte'
|
|
|
|
export let widgetState: WidgetState | undefined
|
|
export let height: string
|
|
export let width: string
|
|
|
|
const meetingQuery = createQuery()
|
|
|
|
let meetingMinutes: MeetingMinutes | undefined = undefined
|
|
let isMeetingMinutesLoaded = false
|
|
|
|
let room: Room | undefined = undefined
|
|
let sid: string | undefined = undefined
|
|
|
|
$: room = $currentRoom
|
|
|
|
void lk.getSid().then((res) => {
|
|
sid = res
|
|
})
|
|
|
|
$: if (
|
|
!$isCurrentInstanceConnected ||
|
|
widgetState?.data?.room === undefined ||
|
|
$currentRoom === undefined ||
|
|
$currentRoom._id !== widgetState?.data?.room
|
|
) {
|
|
closeWidget(love.ids.MeetingWidget)
|
|
}
|
|
|
|
$: if (meetingMinutes?.sid !== sid) {
|
|
meetingMinutes = undefined
|
|
isMeetingMinutesLoaded = false
|
|
}
|
|
|
|
$: if (sid != null && room !== undefined) {
|
|
meetingQuery.query(
|
|
love.class.MeetingMinutes,
|
|
{ sid, attachedTo: room._id, status: MeetingStatus.Active },
|
|
async (res) => {
|
|
meetingMinutes = res[0]
|
|
if (meetingMinutes) {
|
|
currentMeetingMinutes.set(meetingMinutes)
|
|
}
|
|
isMeetingMinutesLoaded = true
|
|
}
|
|
)
|
|
} else {
|
|
meetingQuery.unsubscribe()
|
|
meetingMinutes = undefined
|
|
isMeetingMinutesLoaded = sid !== undefined
|
|
}
|
|
|
|
function handleClose (): void {
|
|
minimizeSidebar()
|
|
}
|
|
</script>
|
|
|
|
{#if widgetState && room}
|
|
{#if widgetState.tab === 'video'}
|
|
<VideoTab {room} doc={meetingMinutes} on:close={handleClose} />
|
|
{:else if widgetState.tab === 'chat'}
|
|
{#if !isMeetingMinutesLoaded}
|
|
<Loading />
|
|
{:else if meetingMinutes}
|
|
<ChatTab {meetingMinutes} {room} {widgetState} {height} {width} on:close={handleClose} />
|
|
{/if}
|
|
{:else if widgetState.tab === 'transcription'}
|
|
{#if !isMeetingMinutesLoaded}
|
|
<Loading />
|
|
{:else if meetingMinutes}
|
|
<TranscriptionTab {meetingMinutes} {room} {widgetState} {height} {width} on:close={handleClose} />
|
|
{/if}
|
|
{/if}
|
|
{/if}
|