diff --git a/.eslintrc.js b/.eslintrc.js index f7cdd0c04e..d385f0e8ed 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,6 +30,8 @@ module.exports = { // react/prop-types cannot handle generic props, so we need to disable it. // https://github.com/yannickcr/eslint-plugin-react/issues/2777#issuecomment-814968432 "react/prop-types": "off", + // Prevent fragments from being added that have only a single child. + "react/jsx-no-useless-fragment": "error" }, overrides: [ { diff --git a/src/PageHeader.tsx b/src/PageHeader.tsx index a235d816d9..d193c0d9ea 100644 --- a/src/PageHeader.tsx +++ b/src/PageHeader.tsx @@ -27,37 +27,27 @@ export const Header = () => { const adminClient = useAdminClient(); const { t } = useTranslation(); - const ManageAccountDropdownItem = () => { - return ( - <> - {adminClient.keycloak && ( - adminClient.keycloak?.accountManagement()} - > - {t("manageAccount")} - - )} - > - ); - }; + const ManageAccountDropdownItem = () => + adminClient.keycloak ? ( + adminClient.keycloak?.accountManagement()} + > + {t("manageAccount")} + + ) : null; - const SignOutDropdownItem = () => { - return ( - <> - {adminClient.keycloak && ( - adminClient.keycloak?.logout({ redirectUri: "" })} - > - {t("signOut")} - - )} - > - ); - }; + const SignOutDropdownItem = () => + adminClient.keycloak ? ( + adminClient.keycloak?.logout({ redirectUri: "" })} + > + {t("signOut")} + + ) : null; const ServerInfoDropdownItem = () => { const { realm } = useRealm(); diff --git a/src/client-scopes/ClientScopesSection.tsx b/src/client-scopes/ClientScopesSection.tsx index 8e0ff6a0eb..637251ddd3 100644 --- a/src/client-scopes/ClientScopesSection.tsx +++ b/src/client-scopes/ClientScopesSection.tsx @@ -107,22 +107,20 @@ export const ClientScopesSection = () => { }); const TypeSelector = (scope: ClientScopeDefaultOptionalType) => ( - <> - { - try { - await changeScope(adminClient, scope, value); - addAlert(t("clientScopeSuccess"), AlertVariant.success); - refresh(); - } catch (error) { - addError("client-scopes:clientScopeError", error); - } - }} - /> - > + { + try { + await changeScope(adminClient, scope, value); + addAlert(t("clientScopeSuccess"), AlertVariant.success); + refresh(); + } catch (error) { + addError("client-scopes:clientScopeError", error); + } + }} + /> ); const ClientScopeDetailLink = ({ @@ -130,14 +128,12 @@ export const ClientScopesSection = () => { type, name, }: ClientScopeDefaultOptionalType) => ( - <> - - {name} - - > + + {name} + ); return ( <> diff --git a/src/client-scopes/add/MapperDialog.tsx b/src/client-scopes/add/MapperDialog.tsx index f0e8b4dbd6..17c8eb08b8 100644 --- a/src/client-scopes/add/MapperDialog.tsx +++ b/src/client-scopes/add/MapperDialog.tsx @@ -128,10 +128,10 @@ export const AddMapperDialog = (props: AddMapperDialogProps) => { - <>{mapper.name}> + {mapper.name} , - <>{mapper.helpText}> + {mapper.helpText} , ]} /> diff --git a/src/client-scopes/details/MapperList.tsx b/src/client-scopes/details/MapperList.tsx index e7141ee709..66715979b6 100644 --- a/src/client-scopes/details/MapperList.tsx +++ b/src/client-scopes/details/MapperList.tsx @@ -99,11 +99,9 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => { ); const MapperLink = ({ id, name }: Row) => ( - <> - - {name} - - > + + {name} + ); return ( diff --git a/src/client-scopes/details/MappingDetails.tsx b/src/client-scopes/details/MappingDetails.tsx index eeebda7958..8cd2b010bd 100644 --- a/src/client-scopes/details/MappingDetails.tsx +++ b/src/client-scopes/details/MappingDetails.tsx @@ -164,40 +164,36 @@ export const MappingDetails = () => { onSubmit={handleSubmit(save)} role="manage-clients" > - <> - {!mapperId.match(isGuid) && ( - - } - fieldId="name" - isRequired + {!mapperId.match(isGuid) && ( + + } + fieldId="name" + isRequired + validated={ + errors.name ? ValidatedOptions.error : ValidatedOptions.default + } + helperTextInvalid={t("common:required")} + > + - - - )} - > + /> + + )} { ); return ( - <> - - - - - - - - } - > - + + + + + + - - - } - > - - - - } - > - - - - } - > - - - - } - > - - - - - - } - fieldId="loginTheme" - > - ( - setLoginThemeOpen(!loginThemeOpen)} - onSelect={(_, value) => { - onChange(value as string); - setLoginThemeOpen(false); - }} - selections={value || t("common:choose")} - variant={SelectVariant.single} - aria-label={t("loginTheme")} - isOpen={loginThemeOpen} - > - - {t("common:choose")} - - <> - {loginThemes?.map((theme) => ( - - ))} - > - - )} - /> - - - ( - - )} - /> - - - ( - onChange("" + value)} - isDisabled={!consentRequired} - /> - )} - /> - - - - - + - - - > + + + } + > + + + + } + > + + + + } + > + + + + } + > + + + + + + } + fieldId="loginTheme" + > + ( + setLoginThemeOpen(!loginThemeOpen)} + onSelect={(_, value) => { + onChange(value as string); + setLoginThemeOpen(false); + }} + selections={value || t("common:choose")} + variant={SelectVariant.single} + aria-label={t("loginTheme")} + isOpen={loginThemeOpen} + > + + {t("common:choose")} + + {/* The type for the children of Select are incorrect, so we need a fragment here. */} + {/* eslint-disable-next-line react/jsx-no-useless-fragment */} + <> + {loginThemes?.map((theme) => ( + + ))} + > + + )} + /> + + + ( + + )} + /> + + + ( + onChange("" + value)} + isDisabled={!consentRequired} + /> + )} + /> + + + + + + + ); }; diff --git a/src/clients/ClientsSection.tsx b/src/clients/ClientsSection.tsx index ee0cedd159..cb5fc0ead5 100644 --- a/src/clients/ClientsSection.tsx +++ b/src/clients/ClientsSection.tsx @@ -70,27 +70,23 @@ export const ClientsSection = () => { }); const ClientDetailLink = (client: ClientRepresentation) => ( - <> - - {client.clientId} - {!client.enabled && ( - - {t("common:disabled")} - - )} - - > + + {client.clientId} + {!client.enabled && ( + + {t("common:disabled")} + + )} + ); const ClientDescription = (client: ClientRepresentation) => ( - <> - - {emptyFormatter()(client.description)} - - > + + {emptyFormatter()(client.description)} + ); return ( diff --git a/src/clients/add/CapabilityConfig.tsx b/src/clients/add/CapabilityConfig.tsx index 10816fd099..531116cdd0 100644 --- a/src/clients/add/CapabilityConfig.tsx +++ b/src/clients/add/CapabilityConfig.tsx @@ -38,264 +38,260 @@ export const CapabilityConfig = ({ unWrap={unWrap} className="keycloak__capability-config__form" > - <> - {protocol === "openid-connect" && ( - <> - - } - > - ( - { - onChange(!value); - if (!value) { - setValue("authorizationServicesEnabled", false); - setValue("serviceAccountsEnabled", false); - } - }} - /> - )} + {protocol === "openid-connect" && ( + <> + - - + ( + { + onChange(!value); + if (!value) { + setValue("authorizationServicesEnabled", false); + setValue("serviceAccountsEnabled", false); + } + }} /> - } - > - ( - { - onChange(value); - if (value) { - setValue("serviceAccountsEnabled", true); - } - }} - isDisabled={clientAuthentication} - /> - )} + )} + /> + + - - - - - ( - - - - - )} - /> - - - ( - - - - - )} - /> - - - ( - - - - - )} - /> - - - ( - - - - - )} - /> - - - - > - )} - > - <> - {protocol === "saml" && ( - <> - + ( + { + onChange(value); + if (value) { + setValue("serviceAccountsEnabled", true); + } + }} + isDisabled={clientAuthentication} /> - } - label={t("encryptAssertions")} - fieldId="kc-encrypt" - hasNoPaddingTop - > - ( - onChange("" + value)} - /> - )} - /> - - + + + + + ( + + + + + )} /> - } - label={t("clientSignature")} - fieldId="kc-client-signature" - hasNoPaddingTop - > - ( - onChange("" + value)} - /> - )} + + + ( + + + + + )} + /> + + + ( + + + + + )} + /> + + + ( + + + + + )} + /> + + + + > + )} + {protocol === "saml" && ( + <> + - - > - )} - > + } + label={t("encryptAssertions")} + fieldId="kc-encrypt" + hasNoPaddingTop + > + ( + onChange("" + value)} + /> + )} + /> + + + } + label={t("clientSignature")} + fieldId="kc-client-signature" + hasNoPaddingTop + > + ( + onChange("" + value)} + /> + )} + /> + + > + )} ); }; diff --git a/src/clients/credentials/SignedJWT.tsx b/src/clients/credentials/SignedJWT.tsx index 78be9c4863..4e57b8e2f1 100644 --- a/src/clients/credentials/SignedJWT.tsx +++ b/src/clients/credentials/SignedJWT.tsx @@ -21,52 +21,50 @@ export const SignedJWT = () => { const [open, isOpen] = useState(false); return ( - <> - - } - > - ( - isOpen(!open)} - onSelect={(_, value) => { - onChange(value as string); - isOpen(false); - }} - selections={value || t("anyAlgorithm")} - variant={SelectVariant.single} - aria-label={t("signatureAlgorithm")} - isOpen={open} - > - - {t("anyAlgorithm")} - - <> - {providers.map((option) => ( - - ))} - > - - )} + - - > + } + > + ( + isOpen(!open)} + onSelect={(_, value) => { + onChange(value as string); + isOpen(false); + }} + selections={value || t("anyAlgorithm")} + variant={SelectVariant.single} + aria-label={t("signatureAlgorithm")} + isOpen={open} + > + + {t("anyAlgorithm")} + + <> + {providers.map((option) => ( + + ))} + > + + )} + /> + ); }; diff --git a/src/clients/keys/Keys.tsx b/src/clients/keys/Keys.tsx index e1bdfc4c88..7f8edf593f 100644 --- a/src/clients/keys/Keys.tsx +++ b/src/clients/keys/Keys.tsx @@ -153,32 +153,29 @@ export const Keys = ({ clientId, save }: KeysProps) => { )} /> - {useJwksUrl !== "true" && ( - <> - {keyInfo ? ( - - } - > - - - ) : ( - "No client certificate configured" - )} - > - )} + } + > + + + ) : ( + "No client certificate configured" + ))} {useJwksUrl === "true" && ( { }; const TypeSelector = (scope: Row) => ( - <> - { - try { - await changeScope( - adminClient, - clientId, - scope, - scope.type, - value as ClientScope - ); - addAlert(t("clientScopeSuccess"), AlertVariant.success); - refresh(); - } catch (error) { - addError("clients:clientScopeError", error); - } - }} - /> - > + { + try { + await changeScope( + adminClient, + clientId, + scope, + scope.type, + value as ClientScope + ); + addAlert(t("clientScopeSuccess"), AlertVariant.success); + refresh(); + } catch (error) { + addError("clients:clientScopeError", error); + } + }} + /> ); return ( diff --git a/src/clients/service-account/ServiceAccount.tsx b/src/clients/service-account/ServiceAccount.tsx index 46073a02d4..0bf745652f 100644 --- a/src/clients/service-account/ServiceAccount.tsx +++ b/src/clients/service-account/ServiceAccount.tsx @@ -97,18 +97,14 @@ export const ServiceAccount = ({ client }: ServiceAccountProps) => { addError("clients:roleMappingUpdatedError", error); } }; - return ( - <> - {serviceAccount && ( - setHide(!hide)} - /> - )} - > - ); + return serviceAccount ? ( + setHide(!hide)} + /> + ) : null; }; diff --git a/src/components/attribute-form/AttributeForm.tsx b/src/components/attribute-form/AttributeForm.tsx index 34f91c7731..f56f38c308 100644 --- a/src/components/attribute-form/AttributeForm.tsx +++ b/src/components/attribute-form/AttributeForm.tsx @@ -75,60 +75,73 @@ export const AttributesForm = ({ }, [fields]); return ( - <> - - - - - - {columns[0]} - - - {columns[1]} - - - - - {fields.map((attribute, rowIndex) => ( - + + + + + + {columns[0]} + + + {columns[1]} + + + + + {fields.map((attribute, rowIndex) => ( + + + + + + + + {rowIndex !== fields.length - 1 && fields.length - 1 !== 0 && ( - - - - - - {rowIndex !== fields.length - 1 && fields.length - 1 !== 0 && ( - remove(rowIndex)} > + + + + )} + {rowIndex === fields.length - 1 && ( + + {fields.length !== 1 && ( - - )} - {rowIndex === fields.length - 1 && ( - - {fields.length !== 1 && ( - remove(rowIndex)} - > - - - )} - - )} - - ))} - - - append({ key: "", value: "" })} - icon={} - isDisabled={!watchLast} - > - {t("roles:addAttributeText")} - - + )} + + )} - - - - - {t("common:save")} - - - {t("common:revert")} - - - - > + ))} + + + append({ key: "", value: "" })} + icon={} + isDisabled={!watchLast} + > + {t("roles:addAttributeText")} + + + + + + + + {t("common:save")} + + + {t("common:revert")} + + + ); }; diff --git a/src/components/bread-crumb/GroupBreadCrumbs.tsx b/src/components/bread-crumb/GroupBreadCrumbs.tsx index 1791439942..217f83a6c5 100644 --- a/src/components/bread-crumb/GroupBreadCrumbs.tsx +++ b/src/components/bread-crumb/GroupBreadCrumbs.tsx @@ -22,37 +22,31 @@ export const GroupBreadCrumbs = () => { }); }, [history]); - return ( - <> - {subGroups.length !== 0 && ( - - - {t("groups")} - - {subGroups.map((group, i) => { - const isLastGroup = i === subGroups.length - 1; - return ( - - {!isLastGroup && ( - remove(group)} - > - {group.name} - + return subGroups.length !== 0 ? ( + + + {t("groups")} + + {subGroups.map((group, i) => { + const isLastGroup = i === subGroups.length - 1; + return ( + + {!isLastGroup && ( + - ); - })} - - )} - > - ); + onClick={() => remove(group)} + > + {group.name} + + )} + {isLastGroup && + (group.id === "search" ? group.name : t("groups:groupDetails"))} + + ); + })} + + ) : null; }; diff --git a/src/components/bread-crumb/PageBreadCrumbs.tsx b/src/components/bread-crumb/PageBreadCrumbs.tsx index 70d13c2f5b..54f33a59b6 100644 --- a/src/components/bread-crumb/PageBreadCrumbs.tsx +++ b/src/components/bread-crumb/PageBreadCrumbs.tsx @@ -37,7 +37,7 @@ export const PageBreadCrumbs = () => { {crumbs.map(({ match, breadcrumb: crumb }, i) => ( {crumbs.length - 1 !== i && {crumb}} - {crumbs.length - 1 === i && <>{crumb}>} + {crumbs.length - 1 === i && crumb} ))} diff --git a/src/components/error/ErrorRenderer.tsx b/src/components/error/ErrorRenderer.tsx index 5d67848039..5fb2f47565 100644 --- a/src/components/error/ErrorRenderer.tsx +++ b/src/components/error/ErrorRenderer.tsx @@ -24,11 +24,9 @@ export const ErrorRenderer = ({ error, resetErrorBoundary }: FallbackProps) => { /> } actionLinks={ - - - {t("retry")} - - + + {t("retry")} + } > diff --git a/src/components/group/GroupPickerDialog.tsx b/src/components/group/GroupPickerDialog.tsx index de15a82e1f..7154551def 100644 --- a/src/components/group/GroupPickerDialog.tsx +++ b/src/components/group/GroupPickerDialog.tsx @@ -192,7 +192,7 @@ export const GroupPickerDialog = ({ {group.name} )} - {navigation.length - 1 === i && <>{group.name}>} + {navigation.length - 1 === i && group.name} ))} @@ -255,7 +255,7 @@ export const GroupPickerDialog = ({ dataListCells={[ {filter === "" ? ( - <>{group.name}> + group.name ) : ( )} diff --git a/src/components/help-enabler/HelpItem.tsx b/src/components/help-enabler/HelpItem.tsx index bc8383ca86..1e6df18d91 100644 --- a/src/components/help-enabler/HelpItem.tsx +++ b/src/components/help-enabler/HelpItem.tsx @@ -23,30 +23,24 @@ export const HelpItem = ({ }: HelpItemProps) => { const { t } = useTranslation(); const { enabled } = useHelp(); - return ( - <> - {enabled && ( - - <> - {!unWrap && ( - e.preventDefault()} - aria-describedby={forID} - className="pf-c-form__group-label-help" - > - - - )} - {unWrap && } - > - - )} - > - ); + return enabled ? ( + + <> + {!unWrap && ( + e.preventDefault()} + aria-describedby={forID} + className="pf-c-form__group-label-help" + > + + + )} + {unWrap && } + > + + ) : null; }; diff --git a/src/components/list-empty-state/ListEmptyState.tsx b/src/components/list-empty-state/ListEmptyState.tsx index d13337813f..ef7ea17b74 100644 --- a/src/components/list-empty-state/ListEmptyState.tsx +++ b/src/components/list-empty-state/ListEmptyState.tsx @@ -40,42 +40,40 @@ export const ListEmptyState = ({ icon, }: ListEmptyStateProps) => { return ( - <> - - {hasIcon && isSearchVariant ? ( - - ) : ( - hasIcon && - )} - - {message} - - {instructions} - {primaryActionText && ( - - {primaryActionText} - - )} - {secondaryActions && ( - - {secondaryActions.map((action) => ( - - {action.text} - - ))} - - )} - - > + + {hasIcon && isSearchVariant ? ( + + ) : ( + hasIcon && + )} + + {message} + + {instructions} + {primaryActionText && ( + + {primaryActionText} + + )} + {secondaryActions && ( + + {secondaryActions.map((action) => ( + + {action.text} + + ))} + + )} + ); }; diff --git a/src/components/table-toolbar/KeycloakDataTable.tsx b/src/components/table-toolbar/KeycloakDataTable.tsx index 10c4549340..22fb82390e 100644 --- a/src/components/table-toolbar/KeycloakDataTable.tsx +++ b/src/components/table-toolbar/KeycloakDataTable.tsx @@ -427,12 +427,7 @@ export function KeycloakDataTable({ {loading && } )} - <> - {!loading && - (!data || data?.length === 0) && - search === "" && - emptyState} - > + {!loading && (!data || data?.length === 0) && search === "" && emptyState} > ); } diff --git a/src/components/table-toolbar/PaginatingTableToolbar.tsx b/src/components/table-toolbar/PaginatingTableToolbar.tsx index 4746072588..5d191aa8a1 100644 --- a/src/components/table-toolbar/PaginatingTableToolbar.tsx +++ b/src/components/table-toolbar/PaginatingTableToolbar.tsx @@ -73,7 +73,7 @@ export const PaginatingTableToolbar: FunctionComponent = ({ } subToolbar={subToolbar} toolbarItemFooter={ - count !== 0 ? {pagination("bottom")} : <>> + count !== 0 ? {pagination("bottom")} : null } inputGroupName={inputGroupName} inputGroupPlaceholder={inputGroupPlaceholder} diff --git a/src/components/table-toolbar/TableToolbar.tsx b/src/components/table-toolbar/TableToolbar.tsx index a93756808b..daa9289c57 100644 --- a/src/components/table-toolbar/TableToolbar.tsx +++ b/src/components/table-toolbar/TableToolbar.tsx @@ -1,6 +1,5 @@ import React, { FormEvent, - Fragment, FunctionComponent, ReactNode, useState, @@ -74,35 +73,33 @@ export const TableToolbar: FunctionComponent = ({ <> - - {inputGroupName && ( - - - {searchTypeComponent} - {inputGroupPlaceholder && ( - <> - - - - - > - )} - - - )} - + {inputGroupName && ( + + + {searchTypeComponent} + {inputGroupPlaceholder && ( + <> + + + + + > + )} + + + )} {toolbarItem} diff --git a/src/components/view-header/ViewHeader.tsx b/src/components/view-header/ViewHeader.tsx index a0c4c33713..2e1b078eb2 100644 --- a/src/components/view-header/ViewHeader.tsx +++ b/src/components/view-header/ViewHeader.tsx @@ -101,7 +101,7 @@ export const ViewHeader = ({ {" "} )} - {isValidElement(badge.text) && <>{badge.text}>}{" "} + {isValidElement(badge.text) && badge.text}{" "} ))} diff --git a/src/dashboard/Dashboard.tsx b/src/dashboard/Dashboard.tsx index 80bff5a128..7b9018ea3b 100644 --- a/src/dashboard/Dashboard.tsx +++ b/src/dashboard/Dashboard.tsx @@ -125,14 +125,10 @@ const Dashboard = () => { {feature}{" "} {isExperimentalFeature(feature) ? ( {t("experimental")} - ) : ( - <>> - )} + ) : null} {isPreviewFeature(feature) ? ( {t("preview")} - ) : ( - <>> - )} + ) : null} ))} diff --git a/src/events/AdminEvents.tsx b/src/events/AdminEvents.tsx index e98405993d..e327684f31 100644 --- a/src/events/AdminEvents.tsx +++ b/src/events/AdminEvents.tsx @@ -137,165 +137,161 @@ export const AdminEvents = () => { }; const LinkResource = (row: AdminEventRepresentation) => ( - <> - - {(text) => ( - <> - {row.resourceType !== "COMPONENT" && ( - - {text} - - )} - {row.resourceType === "COMPONENT" && {text}} - > - )} - - > + + {(text) => ( + <> + {row.resourceType !== "COMPONENT" && ( + + {text} + + )} + {row.resourceType === "COMPONENT" && {text}} + > + )} + ); const adminEventSearchFormDisplay = () => { return ( - <> - - - setSearchDropdownOpen(isOpen)} - className="keycloak__events_search_selector_dropdown__toggle" - > - {t("searchForAdminEvent")} - - } - isOpen={searchDropdownOpen} - > - + + setSearchDropdownOpen(isOpen)} + className="keycloak__events_search_selector_dropdown__toggle" > - - setSelectOpen(isOpen)} - isOpen={selectOpen} - > - - - setSelectOpen(isOpen)} - isOpen={selectOpen} - > - - - - - - setSelectOpen(isOpen)} - isOpen={selectOpen} - > - - - - - - - - - - - - - {t("searchAdminEventsBtn")} - - - - - + } + isOpen={searchDropdownOpen} + > + - {t("refresh")} - - - - > + + setSelectOpen(isOpen)} + isOpen={selectOpen} + > + + + setSelectOpen(isOpen)} + isOpen={selectOpen} + > + + + + + + setSelectOpen(isOpen)} + isOpen={selectOpen} + > + + + + + + + + + + + + + {t("searchAdminEventsBtn")} + + + + + + {t("refresh")} + + + ); }; diff --git a/src/groups/GroupTable.tsx b/src/groups/GroupTable.tsx index ce46ff5237..c35ecb94f6 100644 --- a/src/groups/GroupTable.tsx +++ b/src/groups/GroupTable.tsx @@ -77,17 +77,15 @@ export const GroupTable = () => { }; const GroupNameCell = (group: GroupRepresentation) => ( - <> - { - setSubGroups([...subGroups, group]); - }} - > - {group.name} - - > + { + setSubGroups([...subGroups, group]); + }} + > + {group.name} + ); const handleModalToggle = () => { diff --git a/src/groups/Members.tsx b/src/groups/Members.tsx index e9c69c1ff7..2ef80c396b 100644 --- a/src/groups/Members.tsx +++ b/src/groups/Members.tsx @@ -99,11 +99,9 @@ export const Members = () => { }; const UserDetailLink = (user: MembersOf) => ( - <> - - {user.username} - - > + + {user.username} + ); return ( <> diff --git a/src/groups/SearchGroups.tsx b/src/groups/SearchGroups.tsx index a16a8251e6..d4517e79e3 100644 --- a/src/groups/SearchGroups.tsx +++ b/src/groups/SearchGroups.tsx @@ -62,17 +62,15 @@ export const SearchGroups = () => { }; const GroupNameCell = (group: SearchGroup) => ( - <> - - setSubGroups([{ name: t("searchGroups"), id: "search" }, group]) - } - > - {group.name} - - > + + setSubGroups([{ name: t("searchGroups"), id: "search" }, group]) + } + > + {group.name} + ); const flatten = ( diff --git a/src/identity-providers/IdentityProvidersSection.tsx b/src/identity-providers/IdentityProvidersSection.tsx index d8b864e774..d44ead3265 100644 --- a/src/identity-providers/IdentityProvidersSection.tsx +++ b/src/identity-providers/IdentityProvidersSection.tsx @@ -70,23 +70,21 @@ export const IdentityProvidersSection = () => { const loader = () => Promise.resolve(_.sortBy(providers, "alias")); const DetailLink = (identityProvider: IdentityProviderRepresentation) => ( - <> - - {identityProvider.alias} - {!identityProvider.enabled && ( - - {t("common:disabled")} - - )} - - > + + {identityProvider.alias} + {!identityProvider.enabled && ( + + {t("common:disabled")} + + )} + ); const navigateToCreate = (providerId: string) => diff --git a/src/identity-providers/add/AdvancedSettings.tsx b/src/identity-providers/add/AdvancedSettings.tsx index 4f43393845..bc01dc9243 100644 --- a/src/identity-providers/add/AdvancedSettings.tsx +++ b/src/identity-providers/add/AdvancedSettings.tsx @@ -64,6 +64,8 @@ const LoginFlow = ({ aria-label={t(label)} isOpen={open} > + {/* The type for the children of Select are incorrect, so we need a fragment here. */} + {/* eslint-disable-next-line react/jsx-no-useless-fragment */} <> {defaultValue === "" && ( @@ -71,6 +73,8 @@ const LoginFlow = ({ )} > + {/* The type for the children of Select are incorrect, so we need a fragment here. */} + {/* eslint-disable-next-line react/jsx-no-useless-fragment */} <> {flows?.map((option) => ( { const [promptOpen, setPromptOpen] = useState(false); return ( - <> - setIsExpanded(!isExpanded)} - isExpanded={isExpanded} - > - - - - setIsExpanded(!isExpanded)} + isExpanded={isExpanded} + > + + + + + + + + ( + setPromptOpen(!promptOpen)} + onSelect={(_, value) => { + onChange(value as string); + setPromptOpen(false); + }} + selections={value} + variant={SelectVariant.single} + aria-label={t("prompt")} + isOpen={promptOpen} + > + {promptOptions.map((option) => ( + + {t(`prompts.${option}`)} + + ))} + + )} /> - - - - ( - setPromptOpen(!promptOpen)} - onSelect={(_, value) => { - onChange(value as string); - setPromptOpen(false); - }} - selections={value} - variant={SelectVariant.single} - aria-label={t("prompt")} - isOpen={promptOpen} - > - {promptOptions.map((option) => ( - - {t(`prompts.${option}`)} - - ))} - - )} + + + - - - + ( + onChange(value - 1)} + onChange={onChange} + onPlus={() => onChange(value + 1)} + inputName="input" + inputAriaLabel={t("allowedClockSkew")} + minusBtnAriaLabel={t("common:minus")} + plusBtnAriaLabel={t("common:plus")} + min={0} + unit={t("common:times.seconds")} /> - } - fieldId="allowedClockSkew" - > - ( - onChange(value - 1)} - onChange={onChange} - onPlus={() => onChange(value + 1)} - inputName="input" - inputAriaLabel={t("allowedClockSkew")} - minusBtnAriaLabel={t("common:minus")} - plusBtnAriaLabel={t("common:plus")} - min={0} - unit={t("common:times.seconds")} - /> - )} - /> - - - - - > + + + + ); }; diff --git a/src/identity-providers/icons/FontAwesomeIcon.tsx b/src/identity-providers/icons/FontAwesomeIcon.tsx index d198edc6c8..0c887c110f 100644 --- a/src/identity-providers/icons/FontAwesomeIcon.tsx +++ b/src/identity-providers/icons/FontAwesomeIcon.tsx @@ -41,6 +41,6 @@ export const FontAwesomeIcon = ({ icon }: FontAwesomeIconProps) => { /> ); default: - return <>>; + return null; } }; diff --git a/src/realm-roles/AliasRendererComponent.tsx b/src/realm-roles/AliasRendererComponent.tsx index fbe56cd5a1..52108a934b 100644 --- a/src/realm-roles/AliasRendererComponent.tsx +++ b/src/realm-roles/AliasRendererComponent.tsx @@ -28,7 +28,7 @@ export const AliasRendererComponent = ({ }, [containerId]); if (filterType === "roles" || !containerName) { - return <>{name}>; + return name; } if (filterType === "clients" || containerName) { diff --git a/src/realm-roles/AssociatedRolesTab.tsx b/src/realm-roles/AssociatedRolesTab.tsx index d8236f432f..b23bf8cbbc 100644 --- a/src/realm-roles/AssociatedRolesTab.tsx +++ b/src/realm-roles/AssociatedRolesTab.tsx @@ -134,9 +134,8 @@ export const AssociatedRolesTab = ({ refresh(); }, [additionalRoles, isInheritedHidden]); - const InheritedRoleName = (role: RoleRepresentation) => { - return <>{inheritanceMap.current[role.id!]}>; - }; + const InheritedRoleName = (role: RoleRepresentation) => + inheritanceMap.current[role.id!]; const AliasRenderer = ({ id, name, clientId }: Role) => { return ( @@ -201,98 +200,96 @@ export const AssociatedRolesTab = ({ const goToCreate = () => history.push(`${url}/add-role`); return ( - <> - - - - setOpen(!open)} - /> - { - setSelectedRows([...rows]); - }} - toolbarItem={ - <> - - setIsInheritedHidden(!isInheritedHidden)} - isChecked={isInheritedHidden} - /> - - - toggleModal()} - data-testid="add-role-button" - > - {t("addRole")} - - - - { - toggleDeleteAssociatedRolesDialog(); - }} - > - {t("removeRoles")} - - - > - } - actions={[ - { - title: t("common:remove"), - onRowClick: (role) => { - setSelectedRows([role]); - toggleDeleteDialog(); - }, + + + + setOpen(!open)} + /> + { + setSelectedRows([...rows]); + }} + toolbarItem={ + <> + + setIsInheritedHidden(!isInheritedHidden)} + isChecked={isInheritedHidden} + /> + + + toggleModal()} + data-testid="add-role-button" + > + {t("addRole")} + + + + { + toggleDeleteAssociatedRolesDialog(); + }} + > + {t("removeRoles")} + + + > + } + actions={[ + { + title: t("common:remove"), + onRowClick: (role) => { + setSelectedRows([role]); + toggleDeleteDialog(); }, - ]} - columns={[ - { - name: "name", - displayKey: "roles:roleName", - cellRenderer: AliasRenderer, - cellFormatters: [emptyFormatter()], - }, - { - name: "containerId", - displayKey: "roles:inheritedFrom", - cellRenderer: InheritedRoleName, - cellFormatters: [emptyFormatter()], - }, - { - name: "description", - displayKey: "common:description", - cellFormatters: [emptyFormatter()], - }, - ]} - emptyState={ - - } - /> - - > + }, + ]} + columns={[ + { + name: "name", + displayKey: "roles:roleName", + cellRenderer: AliasRenderer, + cellFormatters: [emptyFormatter()], + }, + { + name: "containerId", + displayKey: "roles:inheritedFrom", + cellRenderer: InheritedRoleName, + cellFormatters: [emptyFormatter()], + }, + { + name: "description", + displayKey: "common:description", + cellFormatters: [emptyFormatter()], + }, + ]} + emptyState={ + + } + /> + ); }; diff --git a/src/realm-roles/RoleAttributes.tsx b/src/realm-roles/RoleAttributes.tsx index c6dba5fd1c..82f76c6d9c 100644 --- a/src/realm-roles/RoleAttributes.tsx +++ b/src/realm-roles/RoleAttributes.tsx @@ -45,61 +45,74 @@ export const RoleAttributes = ({ const watchFirstKey = watch("attributes[0].key", ""); return ( - <> - - - - - - {columns[0]} - - - {columns[1]} - - - - - {fields.map((attribute, rowIndex) => ( - + + + + + + {columns[0]} + + + {columns[1]} + + + + + {fields.map((attribute, rowIndex) => ( + + + + + + + + {rowIndex !== fields.length - 1 && fields.length - 1 !== 0 && ( - - - - - - {rowIndex !== fields.length - 1 && fields.length - 1 !== 0 && ( - remove(rowIndex)} > + + + + )} + {rowIndex === fields.length - 1 && ( + + {fields[rowIndex].key === "" && ( - - )} - {rowIndex === fields.length - 1 && ( - - {fields[rowIndex].key === "" && ( - remove(rowIndex)} - > - - - )} - append({ key: "", value: "" })} - icon={} - isDisabled={!formState.isValid} - /> - - )} - - ))} - - - - - {t("common:save")} - - - {t("common:reload")} - - - - > + )} + append({ key: "", value: "" })} + icon={} + isDisabled={!formState.isValid} + /> + + )} + + ))} + + + + + {t("common:save")} + + + {t("common:reload")} + + + ); }; diff --git a/src/realm-roles/RolesList.tsx b/src/realm-roles/RolesList.tsx index 7206992739..f9e772ce63 100644 --- a/src/realm-roles/RolesList.tsx +++ b/src/realm-roles/RolesList.tsx @@ -126,11 +126,7 @@ export const RolesList = ({ ariaLabelKey="roles:roleList" searchPlaceholderKey="roles:searchFor" isPaginated={paginated} - toolbarItem={ - <> - {t("createRole")} - > - } + toolbarItem={{t("createRole")}} actions={[ { title: t("common:delete"), diff --git a/src/realm-roles/UsersInRoleTab.tsx b/src/realm-roles/UsersInRoleTab.tsx index 5021963dec..2b052a7725 100644 --- a/src/realm-roles/UsersInRoleTab.tsx +++ b/src/realm-roles/UsersInRoleTab.tsx @@ -42,60 +42,22 @@ export const UsersInRoleTab = () => { const { enabled } = useHelp(); return ( - <> - - - {t("roles:whoWillAppearPopoverText")} - history.push(`/${realm}/groups`)} - > - {t("groups")} - - {t("or")} - history.push(`/${realm}/users`)} - > - {t("users")}. - - - } - footerContent={t("roles:whoWillAppearPopoverFooterText")} - > - } - > - {t("roles:whoWillAppearLinkText")} - - - ) - } - emptyState={ - + - {t("noUsersEmptyStateDescription")} + {t("roles:whoWillAppearPopoverText")} history.push(`/${realm}/groups`)} > @@ -103,41 +65,77 @@ export const UsersInRoleTab = () => { {t("or")} history.push(`/${realm}/users`)} > - {t("users")} + {t("users")}. - {t("noUsersEmptyStateDescriptionContinued")} } - /> - } - columns={[ - { - name: "username", - displayKey: "roles:userName", - cellFormatters: [emptyFormatter()], - }, - { - name: "email", - displayKey: "roles:email", - cellFormatters: [emptyFormatter()], - }, - { - name: "lastName", - displayKey: "roles:lastName", - cellFormatters: [emptyFormatter()], - }, - { - name: "firstName", - displayKey: "roles:firstName", - cellFormatters: [upperCaseFormatter(), emptyFormatter()], - }, - ]} - /> - - > + footerContent={t("roles:whoWillAppearPopoverFooterText")} + > + } + > + {t("roles:whoWillAppearLinkText")} + + + ) + } + emptyState={ + + {t("noUsersEmptyStateDescription")} + history.push(`/${realm}/groups`)} + > + {t("groups")} + + {t("or")} + history.push(`/${realm}/users`)} + > + {t("users")} + + {t("noUsersEmptyStateDescriptionContinued")} + + } + /> + } + columns={[ + { + name: "username", + displayKey: "roles:userName", + cellFormatters: [emptyFormatter()], + }, + { + name: "email", + displayKey: "roles:email", + cellFormatters: [emptyFormatter()], + }, + { + name: "lastName", + displayKey: "roles:lastName", + cellFormatters: [emptyFormatter()], + }, + { + name: "firstName", + displayKey: "roles:firstName", + cellFormatters: [upperCaseFormatter(), emptyFormatter()], + }, + ]} + /> + ); }; diff --git a/src/realm-settings/GeneralTab.tsx b/src/realm-settings/GeneralTab.tsx index 85dff589cc..d69b3210c8 100644 --- a/src/realm-settings/GeneralTab.tsx +++ b/src/realm-settings/GeneralTab.tsx @@ -49,172 +49,167 @@ export const RealmSettingsGeneralTab = ({ const requireSslTypes = ["all", "external", "none"]; return ( - <> - - + + + ( + {value} + )} + /> + + + + + + + + + } > - - ( - {value} - )} + + + - - - + ( + setOpen(!open)} + onSelect={(_, value) => { + onChange(value as string); + setOpen(false); + }} + selections={value} + variant={SelectVariant.single} + aria-label={t("requireSsl")} + isOpen={open} + > + {requireSslTypes.map((sslType) => ( + + {t(`sslType.${sslType}`)} + + ))} + + )} + /> + + - - - - - + ( + - } - > - + + - - + + + - } - > - ( - setOpen(!open)} - onSelect={(_, value) => { - onChange(value as string); - setOpen(false); - }} - selections={value} - variant={SelectVariant.single} - aria-label={t("requireSsl")} - isOpen={open} - > - {requireSslTypes.map((sslType) => ( - - {t(`sslType.${sslType}`)} - - ))} - - )} - /> - - + + - } - fieldId="kc-user-manged-access" - > - ( - - )} - /> - - - } - fieldId="kc-endpoints" - > - - - - - - - - - + + + - - - {t("common:save")} - - - {t("common:revert")} - - - - - > + + + {t("common:save")} + + + {t("common:revert")} + + + + ); }; diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index d9e44d8409..fda98db802 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -130,52 +130,46 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => { const goToCreate = () => history.push(`${url}/add-role`); - const ProviderRenderer = ({ provider }: KeyData) => { - return <>{provider}>; - }; + const ProviderRenderer = ({ provider }: KeyData) => provider; const ButtonRenderer = ({ type, publicKey, certificate }: KeyData) => { if (type === "EC") { return ( - <> + { + togglePublicKeyDialog(); + setPublicKey(publicKey!); + }} + variant="secondary" + id="kc-public-key" + > + {t("realm-settings:publicKeys").slice(0, -1)} + + ); + } else if (type === "RSA") { + return ( + { togglePublicKeyDialog(); setPublicKey(publicKey!); }} variant="secondary" - id="kc-public-key" + id="kc-rsa-public-key" > {t("realm-settings:publicKeys").slice(0, -1)} - > - ); - } else if (type === "RSA") { - return ( - <> - - { - togglePublicKeyDialog(); - setPublicKey(publicKey!); - }} - variant="secondary" - id="kc-rsa-public-key" - > - {t("realm-settings:publicKeys").slice(0, -1)} - - { - toggleCertificateDialog(); - setCertificate(certificate!); - }} - variant="secondary" - id="kc-certificate" - > - {t("realm-settings:certificate")} - - - > + { + toggleCertificateDialog(); + setCertificate(certificate!); + }} + variant="secondary" + id="kc-certificate" + > + {t("realm-settings:certificate")} + + ); } }; @@ -200,93 +194,91 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => { ]; return ( - <> - - - - setFilterDropdownOpen(!filterDropdownOpen)} - toggleIcon={} - onSelect={(_, value) => { - setFilterType(value as string); - refresh(); - setFilterDropdownOpen(false); - }} - selections={filterType} - > - {options} - - } - canSelectAll - columns={[ - { - name: "algorithm", - displayKey: "realm-settings:algorithm", - cellFormatters: [emptyFormatter()], - transforms: [cellWidth(15)], - }, - { - name: "type", - displayKey: "realm-settings:type", - cellFormatters: [emptyFormatter()], - transforms: [cellWidth(10)], - }, - { - name: "kid", - displayKey: "realm-settings:kid", - cellFormatters: [emptyFormatter()], - transforms: [cellWidth(10)], - }, - { - name: "provider", - displayKey: "realm-settings:provider", - cellRenderer: ProviderRenderer, - cellFormatters: [emptyFormatter()], - transforms: [cellWidth(10)], - }, - { - name: "publicKeys", - displayKey: "realm-settings:publicKeys", - cellRenderer: ButtonRenderer, - cellFormatters: [], - transforms: [cellWidth(20)], - }, - ]} - isSearching={!!filterType} - emptyState={ - - } - /> - - > + + + + setFilterDropdownOpen(!filterDropdownOpen)} + toggleIcon={} + onSelect={(_, value) => { + setFilterType(value as string); + refresh(); + setFilterDropdownOpen(false); + }} + selections={filterType} + > + {options} + + } + canSelectAll + columns={[ + { + name: "algorithm", + displayKey: "realm-settings:algorithm", + cellFormatters: [emptyFormatter()], + transforms: [cellWidth(15)], + }, + { + name: "type", + displayKey: "realm-settings:type", + cellFormatters: [emptyFormatter()], + transforms: [cellWidth(10)], + }, + { + name: "kid", + displayKey: "realm-settings:kid", + cellFormatters: [emptyFormatter()], + transforms: [cellWidth(10)], + }, + { + name: "provider", + displayKey: "realm-settings:provider", + cellRenderer: ProviderRenderer, + cellFormatters: [emptyFormatter()], + transforms: [cellWidth(10)], + }, + { + name: "publicKeys", + displayKey: "realm-settings:publicKeys", + cellRenderer: ButtonRenderer, + cellFormatters: [], + transforms: [cellWidth(20)], + }, + ]} + isSearching={!!filterType} + emptyState={ + + } + /> + ); }; diff --git a/src/realm-settings/KeysProvidersTab.tsx b/src/realm-settings/KeysProvidersTab.tsx index d1887c2bcc..fee0737874 100644 --- a/src/realm-settings/KeysProvidersTab.tsx +++ b/src/realm-settings/KeysProvidersTab.tsx @@ -256,60 +256,58 @@ export const KeysTabInner = ({ components, refresh }: KeysTabInnerProps) => { - <> - - - - - - - - - - - setProviderDropdownOpen(val)} - isPrimary - > - {t("realm-settings:addProvider")} - - } - dropdownItems={[ - providerTypes.map((item) => ( - { - handleModalToggle(); - - setProviderDropdownOpen(false); - setDefaultConsoleDisplayName(item); - }} - data-testid={`option-${item}`} - key={item} - > - {item} - - )), - ]} + + + + - - - > + + + + + + + setProviderDropdownOpen(val)} + isPrimary + > + {t("realm-settings:addProvider")} + + } + dropdownItems={[ + providerTypes.map((item) => ( + { + handleModalToggle(); + + setProviderDropdownOpen(false); + setDefaultConsoleDisplayName(item); + }} + data-testid={`option-${item}`} + key={item} + > + {item} + + )), + ]} + /> + + { data-testid="provider-name" key={`name-${idx}`} > - <> - - {component.name} - - > + + {component.name} + , - <>{component.providerId}> + {component.providerId} , - <>{component.providerDescription}> + {component.providerDescription} , - - - - - } - hasNoPaddingTop - > - { - save({ ...realm, registrationAllowed: value }); - }} + + + + - - - } - hasNoPaddingTop - > - { - save({ ...realm, resetPasswordAllowed: value }); - }} + } + hasNoPaddingTop + > + { + save({ ...realm, registrationAllowed: value }); + }} + /> + + - - - } - hasNoPaddingTop - > - { - save({ ...realm, rememberMe: value }); - }} + } + hasNoPaddingTop + > + { + save({ ...realm, resetPasswordAllowed: value }); + }} + /> + + - - - - - - - } - hasNoPaddingTop - > - { - save({ ...realm, registrationEmailAsUsername: value }); - }} + } + hasNoPaddingTop + > + { + save({ ...realm, rememberMe: value }); + }} + /> + + + + + + - - - } - hasNoPaddingTop - > - { - save({ ...realm, loginWithEmailAllowed: value }); - }} + } + hasNoPaddingTop + > + { + save({ ...realm, registrationEmailAsUsername: value }); + }} + /> + + - - - } - hasNoPaddingTop - > - { - save({ ...realm, duplicateEmailsAllowed: value }); - }} - isDisabled={ - realm?.loginWithEmailAllowed || - realm?.registrationEmailAsUsername - } + } + hasNoPaddingTop + > + { + save({ ...realm, loginWithEmailAllowed: value }); + }} + /> + + - - + } + hasNoPaddingTop + > + - { - save({ ...realm, verifyEmail: value }); - }} + onChange={(value) => { + save({ ...realm, duplicateEmailsAllowed: value }); + }} + isDisabled={ + realm?.loginWithEmailAllowed || + realm?.registrationEmailAsUsername + } + /> + + - - - - - > + } + hasNoPaddingTop + > + { + save({ ...realm, verifyEmail: value }); + }} + /> + + + + ); }; diff --git a/src/realm-settings/RealmSettingsSection.tsx b/src/realm-settings/RealmSettingsSection.tsx index b03d5e0021..a6d4081886 100644 --- a/src/realm-settings/RealmSettingsSection.tsx +++ b/src/realm-settings/RealmSettingsSection.tsx @@ -53,19 +53,17 @@ export const EditProviderCrumb = () => { const { realm } = useRealm(); return ( - <> - - ( - - {t("keys")} - - )} - /> - {t("providers")} - {t("editProvider")} - - > + + ( + + {t("keys")} + + )} + /> + {t("providers")} + {t("editProvider")} + ); }; diff --git a/src/realm-settings/SessionsTab.tsx b/src/realm-settings/SessionsTab.tsx index ed1f730afc..fc8ece9592 100644 --- a/src/realm-settings/SessionsTab.tsx +++ b/src/realm-settings/SessionsTab.tsx @@ -70,337 +70,294 @@ export const RealmSettingsSessionsTab = ({ }; return ( - <> - - + + - + } > - ( + - } - > - ( - - )} - /> - + )} + /> + - - } - > - ( - - )} + - + } + > + ( + + )} + /> + - - } - > - ( - - )} + - + } + > + ( + + )} + /> + - - } - > - ( - - )} + - - - - + ( + + )} + /> + + + + + - - - } - > - ( - - )} + - + } + > + ( + + )} + /> + - - } - > - ( - - )} + - - - - - - ( + - } - > - ( - - )} + )} + /> + + + + + + - + } + > + ( + + )} + /> + - - } - > - ( - onChange(value.toString())} - /> - )} + - - {offlineSessionMaxEnabled && ( - - } - > - ( - - )} - /> - - )} - - - - + ( + onChange(value.toString())} + /> + )} + /> + + {offlineSessionMaxEnabled && ( } > ( - - } - > - ( - - )} + )} + + + + + - - - - {t("common:save")} - - - {t("common:revert")} - - - - - - > + } + > + ( + + )} + /> + + + } + > + ( + + )} + /> + + + + {t("common:save")} + + + {t("common:revert")} + + + + + ); }; diff --git a/src/realm-settings/ThemesTab.tsx b/src/realm-settings/ThemesTab.tsx index 55a67988ee..56ebb70582 100644 --- a/src/realm-settings/ThemesTab.tsx +++ b/src/realm-settings/ThemesTab.tsx @@ -55,314 +55,308 @@ export const RealmSettingsThemesTab = ({ }); return ( - <> - - + + + } > - - } - > - ( - setLoginThemeOpen(!loginThemeOpen)} - onSelect={(_, value) => { - onChange(value as string); - setLoginThemeOpen(false); - }} - selections={value} - variant={SelectVariant.single} - aria-label={t("loginTheme")} - isOpen={loginThemeOpen} - placeholderText="Select a theme" - data-testid="select-login-theme" - > - {themeTypes.login.map((theme, idx) => ( - - {t(`${theme.name}`)} - - ))} - - )} - /> - - - } - > - ( - setAccountThemeOpen(!accountThemeOpen)} - onSelect={(_, value) => { - onChange(value as string); - setAccountThemeOpen(false); - }} - selections={value} - variant={SelectVariant.single} - aria-label={t("accountTheme")} - isOpen={accountThemeOpen} - placeholderText="Select a theme" - data-testid="select-account-theme" - > - {themeTypes.account.map((theme, idx) => ( - - {t(`${theme.name}`)} - - ))} - - )} - /> - - - } - > - ( - - setAdminConsoleThemeOpen(!adminConsoleThemeOpen) - } - onSelect={(_, value) => { - onChange(value as string); - setAdminConsoleThemeOpen(false); - }} - selections={value} - variant={SelectVariant.single} - aria-label={t("adminConsoleTheme")} - isOpen={adminConsoleThemeOpen} - placeholderText="Select a theme" - data-testid="select-admin-theme" - > - {themeTypes.admin.map((theme, idx) => ( - - {t(`${theme.name}`)} - - ))} - - )} - /> - - - } - > - ( - setEmailThemeOpen(!emailThemeOpen)} - onSelect={(_, value) => { - onChange(value as string); - setEmailThemeOpen(false); - }} - selections={value} - variant={SelectVariant.single} - aria-label={t("emailTheme")} - isOpen={emailThemeOpen} - placeholderText="Select a theme" - data-testid="select-email-theme" - > - {themeTypes.email.map((theme, idx) => ( - - {t(`${theme.name}`)} - - ))} - - )} - /> - - - ( - - )} - /> - - {internationalizationEnabled && ( - <> - ( + setLoginThemeOpen(!loginThemeOpen)} + onSelect={(_, value) => { + onChange(value as string); + setLoginThemeOpen(false); + }} + selections={value} + variant={SelectVariant.single} + aria-label={t("loginTheme")} + isOpen={loginThemeOpen} + placeholderText="Select a theme" + data-testid="select-login-theme" > - ( - { - setSupportedLocalesOpen(!supportedLocalesOpen); - }} - onSelect={(_, v) => { - const option = v as string; - if (!value) { - onChange([option]); - } else if (value!.includes(option)) { - onChange( - value.filter((item: string) => item !== option) - ); - } else { - onChange([...value, option]); - } - }} - onClear={() => { - onChange([]); - }} - selections={value} - variant={SelectVariant.typeaheadMulti} - aria-label={t("supportedLocales")} - isOpen={supportedLocalesOpen} - placeholderText={"Select locales"} - > - {themeTypes?.login![0].locales.map( - (locale: string, idx: number) => ( - - {t(`allSupportedLocales.${locale}`)} - - ) - )} - - )} - /> - - - ( - setDefaultLocaleOpen(!defaultLocaleOpen)} - onSelect={(_, value) => { - onChange(value as string); - setDefaultLocaleOpen(false); - }} - selections={value && t(`allSupportedLocales.${value}`)} - variant={SelectVariant.single} - aria-label={t("defaultLocale")} - isOpen={defaultLocaleOpen} - placeholderText="Select one" - data-testid="select-default-locale" - > - {watchSupportedLocales.map( - (locale: string, idx: number) => ( - - {t(`allSupportedLocales.${locale}`)} - - ) - )} - - )} - /> - - > - )} - - ( + + {t(`${theme.name}`)} + + ))} + + )} + /> + + + } + > + ( + setAccountThemeOpen(!accountThemeOpen)} + onSelect={(_, value) => { + onChange(value as string); + setAccountThemeOpen(false); + }} + selections={value} + variant={SelectVariant.single} + aria-label={t("accountTheme")} + isOpen={accountThemeOpen} + placeholderText="Select a theme" + data-testid="select-account-theme" + > + {themeTypes.account.map((theme, idx) => ( + + {t(`${theme.name}`)} + + ))} + + )} + /> + + + } + > + ( + + setAdminConsoleThemeOpen(!adminConsoleThemeOpen) + } + onSelect={(_, value) => { + onChange(value as string); + setAdminConsoleThemeOpen(false); + }} + selections={value} + variant={SelectVariant.single} + aria-label={t("adminConsoleTheme")} + isOpen={adminConsoleThemeOpen} + placeholderText="Select a theme" + data-testid="select-admin-theme" + > + {themeTypes.admin.map((theme, idx) => ( + + {t(`${theme.name}`)} + + ))} + + )} + /> + + + } + > + ( + setEmailThemeOpen(!emailThemeOpen)} + onSelect={(_, value) => { + onChange(value as string); + setEmailThemeOpen(false); + }} + selections={value} + variant={SelectVariant.single} + aria-label={t("emailTheme")} + isOpen={emailThemeOpen} + placeholderText="Select a theme" + data-testid="select-email-theme" + > + {themeTypes.email.map((theme, idx) => ( + + {t(`${theme.name}`)} + + ))} + + )} + /> + + + ( + + )} + /> + + {internationalizationEnabled && ( + <> + - {t("common:save")} - - - {t("common:revert")} - - - - - > + ( + { + setSupportedLocalesOpen(!supportedLocalesOpen); + }} + onSelect={(_, v) => { + const option = v as string; + if (!value) { + onChange([option]); + } else if (value!.includes(option)) { + onChange( + value.filter((item: string) => item !== option) + ); + } else { + onChange([...value, option]); + } + }} + onClear={() => { + onChange([]); + }} + selections={value} + variant={SelectVariant.typeaheadMulti} + aria-label={t("supportedLocales")} + isOpen={supportedLocalesOpen} + placeholderText={"Select locales"} + > + {themeTypes?.login![0].locales.map( + (locale: string, idx: number) => ( + + {t(`allSupportedLocales.${locale}`)} + + ) + )} + + )} + /> + + + ( + setDefaultLocaleOpen(!defaultLocaleOpen)} + onSelect={(_, value) => { + onChange(value as string); + setDefaultLocaleOpen(false); + }} + selections={value && t(`allSupportedLocales.${value}`)} + variant={SelectVariant.single} + aria-label={t("defaultLocale")} + isOpen={defaultLocaleOpen} + placeholderText="Select one" + data-testid="select-default-locale" + > + {watchSupportedLocales.map( + (locale: string, idx: number) => ( + + {t(`allSupportedLocales.${locale}`)} + + ) + )} + + )} + /> + + > + )} + + + {t("common:save")} + + + {t("common:revert")} + + + + ); }; diff --git a/src/realm-settings/TokensTab.tsx b/src/realm-settings/TokensTab.tsx index 5901719492..535189dcdc 100644 --- a/src/realm-settings/TokensTab.tsx +++ b/src/realm-settings/TokensTab.tsx @@ -101,302 +101,259 @@ export const RealmSettingsTokensTab = ({ } }; return ( - <> - - + + - - - } - > - ( - - setDefaultSigAlgDrpdwnOpen(!defaultSigAlgDrpdwnIsOpen) - } - onSelect={(_, value) => { - onChange(value.toString()); - setDefaultSigAlgDrpdwnOpen(false); - }} - selections={[value.toString()]} - variant={SelectVariant.single} - aria-label={t("defaultSigAlg")} - isOpen={defaultSigAlgDrpdwnIsOpen} - data-testid="select-default-sig-alg" - > - {defaultSigAlgOptions!.map((p, idx) => ( - - ))} - - )} + - - - - + ( + + setDefaultSigAlgDrpdwnOpen(!defaultSigAlgDrpdwnIsOpen) + } + onSelect={(_, value) => { + onChange(value.toString()); + setDefaultSigAlgDrpdwnOpen(false); + }} + selections={[value.toString()]} + variant={SelectVariant.single} + aria-label={t("defaultSigAlg")} + isOpen={defaultSigAlgDrpdwnIsOpen} + data-testid="select-default-sig-alg" + > + {defaultSigAlgOptions!.map((p, idx) => ( + + ))} + + )} + /> + + + + + - + } > - ( + - } - > - ( - - )} + )} + /> + + - - + ( + onChange(value + 1)} + onMinus={() => onChange(value - 1)} + onChange={(event) => + onChange(Number((event.target as HTMLInputElement).value)) + } /> - } - fieldId="refreshTokenMaxReuse" - > - ( - onChange(value + 1)} - onMinus={() => onChange(value - 1)} - onChange={(event) => - onChange(Number((event.target as HTMLInputElement).value)) - } - /> - )} - /> - - - - + + + + + - - - } - > - ( - realm?.ssoSessionIdleTimeout! - ? "warning" - : "default" - } - className="kc-access-token-lifespan" - data-testid="access-token-lifespan-input" - aria-label="access-token-lifespan" - value={value} - onChange={onChange} - units={["minutes", "hours", "days"]} - /> - )} + - + } + > + ( + realm?.ssoSessionIdleTimeout! + ? "warning" + : "default" + } + className="kc-access-token-lifespan" + data-testid="access-token-lifespan-input" + aria-label="access-token-lifespan" + value={value} + onChange={onChange} + units={["minutes", "hours", "days"]} + /> + )} + /> + - - } - > - ( - - )} + - - - } - > - ( - - )} - /> - - - {offlineSessionMaxEnabled && ( - - } - > - ( - - )} - /> - - )} - - - - + ( + + )} + /> + + + } + > + ( + + )} + /> + + + {offlineSessionMaxEnabled && ( } > ( - + + + + + } + > + ( + - } - > - ( - - )} + )} + /> + + - - + ( + + )} + /> + + + {t("overrideActionTokens")} + + + ( + onChange(value.toString())} + units={["minutes", "hours", "days"]} + /> + )} + /> + + + ( + + )} + /> + + + ( + + )} + /> + + + ( + + )} + /> + + + - {t("overrideActionTokens")} - - - ( - onChange(value.toString())} - units={["minutes", "hours", "days"]} - /> - )} - /> - - - ( - - )} - /> - - - ( - - )} - /> - - - ( - - )} - /> - - - - {t("common:save")} - - - {t("common:revert")} - - - - - - > + {t("common:save")} + + + {t("common:revert")} + + + + + ); }; diff --git a/src/realm-settings/event-config/EventsTypeTable.tsx b/src/realm-settings/event-config/EventsTypeTable.tsx index 728189ab25..ea7f97f9d0 100644 --- a/src/realm-settings/event-config/EventsTypeTable.tsx +++ b/src/realm-settings/event-config/EventsTypeTable.tsx @@ -39,15 +39,13 @@ export function EventsTypeTable({ onSelect={onSelect ? onSelect : undefined} canSelectAll={!!onSelect} toolbarItem={ - <> - {addTypes && ( - - - {t("addSavedTypes")} - - - )} - > + addTypes && ( + + + {t("addSavedTypes")} + + + ) } actions={ !onDelete diff --git a/src/realm-settings/key-providers/aes-generated/AESGeneratedForm.tsx b/src/realm-settings/key-providers/aes-generated/AESGeneratedForm.tsx index d998ab1d11..244860d5e4 100644 --- a/src/realm-settings/key-providers/aes-generated/AESGeneratedForm.tsx +++ b/src/realm-settings/key-providers/aes-generated/AESGeneratedForm.tsx @@ -195,20 +195,18 @@ export const AESGeneratedForm = ({ /> )} {editMode && ( - <> - - > + )} )} {editMode && ( - <> - - > + )} )} {editMode && ( - <> - - > + )} )} {editMode && ( - <> - - > + )} )} {editMode && ( - <> - - > + )} )} {editMode && ( - <> - - > + )} - ) : ( - <>> - )} + ) : null} - - } - fieldId="kc-group" - isRequired - > - - - > + } + fieldId="kc-group" + isRequired + > + + ); }; diff --git a/src/user-federation/ldap/mappers/LdapMapperList.tsx b/src/user-federation/ldap/mappers/LdapMapperList.tsx index ce497e88df..91a7c52dc6 100644 --- a/src/user-federation/ldap/mappers/LdapMapperList.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperList.tsx @@ -76,9 +76,7 @@ export const LdapMapperList = () => { }; const MapperLink = (mapper: ComponentRepresentation) => ( - <> - {mapper.name} - > + {mapper.name} ); return ( diff --git a/src/user-federation/ldap/mappers/LdapMapperMsadUserAccount.tsx b/src/user-federation/ldap/mappers/LdapMapperMsadUserAccount.tsx index d13b9d2a07..1223961845 100644 --- a/src/user-federation/ldap/mappers/LdapMapperMsadUserAccount.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperMsadUserAccount.tsx @@ -15,35 +15,33 @@ export const LdapMapperMsadUserAccount = ({ const helpText = useTranslation("user-federation-help").t; return ( - <> - + } + fieldId="kc-der-formatted" + hasNoPaddingTop + > + ( + onChange([`${value}`])} + isChecked={value[0] === "true"} + label={t("common:on")} + labelOff={t("common:off")} /> - } - fieldId="kc-der-formatted" - hasNoPaddingTop - > - ( - onChange([`${value}`])} - isChecked={value[0] === "true"} - label={t("common:on")} - labelOff={t("common:off")} - /> - )} - > - - > + )} + > + ); }; diff --git a/src/user-federation/ldap/mappers/LdapMapperUserAttribute.tsx b/src/user-federation/ldap/mappers/LdapMapperUserAttribute.tsx index 1e36cf129d..e1a5b4300b 100644 --- a/src/user-federation/ldap/mappers/LdapMapperUserAttribute.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperUserAttribute.tsx @@ -173,39 +173,35 @@ export const LdapMapperUserAttribute = ({ > {mapperType === "certificate-ldap-mapper" ? ( - <> - + } + fieldId="kc-der-formatted" + hasNoPaddingTop + > + ( + onChange([`${value}`])} + isChecked={value[0] === "true"} + label={t("common:on")} + labelOff={t("common:off")} /> - } - fieldId="kc-der-formatted" - hasNoPaddingTop - > - ( - onChange([`${value}`])} - isChecked={value[0] === "true"} - label={t("common:on")} - labelOff={t("common:off")} - /> - )} - > - - > - ) : ( - <>> - )} + )} + > + + ) : null} > ); }; diff --git a/src/user-federation/shared/SettingsCache.tsx b/src/user-federation/shared/SettingsCache.tsx index 3f1e2350bd..9286a3f33a 100644 --- a/src/user-federation/shared/SettingsCache.tsx +++ b/src/user-federation/shared/SettingsCache.tsx @@ -190,9 +190,7 @@ export const SettingsCache = ({ )} > - ) : ( - <>> - )} + ) : null} {_.isEqual(cachePolicyType, ["EVICT_DAILY"]) || _.isEqual(cachePolicyType, ["EVICT_WEEKLY"]) ? ( <> @@ -269,9 +267,7 @@ export const SettingsCache = ({ > > - ) : ( - <>> - )} + ) : null} {_.isEqual(cachePolicyType, ["MAX_LIFESPAN"]) ? ( - ) : ( - <>> - )} + ) : null} > ); diff --git a/src/user/UserForm.tsx b/src/user/UserForm.tsx index e3db3bbfeb..8b5243db84 100644 --- a/src/user/UserForm.tsx +++ b/src/user/UserForm.tsx @@ -353,28 +353,26 @@ export const UserForm = ({ typeAheadAriaLabel="Select an action" control={control} render={() => ( - <> - - - {selectedGroups.map((currentChip) => ( - deleteItem(currentChip.name!)} - > - {currentChip.path} - - ))} - - - {t("users:joinGroups")} - - - > + + + {selectedGroups.map((currentChip) => ( + deleteItem(currentChip.name!)} + > + {currentChip.path} + + ))} + + + {t("users:joinGroups")} + + )} /> diff --git a/src/user/UserGroups.tsx b/src/user/UserGroups.tsx index 147afab0a4..d7d338c139 100644 --- a/src/user/UserGroups.tsx +++ b/src/user/UserGroups.tsx @@ -189,9 +189,7 @@ export const UserGroups = () => { refresh(); }, [isDirectMembership]); - const AliasRenderer = (group: GroupRepresentation) => { - return <>{group.name}>; - }; + const AliasRenderer = (group: GroupRepresentation) => group.name; const toggleModal = () => { setOpen(!open); @@ -232,17 +230,15 @@ export const UserGroups = () => { directMembershipList.length === 0 || isDirectMembership; return ( - <> - {canLeaveGroup && ( - leave(group)} - variant="link" - > - {t("leave")} - - )} - > + canLeaveGroup && ( + leave(group)} + variant="link" + > + {t("leave")} + + ) ); }; diff --git a/src/user/UsersSection.tsx b/src/user/UsersSection.tsx index d8676e94d5..556d594d52 100644 --- a/src/user/UsersSection.tsx +++ b/src/user/UsersSection.tsx @@ -63,14 +63,12 @@ export const UsersSection = () => { ); const UserDetailLink = (user: UserRepresentation) => ( - <> - - {user.username} - - > + + {user.username} + ); const loader = async (first?: number, max?: number, search?: string) => {