Skip to content

Commit 3c3e112

Browse files
committed
Update Views.react.js
1 parent a192947 commit 3c3e112

File tree

4 files changed

+38
-24
lines changed

4 files changed

+38
-24
lines changed

src/components/BrowserMenu/BrowserMenu.react.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,17 @@ export default class BrowserMenu extends React.Component {
6868
: {}),
6969
}}
7070
>
71-
{React.Children.map(this.props.children, child => {
72-
if (child.type === BrowserMenu) {
71+
{React.Children.map(this.props.children, (child) => {
72+
if (React.isValidElement(child) && child.type === BrowserMenu) {
7373
return React.cloneElement(child, {
7474
...child.props,
75-
parentClose: () => this.setState({ open: false }),
75+
parentClose: () => {
76+
this.setState({ open: false });
77+
this.props.parentClose?.();
78+
},
7679
});
7780
}
78-
return React.cloneElement(child, {
79-
...child.props,
80-
onClick: () => {
81-
child.props.onClick?.();
82-
this.setState({ open: false });
83-
this.props.parentClose?.();
84-
},
85-
});
81+
return child;
8682
})}
8783
</div>
8884
</div>
@@ -119,7 +115,7 @@ export default class BrowserMenu extends React.Component {
119115
{this.props.icon && <Icon name={this.props.icon} width={14} height={14} />}
120116
<span>{this.props.title}</span>
121117
{isSubmenu &&
122-
React.Children.toArray(this.props.children).some(c => c.type === BrowserMenu) && (
118+
React.Children.toArray(this.props.children).some(c => React.isValidElement(c) && c.type === BrowserMenu) && (
123119
<Icon
124120
name="right-outline"
125121
width={12}

src/components/BrowserMenu/MenuItem.react.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,24 @@ const MenuItem = ({ text, disabled, active, greenActive, onClick }) => {
1919
if (greenActive) {
2020
classes.push(styles.greenActive);
2121
}
22+
23+
const handleClick = (e) => {
24+
if (!disabled && onClick) {
25+
onClick(e);
26+
}
27+
};
28+
2229
return (
23-
<div className={classes.join(' ')} onClick={disabled ? undefined : onClick}>
30+
<div
31+
className={classes.join(' ')}
32+
onClick={handleClick}
33+
onMouseDown={handleClick} // This is needed - onClick alone doesn't work in this context
34+
style={{
35+
position: 'relative',
36+
zIndex: 9999,
37+
cursor: 'pointer'
38+
}}
39+
>
2440
{text}
2541
</div>
2642
);

src/dashboard/Data/Browser/BrowserToolbar.react.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
*/
88
import BrowserFilter from 'components/BrowserFilter/BrowserFilter.react';
99
import BrowserMenu from 'components/BrowserMenu/BrowserMenu.react';
10-
import Icon from 'components/Icon/Icon.react';
1110
import MenuItem from 'components/BrowserMenu/MenuItem.react';
12-
import prettyNumber from 'lib/prettyNumber';
13-
import React, { useRef } from 'react';
1411
import Separator from 'components/BrowserMenu/Separator.react';
15-
import styles from 'dashboard/Data/Browser/Browser.scss';
16-
import Toolbar from 'components/Toolbar/Toolbar.react';
17-
import SecurityDialog from 'dashboard/Data/Browser/SecurityDialog.react';
1812
import ColumnsConfiguration from 'components/ColumnsConfiguration/ColumnsConfiguration.react';
19-
import SecureFieldsDialog from 'dashboard/Data/Browser/SecureFieldsDialog.react';
20-
import LoginDialog from 'dashboard/Data/Browser/LoginDialog.react';
13+
import Icon from 'components/Icon/Icon.react';
2114
import Toggle from 'components/Toggle/Toggle.react';
15+
import Toolbar from 'components/Toolbar/Toolbar.react';
16+
import styles from 'dashboard/Data/Browser/Browser.scss';
17+
import LoginDialog from 'dashboard/Data/Browser/LoginDialog.react';
18+
import SecureFieldsDialog from 'dashboard/Data/Browser/SecureFieldsDialog.react';
19+
import SecurityDialog from 'dashboard/Data/Browser/SecurityDialog.react';
20+
import prettyNumber from 'lib/prettyNumber';
21+
import React, { useRef } from 'react';
2222

2323
const BrowserToolbar = ({
2424
className,
@@ -447,7 +447,7 @@ const BrowserToolbar = ({
447447
)}
448448
<div className={styles.toolbarSeparator} />
449449
<BrowserMenu setCurrent={setCurrent} title="Settings" icon="gear-solid">
450-
<BrowserMenu title="Info Panel">
450+
<BrowserMenu title="Info Panel" setCurrent={setCurrent}>
451451
<MenuItem
452452
text={
453453
<span>
@@ -463,7 +463,9 @@ const BrowserToolbar = ({
463463
Scroll to top
464464
</span>
465465
}
466-
onClick={toggleScrollToTop}
466+
onClick={() => {
467+
toggleScrollToTop();
468+
}}
467469
/>
468470
</BrowserMenu>
469471
</BrowserMenu>

src/dashboard/Data/Views/Views.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class Views extends TableView {
340340
text = 'Link';
341341
}
342342
content = (
343-
<a href={url} target="_blank" rel="noreferrer">
343+
<a href={url} target="_blank" rel="noopener noreferrer">
344344
{text}
345345
</a>
346346
);

0 commit comments

Comments
 (0)