korbit-ai[bot] commented on code in PR #33002: URL: https://github.com/apache/superset/pull/33002#discussion_r2029320512
########## superset-frontend/src/features/bulkCertifyModal/BulkCertifyModal.tsx: ########## @@ -0,0 +1,159 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { useState, useEffect, FC } from 'react'; + +import { t, SupersetClient } from '@superset-ui/core'; +import { FormLabel } from 'src/components/Form'; +import Modal from 'src/components/Modal'; +import { Input } from 'src/components/Input'; +import Button from 'src/components/Button'; + +import Chart from 'src/types/Chart'; +import { Dashboard } from 'src/pages/DashboardList'; +import { Row, Col } from 'src/components'; + +interface BulkCertifyModalProps { + onHide: () => void; + refreshData: () => void; + addSuccessToast: (msg: string) => void; + addDangerToast: (msg: string) => void; + show: boolean; + resourceName: 'chart' | 'dashboard'; + resourceLabel: string; + selected: Chart[] | Dashboard[]; +} + +const BulkCertifyModal: FC<BulkCertifyModalProps> = ({ + show, + selected = [], + resourceName, + resourceLabel, + onHide, + refreshData, + addSuccessToast, + addDangerToast, +}) => { + useEffect(() => {}, []); Review Comment: ### Redundant Empty useEffect <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? Empty useEffect hook that serves no purpose and doesn't implement any functionality. ###### Why this matters Unnecessary code that adds complexity without providing any benefit to the component's functionality. ###### Suggested change ∙ *Feature Preview* Remove the empty useEffect hook: ```typescript // Delete this line: useEffect(() => {}, []); ` ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7c7afaa0-fde3-444b-9db9-ac097a3e6b6e/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7c7afaa0-fde3-444b-9db9-ac097a3e6b6e?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7c7afaa0-fde3-444b-9db9-ac097a3e6b6e?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7c7afaa0-fde3-444b-9db9-ac097a3e6b6e?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7c7afaa0-fde3-444b-9db9-ac097a3e6b6e) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:8791a37b-03a8-492d-997d-2da3451ba3ac --> [](8791a37b-03a8-492d-997d-2da3451ba3ac) ########## superset-frontend/src/features/bulkCertifyModal/BulkCertifyModal.tsx: ########## @@ -0,0 +1,159 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { useState, useEffect, FC } from 'react'; + +import { t, SupersetClient } from '@superset-ui/core'; +import { FormLabel } from 'src/components/Form'; +import Modal from 'src/components/Modal'; +import { Input } from 'src/components/Input'; +import Button from 'src/components/Button'; + +import Chart from 'src/types/Chart'; +import { Dashboard } from 'src/pages/DashboardList'; +import { Row, Col } from 'src/components'; + +interface BulkCertifyModalProps { + onHide: () => void; + refreshData: () => void; + addSuccessToast: (msg: string) => void; + addDangerToast: (msg: string) => void; + show: boolean; + resourceName: 'chart' | 'dashboard'; + resourceLabel: string; + selected: Chart[] | Dashboard[]; +} + +const BulkCertifyModal: FC<BulkCertifyModalProps> = ({ + show, + selected = [], + resourceName, + resourceLabel, + onHide, + refreshData, + addSuccessToast, + addDangerToast, +}) => { + useEffect(() => {}, []); + const [certifiedBy, setCertifiedBy] = useState<string>(''); + const [certificationDetails, setCertificationDetails] = useState<string>(''); + + const resourceLabelPlural = resourceLabel + (selected.length > 1 ? 's' : ''); Review Comment: ### Use translation system for pluralization <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? String concatenation for pluralization is hardcoded and not using the translation system. ###### Why this matters This approach breaks i18n as pluralization rules vary across languages. It also creates inconsistency with the rest of the codebase that uses the translation system. ###### Suggested change ∙ *Feature Preview* Use the translation system's pluralization feature: ```typescript const resourceLabelPlural = t('%s|%s', resourceLabel, selected.length > 1 ? resourceLabel + 's' : resourceLabel); ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/826da367-66be-45bc-a526-74521f4793c2/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/826da367-66be-45bc-a526-74521f4793c2?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/826da367-66be-45bc-a526-74521f4793c2?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/826da367-66be-45bc-a526-74521f4793c2?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/826da367-66be-45bc-a526-74521f4793c2) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:fa1d205f-49b3-4efa-8575-1b2da08c7013 --> [](fa1d205f-49b3-4efa-8575-1b2da08c7013) -- 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]
