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 4 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
4 changes: 3 additions & 1 deletion packages/design/src/Icon/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import '../assets/icomoon/style.css';

const Icon = styled.span`
display: inline-block;
transition: color .3s;
transition: color 0.3s;
${space} ${width} ${color} ${fontSize}
`;

Expand Down Expand Up @@ -151,6 +151,8 @@ export const Expand = makeFontIcon('Expand', 'icon-frame-expand');
export const Facebook = makeFontIcon('Facebook', 'icon-facebook');
export const FacebookSquare = makeFontIcon('FacebookSquare', 'icon-facebook2');
export const FileCode = makeFontIcon('Youtube', 'icon-file-code');
export const FolderPlus = makeFontIcon('FolderPlus', 'icon-folder-plus');
Comment thread
ibeckermayer marked this conversation as resolved.
export const FolderShared = makeFontIcon('FolderShared', 'icon-folder-shared');
export const ForwarderAdded = makeFontIcon(
'ForwarderAdded',
'icon-add-fowarder'
Expand Down
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.eot
Binary file not shown.
4 changes: 4 additions & 0 deletions packages/design/src/assets/icomoon/fonts/icomoon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.ttf
Binary file not shown.
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.woff
Binary file not shown.
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.woff2
Binary file not shown.
14 changes: 13 additions & 1 deletion packages/design/src/assets/icomoon/style.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions packages/teleport/src/DesktopSession/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export default function ActionMenu(props: Props) {
}}
menuProps={menuProps}
>
{props.canShareDirectory && !props.isSharingDirectory && (
<MenuItem onClick={props.onShareDirectory}>
<MenuItemIcon as={Icons.FolderPlus} mr="2" />
Share Directory
</MenuItem>
)}
<MenuItem onClick={props.onDisconnect}>
<MenuItemIcon as={Icons.PowerSwitch} mr="2" />
Disconnect
Expand All @@ -41,6 +47,9 @@ export default function ActionMenu(props: Props) {
}

type Props = {
canShareDirectory: boolean;
isSharingDirectory: boolean;
onShareDirectory: VoidFunction;
Comment thread
ibeckermayer marked this conversation as resolved.
onDisconnect: VoidFunction;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ const props: State = {
onWsClose: () => {},
wsConnection: 'closed',
disconnected: false,
setDisconnected: () => null,
setDisconnected: () => {},
setClipboardState: () => {},
setIsRecording: () => {},
canShareDirectory: true,
isSharingDirectory: false,
setIsSharingDirectory: () => {},
onPngFrame: () => {},
onTdpError: () => {},
onKeyDown: () => {},
Expand Down Expand Up @@ -136,6 +141,7 @@ export const ConnectedSettingsTrue = () => {
errorText: '',
}}
isRecording={true}
isSharingDirectory={true}
onPngFrame={(ctx: CanvasRenderingContext2D) => {
fillGray(ctx.canvas);
}}
Expand Down
20 changes: 18 additions & 2 deletions packages/teleport/src/DesktopSession/DesktopSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ function Session(props: PropsWithChildren<State>) {
username,
hostname,
clipboardState,
setClipboardState,
isRecording,
setIsRecording,
canShareDirectory,
isSharingDirectory,
setIsSharingDirectory,
onPngFrame,
onClipboardData,
onTdpError,
Expand Down Expand Up @@ -144,11 +149,22 @@ function Session(props: PropsWithChildren<State>) {
<TopBar
onDisconnect={() => {
setDisconnected(true);
setClipboardState(prevState => ({
...prevState,
enabled: false,
}));
setIsRecording(false);
setIsSharingDirectory(false);
tdpClient.nuke();
}}
userHost={`${username}@${hostname}`}
clipboard={clipboardSharingActive}
recording={isRecording}
clipboardSharingEnabled={clipboardSharingActive}
isRecording={isRecording}
canShareDirectory={canShareDirectory}
isSharingDirectory={isSharingDirectory}
onShareDirectory={() => {
setIsSharingDirectory(true);
}}
/>

{props.children}
Expand Down
56 changes: 37 additions & 19 deletions packages/teleport/src/DesktopSession/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ limitations under the License.
import React from 'react';
import styled, { useTheme } from 'styled-components';
import { Text, TopNav, Flex } from 'design';
import { Clipboard } from 'design/Icon';
import { Clipboard, FolderShared } from 'design/Icon';
import { colors } from 'teleport/Console/colors';
import ActionMenu from './ActionMenu';

export default function TopBar(props: Props) {
const { userHost, clipboard, recording, onDisconnect } = props;
const {
userHost,
clipboardSharingEnabled,
isRecording,
onDisconnect,
canShareDirectory,
isSharingDirectory,
onShareDirectory,
} = props;
const theme = useTheme();

const primaryOnTrue = (b: boolean): any => {
Expand All @@ -42,30 +50,31 @@ export default function TopBar(props: Props) {
{userHost}
</Text>

<Text
style={{
...primaryOnTrue(clipboard),
verticalAlign: 'text-bottom',
}}
>
<StyledClipboard style={primaryOnTrue(clipboard)} pr={2} />
Clipboard Sharing {clipboard ? 'Enabled' : 'Disabled'}
</Text>

<Flex px={3}>
<Flex alignItems="center">
<StyledFolderShared
style={primaryOnTrue(isSharingDirectory)}
pr={3}
/>
<StyledClipboard
style={primaryOnTrue(clipboardSharingEnabled)}
pr={3}
/>
<StyledRecordingIndicator
style={{
backgroundColor: recording
backgroundColor: isRecording
? theme.colors.error.light
: theme.colors.text.secondary,
}}
/>
<Text style={primaryOnTrue(recording)}>
{recording ? '' : 'Not '}Recording
</Text>
<Text style={primaryOnTrue(isRecording)}>Recording</Text>
</Flex>
<ActionMenu onDisconnect={onDisconnect} />
<ActionMenu
onDisconnect={onDisconnect}
canShareDirectory={canShareDirectory}
isSharingDirectory={isSharingDirectory}
onShareDirectory={onShareDirectory}
/>
</Flex>
</TopNav>
);
Expand All @@ -79,6 +88,12 @@ const StyledClipboard = styled(Clipboard)`
align-self: 'center';
`;

const StyledFolderShared = styled(FolderShared)`
font-weight: ${({ theme }) => theme.fontWeights.bold};
font-size: ${({ theme }) => theme.fontSizes[6] + 'px'};
Comment on lines +106 to +107

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this, we should be doing this more to keep in line with our theme @rudream

align-self: 'center';
`;

const StyledRecordingIndicator = styled.div`
width: 10px;
height: 10px;
Expand All @@ -89,7 +104,10 @@ const StyledRecordingIndicator = styled.div`

type Props = {
userHost: string;
clipboard: boolean;
recording: boolean;
clipboardSharingEnabled: boolean;
isRecording: boolean;
canShareDirectory: boolean;
isSharingDirectory: boolean;
onDisconnect: VoidFunction;
onShareDirectory: VoidFunction;
};
Loading