From cac2c223dd0c463aff3462e3b1c9a89a995e6dee Mon Sep 17 00:00:00 2001 From: Adriano Belisario Date: Sun, 3 May 2026 20:51:49 +0000 Subject: [PATCH] feat: remove price and currency fields from frontend and backend Co-Authored-By: Claude Sonnet 4.6 --- app/[slug]/page.tsx | 10 ---- app/api/items/[id]/route.ts | 4 -- app/api/wishlists/[id]/items/route.ts | 4 -- components/admin/ItemCard.tsx | 5 -- components/admin/ItemForm.tsx | 19 ------- components/item-form.tsx | 71 +++++---------------------- lib/api.ts | 4 -- 7 files changed, 13 insertions(+), 104 deletions(-) diff --git a/app/[slug]/page.tsx b/app/[slug]/page.tsx index 61f364d..71a0f45 100644 --- a/app/[slug]/page.tsx +++ b/app/[slug]/page.tsx @@ -125,13 +125,6 @@ function PublicWishlistContent() { return item.remainingQuantity > 0 || my || item.id === justClaimedItemId; }); - const formatPrice = (price: number | null, currency: string) => { - if (!price) return null; - return new Intl.NumberFormat('pt-BR', { - style: 'currency', - currency: currency || 'BRL', - }).format(price); - }; if (isLoading) { return ( @@ -288,9 +281,6 @@ function PublicWishlistContent() { {url.label} - - {item.price && formatPrice(item.price, item.currency)} - ))} diff --git a/app/api/items/[id]/route.ts b/app/api/items/[id]/route.ts index 9aebca7..98684de 100644 --- a/app/api/items/[id]/route.ts +++ b/app/api/items/[id]/route.ts @@ -81,8 +81,6 @@ export async function PATCH( const { name, description, - price, - currency, quantity, imageUrl, purchaseUrls, @@ -110,8 +108,6 @@ export async function PATCH( if (name !== undefined) updateData.name = name; if (description !== undefined) updateData.description = description; - if (price !== undefined) updateData.price = price; - if (currency !== undefined) updateData.currency = currency; if (quantity !== undefined) updateData.quantity = quantity; if (imageUrl !== undefined) updateData.imageUrl = imageUrl; if (purchaseUrls !== undefined) updateData.purchaseUrls = purchaseUrls; diff --git a/app/api/wishlists/[id]/items/route.ts b/app/api/wishlists/[id]/items/route.ts index bffaad8..5e63adc 100644 --- a/app/api/wishlists/[id]/items/route.ts +++ b/app/api/wishlists/[id]/items/route.ts @@ -82,8 +82,6 @@ export async function POST( const { name, description, - price, - currency, quantity, imageUrl, purchaseUrls, @@ -128,8 +126,6 @@ export async function POST( wishlistId: id, name, description: description || null, - price: price || null, - currency: currency || 'USD', quantity: quantity || 1, imageUrl: imageUrl || null, purchaseUrls: purchaseUrls || null, diff --git a/components/admin/ItemCard.tsx b/components/admin/ItemCard.tsx index f6da2a7..5475730 100644 --- a/components/admin/ItemCard.tsx +++ b/components/admin/ItemCard.tsx @@ -69,11 +69,6 @@ export default function ItemCard({ {item.description}

)} - {item.price && ( -

- ${item.price.toFixed(2)} {item.currency} -

- )}
diff --git a/components/admin/ItemForm.tsx b/components/admin/ItemForm.tsx index 392fe03..dfd2751 100644 --- a/components/admin/ItemForm.tsx +++ b/components/admin/ItemForm.tsx @@ -18,8 +18,6 @@ export default function ItemForm({ item, onSubmit, onCancel, mode, error }: Item item || { name: '', description: '', - price: null, - currency: 'USD', quantity: 1, imageUrl: '', purchaseUrls: [], @@ -67,23 +65,6 @@ export default function ItemForm({ item, onSubmit, onCancel, mode, error }: Item } />
-
- - - setFormData((prev) => ({ - ...prev, - price: e.target.value ? parseFloat(e.target.value) : null, - })) - } - /> -
- {/* Price, Currency & Quantity */} -
-
- - { - const value = e.target.value; - // Only allow empty string or valid numbers (including decimals) - if (value === '' || /^\d*\.?\d*$/.test(value)) { - setFormData((prev) => ({ ...prev, price: value })); - } - }} - /> -
-
- - -
-
- - - setFormData((prev) => ({ ...prev, quantity: e.target.value })) - } - /> -
+
+ + + setFormData((prev) => ({ ...prev, quantity: e.target.value })) + } + />
{/* Image Upload/URL */} diff --git a/lib/api.ts b/lib/api.ts index a42464f..3c6b800 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -147,8 +147,6 @@ export interface Item { wishlistId: string; name: string; description: string | null; - price: number | null; - currency: string; quantity: number; imageUrl: string | null; purchaseUrls: Array<{ label: string; url: string }> | null; @@ -333,8 +331,6 @@ export const claimingApi = { export interface ScrapedData { title?: string; description?: string; - price?: number; - currency?: string; imageUrl?: string; }