Skip to content

Commit

Permalink
Added snackBarBottomOffset back to the theme and started using it as …
Browse files Browse the repository at this point in the history
…the offset for Snackbar's where there is no bottom navigation bar
  • Loading branch information
oddballdave committed Dec 12, 2024
1 parent 0580fb5 commit c36561f
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ function AskForClaimDecision({ navigation, route }: AskForClaimDecisionProps) {
snackbar.show('Request sent')
},
onError: () =>
snackbar.show('Request could not be sent', { isError: true, offset: 0, onActionPressed: () => onSubmit }),
snackbar.show('Request could not be sent', {
isError: true,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => onSubmit,
}),
}
submitClaimDecision(claimID, mutateOptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function UploadFile({ navigation, route }: UploadFileProps) {
onError: () =>
snackbar.show(t('fileUpload.submitted.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: onUploadConfirmed,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function UploadOrAddPhotos({ navigation, route }: UploadOrAddPhotosProps) {
onError: () =>
snackbar.show(t('fileUpload.submitted.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: onUploadConfirmed,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Events } from 'constants/analytics'
import { NAMESPACE } from 'constants/namespaces'
import { FolderNameTypeConstants, FormHeaderType, FormHeaderTypeConstants } from 'constants/secureMessaging'
import { logAnalyticsEvent } from 'utils/analytics'
import { useDestructiveActionSheet, useRouteNavigation } from 'utils/hooks'
import { useDestructiveActionSheet, useRouteNavigation, useTheme } from 'utils/hooks'

type ComposeCancelConfirmationProps = {
/** Contents of the message */
Expand All @@ -31,6 +31,7 @@ export function useComposeCancelConfirmation(): [
] {
const snackbar = useSnackbar()
const { t } = useTranslation(NAMESPACE.COMMON)
const theme = useTheme()
const navigateTo = useRouteNavigation()
const confirmationAlert = useDestructiveActionSheet()
const goToDrafts = useGoToDrafts()
Expand Down Expand Up @@ -82,7 +83,7 @@ export function useComposeCancelConfirmation(): [
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => saveDraft(params, mutateOptions),
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
const params: SendMessageParameters = { messageData: messageData, uploads: attachmentsList }
snackbar.show(t('secureMessaging.startNewMessage.sent.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => sendMessage(params, mutateOptions),
})
}
Expand Down Expand Up @@ -272,7 +272,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
onError: () => {
snackbar.show(t('secureMessaging.deleteDraft.snackBarErrorMessage'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => deleteDraft(params, mutateOptions),
})
},
Expand Down Expand Up @@ -480,7 +480,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => saveDraft(params, mutateOptions),
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function ReplyMessage({ navigation, route }: ReplyMessageProps) {
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () =>
saveDraft(
{
Expand Down Expand Up @@ -254,7 +254,7 @@ function ReplyMessage({ navigation, route }: ReplyMessageProps) {
} else {
snackbar.show(t('secureMessaging.startNewMessage.sent.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () =>
sendMessage(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => {
// passing messageDataRef to ensure we have the latest messageData
saveDraft({ messageData: messageDataRef.current }, mutateOptions)
Expand All @@ -333,7 +333,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
} else {
snackbar.show(t('secureMessaging.startNewMessage.sent.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => {
// passing messageDataRef to ensure we have the latest messageData
sendMessage({ messageData: messageDataRef.current, uploads: attachmentsList }, mutateOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function AddressValidation({
onError: () =>
snackbar.show(GenerateAddressMessage(t, addressType, true), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => save,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function EditAddressScreen({ navigation, route }: IEditAddressScreen) {
onError: () =>
snackbar.show(t('contactInformation.residentialAddress.removed.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => deleteAddress,
}),
}
Expand Down Expand Up @@ -277,7 +277,7 @@ function EditAddressScreen({ navigation, route }: IEditAddressScreen) {
onError: () =>
snackbar.show(GenerateAddressMessage(t, addressType, true), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => save,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,14 @@ function EditEmailScreen({ navigation }: EditEmailScreenProps) {
onError: (error: unknown) => {
if (isErrorObject(error)) {
if (error.status === 400) {
snackbar.show(t('contactInformation.emailAddress.not.saved'), { isError: true, offset: 0 })
snackbar.show(t('contactInformation.emailAddress.not.saved'), {
isError: true,
offset: theme.dimensions.snackBarBottomOffset,
})
} else {
snackbar.show(t('contactInformation.emailAddress.not.saved'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => saveEmail(emailData, mutateOptions),
})
}
Expand Down Expand Up @@ -131,7 +134,7 @@ function EditEmailScreen({ navigation }: EditEmailScreenProps) {
onError: () =>
snackbar.show(t('contactInformation.emailAddress.not.removed'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => deleteEmail(emailData, mutateOptions),
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function EditPhoneNumberScreen({ navigation, route }: IEditPhoneNumberScreen) {
isErrorObject(error) &&
snackbar.show(t('contactInformation.phoneNumber.not.saved', { type: displayTitle }), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: save,
}),
}
Expand All @@ -148,7 +148,7 @@ function EditPhoneNumberScreen({ navigation, route }: IEditPhoneNumberScreen) {
isErrorObject(error) &&
snackbar.show(t('contactInformation.phoneNumber.not.removed', { type: displayTitle }), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => deletePhoneNumber(phoneData, mutateOptions),
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function GenderIdentityScreen({ navigation }: GenderIdentityScreenProps) {
onError: () =>
snackbar.show(t('personalInformation.genderIdentity.not.saved'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: updateGenderIdentity,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function PreferredNameScreen({ navigation }: PreferredNameScreenProps) {
onError: () =>
snackbar.show(t('personalInformation.preferredName.notSaved'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: updatePreferredName,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function EditDirectDepositScreen({ navigation, route }: EditDirectDepositProps)
if (!routingNumberError) {
snackbar.show(t('directDeposit.saved.error'), {
isError: true,
offset: 0,
offset: theme.dimensions.snackBarBottomOffset,
onActionPressed: () => updateBankInfo(updateBankData, mutateOptions),
})
}
Expand Down
1 change: 1 addition & 0 deletions VAMobile/src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export type VATheme = {
maxNumMessageAttachments: number
navBarHeight: number
paginationTopPadding: number
snackBarBottomOffset: number
chevronListItemWidth: number
chevronListItemHeight: number
linkRowChevronPaddingRight: number
Expand Down
1 change: 1 addition & 0 deletions VAMobile/src/styles/themes/standardTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ let theme: VATheme = {
tagMinWidth: 29,
maxNumMessageAttachments: 4,
paginationTopPadding: 40,
snackBarBottomOffset: 20,
chevronListItemWidth: 30,
chevronListItemHeight: 45,
linkRowChevronPaddingRight: 18,
Expand Down

0 comments on commit c36561f

Please sign in to comment.