Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
55c9094
Add mapping of profile color to theme color
gzdunek Jan 23, 2025
53ae5ca
Prepare UserIcon to display colors, make it slightly larger
gzdunek Jan 23, 2025
a38c33b
Rewrite single identity item to show icon and user/cluster in separat…
gzdunek Jan 23, 2025
eef851a
Render single cluster items in a list
gzdunek Jan 23, 2025
38ea693
Add color picker
gzdunek Jan 23, 2025
adf1a12
Render active cluster separately, above inactive clusters
gzdunek Jan 23, 2025
f6b3aae
Put the new identity components together
gzdunek Jan 23, 2025
589a3b6
Refactor `Identity` story, render the container component instead of …
gzdunek Jan 23, 2025
2277d20
Refresh startup page
gzdunek Jan 23, 2025
5764532
Minor style fixes
gzdunek Jan 24, 2025
8848477
Add comment about `dataVisualisationColors`
gzdunek Jan 27, 2025
6d7669c
Bring back the original styling of `StaticListItem`
gzdunek Jan 27, 2025
c1ca1d5
Make the pencil icon hoverable and clickable
gzdunek Jan 27, 2025
f832037
Increase min-width from 200 px to 300 px, simplify active cluster layout
gzdunek Jan 28, 2025
a40abe4
Show logout button when any part of `ListItem` is hovered
gzdunek Jan 28, 2025
65129f7
Remove text from logout button, improve titles
gzdunek Jan 28, 2025
fd15900
Pass correct index number to `AddClusterItem`
gzdunek Jan 28, 2025
69fd8b1
Update comment for `focusGrabber`
gzdunek Jan 29, 2025
850e92e
Use `useStoreSelector` correctly
gzdunek Jan 29, 2025
4dda63b
Improve accessibility of color picker
gzdunek Jan 29, 2025
d7306ce
Replace Pam icon with plus symbol
gzdunek Jan 29, 2025
b2ee4c1
Remove unnecessary optional chaining
gzdunek Jan 29, 2025
a633924
Align profile status error with user icon
gzdunek Jan 29, 2025
56348fd
Add story for cluster connect panel
gzdunek Jan 29, 2025
ef3bf76
Make user icon letter follow active theme
gzdunek Jan 29, 2025
08230d0
Change gap from 11 px to 10 px
gzdunek Jan 30, 2025
2e6b4a4
Rename profile color -> workspace color
gzdunek Jan 30, 2025
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
6 changes: 5 additions & 1 deletion web/packages/design/src/theme/themes/darkTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ import { lighten } from '../utils/colorManipulator';
import { sharedColors, sharedStyles } from './sharedStyles';
import { DataVisualisationColors, Theme, ThemeColors } from './types';

const dataVisualisationColors: DataVisualisationColors = {
/**
* Used for the user icon in Connect (the top-right one).
* In both the light and dark mode, the dark version of dataVisualisationColors is used.
*/
export const dataVisualisationColors: DataVisualisationColors = {
primary: {
purple: '#9F85FF',
wednesdays: '#F74DFF',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* Teleport
* Copyright (C) 2025 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import {
makeLoggedInUser,
makeRootCluster,
} from 'teleterm/services/tshd/testHelpers';
import { MockAppContextProvider } from 'teleterm/ui/fixtures/MockAppContextProvider';
import { MockAppContext } from 'teleterm/ui/fixtures/mocks';

import { ClusterConnectPanel } from './ClusterConnectPanel';

export default {
title: 'Teleterm/ClusterConnectPanel',
};

const profileStatusError =
'No YubiKey device connected with serial number 14358031. Connect the device and try again.';
const clusterOrange = makeRootCluster({
name: 'orange',
loggedInUser: makeLoggedInUser({
name: 'bob',
roles: ['access', 'editor'],
sshLogins: ['root'],
}),
uri: '/clusters/orange',
});
const clusterViolet = makeRootCluster({
name: 'violet',
loggedInUser: makeLoggedInUser({ name: 'sammy' }),
uri: '/clusters/violet',
});

export const Empty = () => {
return (
<MockAppContextProvider>
<ClusterConnectPanel />
</MockAppContextProvider>
);
};

export const WithClusters = () => {
const ctx = new MockAppContext();
ctx.addRootCluster(clusterOrange);
ctx.addRootCluster(clusterViolet);

return (
<MockAppContextProvider appContext={ctx}>
<ClusterConnectPanel />;
</MockAppContextProvider>
);
};

export const WithErrors = () => {
const ctx = new MockAppContext();
ctx.addRootCluster(
makeRootCluster({
...clusterOrange,
profileStatusError,
})
);
ctx.addRootCluster(clusterViolet);
return (
<MockAppContextProvider appContext={ctx}>
<ClusterConnectPanel />;
</MockAppContextProvider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,51 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { useCallback, useEffect, useRef } from 'react';
import styled from 'styled-components';

import { Box, ButtonPrimary, Flex, H1, ResourceIcon, Text } from 'design';
import {
Box,
ButtonPrimary,
Flex,
H1,
H2,
P2,
ResourceIcon,
Text,
} from 'design';

import { useAppContext } from 'teleterm/ui/appContextProvider';

import { RecentClusters } from './RecentClusters';
import { NullKeyboardArrowsNavigation } from 'teleterm/ui/components/KeyboardArrowsNavigation/KeyboardArrowsNavigation';
import { useStoreSelector } from 'teleterm/ui/hooks/useStoreSelector';
import { ClusterList } from 'teleterm/ui/TopBar/Identity/IdentityList/IdentityList';
import { RootClusterUri } from 'teleterm/ui/uri';

export function ClusterConnectPanel() {
const ctx = useAppContext();

function handleConnect() {
const clusters = useStoreSelector(
'clustersService',
useCallback(state => state.clusters, [])
);
const rootClusters = [...clusters.values()].filter(c => !c.leaf);
function add(): void {
ctx.commandLauncher.executeCommand('cluster-connect', {});
}

function connect(clusterUri: RootClusterUri): void {
ctx.workspacesService.setActiveWorkspace(clusterUri);
}

const containerRef = useRef<HTMLDivElement>();

// Focus the first item.
const hasCluster = !!rootClusters.length;
useEffect(() => {
if (hasCluster) {
containerRef.current.querySelector('li').focus();
}
}, [hasCluster]);

return (
<ScrollingContainer>
<Box width="100%" m="auto" pb={3} pt={1} px={3}>
Expand All @@ -41,16 +71,48 @@ export function ClusterConnectPanel() {
alignItems="center"
>
<ResourceIcon width="120px" name="server" mb={3} />
<H1 mb={2}>Connect a Cluster</H1>
<Text color="text.slightlyMuted" mb={3} textAlign="center">
Connect an existing Teleport cluster <br /> to start using Teleport
Connect.
</Text>
<ButtonPrimary size="large" onClick={handleConnect}>
Connect
</ButtonPrimary>
{hasCluster ? (
<Flex flexDirection="column">
<H2>Clusters</H2>
<P2 color="text.slightlyMuted" mb={2}>
Log in to a cluster to use Teleport Connect.
</P2>
{/*Disable arrows navigation, it doesn't work well here,*/}
{/*since it requires the container to be focused.*/}
{/*The user can navigate with Tab.*/}
<NullKeyboardArrowsNavigation>
<Flex
maxWidth="450px"
ref={containerRef}
flexDirection="column"
css={`
li {
border-radius: ${p => p.theme.radii[2]}px;
padding: ${p => p.theme.space[2]}px;
}
`}
>
<ClusterList
clusters={rootClusters}
onAdd={add}
onSelect={connect}
/>
</Flex>
</NullKeyboardArrowsNavigation>
</Flex>
) : (
<>
<H1 mb={2}>Connect a Cluster</H1>
<Text color="text.slightlyMuted" mb={3} textAlign="center">
Connect an existing Teleport cluster <br /> to start using
Teleport Connect.
</Text>
<ButtonPrimary size="large" onClick={add}>
Connect
</ButtonPrimary>
</>
)}
</Flex>
<RecentClusters />
</Box>
</ScrollingContainer>
);
Expand Down

This file was deleted.

This file was deleted.

Loading