Fix TypeScript compilation errors across components, selectors, and profile module
This commit is contained in:
@@ -32,7 +32,7 @@ export const AgentSkeletonLoader = ({ type }: AgentSkeletonLoaderProps) => {
|
||||
opacity: opacity.value,
|
||||
}));
|
||||
|
||||
const SkeletonBlock = ({ width = '100%', height = 20, borderRadius = 4, mb = 0 }: { width?: DimensionValue; height?: number; borderRadius?: number; mb?: number }) => (
|
||||
const SkeletonBlock = ({ width = '100%', height = 20, borderRadius = 4, mb = 0, mt = 0 }: { width?: DimensionValue; height?: number; borderRadius?: number; mb?: number; mt?: number }) => (
|
||||
<Animated.View
|
||||
style={[
|
||||
{
|
||||
@@ -40,6 +40,7 @@ export const AgentSkeletonLoader = ({ type }: AgentSkeletonLoaderProps) => {
|
||||
height,
|
||||
borderRadius,
|
||||
marginBottom: mb,
|
||||
marginTop: mt,
|
||||
backgroundColor: theme.colors.cardBorder,
|
||||
},
|
||||
animatedStyle,
|
||||
|
||||
@@ -9,7 +9,7 @@ interface CustomerCardProps {
|
||||
customer: AgentCustomer;
|
||||
onPress?: () => void;
|
||||
onAction?: () => void;
|
||||
actionIcon?: string;
|
||||
actionIcon?: any;
|
||||
actionColor?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
} from '../utils/agentMockData';
|
||||
import { generateReceiptNumber } from '../utils/agentFormatters';
|
||||
|
||||
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
||||
const delay = (ms: number) => new Promise<void>(resolve => setTimeout(resolve, ms));
|
||||
|
||||
export const agentApi = baseApi.injectEndpoints({
|
||||
endpoints: (builder) => ({
|
||||
|
||||
@@ -192,7 +192,7 @@ export const MOCK_LOAN_REQUESTS: AgentLoanRequest[] = [
|
||||
|
||||
export const MOCK_ROUTE: AgentRoute = {
|
||||
id: 'route-today',
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
date: new Date().toISOString().split('T')[0] ?? '',
|
||||
totalDistance: '12.5 km',
|
||||
estimatedDuration: '2h 30m',
|
||||
completionPercent: 61,
|
||||
|
||||
@@ -196,7 +196,7 @@ export default function CardsOverviewScreen({ navigation }: Props) {
|
||||
const cardsStatus = useAppSelector(selectCardsStatus);
|
||||
const selectedCard = useAppSelector(selectSelectedCard);
|
||||
const selectedIndex = useAppSelector(selectSelectedCardIndex);
|
||||
const accounts = useAppSelector((state) => state.account.accounts);
|
||||
const accounts = useAppSelector(selectAllAccounts);
|
||||
|
||||
const selectedTransactions = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -94,7 +94,7 @@ export default function MiniStatementScreen({ route }: Props) {
|
||||
const [isStartDatePickerVisible, setIsStartDatePickerVisible] = useState(false);
|
||||
const [isEndDatePickerVisible, setIsEndDatePickerVisible] = useState(false);
|
||||
|
||||
const accounts = useAppSelector(state => state.account.accounts);
|
||||
const accounts = useAppSelector(selectAllAccounts);
|
||||
const allTransactions = useAppSelector(state => state.account.transactions);
|
||||
const account = accounts.find((item) => item.id === selectedId) ?? accounts[0];
|
||||
|
||||
|
||||
@@ -13,3 +13,4 @@ export const selectSelectedAccount = createSelector(
|
||||
|
||||
export const selectRecentTransactions = (state: RootState) => state.account.transactions;
|
||||
export const selectDashboardShortcuts = (state: RootState) => state.account.quickActions;
|
||||
export const selectAllAccounts = (state: RootState) => state.account.accounts;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { StyleSheet, View, Text, ScrollView } from 'react-native';
|
||||
import { StyleSheet, View, Text, ScrollView, Alert } from 'react-native';
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
||||
|
||||
import { ScreenShell, Card } from '../../../components';
|
||||
|
||||
@@ -6,36 +6,57 @@ import { resolveWithMock } from '../../../services/api/serviceHelpers';
|
||||
export const profileApi = baseApi.injectEndpoints({
|
||||
endpoints: (builder) => ({
|
||||
getProfile: builder.query<UserProfile, void>({
|
||||
queryFn: () => resolveWithMock({ mockData: demoUser }),
|
||||
providesTags: ['UserProfile'],
|
||||
queryFn: () =>
|
||||
resolveWithMock({
|
||||
mockData: demoUser,
|
||||
request: async () => demoUser,
|
||||
}),
|
||||
providesTags: ['Profile'],
|
||||
}),
|
||||
updateProfile: builder.mutation<UserProfile, Partial<UserProfile>>({
|
||||
queryFn: (updates) => resolveWithMock({ mockData: { ...demoUser, ...updates } }),
|
||||
invalidatesTags: ['UserProfile'],
|
||||
queryFn: (updates) => {
|
||||
const updated = { ...demoUser, ...updates };
|
||||
return resolveWithMock({
|
||||
mockData: updated,
|
||||
request: async () => updated,
|
||||
});
|
||||
},
|
||||
invalidatesTags: ['Profile'],
|
||||
}),
|
||||
getLinkedAccounts: builder.query<AccountSummary[], void>({
|
||||
queryFn: () => resolveWithMock({ mockData: demoAccounts }),
|
||||
queryFn: () =>
|
||||
resolveWithMock({
|
||||
mockData: demoAccounts,
|
||||
request: async () => demoAccounts,
|
||||
}),
|
||||
providesTags: ['Accounts'],
|
||||
}),
|
||||
addLinkedAccount: builder.mutation<AccountSummary, Partial<AccountSummary>>({
|
||||
queryFn: (accountData) =>
|
||||
resolveWithMock({
|
||||
mockData: {
|
||||
id: `acc_${Math.random().toString(36).substr(2, 9)}`,
|
||||
type: 'Savings',
|
||||
accountHolder: demoUser.firstName + ' ' + demoUser.lastName,
|
||||
branch: 'Mumbai Main',
|
||||
maskedNumber: `XXXX ${accountData.maskedNumber?.slice(-4) || '9999'}`,
|
||||
availableBalance: 0,
|
||||
currentBalance: 0,
|
||||
currency: 'INR',
|
||||
...accountData,
|
||||
} as AccountSummary,
|
||||
}),
|
||||
queryFn: (accountData) => {
|
||||
const newAccount = {
|
||||
id: `acc_${Math.random().toString(36).substr(2, 9)}`,
|
||||
type: 'Savings',
|
||||
accountHolder: demoUser.firstName + ' ' + demoUser.lastName,
|
||||
branch: 'Mumbai Main',
|
||||
maskedNumber: `XXXX ${accountData.maskedNumber?.slice(-4) || '9999'}`,
|
||||
availableBalance: 0,
|
||||
currentBalance: 0,
|
||||
currency: 'INR',
|
||||
...accountData,
|
||||
} as AccountSummary;
|
||||
return resolveWithMock({
|
||||
mockData: newAccount,
|
||||
request: async () => newAccount,
|
||||
});
|
||||
},
|
||||
invalidatesTags: ['Accounts'],
|
||||
}),
|
||||
removeLinkedAccount: builder.mutation<void, string>({
|
||||
queryFn: () => resolveWithMock({ mockData: undefined }),
|
||||
queryFn: () =>
|
||||
resolveWithMock<void>({
|
||||
mockData: undefined as any,
|
||||
request: async () => undefined as any,
|
||||
}),
|
||||
invalidatesTags: ['Accounts'],
|
||||
}),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user