feat: remove price and currency fields from frontend and backend
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -125,13 +125,6 @@ function PublicWishlistContent() {
|
|||||||
return item.remainingQuantity > 0 || my || item.id === justClaimedItemId;
|
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) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
@@ -288,9 +281,6 @@ function PublicWishlistContent() {
|
|||||||
<span className="text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 font-medium">
|
<span className="text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 font-medium">
|
||||||
{url.label}
|
{url.label}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-gray-900 dark:text-white font-bold text-lg">
|
|
||||||
{item.price && formatPrice(item.price, item.currency)}
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ export async function PATCH(
|
|||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
price,
|
|
||||||
currency,
|
|
||||||
quantity,
|
quantity,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
purchaseUrls,
|
purchaseUrls,
|
||||||
@@ -110,8 +108,6 @@ export async function PATCH(
|
|||||||
|
|
||||||
if (name !== undefined) updateData.name = name;
|
if (name !== undefined) updateData.name = name;
|
||||||
if (description !== undefined) updateData.description = description;
|
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 (quantity !== undefined) updateData.quantity = quantity;
|
||||||
if (imageUrl !== undefined) updateData.imageUrl = imageUrl;
|
if (imageUrl !== undefined) updateData.imageUrl = imageUrl;
|
||||||
if (purchaseUrls !== undefined) updateData.purchaseUrls = purchaseUrls;
|
if (purchaseUrls !== undefined) updateData.purchaseUrls = purchaseUrls;
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ export async function POST(
|
|||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
price,
|
|
||||||
currency,
|
|
||||||
quantity,
|
quantity,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
purchaseUrls,
|
purchaseUrls,
|
||||||
@@ -128,8 +126,6 @@ export async function POST(
|
|||||||
wishlistId: id,
|
wishlistId: id,
|
||||||
name,
|
name,
|
||||||
description: description || null,
|
description: description || null,
|
||||||
price: price || null,
|
|
||||||
currency: currency || 'USD',
|
|
||||||
quantity: quantity || 1,
|
quantity: quantity || 1,
|
||||||
imageUrl: imageUrl || null,
|
imageUrl: imageUrl || null,
|
||||||
purchaseUrls: purchaseUrls || null,
|
purchaseUrls: purchaseUrls || null,
|
||||||
|
|||||||
@@ -69,11 +69,6 @@ export default function ItemCard({
|
|||||||
{item.description}
|
{item.description}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{item.price && (
|
|
||||||
<p className="text-base text-gray-500 dark:text-gray-400 mt-1">
|
|
||||||
${item.price.toFixed(2)} {item.currency}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col w-16 border-l border-gray-200 dark:border-gray-700">
|
<div className="flex flex-col w-16 border-l border-gray-200 dark:border-gray-700">
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ export default function ItemForm({ item, onSubmit, onCancel, mode, error }: Item
|
|||||||
item || {
|
item || {
|
||||||
name: '',
|
name: '',
|
||||||
description: '',
|
description: '',
|
||||||
price: null,
|
|
||||||
currency: 'USD',
|
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
purchaseUrls: [],
|
purchaseUrls: [],
|
||||||
@@ -67,23 +65,6 @@ export default function ItemForm({ item, onSubmit, onCancel, mode, error }: Item
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<label className="block text-base font-medium text-gray-700 dark:text-gray-300 mb-1">
|
|
||||||
Price
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
className="w-full px-2 py-1.5 text-base border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-gray-700 dark:text-white"
|
|
||||||
value={formData.price || ''}
|
|
||||||
onChange={(e) =>
|
|
||||||
setFormData((prev) => ({
|
|
||||||
...prev,
|
|
||||||
price: e.target.value ? parseFloat(e.target.value) : null,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="md:col-span-2">
|
<div className="md:col-span-2">
|
||||||
<label className="block text-base font-medium text-gray-700 dark:text-gray-300 mb-1">
|
<label className="block text-base font-medium text-gray-700 dark:text-gray-300 mb-1">
|
||||||
Description
|
Description
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ export default function ItemForm({ initialData, onSubmit, onCancel, isEditing =
|
|||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
name: initialData?.name || '',
|
name: initialData?.name || '',
|
||||||
description: initialData?.description || '',
|
description: initialData?.description || '',
|
||||||
price: initialData?.price?.toString() || '',
|
|
||||||
currency: initialData?.currency || 'USD',
|
|
||||||
quantity: initialData?.quantity?.toString() || '1',
|
quantity: initialData?.quantity?.toString() || '1',
|
||||||
imageUrl: initialData?.imageUrl || '',
|
imageUrl: initialData?.imageUrl || '',
|
||||||
purchaseUrl: initialData?.purchaseUrls?.[0]?.url || '',
|
purchaseUrl: initialData?.purchaseUrls?.[0]?.url || '',
|
||||||
@@ -42,8 +40,6 @@ export default function ItemForm({ initialData, onSubmit, onCancel, isEditing =
|
|||||||
...prev,
|
...prev,
|
||||||
name: data.title || prev.name,
|
name: data.title || prev.name,
|
||||||
description: data.description || prev.description,
|
description: data.description || prev.description,
|
||||||
price: data.price?.toString() || prev.price,
|
|
||||||
currency: data.currency || prev.currency,
|
|
||||||
imageUrl: data.imageUrl || prev.imageUrl,
|
imageUrl: data.imageUrl || prev.imageUrl,
|
||||||
purchaseUrl: scrapeUrl,
|
purchaseUrl: scrapeUrl,
|
||||||
purchaseLabel: new URL(scrapeUrl).hostname.replace('www.', ''),
|
purchaseLabel: new URL(scrapeUrl).hostname.replace('www.', ''),
|
||||||
@@ -74,8 +70,6 @@ export default function ItemForm({ initialData, onSubmit, onCancel, isEditing =
|
|||||||
await onSubmit({
|
await onSubmit({
|
||||||
name: formData.name,
|
name: formData.name,
|
||||||
description: formData.description || null,
|
description: formData.description || null,
|
||||||
price: formData.price ? parseFloat(formData.price) : null,
|
|
||||||
currency: formData.currency,
|
|
||||||
quantity: parseInt(formData.quantity) || 1,
|
quantity: parseInt(formData.quantity) || 1,
|
||||||
imageUrl: formData.imageUrl || null,
|
imageUrl: formData.imageUrl || null,
|
||||||
purchaseUrls,
|
purchaseUrls,
|
||||||
@@ -155,58 +149,19 @@ export default function ItemForm({ initialData, onSubmit, onCancel, isEditing =
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Price, Currency & Quantity */}
|
<div>
|
||||||
<div className="grid grid-cols-3 gap-4">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
<div>
|
Quantidade
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
</label>
|
||||||
Preço
|
<input
|
||||||
</label>
|
type="number"
|
||||||
<input
|
min="1"
|
||||||
type="number"
|
className="w-full px-3 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900"
|
||||||
step="0.01"
|
value={formData.quantity}
|
||||||
min="0"
|
onChange={(e) =>
|
||||||
className="w-full px-3 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900"
|
setFormData((prev) => ({ ...prev, quantity: e.target.value }))
|
||||||
value={formData.price}
|
}
|
||||||
onChange={(e) => {
|
/>
|
||||||
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 }));
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
||||||
Moeda
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
className="w-full px-3 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900"
|
|
||||||
value={formData.currency}
|
|
||||||
onChange={(e) =>
|
|
||||||
setFormData((prev) => ({ ...prev, currency: e.target.value }))
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<option value="BRL">BRL</option>
|
|
||||||
<option value="USD">USD</option>
|
|
||||||
<option value="EUR">EUR</option>
|
|
||||||
<option value="GBP">GBP</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
||||||
Quantidade
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
min="1"
|
|
||||||
className="w-full px-3 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900"
|
|
||||||
value={formData.quantity}
|
|
||||||
onChange={(e) =>
|
|
||||||
setFormData((prev) => ({ ...prev, quantity: e.target.value }))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Image Upload/URL */}
|
{/* Image Upload/URL */}
|
||||||
|
|||||||
@@ -147,8 +147,6 @@ export interface Item {
|
|||||||
wishlistId: string;
|
wishlistId: string;
|
||||||
name: string;
|
name: string;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
price: number | null;
|
|
||||||
currency: string;
|
|
||||||
quantity: number;
|
quantity: number;
|
||||||
imageUrl: string | null;
|
imageUrl: string | null;
|
||||||
purchaseUrls: Array<{ label: string; url: string }> | null;
|
purchaseUrls: Array<{ label: string; url: string }> | null;
|
||||||
@@ -333,8 +331,6 @@ export const claimingApi = {
|
|||||||
export interface ScrapedData {
|
export interface ScrapedData {
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
price?: number;
|
|
||||||
currency?: string;
|
|
||||||
imageUrl?: string;
|
imageUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user