generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [View/Update institution profile] Create a shared page-level al…
…ert for when API is unreachable (#1056) Closes #1054 ## Changes - Create a shared page-level alert for when API is unreachable - Add `API down` page-level alert to `Update institution profile` page ## How to test this PR 1. Visit [View institution profile](http://localhost:8899/institution/123456789TESTBANK123) 2. Use Chrome devtools to block Institution API requests <img width="522" alt="Screenshot 2024-11-13 at 10 51 26 AM" src="https://github.com/user-attachments/assets/9b43f41d-deee-4f45-aa5c-aa1667d1adb3"> 3. Reload page 4. Verify page-level alert and no crashes 5. Visit [Update institution profile](http://localhost:8899/institution/123456789TESTBANK123/update) 6. Verify page-level alert and no crashes ## Screenshots ### View institution profile (api down) ![view-down](https://github.com/user-attachments/assets/8750142f-5e10-4b35-99d9-634b6c91251a) ### Update institution profile (api down) ![update-down](https://github.com/user-attachments/assets/2d80a9db-601b-4243-be19-0e36a49afa65) ### Update institution profile: LEI alert and Email domain(s) language ![update-missing-lei](https://github.com/user-attachments/assets/0b5b7346-f635-4542-b524-158bba903b1a)
- Loading branch information
Showing
4 changed files
with
95 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/pages/Filing/ViewInstitutionProfile/AlertInstitutionApiUnreachable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import CommonLinks from 'components/CommonLinks'; | ||
import { Alert } from 'design-system-react'; | ||
|
||
export const MESSAGE_INSTITUTION_API_DOWN = | ||
'A problem occurred when trying to load your profile'; | ||
|
||
export interface InstitutionApiErrorWrapperType { | ||
isError?: boolean; | ||
children: JSX.Element | JSX.Element[]; | ||
} | ||
|
||
// Shared page-level alert for Institution API errors | ||
export function AlertInstitutionApiUnreachable({ | ||
isError, | ||
children, | ||
}: InstitutionApiErrorWrapperType): JSX.Element { | ||
if (isError) | ||
return ( | ||
<Alert status='error' message={MESSAGE_INSTITUTION_API_DOWN}> | ||
<p> | ||
Try again in a few minutes. If this issues persists,{' '} | ||
<CommonLinks.EmailSupportStaff | ||
subject={`[Error] ${MESSAGE_INSTITUTION_API_DOWN}`} | ||
/> | ||
. | ||
</p> | ||
</Alert> | ||
); | ||
|
||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return <>{children}</>; | ||
} | ||
|
||
AlertInstitutionApiUnreachable.defaultProps = { | ||
isError: false, | ||
}; | ||
|
||
export default AlertInstitutionApiUnreachable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters