Update CBS Mobile App codebase
This commit is contained in:
@@ -12,8 +12,10 @@ import type { NativeStackScreenProps } from '@react-navigation/native-stack';
|
||||
import Ionicons from '@react-native-vector-icons/ionicons';
|
||||
|
||||
import { Button, Card, EmptyState, Loader, ScreenShell } from '../../../components';
|
||||
import { FeatureKey } from '../../../constants/featureKeys';
|
||||
import { useFeature } from '../../../features';
|
||||
import type { MainTabParamList, ServicesStackParamList } from '../../../navigation/types';
|
||||
import { useTheme } from '../../../theme';
|
||||
import { useTheme, fontFamily } from '../../../theme';
|
||||
import { formatCompactCurrency, formatCurrency } from '../../../utils/formatters';
|
||||
import { DepositAccountCard } from '../components/DepositAccountCard';
|
||||
import { DepositOptionChip } from '../components/DepositOptionChip';
|
||||
@@ -81,6 +83,16 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
const selectedFilterLabel =
|
||||
FILTERS.find((item) => item.id === filter)?.label ?? 'All deposits';
|
||||
|
||||
/**
|
||||
* Each action is gated on the route it opens. Without this the buttons
|
||||
* render whatever the config says, while the navigator refuses to register
|
||||
* the destination — a control that looks live and does nothing.
|
||||
*/
|
||||
const canOpenFd = useFeature(FeatureKey.SERVICES_DEPOSITS_OPEN_FD);
|
||||
const canOpenRd = useFeature(FeatureKey.SERVICES_DEPOSITS_OPEN_RD);
|
||||
const canCalculate = useFeature(FeatureKey.SERVICES_DEPOSITS_CALCULATOR);
|
||||
const showQuickActions = canOpenFd || canOpenRd || canCalculate;
|
||||
|
||||
const handleOpenFixedDeposit = () => navigation.navigate('OpenFixedDeposit');
|
||||
const handleOpenRecurringDeposit = () => navigation.navigate('OpenRecurringDeposit');
|
||||
const handleOpenCalculator = () => navigation.navigate('DepositCalculator');
|
||||
@@ -220,6 +232,7 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
</Card>
|
||||
</View>
|
||||
|
||||
{showQuickActions ? (
|
||||
<Card style={styles.actionCard}>
|
||||
<View style={styles.sectionHeader}>
|
||||
<View>
|
||||
@@ -234,6 +247,7 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
|
||||
<View style={styles.actionGrid}>
|
||||
<View style={styles.actionRow}>
|
||||
{canOpenFd ? (
|
||||
<View style={styles.actionColumn}>
|
||||
<Button
|
||||
title="Open FD"
|
||||
@@ -248,6 +262,8 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
{canOpenRd ? (
|
||||
<View style={styles.actionColumn}>
|
||||
<Button
|
||||
title="Open RD"
|
||||
@@ -263,7 +279,9 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
{canCalculate ? (
|
||||
<Button
|
||||
title="Calculator"
|
||||
variant="secondary"
|
||||
@@ -277,8 +295,10 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
</View>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{summary.nearMaturityDeposits.length ? (
|
||||
<Card style={styles.watchCard}>
|
||||
@@ -384,9 +404,13 @@ export default function DepositsOverviewScreen({ navigation, route }: Props) {
|
||||
{!isLoading && !isError && !filteredDeposits.length ? (
|
||||
<EmptyState
|
||||
title="No deposits found"
|
||||
description="Open a new fixed or recurring deposit to start building your savings ladder."
|
||||
actionLabel="Open fixed deposit"
|
||||
onAction={handleOpenFixedDeposit}
|
||||
description={
|
||||
canOpenFd
|
||||
? 'Open a new fixed or recurring deposit to start building your savings ladder.'
|
||||
: 'You have no fixed or recurring deposits with us. Visit your branch to open one.'
|
||||
}
|
||||
actionLabel={canOpenFd ? 'Open fixed deposit' : undefined}
|
||||
onAction={canOpenFd ? handleOpenFixedDeposit : undefined}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -437,13 +461,13 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
heroEyebrow: {
|
||||
fontSize: 11,
|
||||
fontWeight: '700',
|
||||
fontFamily: fontFamily.bold,
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: 0.8,
|
||||
},
|
||||
heroTitle: {
|
||||
fontSize: 20,
|
||||
fontWeight: '900',
|
||||
fontFamily: fontFamily.bold,
|
||||
lineHeight: 26,
|
||||
},
|
||||
heroSubtitle: {
|
||||
@@ -464,13 +488,13 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
heroHighlightLabel: {
|
||||
fontSize: 11,
|
||||
fontWeight: '700',
|
||||
fontFamily: fontFamily.bold,
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: 0.8,
|
||||
},
|
||||
heroHighlightValue: {
|
||||
fontSize: 28,
|
||||
fontWeight: '900',
|
||||
fontFamily: fontFamily.bold,
|
||||
letterSpacing: -0.8,
|
||||
},
|
||||
heroHighlightCaption: {
|
||||
@@ -488,12 +512,12 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
heroBadgeValue: {
|
||||
fontSize: 22,
|
||||
fontWeight: '900',
|
||||
fontFamily: fontFamily.bold,
|
||||
letterSpacing: -0.5,
|
||||
},
|
||||
heroBadgeLabel: {
|
||||
fontSize: 11,
|
||||
fontWeight: '700',
|
||||
fontFamily: fontFamily.bold,
|
||||
textAlign: 'center',
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: 0.5,
|
||||
@@ -512,13 +536,13 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
heroMetricLabel: {
|
||||
fontSize: 11,
|
||||
fontWeight: '700',
|
||||
fontFamily: fontFamily.bold,
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: 0.8,
|
||||
},
|
||||
heroMetricValue: {
|
||||
fontSize: 20,
|
||||
fontWeight: '900',
|
||||
fontFamily: fontFamily.bold,
|
||||
letterSpacing: -0.4,
|
||||
},
|
||||
heroMetricCaption: {
|
||||
@@ -533,7 +557,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 18,
|
||||
fontWeight: '800',
|
||||
fontFamily: fontFamily.bold,
|
||||
},
|
||||
sectionSubtitle: {
|
||||
fontSize: 13,
|
||||
@@ -572,7 +596,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
watchTitle: {
|
||||
fontSize: 16,
|
||||
fontWeight: '800',
|
||||
fontFamily: fontFamily.bold,
|
||||
},
|
||||
watchSubtitle: {
|
||||
fontSize: 13,
|
||||
@@ -592,15 +616,15 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
watchDeposit: {
|
||||
fontSize: 14,
|
||||
fontWeight: '800',
|
||||
fontFamily: fontFamily.bold,
|
||||
},
|
||||
watchMeta: {
|
||||
fontSize: 12,
|
||||
fontWeight: '500',
|
||||
fontFamily: fontFamily.medium,
|
||||
},
|
||||
watchDays: {
|
||||
fontSize: 13,
|
||||
fontWeight: '800',
|
||||
fontFamily: fontFamily.bold,
|
||||
borderRadius: 999,
|
||||
overflow: 'hidden',
|
||||
paddingHorizontal: 10,
|
||||
@@ -630,12 +654,12 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
portfolioCountValue: {
|
||||
fontSize: 20,
|
||||
fontWeight: '900',
|
||||
fontFamily: fontFamily.bold,
|
||||
letterSpacing: -0.4,
|
||||
},
|
||||
portfolioCountLabel: {
|
||||
fontSize: 11,
|
||||
fontWeight: '700',
|
||||
fontFamily: fontFamily.bold,
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: 0.8,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user