Skip to content

Commit 1be4e54

Browse files
committed
Pop ups in full screen mode
Signed-off-by: Alexander Platov <[email protected]>
1 parent 2b1a262 commit 1be4e54

File tree

9 files changed

+85
-73
lines changed

9 files changed

+85
-73
lines changed

packages/ui/src/components/ButtonMenu.svelte

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
export let focusIndex = -1
4444
export let id: string | undefined = undefined
4545
export let dataId: string | undefined = undefined
46+
export let fullScreenPopup: boolean = false
4647
4748
let opened: boolean = false
4849
@@ -57,13 +58,20 @@
5758
}
5859
opened = true
5960
closeTooltip()
60-
showPopup(ModernPopup, { items, selected: noSelection ? undefined : selected, params }, element, (result) => {
61-
if (result) {
62-
selected = result
63-
dispatch('selected', result)
64-
}
65-
opened = false
66-
})
61+
showPopup(
62+
ModernPopup,
63+
{ items, selected: noSelection ? undefined : selected, params },
64+
element,
65+
(result) => {
66+
if (result) {
67+
selected = result
68+
dispatch('selected', result)
69+
}
70+
opened = false
71+
},
72+
() => {},
73+
{ category: 'popup', overlay: true, fullScreen: fullScreenPopup }
74+
)
6775
}
6876
}
6977

packages/ui/src/components/DropdownLabelsIntl.svelte

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
export let width: string | undefined = undefined
3939
export let labelDirection: TooltipAlignment | undefined = undefined
4040
export let shouldUpdateUndefined: boolean = true
41+
export let fullScreenPopup: boolean = false
4142
export let minW0 = true
4243
export let focusIndex: number = -1
4344
export let dataId: string | undefined = undefined
@@ -56,13 +57,20 @@
5657
function openPopup () {
5758
if (!opened) {
5859
opened = true
59-
showPopup(DropdownLabelsPopupIntl, { items, selected, params }, container, (result) => {
60-
if (result) {
61-
selected = result
62-
dispatch('selected', result)
63-
}
64-
opened = false
65-
})
60+
showPopup(
61+
DropdownLabelsPopupIntl,
62+
{ items, selected, params },
63+
container,
64+
(result) => {
65+
if (result) {
66+
selected = result
67+
dispatch('selected', result)
68+
}
69+
opened = false
70+
},
71+
() => {},
72+
{ category: 'popup', overlay: true, fullScreen: fullScreenPopup }
73+
)
6674
}
6775
}
6876

packages/ui/src/components/Popup.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,25 @@
1919
import PopupInstance from './PopupInstance.svelte'
2020
2121
export let contentPanel: HTMLElement | undefined = undefined
22+
export let fullScreen: boolean = false
2223
2324
const instances: PopupInstance[] = []
2425
2526
export function fitPopupInstance (): void {
2627
instances.forEach((p) => p.fitPopupInstance())
2728
}
2829
29-
$: instances.length = $popups.filter((p) => p.dock !== true).length
30+
const checkFS = (popup: any): boolean => {
31+
return (fullScreen && popup.options.fullScreen === true) || (!fullScreen && popup.options.fullScreen !== true)
32+
}
33+
34+
$: instances.length = $popups.filter((p) => p.dock !== true && checkFS(p)).length
3035
</script>
3136

3237
{#if $popups.length > 0}
3338
<slot name="popup-header" />
3439
{/if}
35-
{#each $popups.filter((p) => p.dock !== true) as popup, i (popup.id)}
40+
{#each $popups.filter((p) => p.dock !== true && checkFS(p)) as popup, i (popup.id)}
3641
<PopupInstance
3742
bind:this={instances[i]}
3843
is={popup.is}

packages/ui/src/popups.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface CompAndProps {
2828
options: {
2929
category: string
3030
overlay: boolean
31+
fullScreen?: boolean
3132
fixed?: boolean
3233
refId?: string
3334
}
@@ -90,6 +91,7 @@ export function showPopup (
9091
options: {
9192
category: string
9293
overlay: boolean
94+
fullScreen?: boolean
9395
fixed?: boolean
9496
refId?: string
9597
id?: string

plugins/love-resources/src/components/ControlBar.svelte

Lines changed: 17 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
IconMoreV,
2626
IconUpOutline,
2727
ModernButton,
28-
PopupInstance,
28+
Popup,
2929
SplitButton,
3030
eventToHTMLElement,
3131
showPopup,
@@ -76,7 +76,6 @@
7676
let allowCam: boolean = false
7777
const allowShare: boolean = true
7878
let allowLeave: boolean = false
79-
let popup: CompAndProps | undefined = undefined
8079
let noLabel: boolean = false
8180
8281
$: allowCam = $currentRoom?.type === RoomType.Video
@@ -100,50 +99,32 @@
10099
await leaveRoom($myInfo, $myOffice)
101100
}
102101
103-
function getPopup (component: AnySvelteComponent, e: MouseEvent, props: any = {}): CompAndProps {
104-
return {
105-
id: 'fsPopup',
106-
is: component,
102+
function showPopupIfFullScreen (component: AnySvelteComponent, props: any = {}, e: MouseEvent): void {
103+
showPopup(
104+
component,
107105
props,
108-
element: eventToHTMLElement(e),
109-
options: { category: 'popup', overlay: true },
110-
close: () => {
111-
popup = undefined
112-
}
113-
}
106+
eventToHTMLElement(e),
107+
() => {},
108+
() => {},
109+
{ category: 'popup', overlay: true, fullScreen }
110+
)
114111
}
115112
116113
function micSettings (e: MouseEvent): void {
117-
if (fullScreen) {
118-
popup = getPopup(MicSettingPopup, e)
119-
} else {
120-
showPopup(MicSettingPopup, {}, eventToHTMLElement(e))
121-
}
114+
showPopupIfFullScreen(MicSettingPopup, {}, e)
122115
}
123116
124117
function camSettings (e: MouseEvent): void {
125-
if (fullScreen) {
126-
popup = getPopup(CamSettingPopup, e)
127-
} else {
128-
showPopup(CamSettingPopup, {}, eventToHTMLElement(e))
129-
}
118+
showPopupIfFullScreen(CamSettingPopup, {}, e)
130119
}
131120
132121
function shareSettings (e: MouseEvent): void {
133-
if (fullScreen) {
134-
popup = getPopup(ShareSettingPopup, e)
135-
} else {
136-
showPopup(ShareSettingPopup, {}, eventToHTMLElement(e))
137-
}
122+
showPopupIfFullScreen(ShareSettingPopup, {}, e)
138123
}
139124
140125
function setAccess (e: MouseEvent): void {
141126
if (isOffice(room) && room.person !== me) return
142-
if (fullScreen) {
143-
popup = getPopup(RoomAccessPopup, e, { room })
144-
} else {
145-
showPopup(RoomAccessPopup, { room }, eventToHTMLElement(e))
146-
}
127+
showPopupIfFullScreen(RoomAccessPopup, { room }, e)
147128
}
148129
149130
const me = getCurrentEmployee()
@@ -174,7 +155,7 @@
174155
175156
async function handleAction (action: Action): Promise<void> {
176157
const fn = await getResource(action.action)
177-
await fn(room)
158+
await fn(room, undefined, { fullScreen })
178159
}
179160
$: withVideo = $screenSharing || room.type === RoomType.Video
180161
@@ -321,6 +302,7 @@
321302
kind="secondary"
322303
size="large"
323304
noSelection
305+
fullScreenPopup={fullScreen}
324306
on:selected={handleMenuOption}
325307
/>
326308
{/if}
@@ -337,20 +319,8 @@
337319
</svelte:fragment>
338320

339321
<svelte:fragment slot="extra">
340-
{#if popup && fullScreen}
341-
<PopupInstance
342-
is={popup.is}
343-
props={popup.props}
344-
element={popup.element}
345-
onClose={popup.onClose}
346-
onUpdate={popup.onUpdate}
347-
zIndex={1}
348-
top={true}
349-
close={popup.close}
350-
overlay={popup.options.overlay}
351-
contentPanel={undefined}
352-
{popup}
353-
/>
322+
{#if fullScreen}
323+
<Popup fullScreen />
354324
{/if}
355325
</svelte:fragment>
356326
</ControlBarContainer>

plugins/love-resources/src/components/RoomLanguageSelector.svelte

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
2626
export let room: Room
2727
export let kind: 'dropdown' | 'icon' = 'dropdown'
28+
export let fullScreenPopup: boolean = false
2829
2930
const client = getClient()
3031
@@ -48,12 +49,19 @@
4849
}
4950
5051
function showLanguagesPopup (): void {
51-
showPopup(DropdownLabelsPopupIntl, { items, selected: selectedItem }, container, async (result) => {
52-
if (result != null && result !== '') {
53-
selectedItem = result
54-
await handleSelection(result)
55-
}
56-
})
52+
showPopup(
53+
DropdownLabelsPopupIntl,
54+
{ items, selected: selectedItem },
55+
container,
56+
async (result) => {
57+
if (result != null && result !== '') {
58+
selectedItem = result
59+
await handleSelection(result)
60+
}
61+
},
62+
() => {},
63+
{ category: 'popup', overlay: true, fullScreen: fullScreenPopup }
64+
)
5765
}
5866
</script>
5967

@@ -66,6 +74,7 @@
6674
iconProps={{ lang: selectedItem }}
6775
bind:selected={selectedItem}
6876
label={view.string.AddSavedView}
77+
{fullScreenPopup}
6978
on:selected={(e) => handleSelection(e.detail)}
7079
/>
7180
{:else}

plugins/love-resources/src/components/RoomSettingsPopup.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import love from '../plugin'
2424
2525
export let room: Room
26+
export let fullScreenPopup: boolean = false
2627
2728
const dispatch = createEventDispatcher()
2829
@@ -65,7 +66,7 @@
6566
</div>
6667
<div class="component">
6768
{#if selectedGroup.id === 'transcription'}
68-
<RoomTranscriptionSettings {room} />
69+
<RoomTranscriptionSettings {room} {fullScreenPopup} />
6970
{/if}
7071
</div>
7172
</div>

plugins/love-resources/src/components/RoomTranscriptionSettings.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import RoomLanguageSelector from './RoomLanguageSelector.svelte'
2121
2222
export let room: Room
23+
export let fullScreenPopup: boolean = false
2324
2425
const client = getClient()
2526
@@ -37,7 +38,7 @@
3738
<div class="antiGrid-row__header">
3839
<Label label={ui.string.Language} />
3940
</div>
40-
<RoomLanguageSelector {room} />
41+
<RoomLanguageSelector {room} {fullScreenPopup} />
4142
</div>
4243
<div class="antiGrid-row">
4344
<div class="antiGrid-row__header">

plugins/love-resources/src/utils.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,10 +1194,18 @@ export async function updateSessionLanguage (room: Room): Promise<void> {
11941194
}
11951195
}
11961196

1197-
export async function showRoomSettings (room?: Room): Promise<void> {
1197+
export async function showRoomSettings (room?: Room, evt?: Event, params?: Record<string, any>): Promise<any> {
11981198
if (room === undefined) return
11991199

1200-
showPopup(RoomSettingsPopup, { room }, 'top')
1200+
const fullScreen: boolean = params?.fullScreen
1201+
showPopup(
1202+
RoomSettingsPopup,
1203+
{ room, fullScreenPopup: fullScreen },
1204+
'top',
1205+
() => {},
1206+
() => {},
1207+
{ category: 'popup', overlay: true, fullScreen }
1208+
)
12011209
}
12021210

12031211
export async function copyGuestLink (room?: Room): Promise<void> {

0 commit comments

Comments
 (0)