bito-code-review[bot] commented on code in PR #39451:
URL: https://github.com/apache/superset/pull/39451#discussion_r3518371472


##########
superset-frontend/.storybook/shared/Expandable.tsx:
##########
@@ -17,45 +17,38 @@
  * under the License.
  */
 
-import { Component, ReactNode } from 'react';
+import { useState, useCallback, ReactNode } from 'react';
 
 export type Props = {
   children: ReactNode;
   expandableWhat?: string;
 };
 
-type State = {
-  open: boolean;
-};
-
-export default class Expandable extends Component<Props, State> {
-  constructor(props: Props) {
-    super(props);
-    this.state = { open: false };
-    this.handleToggle = this.handleToggle.bind(this);
-  }
+export default function Expandable({ children, expandableWhat }: Props) {
+  const [open, setOpen] = useState(false);
 
-  handleToggle() {
-    this.setState(({ open }) => ({ open: !open }));
-  }
+  const handleToggle = useCallback(() => {
+    setOpen(prevOpen => !prevOpen);
+  }, []);
 
-  render() {
-    const { open } = this.state;
-    const { children, expandableWhat } = this.props;
+  const label = expandableWhat
+    ? `${open ? 'Hide' : 'Show'} ${expandableWhat}`
+    : open
+      ? 'Hide'
+      : 'Show';

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing translation function</b></div>
   <div id="fix">
   
   User-facing text labels 'Hide' and 'Show' should use the translation 
function `t()` for internationalization support. The same directory's 
`VerifyCORS.tsx` demonstrates this pattern correctly with `import { t } from 
'@apache-superset/core/translation'`.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #400859</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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