Skip to content

Commit a70658a

Browse files
authored
Merge pull request #1090 from IFRCGo/fix/account-detail-org-type-label
Use label for org type enum in account details page
2 parents 3106e68 + 90678ed commit a70658a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.changeset/violet-bikes-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Show Organization Type properly in Account Details page

app/src/views/AccountDetails/index.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ import {
1717
isDefined,
1818
isNotDefined,
1919
isTruthyString,
20+
listToMap,
2021
} from '@togglecorp/fujs';
2122

2223
import Link from '#components/Link';
24+
import useGlobalEnums from '#hooks/domain/useGlobalEnums';
2325
import useUserMe from '#hooks/domain/useUserMe';
2426
import useFilterState from '#hooks/useFilterState';
2527
import { useRequest } from '#utils/restRequest';
@@ -49,6 +51,11 @@ export function Component() {
4951
] = useBooleanState(false);
5052

5153
const meResponse = useUserMe();
54+
const { api_profile_org_types } = useGlobalEnums();
55+
const orgTypeMap = listToMap(
56+
api_profile_org_types,
57+
({ key }) => key,
58+
);
5259

5360
const onEditProfileCancel = useCallback(() => {
5461
setShowEditProfileModal(false);
@@ -146,7 +153,11 @@ export function Component() {
146153
/>
147154
<TextOutput
148155
label={strings.organizationTypeLabel}
149-
value={meResponse?.profile?.org_type}
156+
value={
157+
isDefined(meResponse?.profile.org_type)
158+
? orgTypeMap?.[meResponse?.profile?.org_type]?.value
159+
: undefined
160+
}
150161
strongLabel
151162
/>
152163
<TextOutput

0 commit comments

Comments
 (0)