eschutho commented on a change in pull request #18722:
URL: https://github.com/apache/superset/pull/18722#discussion_r810266915



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -144,9 +158,30 @@ const RightMenu = ({
       {menu.label}
     </>
   );
+
+  const handleMenuSelection = (itemChose: React.Key) => {
+    if (itemChose === GlobalMenuDataOptions.DB_CONNECTION) {
+      setShowModal(true);
+      setEngine('');
+    }
+    if (itemChose === GlobalMenuDataOptions.GOOGLE_SHEETS) {
+      setShowModal(true);
+      setEngine('Google Sheets');
+    }
+  };
+
   return (
     <StyledDiv align={align}>
-      <Menu mode="horizontal">
+      <DatabaseModal
+        onHide={() => setShowModal(false)}
+        show={showModal}
+        dbEngine={engine}
+      />
+      <Menu
+        selectable={false}
+        mode="horizontal"
+        onClick={({ key }) => handleMenuSelection(key)}

Review comment:
       another nit, but you can dry this up a bit by just passing the function, 
and then you can destructure the key in the props above in the function 
declaration itself. It's fine to only send the function what it needs if 
there's a lot of information that isn't going to be used, but for onClick 
handlers, this is usually an acceptable approach to send all the event info to 
the function. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to