diff --git a/src/user/UserCredentials.tsx b/src/user/UserCredentials.tsx index 67e5999d71..90b04a39c5 100644 --- a/src/user/UserCredentials.tsx +++ b/src/user/UserCredentials.tsx @@ -7,6 +7,8 @@ import { } from "react"; import { AlertVariant, + PageSection, + PageSectionVariants, Button, ButtonVariant, Divider, @@ -371,118 +373,122 @@ export const UserCredentials = ({ user }: UserCredentialsProps) => { {t("credentialResetBtn")} )} - - - - - - - - {t("type")} - {t("userLabel")} - {t("data")} - - - - - + - {groupedUserCredentials.map((groupedCredential, rowIndex) => ( - - id).toString()} - draggable={groupedUserCredentials.length > 1} - onDrop={onDrop} - onDragEnd={onDragEnd} - onDragStart={onDragStart} - > - id - )}`, - }} + + + + - {groupedCredential.value.length > 1 ? ( + + + {t("type")} + {t("userLabel")} + {t("data")} + + + + + + {groupedUserCredentials.map((groupedCredential, rowIndex) => ( + + id) + .toString()} + draggable={groupedUserCredentials.length > 1} + onDrop={onDrop} + onDragEnd={onDragEnd} + onDragStart={onDragStart} + > { - const rows = groupedUserCredentials.map( - (credential, index) => - index === rowIndex - ? { - ...credential, - isExpanded: !credential.isExpanded, - } - : credential - ); - setGroupedUserCredentials(rows); - }, + className={ + groupedUserCredentials.length === 1 ? "one-row" : "" + } + draggableRow={{ + id: `draggable-row-${groupedCredential.value.map( + ({ id }) => id + )}`, }} /> - ) : ( - - )} - - {toUpperCase(groupedCredential.key)} - - {groupedCredential.value.length <= 1 && - groupedCredential.value.map((credential) => ( - - ))} - - {groupedCredential.isExpanded && - groupedCredential.value.map((credential) => ( - - + {groupedCredential.value.length > 1 ? ( id - )}`, + className="kc-expandRow-btn" + expand={{ + rowIndex, + isExpanded: groupedCredential.isExpanded, + onToggle: (_, rowIndex) => { + const rows = groupedUserCredentials.map( + (credential, index) => + index === rowIndex + ? { + ...credential, + isExpanded: !credential.isExpanded, + } + : credential + ); + setGroupedUserCredentials(rows); + }, }} /> - + )} + + {toUpperCase(groupedCredential.key)} + + {groupedCredential.value.length <= 1 && + groupedCredential.value.map((credential) => ( + + ))} + + {groupedCredential.isExpanded && + groupedCredential.value.map((credential) => ( + - {toUpperCase(credential.type!)} - - - - ))} - - ))} - - + + id + )}`, + }} + /> + + {toUpperCase(credential.type!)} + + + + ))} + + ))} + + + ) : (