Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 60046c3

Browse files
committed
feat: add price attribute to GiftIdea model and update GiftCard component to display recipient and event date
1 parent b5b2b4b commit 60046c3

File tree

3 files changed

+28
-31
lines changed

3 files changed

+28
-31
lines changed

src/app/(gifts)/index.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const HomeScreen = () => {
1919
'https://api.a0.dev/assets/image?text=gift%20box%20with%20art%20supplies%20and%20golden%20bow',
2020
title: 'Creative Art Set',
2121
description: 'Perfect for budding artists',
22+
price: 29.99,
2223
recipient: 'Emily',
2324
selectedDate: new Date('2023-12-25').toISOString(),
2425
},
@@ -28,6 +29,7 @@ const HomeScreen = () => {
2829
'https://api.a0.dev/assets/image?text=luxury%20chocolate%20box%20assortment',
2930
title: 'Gourmet Chocolate Basket',
3031
description: 'Indulgent treat for any occasion',
32+
price: 49.99,
3133
recipient: 'Michael',
3234
selectedDate: new Date('2023-11-15').toISOString(),
3335
},
@@ -37,9 +39,30 @@ const HomeScreen = () => {
3739
'https://api.a0.dev/assets/image?text=elegant%20stainless%20steel%20watch',
3840
title: 'Stainless Steel Watch',
3941
description: 'Timeless elegance for him',
42+
price: 199.99,
4043
recipient: 'Alex',
4144
selectedDate: new Date('2024-01-01').toISOString(),
4245
},
46+
{
47+
id: '4',
48+
image:
49+
'https://api.a0.dev/assets/image?text=stylish%20handbag%20for%20women',
50+
title: 'Stylish Handbag',
51+
description: 'Fashionable accessory for her',
52+
price: 89.99,
53+
recipient: 'Sophia',
54+
selectedDate: new Date('2023-10-31').toISOString(),
55+
},
56+
{
57+
id: '5',
58+
image:
59+
'https://api.a0.dev/assets/image?text=high-tech%20wireless%20earbuds',
60+
title: 'Wireless Earbuds',
61+
description: 'High-quality sound on the go',
62+
price: 79.99,
63+
recipient: 'John',
64+
selectedDate: new Date('2023-11-20').toISOString(),
65+
},
4366
];
4467

4568
const handleAddGift = () => {
@@ -58,6 +81,7 @@ const HomeScreen = () => {
5881
image={gift.image}
5982
title={gift.title}
6083
description={gift.description}
84+
price={gift.price}
6185
recipient={gift.recipient}
6286
selectedDate={gift.selectedDate}
6387
/>

src/components/utils/GiftCard.tsx

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,12 @@ export default function GiftCard({
1414
image,
1515
title,
1616
description,
17+
price,
1718
recipient,
1819
selectedDate,
19-
onEdit,
20-
onDelete,
2120
}: GiftCardProps) {
22-
const handleDelete = () => {
23-
Alert.alert(
24-
'Confirm Delete',
25-
`Are you sure you want to delete the gift idea "${title}"?`,
26-
[
27-
{ text: 'Cancel', style: 'cancel' },
28-
{ text: 'Delete', style: 'destructive', onPress: onDelete },
29-
],
30-
);
31-
};
32-
3321
const router = useRouter();
3422

35-
const handleEdit = () => {
36-
router.push({
37-
pathname: '/edit-gift',
38-
params: { id, image, title, description, recipient, selectedDate },
39-
});
40-
};
41-
4223
const handlePress = () => {
4324
router.push({
4425
pathname: '/detail-gift',
@@ -51,20 +32,11 @@ export default function GiftCard({
5132
<Image source={{ uri: image }} style={styles.image} />
5233
<View style={styles.content}>
5334
<Text style={styles.title}>{title}</Text>
54-
<Text style={styles.description}>{description}</Text>
55-
<Text style={styles.recipient}>For: {recipient}</Text>
35+
<Text style={styles.recipient}>for {recipient}</Text>
5636
<Text style={styles.date}>
57-
Event Date: {new Date(selectedDate).toLocaleDateString()}
37+
Happening on {new Date(selectedDate).toLocaleDateString()}
5838
</Text>
5939
</View>
60-
<View style={styles.actions}>
61-
<Pressable onPress={handleEdit} style={styles.actionButton}>
62-
<Ionicons name="pencil-outline" size={20} color="#007BFF" />
63-
</Pressable>
64-
<Pressable onPress={handleDelete} style={styles.actionButton}>
65-
<Ionicons name="trash-outline" size={20} color="#FF4D4F" />
66-
</Pressable>
67-
</View>
6840
</Pressable>
6941
);
7042
}

src/models/GiftIdea.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface GiftIdea {
33
image: string;
44
title: string;
55
description: string;
6+
price: number;
67
recipient: string;
78
selectedDate: string;
89
}

0 commit comments

Comments
 (0)