Skip to content

Commit 8e21cfe

Browse files
committed
feat: Implement SubscriptionDetail screen
- Created SubscriptionDetailScreen with full subscription details - Added pause/resume/cancel functionality - Updated navigation to include SubscriptionDetail route - Fixed type issues in navigation Closes #8
1 parent effa119 commit 8e21cfe

5 files changed

Lines changed: 719 additions & 204 deletions

File tree

src/components/common/Button.tsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
import React from 'react';
2-
import { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';
2+
import {
3+
TouchableOpacity,
4+
Text,
5+
StyleSheet,
6+
ActivityIndicator,
7+
StyleProp,
8+
ViewStyle,
9+
} from 'react-native';
310
import { colors, spacing, typography, borderRadius } from '../../utils/constants';
411

512
export interface ButtonProps {
613
title: string;
714
onPress: () => void;
8-
variant?: 'primary' | 'secondary' | 'outline' | 'crypto';
15+
variant?: 'primary' | 'secondary' | 'outline' | 'crypto' | 'danger';
916
size?: 'small' | 'medium' | 'large';
1017
disabled?: boolean;
1118
loading?: boolean;
1219
fullWidth?: boolean;
20+
style?: StyleProp<ViewStyle>;
1321
}
1422

1523
export const Button: React.FC<ButtonProps> = ({
@@ -20,13 +28,15 @@ export const Button: React.FC<ButtonProps> = ({
2028
disabled = false,
2129
loading = false,
2230
fullWidth = false,
31+
style,
2332
}) => {
2433
const buttonStyle = [
2534
styles.button,
2635
styles[variant],
2736
styles[size],
2837
fullWidth && styles.fullWidth,
2938
disabled && styles.disabled,
39+
style,
3040
];
3141

3242
const textStyle = [
@@ -41,8 +51,7 @@ export const Button: React.FC<ButtonProps> = ({
4151
style={buttonStyle}
4252
onPress={onPress}
4353
disabled={disabled || loading}
44-
activeOpacity={0.8}
45-
>
54+
activeOpacity={0.8}>
4655
{loading ? (
4756
<ActivityIndicator
4857
color={variant === 'outline' ? colors.primary : colors.text}
@@ -62,7 +71,7 @@ const styles = StyleSheet.create({
6271
justifyContent: 'center',
6372
flexDirection: 'row',
6473
},
65-
74+
6675
// Variants
6776
primary: {
6877
backgroundColor: colors.primary,
@@ -78,7 +87,10 @@ const styles = StyleSheet.create({
7887
crypto: {
7988
backgroundColor: colors.accent,
8089
},
81-
90+
danger: {
91+
backgroundColor: colors.error,
92+
},
93+
8294
// Sizes
8395
small: {
8496
paddingVertical: spacing.sm,
@@ -95,15 +107,15 @@ const styles = StyleSheet.create({
95107
paddingHorizontal: spacing.xl,
96108
minHeight: 56,
97109
},
98-
110+
99111
// States
100112
disabled: {
101113
opacity: 0.5,
102114
},
103115
fullWidth: {
104116
width: '100%',
105117
},
106-
118+
107119
// Text styles
108120
text: {
109121
fontWeight: '600',
@@ -120,7 +132,10 @@ const styles = StyleSheet.create({
120132
cryptoText: {
121133
color: colors.text,
122134
},
123-
135+
dangerText: {
136+
color: colors.text,
137+
},
138+
124139
smallText: {
125140
...typography.caption,
126141
},
@@ -130,7 +145,7 @@ const styles = StyleSheet.create({
130145
largeText: {
131146
...typography.h3,
132147
},
133-
148+
134149
disabledText: {
135150
opacity: 0.7,
136151
},

src/navigation/AppNavigator.tsx

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import HomeScreen from '../screens/HomeScreen';
77
import AddSubscriptionScreen from '../screens/AddSubscriptionScreen';
88
import WalletConnectScreen from '../screens/WalletConnectScreen';
99
import CryptoPaymentScreen from '../screens/CryptoPaymentScreen';
10+
import SubscriptionDetailScreen from '../screens/SubscriptionDetailScreen';
11+
import AnalyticsScreen from '../screens/AnalyticsScreen';
12+
import SettingsScreen from '../screens/SettingsScreen';
1013
import { colors } from '../utils/constants';
1114
import { RootStackParamList, TabParamList } from './types';
1215

@@ -15,23 +18,24 @@ const Stack = createNativeStackNavigator<RootStackParamList>();
1518

1619
const HomeStack = () => (
1720
<Stack.Navigator>
18-
<Stack.Screen
19-
name="Home"
20-
component={HomeScreen}
21+
<Stack.Screen name="Home" component={HomeScreen} options={{ headerShown: false }} />
22+
<Stack.Screen
23+
name="AddSubscription"
24+
component={AddSubscriptionScreen}
2125
options={{ headerShown: false }}
2226
/>
23-
<Stack.Screen
24-
name="AddSubscription"
25-
component={AddSubscriptionScreen}
27+
<Stack.Screen
28+
name="SubscriptionDetail"
29+
component={SubscriptionDetailScreen}
2630
options={{ headerShown: false }}
2731
/>
28-
<Stack.Screen
29-
name="WalletConnect"
32+
<Stack.Screen
33+
name="WalletConnect"
3034
component={WalletConnectScreen}
3135
options={{ headerShown: false }}
3236
/>
33-
<Stack.Screen
34-
name="CryptoPayment"
37+
<Stack.Screen
38+
name="CryptoPayment"
3539
component={CryptoPaymentScreen}
3640
options={{ headerShown: false }}
3741
/>
@@ -49,8 +53,7 @@ const TabNavigator = () => (
4953
tabBarActiveTintColor: colors.primary,
5054
tabBarInactiveTintColor: colors.textSecondary,
5155
headerShown: false,
52-
}}
53-
>
56+
}}>
5457
<Tab.Screen
5558
name="HomeTab"
5659
component={HomeStack}
@@ -81,6 +84,26 @@ const TabNavigator = () => (
8184
),
8285
}}
8386
/>
87+
<Tab.Screen
88+
name="AnalyticsTab"
89+
component={AnalyticsScreen}
90+
options={{
91+
tabBarLabel: 'Analytics',
92+
tabBarIcon: ({ color, size }) => (
93+
<Text style={{ color, fontSize: size, fontWeight: 'bold' }}>📊</Text>
94+
),
95+
}}
96+
/>
97+
<Tab.Screen
98+
name="SettingsTab"
99+
component={SettingsScreen}
100+
options={{
101+
tabBarLabel: 'Settings',
102+
tabBarIcon: ({ color, size }) => (
103+
<Text style={{ color, fontSize: size, fontWeight: 'bold' }}>⚙️</Text>
104+
),
105+
}}
106+
/>
84107
</Tab.Navigator>
85108
);
86109

0 commit comments

Comments
 (0)