Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | import { useMemo } from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; import { Tooltip, type SimpleSelectOption } from '@allshares/studio-design-system'; import { UserPrettyFormat } from '@amalia/data-capture/fields/components'; import { useAuthorizedProfiles } from '@amalia/tenants/users/profile/state'; import { type UserProfile } from '@amalia/tenants/users/profile/types'; export const useUserOptions = () => { const { formatMessage } = useIntl(); const { data: users } = useAuthorizedProfiles(); return useMemo( () => users.map(({ email, firstName, id, lastName, pictureURL }) => ({ label: ( <Tooltip placement="right" content={ <FormattedMessage defaultMessage="{firstName} {lastName} - {email}" values={{ firstName, lastName, email, }} /> } > <UserPrettyFormat firstName={firstName} lastName={lastName} pictureURL={pictureURL} /> </Tooltip> ), value: id, filterLabel: [firstName, lastName, email].join(' '), valueLabel: formatMessage( { defaultMessage: '{firstName} {lastName}' }, { firstName, lastName, }, ), })), [users, formatMessage], ) satisfies SimpleSelectOption<UserProfile['id']>[]; }; |