Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Pexip screen selector #2942

Merged
merged 64 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
47cd7e9
grow
jeanfbrito Jul 11, 2024
adc6f44
wip
jeanfbrito Jul 12, 2024
4ab5789
button group added
jeanfbrito Jul 17, 2024
673b81e
wip
jeanfbrito Jul 18, 2024
b405214
open settings panel
jeanfbrito Jul 23, 2024
7674891
fix settings view
jeanfbrito Jul 23, 2024
ad12ab5
fix downloads view
jeanfbrito Jul 23, 2024
2dcc798
fix badges
jeanfbrito Jul 24, 2024
248f5b6
top bar title update
jeanfbrito Jul 25, 2024
2246906
only show topbar on osx
jeanfbrito Jul 29, 2024
519e49c
persistMachineTheme
jeanfbrito Jul 31, 2024
89e8893
changes theme by server and machine as callback
jeanfbrito Jul 31, 2024
af784b4
change topbar to the page title
jeanfbrito Aug 1, 2024
48412cb
settings now supports themes
jeanfbrito Aug 1, 2024
200681f
downloads with theme
jeanfbrito Aug 1, 2024
a8ecd6d
add actions to settings kebab menu
jeanfbrito Aug 5, 2024
3cddbe0
hide sidebar
jeanfbrito Aug 6, 2024
61afefa
add menu translation
jeanfbrito Aug 7, 2024
8473b5c
wip actions menu
jeanfbrito Aug 8, 2024
d56337c
add server menu actions
jeanfbrito Aug 9, 2024
bbad94c
add other actions
jeanfbrito Aug 9, 2024
eba113d
fix server remove click propagation
jeanfbrito Aug 9, 2024
392dc9b
working tooltips
jeanfbrito Aug 9, 2024
44c3737
add tooltips translation
jeanfbrito Aug 9, 2024
a9e444b
fix wrong tooltip when context menu is open
jeanfbrito Aug 9, 2024
3686195
fix lint
jeanfbrito Aug 12, 2024
b0e576f
bump to rebuild
jeanfbrito Aug 12, 2024
93e5be6
update fuselage
jeanfbrito Aug 14, 2024
8121269
fix tooltip theme
jeanfbrito Aug 14, 2024
9a90f9a
wip
jeanfbrito Aug 14, 2024
570cb2a
done tooltip provider
jeanfbrito Aug 14, 2024
a5f63d2
finish tooltip provider
jeanfbrito Aug 14, 2024
da02ae7
wip settings tooltip
jeanfbrito Aug 14, 2024
f373bb0
convert to rocket.chat tooltip provider
jeanfbrito Aug 14, 2024
a639b53
fix debounce
jeanfbrito Aug 14, 2024
845584b
lint fix
jeanfbrito Aug 14, 2024
c557a37
fix tooltip being stuck
jeanfbrito Aug 14, 2024
4305bbf
settings tooltip update
jeanfbrito Aug 15, 2024
99837d7
lint fix
jeanfbrito Aug 15, 2024
ae74185
fix breaking theme selection
jeanfbrito Aug 19, 2024
adedb52
update node version
jeanfbrito Aug 19, 2024
c8f5bc6
node update
jeanfbrito Aug 19, 2024
2db22cc
Fix build pr (#2930)
jeanfbrito Aug 20, 2024
f04c2f3
update fuselage icons
jeanfbrito Aug 20, 2024
a1c1ab5
Merge branch 'new-ui' of https://github.com/RocketChat/Rocket.Chat.El…
jeanfbrito Aug 20, 2024
e7a19e6
rollback fuselage icons
jeanfbrito Aug 20, 2024
f199dcb
update puppeteer
jeanfbrito Aug 21, 2024
5948b16
change node to the actions default
jeanfbrito Aug 21, 2024
9f141d9
update validate-pr action
jeanfbrito Aug 21, 2024
9af18f3
fix path
jeanfbrito Aug 21, 2024
49ad226
Pr comments (#2933)
jeanfbrito Aug 21, 2024
f0c40a2
convert unsupported server to fuselage
jeanfbrito Aug 22, 2024
1943140
Merge branch 'new-ui' of https://github.com/RocketChat/Rocket.Chat.El…
jeanfbrito Aug 22, 2024
78515db
lint fix
jeanfbrito Aug 22, 2024
52b259b
add translations
jeanfbrito Sep 6, 2024
347ec59
make theme change on server theme change
jeanfbrito Sep 6, 2024
c835aa8
add old selected state
jeanfbrito Sep 9, 2024
f353dcd
Merge branch 'master' into new-ui
jeanfbrito Sep 9, 2024
470efd1
lint fix
jeanfbrito Sep 9, 2024
c843581
fix select color theme
jeanfbrito Sep 9, 2024
7965602
wip
jeanfbrito Sep 10, 2024
cd697d3
wip
jeanfbrito Sep 10, 2024
b61fc14
Revamp screen picker for Pexip calls
jeanfbrito Sep 11, 2024
e8d7992
Merge branch 'master' into fix-pexip-screen-selector
jeanfbrito Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions src/public/video-call-window.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self'" />
<title>Rocket.Chat</title>
<link rel="stylesheet" href="./main.css" />
<style>
webview {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: inline-flex !important;
}
</style>
<link rel="stylesheet" href="./icons/rocketchat.css" />
</head>

<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self'">
<title>Rocket.Chat</title>
<style>
webview {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: inline-flex !important;
}
</style>
<link rel="stylesheet" href="./icons/rocketchat.css">
</head>

<body style="background-color: #347d9a">
<div id="root"></div>
<script src="./video-call-window.js"></script>
</body>

</html>
<body style="background-color: #347d9a">
<div id="root"></div>
<script src="./video-call-window.js"></script>
</body>
</html>
151 changes: 95 additions & 56 deletions src/videoCallWindow/screenSharePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
Box,
Button,
Callout,
Label,
Margins,
PaletteStyleTag,
Scrollable,
} from '@rocket.chat/fuselage';
import type {
Expand All @@ -14,7 +16,6 @@ import { ipcRenderer } from 'electron';
import { useEffect, useState } from 'react';

import { Dialog } from '../ui/components/Dialog';
import { Source } from '../ui/components/ScreenSharingDialog/styles';

const desktopCapturer: DesktopCapturer = {
getSources: (opts: SourcesOptions) =>
Expand All @@ -24,6 +25,7 @@ const desktopCapturer: DesktopCapturer = {
export function ScreenSharePicker() {
const [visible, setVisible] = useState(false);
const [sources, setSources] = useState<DesktopCapturerSource[]>([]);
const [hoveredSourceId, setHoveredSourceId] = useState<string | null>(null);
const [
isScreenRecordingPermissionGranted,
setIsScreenRecordingPermissionGranted,
Expand All @@ -33,9 +35,10 @@ export function ScreenSharePicker() {
const sources = await desktopCapturer.getSources({
types: ['window', 'screen'],
});
const filteredSources = sources.filter(
(source) => source.thumbnail.isEmpty() === false
);
const filteredSources = sources
.filter((source) => !source.thumbnail.isEmpty())
.sort((a, b) => a.name.localeCompare(b.name));
if (filteredSources.length === 0) return;
setSources(filteredSources);
};

Expand Down Expand Up @@ -67,7 +70,7 @@ export function ScreenSharePicker() {

const timer = setInterval(() => {
fetchSources();
}, 2000);
}, 3000);

return () => {
clearInterval(timer);
Expand All @@ -84,21 +87,37 @@ export function ScreenSharePicker() {
ipcRenderer.send('video-call-window/screen-sharing-source-responded', null);
};

const handleMouseEnter = (id: string) => {
setHoveredSourceId(id);
};

const handleMouseLeave = () => {
setHoveredSourceId(null);
};

return (
<Dialog isVisible={visible} onClose={handleClose}>
<Box
display='flex'
flexWrap='wrap'
alignItems='stretch'
justifyContent='center'
maxWidth='x800'
>
{!isScreenRecordingPermissionGranted && (
<Box alignSelf='center' display='flex'>
<Box>
<PaletteStyleTag
theme='light'
selector=':root'
// tagId='sidebar-palette'
/>
<Dialog isVisible={visible} onClose={handleClose}>
<Box
display='flex'
flexWrap='wrap'
alignItems='stretch'
justifyContent='center'
maxWidth='x800'
// bg='tint'
borderRadius='x16'
>
{!isScreenRecordingPermissionGranted && (
<Callout
title='Screen Recording Permissions Denied'
type='danger'
maxWidth='100%'
marginBlockEnd='x16'
>
The screen sharing feature requires screen recording permissions
to be granted. Please grant screen recording permissions in your
Expand All @@ -108,52 +127,72 @@ export function ScreenSharePicker() {
<b> Screen Recording</b> and check
<b> Rocket.Chat</b>
</Callout>
)}
<Box alignSelf='center' display='flex'>
<Box fontScale='h1' alignSelf='left'>
Select a screen to share
</Box>
</Box>
)}
<Box alignSelf='center' display='flex'>
<Box fontScale='h1' alignSelf='left'>
Select a screen to share
</Box>
</Box>
<Scrollable>
<Margins blockStart='x16' blockEnd='x16'>
<Box
display='flex'
flexWrap='wrap'
alignItems='stretch'
justifyContent='center'
maxSize='x730'
>
{sources.map(({ id, name, thumbnail }) => (
<Source
key={id}
display='flex'
flexDirection='column'
onClick={handleScreenSharingSourceClick(id)}
>
<Scrollable>
<Margins blockStart='x16' blockEnd='x16'>
<Box
display='flex'
flexWrap='wrap'
alignItems='stretch'
justifyContent='center'
maxSize='x730'
>
{sources.map(({ id, name, thumbnail }) => (
<Box
flexGrow={1}
width='x160'
height='x200'
key={id}
display='flex'
alignItems='center'
justifyContent='center'
flexDirection='column'
onClick={handleScreenSharingSourceClick(id)}
// bg='tint'
margin='x8'
// borderRadius='x8'
onMouseEnter={() => handleMouseEnter(id)}
onMouseLeave={handleMouseLeave}
style={{
cursor: 'pointer',
}}
borderRadius='x8'
border={
hoveredSourceId === id
? '2px solid var(--rcx-color-stroke-light)'
: '2px solid transparent'
}
>
<Box
is='img'
src={thumbnail.toDataURL()}
alt={name}
style={{ maxWidth: '148px', maxHeight: '148px' }}
/>
flexGrow={1}
display='flex'
alignItems='center'
justifyContent='center'
content='center'
>
<Box
is='img'
src={thumbnail.toDataURL()}
alt={name}
style={{ maxWidth: '148px', maxHeight: '148px' }}
borderRadius='x2'
/>
</Box>
<Label margin='x8' withTruncatedText>
{name}
</Label>
</Box>
<Box>{name}</Box>
</Source>
))}
</Box>
</Margins>
</Scrollable>
</Box>
<Box alignSelf='center' display='flex'>
<Button onClick={handleClose}>Cancel</Button>
</Box>
</Dialog>
))}
</Box>
</Margins>
</Scrollable>
</Box>
<Box alignSelf='center' display='flex' marginBlockStart='x24'>
<Button onClick={handleClose}>Cancel</Button>
</Box>
</Dialog>
</Box>
);
}
5 changes: 3 additions & 2 deletions src/videoCallWindow/videoCallWindow.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Box } from '@rocket.chat/fuselage';
import { ipcRenderer } from 'electron';
import { useEffect, useRef, useState } from 'react';

Expand All @@ -20,7 +21,7 @@ function VideoCallWindow() {
}, [videoCallUrl]);

return (
<div>
<Box>
<ScreenSharePicker />
<webview
ref={webviewRef}
Expand All @@ -29,7 +30,7 @@ function VideoCallWindow() {
webpreferences='nodeIntegration,nativeWindowOpen=true'
allowpopups={'true' as any}
/>
</div>
</Box>
);
}

Expand Down
Loading