Skip to content

Commit ab8bde8

Browse files
committed
Disable pointer cursor and connect on click for disconnected connections
1 parent 3f401a0 commit ab8bde8

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

packages/compass-connections-navigation/src/base-navigation-item.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type NavigationBaseItemProps = {
1717
isExpandDisabled: boolean;
1818
isExpanded: boolean;
1919
isFocused: boolean;
20+
hasDefaultAction: boolean;
2021
icon: React.ReactNode;
2122
style: React.CSSProperties;
2223

@@ -37,7 +38,6 @@ const menuStyles = css({
3738
});
3839

3940
const itemContainerStyles = css({
40-
cursor: 'pointer',
4141
color: 'var(--item-color)',
4242
backgroundColor: 'var(--item-bg-color)',
4343
'&[data-is-active="true"] .item-wrapper': {
@@ -53,6 +53,10 @@ const itemContainerStyles = css({
5353
},
5454
});
5555

56+
const itemContainerWithActionStyles = css({
57+
cursor: 'pointer',
58+
});
59+
5660
const itemWrapperStyles = css({
5761
display: 'flex',
5862
height: ROW_HEIGHT,
@@ -93,14 +97,17 @@ export const NavigationBaseItem: React.FC<NavigationBaseItemProps> = ({
9397
isExpandDisabled,
9498
isExpanded,
9599
isFocused,
100+
hasDefaultAction,
96101
onExpand,
97102
children,
98103
}) => {
99104
const [hoverProps, isHovered] = useHoverState();
100105
return (
101106
<div
102107
data-testid="base-navigation-item"
103-
className={itemContainerStyles}
108+
className={cx(itemContainerStyles, {
109+
[itemContainerWithActionStyles]: hasDefaultAction,
110+
})}
104111
{...hoverProps}
105112
{...dataAttributes}
106113
>

packages/compass-connections-navigation/src/connections-navigation-tree.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ const ConnectionsNavigationTree: React.FunctionComponent<
8787
if (item.type === 'connection') {
8888
if (item.connectionStatus === 'connected') {
8989
onItemAction(item, 'select-connection');
90-
} else {
91-
onItemAction(item, 'connection-connect');
9290
}
9391
} else if (item.type === 'database') {
9492
onItemAction(item, 'select-database');

packages/compass-connections-navigation/src/navigation-item.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ export function NavigationItem({
251251
isActive={isActive}
252252
isFocused={isFocused}
253253
isExpanded={!!item.isExpanded}
254+
hasDefaultAction={
255+
item.type !== 'connection' || item.connectionStatus === 'connected'
256+
}
254257
icon={itemIcon}
255258
name={item.name}
256259
style={style}

0 commit comments

Comments
 (0)