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

accessibility fixes #1853

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion code/aspen_app/src/components/Action/Holds/HoldPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const HoldPrompt = (props) => {
{_.isArray(accounts) && _.size(accounts) > 0 ? (
<FormControl>
<FormControlLabel>
<FormControlLabelText color={textColor}>{isPlacingHold ? getTermFromDictionary('en', 'linked_place_hold_for_account') : getTermFromDictionary('en', 'linked_checkout_to_account')}</FormControlLabelText>
<FormControlLabelText color={textColor}>{isPlacingHold ? getTermFromDictionary(language, 'linked_place_hold_for_account') : getTermFromDictionary(language, 'linked_checkout_to_account')}</FormControlLabelText>
</FormControlLabel>
<Select name="linkedAccount" selectedValue={activeAccount} minWidth={200} mt="$1" mb="$3" onValueChange={(itemValue) => setActiveAccount(itemValue)}>
<SelectTrigger variant="outline" size="md">
Expand Down
2 changes: 1 addition & 1 deletion code/aspen_app/src/screens/Auth/ResetExpiredPin.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ResetExpiredPin = (props) => {
setExpiredPin(false);
setIsOpen(false);
} else {
popAlert('Error', result.message ?? 'Unable to update pin', 'error');
popAlert(getTermFromDictionary('en', 'error'), result.message ?? 'Unable to update pin', 'error');
}
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion code/aspen_app/src/screens/GroupedWork/Editions.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const Editions = () => {
bgColor={theme['colors']['primary']['500']}
onPress={async () => {
setPlacingItemHold(true);
await placeHold(library.baseUrl, selectedItem, 'ils', holdSelectItemResponse.patronId, holdSelectItemResponse.pickupLocation, '', 'item', null, null, null, holdSelectItemResponse.bibId).then(async (result) => {
await placeHold(library.baseUrl, selectedItem, 'ils', holdSelectItemResponse.patronId, holdSelectItemResponse.pickupLocation, '', 'item', null, null, null, holdSelectItemResponse.bibId, language).then(async (result) => {
setResponse(result);
queryClient.invalidateQueries({ queryKey: ['holds', holdSelectItemResponse.patronId, library.baseUrl, language] });
queryClient.invalidateQueries({ queryKey: ['user', library.baseUrl, language] });
Expand Down
128 changes: 39 additions & 89 deletions code/aspen_app/src/screens/GroupedWork/OverDriveSettings.js
Original file line number Diff line number Diff line change
@@ -1,95 +1,45 @@
import {
Button,
Checkbox,
FormControl,
Input,
Modal,
Stack,
} from "native-base";
import React from "react";
import { Button, Checkbox, FormControl, Input, Modal, Stack } from 'native-base';
import React from 'react';

// custom components and helper files
import { updateOverDriveEmail } from "../../util/accountActions";
import {getTermFromDictionary} from '../../translations/TranslationService';
import { updateOverDriveEmail } from '../../util/accountActions';
import { getTermFromDictionary } from '../../translations/TranslationService';

export const GetOverDriveSettings = (props) => {
const {
promptTitle,
promptItemId,
promptSource,
promptPatronId,
promptForOverdriveEmail,
libraryUrl,
showOverDriveSettings,
handleOverDriveSettings,
showAlert,
setEmail,
setRememberPrompt,
overdriveEmail,
language
} = props;
const { promptTitle, promptItemId, promptSource, promptPatronId, promptForOverdriveEmail, libraryUrl, showOverDriveSettings, handleOverDriveSettings, showAlert, setEmail, setRememberPrompt, overdriveEmail, language } = props;

return (
<Modal
isOpen={showOverDriveSettings}
onClose={() => handleOverDriveSettings(false)}
avoidKeyboard
closeOnOverlayClick={false}
>
<Modal.Content>
<Modal.CloseButton />
<Modal.Header>{promptTitle}</Modal.Header>
<Modal.Body mt={4}>
<FormControl>
<Stack>
<FormControl.Label>
{getTermFromDictionary(language, 'overdrive_email_field')}
</FormControl.Label>
<Input
autoCapitalize="none"
autoCorrect={false}
id="overdriveEmail"
onChangeText={(text) => setEmail(text)}
/>
<Checkbox
value="yes"
my={2}
id="promptForOverdriveEmail"
onChange={(isSelected) => setRememberPrompt(isSelected)}
>
{getTermFromDictionary(language, 'remember_settings')}
</Checkbox>
</Stack>
</FormControl>
</Modal.Body>
<Modal.Footer>
<Button.Group space={2} size="md">
<Button
colorScheme="primary"
variant="ghost"
onPress={() => handleOverDriveSettings(false)}
>
{getTermFromDictionary(language, 'close_window')}
</Button>
<Button
onPress={async () => {
await updateOverDriveEmail(
promptItemId,
promptSource,
promptPatronId,
overdriveEmail,
promptForOverdriveEmail,
libraryUrl
).then((response) => {
showAlert(response);
});
}}
>
{getTermFromDictionary(language, 'place_hold')}
</Button>
</Button.Group>
</Modal.Footer>
</Modal.Content>
</Modal>
);
return (
<Modal isOpen={showOverDriveSettings} onClose={() => handleOverDriveSettings(false)} avoidKeyboard closeOnOverlayClick={false}>
<Modal.Content>
<Modal.CloseButton />
<Modal.Header>{promptTitle}</Modal.Header>
<Modal.Body mt={4}>
<FormControl>
<Stack>
<FormControl.Label>{getTermFromDictionary(language, 'overdrive_email_field')}</FormControl.Label>
<Input autoCapitalize="none" autoCorrect={false} id="overdriveEmail" onChangeText={(text) => setEmail(text)} />
<Checkbox value="yes" my={2} id="promptForOverdriveEmail" onChange={(isSelected) => setRememberPrompt(isSelected)}>
{getTermFromDictionary(language, 'remember_settings')}
</Checkbox>
</Stack>
</FormControl>
</Modal.Body>
<Modal.Footer>
<Button.Group space={2} size="md">
<Button colorScheme="primary" variant="ghost" onPress={() => handleOverDriveSettings(false)}>
{getTermFromDictionary(language, 'close_window')}
</Button>
<Button
onPress={async () => {
await updateOverDriveEmail(promptItemId, promptSource, promptPatronId, overdriveEmail, promptForOverdriveEmail, libraryUrl, language).then((response) => {
showAlert(response);
});
}}>
{getTermFromDictionary(language, 'place_hold')}
</Button>
</Button.Group>
</Modal.Footer>
</Modal.Content>
</Modal>
);
};
2 changes: 1 addition & 1 deletion code/aspen_app/src/screens/GroupedWork/Variations.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export const Variations = (props) => {
bgColor={theme['colors']['primary']['500']}
onPress={async () => {
setPlacingItemHold(true);
await placeHold(library.baseUrl, selectedItem, 'ils', holdSelectItemResponse.patronId, holdSelectItemResponse.pickupLocation, '', 'item', null, null, null, holdSelectItemResponse.bibId).then(async (result) => {
await placeHold(library.baseUrl, selectedItem, 'ils', holdSelectItemResponse.patronId, holdSelectItemResponse.pickupLocation, '', 'item', null, null, null, holdSelectItemResponse.bibId, language).then(async (result) => {
setResponse(result);
queryClient.invalidateQueries({ queryKey: ['holds', holdSelectItemResponse.patronId, library.baseUrl, language] });
queryClient.invalidateQueries({ queryKey: ['user', library.baseUrl, language] });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const MyCheckout = (props) => {
isLoadingText={getTermFromDictionary(language, 'accessing', true)}
onPress={() => {
setAccess(true);
viewOverDriveItem(checkout.userId, formatId, checkout.overDriveId, library.baseUrl).then((result) => {
viewOverDriveItem(checkout.userId, formatId, checkout.overDriveId, library.baseUrl, language).then((result) => {
setAccess(false);
toggle();
});
Expand All @@ -241,7 +241,7 @@ export const MyCheckout = (props) => {
isLoadingText={getTermFromDictionary(language, 'accessing', true)}
onPress={() => {
setAccess(true);
viewOnlineItem(checkout.userId, checkout.recordId, checkout.source, checkout.accessOnlineUrl, library.baseUrl).then((result) => {
viewOnlineItem(checkout.userId, checkout.recordId, checkout.source, checkout.accessOnlineUrl, library.baseUrl, language).then((result) => {
setAccess(false);
toggle();
});
Expand All @@ -254,7 +254,7 @@ export const MyCheckout = (props) => {
isLoadingText={getTermFromDictionary(language, 'returning', true)}
onPress={() => {
setReturn(true);
returnCheckout(checkout.userId, checkout.recordId, checkout.source, checkout.overDriveId, library.baseUrl, version, checkout.transactionId).then((result) => {
returnCheckout(checkout.userId, checkout.recordId, checkout.source, checkout.overDriveId, library.baseUrl, version, checkout.transactionId, language).then((result) => {
setReturn(false);
reloadCheckouts();
toggle();
Expand All @@ -272,7 +272,7 @@ export const MyCheckout = (props) => {
isLoadingText={getTermFromDictionary(language, 'returning', true)}
onPress={() => {
setReturn(true);
returnCheckout(checkout.userId, checkout.recordId, checkout.source, checkout.overDriveId, library.baseUrl, version, checkout.transactionId).then((result) => {
returnCheckout(checkout.userId, checkout.recordId, checkout.source, checkout.overDriveId, library.baseUrl, version, checkout.transactionId, language).then((result) => {
setReturn(false);
reloadCheckouts();
toggle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const MyCheckouts = () => {
colorScheme="primary"
onPress={() => {
setRenewAll(true);
renewAllCheckouts(library.baseUrl).then((result) => {
renewAllCheckouts(library.baseUrl, language).then((result) => {
if (result?.confirmRenewalFee && result.confirmRenewalFee) {
setRenewConfirmationResponse({
message: result.api.message,
Expand Down Expand Up @@ -334,7 +334,7 @@ export const MyCheckouts = () => {
setConfirmingRenewal(true);

if (renewConfirmationResponse.renewType === 'all') {
await confirmRenewAllCheckouts(library.baseUrl).then(async (result) => {
await confirmRenewAllCheckouts(library.baseUrl, language).then(async (result) => {
queryClient.invalidateQueries({ queryKey: ['user', library.baseUrl, language] });
queryClient.invalidateQueries({ queryKey: ['checkouts', user.id, library.baseUrl, language, source] });

Expand Down
4 changes: 2 additions & 2 deletions code/aspen_app/src/screens/MyAccount/Lists/EditList.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ const DeleteList = (props) => {
setIsOpen(!isOpen);
if (res.success === false) {
status = 'danger';
popAlert('Unable to delete list', res.message, status);
popAlert(res.title, res.message, status);
} else {
popAlert('List deleted', res.message, status);
popAlert(res.title, res.message, status);
navigateStack('AccountScreenTab', 'MyLists', {
libraryUrl: library.baseUrl,
hasPendingChanges: true,
Expand Down
Loading