Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/8467-UseDesignSystemAlertComponent #9022

Merged
merged 29 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a65ef1a
Upgrade mobile-component-library and eslint-config-mobile
alexandec Jun 27, 2024
225a597
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Jul 2, 2024
4a9326d
Convert first set of components to use Alert component
alexandec Jul 3, 2024
7c5120c
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Jul 8, 2024
7911bd8
Second set of conversions to Alert component
alexandec Jul 8, 2024
02d0f93
Create and use AlertWithScroll component
alexandec Jul 9, 2024
eba1446
Remove adjustment to alert scroll position
alexandec Jul 9, 2024
4355988
Change name to AlertWithHaptics
alexandec Jul 9, 2024
1a88105
Further update to mobile-component-library
alexandec Jul 9, 2024
a0559db
Simplify MessageAlert changes
alexandec Jul 9, 2024
eeebcca
Update E2E mapping
alexandec Jul 9, 2024
3e516ba
Replace and remove CollapsibleAlert component
alexandec Jul 9, 2024
5b5d14d
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Jul 9, 2024
6699f6a
Unit test fixes
alexandec Jul 9, 2024
db0c20c
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Jul 10, 2024
b0adffd
Fixes based on PR reviews
alexandec Jul 10, 2024
74c0ccf
Unit test fix
alexandec Jul 11, 2024
7505d99
Bump component-library to 0.20.3. Add mobile-assets and mobile-tokens…
narin Jul 15, 2024
332529b
Update design system colors imports
narin Jul 15, 2024
772299c
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Aug 19, 2024
f24ece1
Convert additional AlertBoxes to AlertWithHaptics
alexandec Aug 19, 2024
a613bb9
Upgrade mobile-component-library and mobile-tokens to latest
alexandec Aug 19, 2024
fdaa27b
Use AlertWithHaptics on ClaimDetailsScreen
alexandec Aug 19, 2024
d9dcaa2
Spacing tweaks for alert content
alexandec Aug 19, 2024
2b4a465
Remove extra spacing in WaygateWrapper alert
alexandec Aug 20, 2024
6e0f4af
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Aug 20, 2024
c759cf1
Improvements for CustomError and TakePhotos alerts
alexandec Aug 20, 2024
fa771f0
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Aug 20, 2024
8a7f9ec
Merge branch 'develop' into feature/8467-UseDesignSystemAlertComponent
alexandec Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions .github/workflows/e2e_detox_mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Detox e2e tests in CI
#

name: '[e2e] Detox Mapping'
name: "[e2e] Detox Mapping"

on:
workflow_call:
outputs:
test_matrix:
description: "The matrix output for the e2e tests"
value: ${{ jobs.find_detox_tests_to_run.outputs.output1 }}
test_run:
description: "String saying test has been run"
value: ${{ jobs.find_detox_tests_to_run.outputs.output2}}
outputs:
test_matrix:
description: "The matrix output for the e2e tests"
value: ${{ jobs.find_detox_tests_to_run.outputs.output1 }}
test_run:
description: "String saying test has been run"
value: ${{ jobs.find_detox_tests_to_run.outputs.output2}}

defaults:
run:
working-directory: VAMobile
Expand All @@ -39,11 +39,11 @@ env:
jobs:
find_detox_tests_to_run:
runs-on: ubuntu-latest
outputs:
outputs:
output1: ${{ steps.testing_matrix.outputs.TESTING_MATRIX }}
output2: ${{ steps.testing_matrix.outputs.TEST_RUN}}

steps:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Get file difference by file name
id: changed_files_file_name
uses: tj-actions/changed-files@v41
with:
with:
json: true
base_sha: "${{ steps.get-sha.outputs.sha }}"
- name: Get testing matrix array
Expand Down Expand Up @@ -130,10 +130,9 @@ jobs:
select(contains(["RadioGroup"])) += ["PersonalInformationScreen", "ContactInformation"] |
select(contains(["VATextInput"]) or contains(["WaygateWrapper"])) += ["AvailabilityFramework"] |
select(contains(["AccordionCollapsible"])) += ["Claims", "Messages"] |
select(contains(["AlertBox"])) += ["AvailabilityFramework", "VALetters", "Appointments", "Prescriptions", "Messages", "ContactInformation", "DirectDeposit"] |
select(contains(["AlertWithHaptics"])) += ["AvailabilityFramework", "VALetters", "Appointments", "Prescriptions", "Messages", "ContactInformation", "DirectDeposit", "Cerner", "Prescriptions", "ContactInformation"] |
select(contains(["AppVersionAndBuild"])) += ["LoginScreen", "SettingsScreen"] |
select(contains(["ClickForActionLink"]) or contains(["ClickToCallPhoneNumber"])) += ["AvailabilityFramework", "Claims", "Appeals", "DisabilityRatings", "Appointments", "Prescriptions", "Messages", "MilitaryInformation", "HomeScreen", "VeteransCrisisLine", "VeteranStatusCard", "DirectDeposit", "Payments", "PersonalInformationScreen"] |
select(contains(["CollapsibileAlert"])) += ["Cerner", "Prescriptions", "ContactInformation"] |
select(contains(["CollapsibleView"])) += ["Appeals", "AppealsExpanded", "Messages", "DirectDeposit"] |
select(contains(["DefaultList"])) += ["Claims", "DisabilityRattings", "VALetters", "ContactInformation", "Appointments", "VaccineRecords", "MilitaryInformation", "PersonalInformationScreen", "DirectDeposit", "Prescriptions", "Payments", "SettingsScreen"] |
select(contains(["LabelTag"])) += ["Prescriptions", "Messages"] |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ return (
</Box>
{replyExpired && (
<Box mt={theme.dimensions.standardMarginBetween} mx={theme.dimensions.gutter} mb={theme.dimensions.contentMarginBottom}>
<AlertBox border={'warning'} title={t('secureMessaging.reply.youCanNoLonger')} text={t('secureMessaging.reply.olderThan45Days')}>
<AlertWithHaptics variant={'warning'} header={t('secureMessaging.reply.youCanNoLonger')} description={t('secureMessaging.reply.olderThan45Days')}>
<Box mt={theme.dimensions.standardMarginBetween}>
<Button
label={t('secureMessaging.startNewMessage.new')}
onPress={onPressCompose}
a11yHint={t('secureMessaging.startNewMessage.new.a11yHint')}
/>
</Box>
</AlertBox>
</AlertWithHaptics>
</Box>
)}
</VAScrollView>
{!replyExpired && <ReplyMessageButton messageID={messageID} />}
</>
)`

<HooksInfo componentName="useAutoScrollToElement" example={exampleString}/>
<HooksInfo componentName="useAutoScrollToElement" example={exampleString} />
4 changes: 2 additions & 2 deletions VAMobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
},
"dependencies": {
"@department-of-veterans-affairs/mobile-assets": "0.12.0",
"@department-of-veterans-affairs/mobile-tokens": "0.12.0",
"@department-of-veterans-affairs/mobile-component-library": "0.19.1",
"@department-of-veterans-affairs/mobile-component-library": "0.21.0",
"@department-of-veterans-affairs/mobile-tokens": "0.14.0",
"@expo/react-native-action-sheet": "^4.1.0",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-firebase/analytics": "^18.9.0",
Expand Down
16 changes: 0 additions & 16 deletions VAMobile/src/components/AlertBox.test.tsx

This file was deleted.

104 changes: 0 additions & 104 deletions VAMobile/src/components/AlertBox.tsx

This file was deleted.

16 changes: 16 additions & 0 deletions VAMobile/src/components/AlertWithHaptics.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'

import { context, render, screen } from 'testUtils'

import AlertWithHaptics from './AlertWithHaptics'

context('AlertWithHaptics', () => {
beforeEach(() => {
render(<AlertWithHaptics variant="warning" header={'Warning title'} description={'My warning'} />)
})

it('initializes correctly', () => {
expect(screen.getByText('My warning')).toBeTruthy()
expect(screen.getByRole('heading', { name: 'Warning title' })).toBeTruthy()
})
})
54 changes: 54 additions & 0 deletions VAMobile/src/components/AlertWithHaptics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React, { FC, RefObject, useEffect, useState } from 'react'
import { ScrollView, View } from 'react-native'
import { HapticFeedbackTypes } from 'react-native-haptic-feedback'

import { Alert, AlertProps } from '@department-of-veterans-affairs/mobile-component-library/src/components/Alert/Alert'

import { triggerHaptic } from 'utils/haptics'
import { useAutoScrollToElement } from 'utils/hooks'

export type AlertWithHapticsProps = AlertProps & {
/** Optional boolean for determining when to focus on error alert boxes (e.g. onSaveClicked). Default is true */
focusOnError?: boolean
/** Optional ref for the parent scrollView so we can scroll to the Alert */
scrollViewRef?: RefObject<ScrollView>
}

/**
* Wrapper for the Alert component which triggers haptics and optionally scrolls
*/
const AlertWithHaptics: FC<AlertWithHapticsProps> = ({
children,
scrollViewRef,
focusOnError = true,
...alertProps
}) => {
const [scrollRef, viewRef, scrollToAlert] = useAutoScrollToElement()
const [shouldFocus, setShouldFocus] = useState(true)
const { variant, header, description } = alertProps

useEffect(() => {
if (variant === 'error' && scrollViewRef?.current && (header || description)) {
scrollRef.current = scrollViewRef.current
scrollToAlert()
}
setShouldFocus(focusOnError)
}, [variant, focusOnError, scrollRef, scrollToAlert, scrollViewRef, header, description])

const vibrate = () => {
if (variant === 'error') {
triggerHaptic(HapticFeedbackTypes.notificationError)
} else if (variant === 'warning') {
triggerHaptic(HapticFeedbackTypes.notificationWarning)
}
}

return (
<View ref={viewRef}>
<Alert {...alertProps}>{children}</Alert>
{shouldFocus && vibrate()}
</View>
)
}

export default AlertWithHaptics
30 changes: 0 additions & 30 deletions VAMobile/src/components/CollapsibleAlert.test.tsx

This file was deleted.

Loading
Loading