Skip to content

Commit

Permalink
Make recent fare contracts spinner appear immediately (#3690)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristianSelnas committed Jun 27, 2023
1 parent bb09b38 commit 1357420
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@ import {TicketingTexts, useTranslation} from '@atb/translations';
import RecentFareContractsTexts from '@atb/translations/screens/subscreens/RecentFareContractsTexts';
import React, {useMemo} from 'react';
import {ActivityIndicator, ScrollView, View} from 'react-native';
import {useRecentFareContracts} from '../../use-recent-fare-contracts';
import {RecentFareContractComponent} from './RecentFareContractComponent';
import {useFirestoreConfiguration} from '@atb/configuration/FirestoreConfigurationContext';
import {FareProductTypeConfig} from '@atb/configuration';
import {RecentFareContract} from '../../types';
import {useTicketingState} from '@atb/ticketing';

type Props = {
recentFareContracts: RecentFareContract[];
loading: boolean;
onSelect: (
rfc: RecentFareContract,
fareProductTypeConfig: FareProductTypeConfig,
) => void;
};

export const RecentFareContracts = ({onSelect}: Props) => {
export const RecentFareContracts = ({
recentFareContracts,
loading,
onSelect,
}: Props) => {
const styles = useStyles();
const {theme} = useTheme();
const {t} = useTranslation();
const {recentFareContracts, loading} = useRecentFareContracts();
const {fareProductTypeConfigs} = useFirestoreConfiguration();
const {customerProfile} = useTicketingState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const TicketTabNav_PurchaseTabScreen = ({navigation}: Props) => {
const {abtCustomerId, authenticationType} = useAuthState();
const isSignedInAsAbtCustomer = !!abtCustomerId;
const {theme} = useTheme();
const {recentFareContracts} = useRecentFareContracts();
const {recentFareContracts, loading} = useRecentFareContracts();
const hasRecentFareContracts =
enable_recent_tickets && !!recentFareContracts.length;
const styles = useStyles();
Expand Down Expand Up @@ -135,9 +135,11 @@ export const TicketTabNav_PurchaseTabScreen = ({navigation}: Props) => {

return isSignedInAsAbtCustomer ? (
<ScrollView>
{hasRecentFareContracts && (
<RecentFareContracts onSelect={onFareContractSelect} />
)}
<RecentFareContracts
recentFareContracts={recentFareContracts}
loading={loading}
onSelect={onFareContractSelect}
/>
<View
style={[
styles.container,
Expand Down

0 comments on commit 1357420

Please sign in to comment.