Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions packages/teleport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"devDependencies": {
"@gravitational/build": "^1.0.0",
"@types/wicg-native-file-system": "^2020.6.0",
Comment thread
ibeckermayer marked this conversation as resolved.
"jest-canvas-mock": "^2.3.1"
}
}
4 changes: 0 additions & 4 deletions packages/teleport/src/DesktopSession/DesktopSession.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const props: State = {
permission: { state: '' },
errorText: '',
},
isRecording: false,
tdpClient: fakeClient(),
username: 'user',
onWsOpen: () => {},
Expand All @@ -55,7 +54,6 @@ const props: State = {
disconnected: false,
setDisconnected: () => {},
setClipboardState: () => {},
setIsRecording: () => {},
canShareDirectory: true,
isSharingDirectory: false,
setIsSharingDirectory: () => {},
Expand Down Expand Up @@ -113,7 +111,6 @@ export const ConnectedSettingsFalse = () => {
permission: { state: '' },
errorText: '',
}}
isRecording={false}
onPngFrame={(ctx: CanvasRenderingContext2D) => {
fillGray(ctx.canvas);
}}
Expand All @@ -140,7 +137,6 @@ export const ConnectedSettingsTrue = () => {
permission: { state: 'granted' },
errorText: '',
}}
isRecording={true}
isSharingDirectory={true}
onPngFrame={(ctx: CanvasRenderingContext2D) => {
fillGray(ctx.canvas);
Expand Down
21 changes: 14 additions & 7 deletions packages/teleport/src/DesktopSession/DesktopSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ function Session(props: PropsWithChildren<State>) {
hostname,
clipboardState,
setClipboardState,
isRecording,
setIsRecording,
canShareDirectory,
isSharingDirectory,
setIsSharingDirectory,
Expand Down Expand Up @@ -144,6 +142,19 @@ function Session(props: PropsWithChildren<State>) {
!disconnected &&
clipboardSuccess;

const onShareDirectory = () => {
window
.showDirectoryPicker()
.then(sharedDirHandle => {
setIsSharingDirectory(true);
tdpClient.sharedDirectory = sharedDirHandle;
tdpClient.sendSharedDirectoryAnnounce();
})
.catch(() => {
setIsSharingDirectory(false);
});
};

return (
<Flex flexDirection="column">
<TopBar
Expand All @@ -153,18 +164,14 @@ function Session(props: PropsWithChildren<State>) {
...prevState,
enabled: false,
}));
setIsRecording(false);
setIsSharingDirectory(false);
tdpClient.nuke();
}}
userHost={`${username}@${hostname}`}
clipboardSharingEnabled={clipboardSharingActive}
isRecording={isRecording}
canShareDirectory={canShareDirectory}
isSharingDirectory={isSharingDirectory}
onShareDirectory={() => {
setIsSharingDirectory(true);
}}
onShareDirectory={onShareDirectory}
/>

{props.children}
Expand Down
23 changes: 0 additions & 23 deletions packages/teleport/src/DesktopSession/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function TopBar(props: Props) {
const {
userHost,
clipboardSharingEnabled,
isRecording,
onDisconnect,
canShareDirectory,
isSharingDirectory,
Expand Down Expand Up @@ -70,19 +69,6 @@ export default function TopBar(props: Props) {
: 'Clipboard Sharing Disabled'
}
/>
<Flex
title={isRecording ? 'Recording In Progress' : 'Not Recording'}
alignItems="center"
>
<StyledRecordingIndicator
style={{
backgroundColor: isRecording
? theme.colors.error.light
: theme.colors.text.secondary,
}}
/>
<Text style={primaryOnTrue(isRecording)}>Recording</Text>
</Flex>
</Flex>
<ActionMenu
onDisconnect={onDisconnect}
Expand All @@ -108,18 +94,9 @@ const StyledFolderShared = styled(FolderShared)`
align-self: 'center';
`;

const StyledRecordingIndicator = styled.div`
width: 10px;
height: 10px;
border-radius: 10px;
margin-right: 6px;
vertical-align: text-bottom;
`;

type Props = {
userHost: string;
clipboardSharingEnabled: boolean;
isRecording: boolean;
canShareDirectory: boolean;
isSharingDirectory: boolean;
onDisconnect: VoidFunction;
Expand Down
Loading