Skip to content

Commit

Permalink
feat: sonarcloud issues
Browse files Browse the repository at this point in the history
Signed-off-by: pranalidhanavade <[email protected]>
  • Loading branch information
pranalidhanavade committed Dec 5, 2024
1 parent 4b57ea8 commit f7e7e2c
Showing 1 changed file with 34 additions and 32 deletions.
66 changes: 34 additions & 32 deletions src/components/Verification/ConnectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,39 @@ const ConnectionList = (props: {
});
};

const renderCheckbox = (
ele: IConnectionList,
isChecked: boolean,
connections: IConnectionList[],
) => {
return (
<div className="flex items-center" id="issuance_checkbox">
<input
id="default-checkbox"
type="checkbox"
name="connection"
defaultChecked={ele.checked || isChecked}
onClick={async (event: React.MouseEvent<HTMLInputElement>) => {
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"
/>
</div>
);
};


const selectOrganization = async (
item: IConnectionList,
Expand Down Expand Up @@ -126,38 +159,7 @@ const ConnectionList = (props: {

return {
data: [
{
data: (
<div className="flex items-center" id="issuance_checkbox">
<input
id="default-checkbox"
type="checkbox"
name="connection"
defaultChecked={ele.checked || isChecked}
onClick={async (
event: React.MouseEvent<HTMLInputElement>,
) => {
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"
/>
</div>
),
},
{ data: renderCheckbox(ele, isChecked, connections) },
{ data: userName },
{ data: connectionId },
{
Expand Down

0 comments on commit f7e7e2c

Please sign in to comment.