))}
diff --git a/frontend/vizzy/app/dashboard/layout/listings-page.tsx b/frontend/vizzy/app/dashboard/layout/listings-page.tsx
index daa1458c..71a470ec 100644
--- a/frontend/vizzy/app/dashboard/layout/listings-page.tsx
+++ b/frontend/vizzy/app/dashboard/layout/listings-page.tsx
@@ -62,11 +62,17 @@ export function ListingsPage() {
{[...Array(6)].map((_, index) => (
-
-
))}
diff --git a/frontend/vizzy/app/listing/[id]/page.tsx b/frontend/vizzy/app/listing/[id]/page.tsx
index 2ece6d09..b36c4a04 100644
--- a/frontend/vizzy/app/listing/[id]/page.tsx
+++ b/frontend/vizzy/app/listing/[id]/page.tsx
@@ -4,6 +4,7 @@ import { useRouter } from 'next/navigation';
import { use, useEffect, useState } from 'react';
import { Calendar, Heart, Info, MapPin, Tag, Pencil } from 'lucide-react';
import Image from 'next/image';
+import { toast } from 'sonner';
import type { Listing } from '@/types/listing';
import { fetchListing } from '@/lib/api/listings/listings';
import { fetchListingImages } from '@/lib/api/listings/fetch-listing-images';
@@ -144,20 +145,25 @@ export default function ProductListing({
return;
}
- try {
- if (isFavorite) {
- const result = await removeFavorite(parseInt(id));
- if ('data' in result) {
- setIsFavorite(false);
- }
- } else {
- const result = await addFavorite(parseInt(id));
- if ('data' in result) {
- setIsFavorite(true);
- }
+ if (isFavorite) {
+ const result = await removeFavorite(parseInt(id));
+ if (!result.error) {
+ toast.success(listingT('toast.favoriteRemoved'), {
+ description: listingT('toast.favoriteRemovedDescription'),
+ duration: 4000,
+ });
+ setIsFavorite(false);
}
- } catch (error) {
- console.error('Error toggling favorite:', error);
+ return;
+ }
+
+ const result = await addFavorite(parseInt(id));
+ if (result.data) {
+ setIsFavorite(true);
+ toast.success(listingT('toast.favoriteAdded'), {
+ description: listingT('toast.favoriteAddedDescription'),
+ duration: 4000,
+ });
}
};
diff --git a/frontend/vizzy/components/marketplace/filters-section.tsx b/frontend/vizzy/components/marketplace/filters-section.tsx
index 8fec7d5f..e51f035c 100644
--- a/frontend/vizzy/components/marketplace/filters-section.tsx
+++ b/frontend/vizzy/components/marketplace/filters-section.tsx
@@ -139,17 +139,24 @@ export function FiltersSection({
value={locationDistance}
onValueChange={handleDistanceChange}
>
-
+
- 1 km
- 5 km
- 10 km
- 25 km
- 50 km
+
+ 1 km
+
+
+ 5 km
+
+
+ 10 km
+
+
+ 25 km
+
diff --git a/frontend/vizzy/messages/en.json b/frontend/vizzy/messages/en.json
index 321374c5..e91b9d3e 100644
--- a/frontend/vizzy/messages/en.json
+++ b/frontend/vizzy/messages/en.json
@@ -316,7 +316,13 @@
},
"toast": {
"deleteSuccess": "Listing deleted successfully",
- "deleteError": "Failed to delete listing. Please try again."
+ "deleteError": "Failed to delete listing. Please try again.",
+ "favoriteAdded": "Listing added to favorites",
+ "favoriteAddedDescription": "You can now find this listing in your favorites section.",
+ "favoriteRemoved": "Listing removed from favorites",
+ "favoriteRemovedDescription": "This listing was successfully removed from your favorites section.",
+ "favoriteError": "Failed to add/remove listing from favorites. Please try again.",
+ "favoriteErrorDescription": "An error occurred while adding/removing this listing from your favorites. Please try again later."
}
},
"homepage": {
diff --git a/frontend/vizzy/messages/pt.json b/frontend/vizzy/messages/pt.json
index cb1e7e23..22ef71c2 100644
--- a/frontend/vizzy/messages/pt.json
+++ b/frontend/vizzy/messages/pt.json
@@ -315,7 +315,13 @@
},
"toast": {
"deleteSuccess": "Anúncio eliminado com sucesso",
- "deleteError": "Falha ao eliminar o anúncio. Por favor, tente novamente."
+ "deleteError": "Falha ao eliminar o anúncio. Por favor, tenta novamente.",
+ "favoriteAdded": "Anúncio adicionado aos favoritos!",
+ "favoriteAddedDescription": "Este anúncio foi adicionado com sucesso à tua lista de favoritos.",
+ "favoriteRemoved": "Anúncio removido dos favoritos!",
+ "favoriteRemovedDescription": "Este anúncio foi removido com sucesso da tua lista de favoritos.",
+ "favoriteError": "Falha ao adicionar/remover anúncio aos/dos favoritos. Por favor, tenta novamente.",
+ "favoriteErrorDescription": "Ocorreu um erro ao adicionar/remover este anúncio aos/dos favoritos. Por favor, tenta novamente mais tarde."
}
},
"homepage": {