From 4f9d60047845ed6ef61661c17109cb690ea6dadb Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Sun, 1 Oct 2023 11:05:28 +0200 Subject: [PATCH] Re-use Role Card component --- client/src/components/User.js | 21 ++++++--------------- client/src/locale/en.js | 2 +- client/src/locale/nl.js | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/client/src/components/User.js b/client/src/components/User.js index 75e573c2..a59f620a 100644 --- a/client/src/components/User.js +++ b/client/src/components/User.js @@ -7,7 +7,7 @@ import I18n from "../locale/I18n"; import Logo from "./Logo"; import {Card, CardType} from "@surfnet/sds"; import {isEmpty} from "../utils/Utils"; -import {deriveRemoteApplicationAttributes, providerInfo} from "../utils/Manage"; +import {deriveRemoteApplicationAttributes} from "../utils/Manage"; import {ReactComponent as SearchIcon} from "@surfnet/sds/icons/functional-icons/search.svg"; import {MoreLessText} from "./MoreLessText"; import {RoleCard} from "./RoleCard"; @@ -39,7 +39,7 @@ export const User = ({user, other}) => { ) } - const renderSearch = (value, valueSetter, valueReference) => { + const renderSearch = (value, valueSetter, placeholder, valueReference) => { return (
@@ -50,7 +50,7 @@ export const User = ({user, other}) => { onChange={e => valueSetter(e.target.value)} value={value} ref={valueReference} - placeholder={I18n.t(`users.applicationsSearchPlaceHolder`)}/> + placeholder={placeholder}/> @@ -73,16 +73,7 @@ export const User = ({user, other}) => { const renderUserRole = (userRole, index) => { const role = userRole.role; - const provider = role.application || providerInfo(null); - const logo = provider.data.metaDataFields["logo:0:url"]; - const children = -
- - -
; - return ( - - ); + return } const filterApplication = application => { @@ -130,7 +121,7 @@ export const User = ({user, other}) => {

{I18n.t(`users.${other ? "rolesInfoOther" : "rolesInfo"}`, {name: user.name})}

- {renderSearch(query, setQuery, searchRef)} + {renderSearch(query, setQuery, I18n.t(`roles.searchPlaceHolder`, searchRef))}
{filteredUserRoles .map((userRole, index) => renderUserRole(userRole, index))} @@ -143,7 +134,7 @@ export const User = ({user, other}) => {

{I18n.t(`users.${other ? "applicationsInfoOther" : "applicationsInfo"}`, {name: user.name})}

- {renderSearch(queryApplication, setQueryApplication)} + {renderSearch(queryApplication, setQueryApplication, I18n.t(`users.applicationsSearchPlaceHolder`))}
{filteredApplications .map((application, index) => renderApplication(application, index))} diff --git a/client/src/locale/en.js b/client/src/locale/en.js index c7ea2060..6d218170 100644 --- a/client/src/locale/en.js +++ b/client/src/locale/en.js @@ -74,7 +74,7 @@ const en = { users: { found: "{{count}} {{plural}} found", moreResults: "There are more results than shown, please refine your search.", - applicationsSearchPlaceHolder: "Search for roles...", + applicationsSearchPlaceHolder: "Search for application...", name_email: "Name / email", name: "Name", email: "Email", diff --git a/client/src/locale/nl.js b/client/src/locale/nl.js index 18a827c0..2ea19b0b 100644 --- a/client/src/locale/nl.js +++ b/client/src/locale/nl.js @@ -74,7 +74,7 @@ const nl = { users: { found: "{{count}} {{plural}} gevonden", moreResults: "Er zijn meer resultaten dan getoond kunnen worden, vereng je zoekopdracht.", - applicationsSearchPlaceHolder: "Zoek rollen...", + applicationsSearchPlaceHolder: "Zoek applicaties...", name_email: "Naam / e-mail", name: "Naam", email: "E-mail",