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

See all locations enhancement #118

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
6 changes: 3 additions & 3 deletions code/aspen_app/app-configs/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "24.08.00",
"build": "270",
"patch": "0"
"version": "24.09.00",
"build": "275",
"patch": "2"
}
21 changes: 14 additions & 7 deletions code/aspen_app/src/screens/MyAccount/TitlesOnHold/MyHold.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons';
import { useNavigation } from '@react-navigation/native';
import CachedImage from 'expo-cached-image';
import DateTimePickerModal from 'react-native-modal-datetime-picker';
import { Image } from 'expo-image';
import _ from 'lodash';
import { Actionsheet, Box, Button, Center, Checkbox, HStack, Icon, Pressable, Text, useDisclose, VStack } from 'native-base';
import { Actionsheet, Box, Button, Center, Checkbox, HStack, Icon, Pressable, Text, useDisclose, VStack, useToken, useColorModeValue } from 'native-base';
import React from 'react';
import { popAlert } from '../../../components/loadError';
import { HoldsContext, LanguageContext, LibrarySystemContext, UserContext } from '../../../context/initialContext';
import { getAuthor, getBadge, getCleanTitle, getExpirationDate, getFormat, getOnHoldFor, getPickupLocation, getPosition, getStatus, getTitle, getType } from '../../../helpers/item';
import { navigateStack } from '../../../helpers/RootNavigator';
import { getTermFromDictionary, getTranslationsWithValues } from '../../../translations/TranslationService';
import { cancelHold, cancelHolds, cancelVdxRequest, thawHold, thawHolds } from '../../../util/accountActions';
import { getTermFromDictionary } from '../../../translations/TranslationService';
import { cancelHold, cancelHolds, cancelVdxRequest, freezeHold, freezeHolds, thawHold, thawHolds } from '../../../util/accountActions';
import { formatDiscoveryVersion } from '../../../util/loadLibrary';
import { checkoutItem } from '../../../util/recordActions';
import { SelectPickupLocation } from './SelectPickupLocation';
Expand Down Expand Up @@ -89,6 +89,9 @@ export const MyHold = (props) => {
}
}

const freezingHoldLabel = getTermFromDictionary(language, 'freezing_hold');
const freezeHoldLabel = getTermFromDictionary(language, 'freeze_hold');

const openGroupedWork = (item, title) => {
navigateStack('AccountScreenTab', 'MyHold', {
id: item,
Expand Down Expand Up @@ -251,7 +254,7 @@ export const MyHold = (props) => {
</Actionsheet.Item>
);
} else {
return <SelectThawDate isOpen={isOpen} label={null} language={language} libraryContext={library} holdsContext={updateHolds} onClose={onClose} freezeId={hold.cancelId} recordId={hold.recordId} source={hold.source} libraryUrl={library.baseUrl} userId={hold.userId} resetGroup={resetGroup} />;
return <SelectThawDate isOpen={isOpen} label={null} freezeLabel={freezeHoldLabel} freezingLabel={freezingHoldLabel} language={language} libraryContext={library} holdsContext={updateHolds} onClose={onClose} freezeId={hold.cancelId} recordId={hold.recordId} source={hold.source} libraryUrl={library.baseUrl} userId={hold.userId} resetGroup={resetGroup} />;
}
} else {
return null;
Expand Down Expand Up @@ -371,6 +374,8 @@ export const ManageSelectedHolds = (props) => {
const numToFreezeLabel = getTermFromDictionary(language, 'freeze_selected_holds') + ' (' + numToFreeze + ')';
const numToThawLabel = getTermFromDictionary(language, 'thaw_selected_holds') + ' (' + numToThaw + ')';
const numSelectedLabel = getTermFromDictionary(language, 'manage_selected') + ' (' + numSelected + ')';
const freezingHoldLabel = getTermFromDictionary(language, 'freezing_hold');
const freezeHoldLabel = getTermFromDictionary(language, 'freeze_hold');

const cancelActionItem = () => {
if (numToCancel > 0) {
Expand Down Expand Up @@ -424,7 +429,7 @@ export const ManageSelectedHolds = (props) => {
<Actionsheet isOpen={isOpen} onClose={onClose}>
<Actionsheet.Content>
{cancelActionItem()}
<SelectThawDate isOpen={isOpen} label={numToFreezeLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numSelected} data={titlesToFreeze} />
<SelectThawDate isOpen={isOpen} label={numToFreezeLabel} freezeLabel={freezeHoldLabel} freezingLabel={freezingHoldLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numSelected} data={titlesToFreeze} />
{thawActionItem()}
</Actionsheet.Content>
</Actionsheet>
Expand Down Expand Up @@ -489,6 +494,8 @@ export const ManageAllHolds = (props) => {
const numToCancelLabel = getTermFromDictionary(language, 'cancel_all_holds') + ' (' + numToCancel + ')';
const numToFreezeLabel = getTermFromDictionary(language, 'freeze_all_holds') + ' (' + numToFreeze + ')';
const numToThawLabel = getTermFromDictionary(language, 'thaw_all_holds') + ' (' + numToThaw + ')';
const freezingHoldLabel = getTermFromDictionary(language, 'freezing_hold');
const freezeHoldLabel = getTermFromDictionary(language, 'freeze_hold');

if (numToManage >= 1) {
return (
Expand All @@ -511,7 +518,7 @@ export const ManageAllHolds = (props) => {
}}>
{numToCancelLabel}
</Actionsheet.Item>
<SelectThawDate label={numToFreezeLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numToManage} data={titlesToFreeze} />
<SelectThawDate label={numToFreezeLabel} freezeLabel={freezeHoldLabel} freezingLabel={freezingHoldLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numToManage} data={titlesToFreeze} />
<Actionsheet.Item
isLoading={thawing}
isLoadingText={getTermFromDictionary(language, 'thaw_hold', true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import React from 'react';
import DateTimePickerModal from 'react-native-modal-datetime-picker';
import { MaterialIcons } from '@expo/vector-icons';
import { Actionsheet, Icon, useToken, useColorModeValue } from 'native-base';
import { LanguageContext } from '../../../context/initialContext';
import { freezeHold, freezeHolds } from '../../../util/accountActions';
import { getTermFromDictionary } from '../../../translations/TranslationService';

export const SelectThawDate = (props) => {
const { label, language, libraryContext, onClose, freezeId, recordId, source, userId, resetGroup, isOpen } = props;
const { freezingLabel, freezeLabel, label, libraryContext, onClose, freezeId, recordId, source, userId, resetGroup, isOpen } = props;
let data = props.data;
const { language } = React.useContext(LanguageContext);
const [loading, setLoading] = React.useState(false);

const textColor = useToken('colors', useColorModeValue('text.500', 'text.50'));
const colorMode = useColorModeValue(false, true);

let actionLabel = getTermFromDictionary(language, 'freeze_hold');
let actionLabel = freezeLabel;
if (label) {
actionLabel = label;
}
Expand Down Expand Up @@ -57,7 +59,7 @@ export const SelectThawDate = (props) => {
<Actionsheet.Item startIcon={data ? null : <Icon as={MaterialIcons} name="pause" color="trueGray.400" mr="1" size="6" />} onPress={showDatePicker}>
{actionLabel}
</Actionsheet.Item>
<DateTimePickerModal isVisible={isDatePickerVisible} date={date} mode="date" onConfirm={onSelectDate} onCancel={hideDatePicker} isDarkModeEnabled={colorMode} minimumDate={today} textColor={textColor} confirmTextIOS={loading ? getTermFromDictionary('en', 'freezing_hold') : getTermFromDictionary('en', 'freeze_hold')} />
<DateTimePickerModal isVisible={isDatePickerVisible} date={date} mode="date" onConfirm={onSelectDate} onCancel={hideDatePicker} isDarkModeEnabled={colorMode} minimumDate={today} textColor={textColor} confirmTextIOS={loading ? freezingLabel : actionLabel} />
</>
);
};
11 changes: 10 additions & 1 deletion code/aspen_app/src/screens/Search/Facets/RadioGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export default class Facet_RadioGroup extends Component {

componentDidUpdate(prevProps, prevState) {
if (prevState.value !== this.state.applied) {
this.renderValue();
console.log('prevState.value', prevState.value);
console.log('this.state.applied', this.state.applied);
//this.renderValue();
}
}

Expand All @@ -59,17 +61,22 @@ export default class Facet_RadioGroup extends Component {
const { category, value } = this.state;
if (category !== 'sort_by') {
console.log('payload > ', payload);
console.log('value > ', value);
if (payload === value) {
console.log('new is same as old. removing.');
removeAppliedFilter(category, payload);
this.setState({
value: '',
});
} else {
console.log('new value. adding.');
addAppliedFilter(category, payload, false);
this.setState({
value: payload,
});
}

console.log('current state value: ' + this.state.value);
} else {
console.log('payload > ', payload);
console.log('value > ', value);
Expand All @@ -94,6 +101,8 @@ export default class Facet_RadioGroup extends Component {
const { items, category, title, updater, applied } = this.state;
const name = category + '_group';

console.log(items);

if (category === 'sort_by') {
return (
<VStack space={2}>
Expand Down
Loading
Loading