From f7e7e2ce8888f3fc557110aeb67c783d7f375eba Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 5 Dec 2024 11:23:03 +0530 Subject: [PATCH] feat: sonarcloud issues Signed-off-by: pranalidhanavade --- .../Verification/ConnectionList.tsx | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/src/components/Verification/ConnectionList.tsx b/src/components/Verification/ConnectionList.tsx index dc11b105..4f6db0c3 100644 --- a/src/components/Verification/ConnectionList.tsx +++ b/src/components/Verification/ConnectionList.tsx @@ -73,6 +73,39 @@ const ConnectionList = (props: { }); }; + const renderCheckbox = ( + ele: IConnectionList, + isChecked: boolean, + connections: IConnectionList[], + ) => { + return ( +
+ ) => { + const inputElement = event.target as HTMLInputElement; + + const updateConnectionList = connections.map((item) => { + if (item.connectionId === ele.connectionId) { + selectOrganization(item, inputElement.checked); + return { + ...item, + checked: inputElement.checked, + }; + } + return item; + }); + setConnectionList(updateConnectionList); + }} + className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded-lg dark:ring-offset-gray-800 dark:bg-gray-700 dark:border-gray-600 cursor-pointer" + /> +
+ ); + }; + const selectOrganization = async ( item: IConnectionList, @@ -126,38 +159,7 @@ const ConnectionList = (props: { return { data: [ - { - data: ( -
- , - ) => { - const inputElement = event.target as HTMLInputElement; - - const updateConnectionList = connections?.map( - (item) => { - if (item.connectionId === ele.connectionId) { - selectOrganization(item, inputElement.checked); - return { - ...item, - checked: inputElement.checked, - }; - } - return item; - }, - ); - setConnectionList(updateConnectionList); - }} - className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded-lg dark:ring-offset-gray-800 dark:bg-gray-700 dark:border-gray-600 cursor-pointer" - /> -
- ), - }, + { data: renderCheckbox(ele, isChecked, connections) }, { data: userName }, { data: connectionId }, {