Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions frontend/vizzy/app/dashboard/layout/favorites-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ export function FavoritesPage() {
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{[...Array(6)].map((_, index) => (
<div key={index} className="border rounded-lg overflow-hidden">
<Skeleton className="h-64 w-full" />
<div className="p-4 space-y-3">
<Skeleton className="h-6 w-3/4" />
<Skeleton className="h-4 w-1/2" />
<Skeleton className="h-10 w-full mt-4" />
<div className="flex h-full">
<div className="relative w-24 h-full min-h-[100px] flex-shrink-0 overflow-hidden">
<Skeleton className="h-full w-full" />
</div>
<div className="flex-1 p-4 space-y-3">
<div className="flex justify-between items-start gap-2">
<Skeleton className="h-6 w-3/4" />
<Skeleton className="h-5 w-16" />
</div>
<Skeleton className="h-4 w-1/2" />
</div>
</div>
</div>
))}
Expand Down
16 changes: 11 additions & 5 deletions frontend/vizzy/app/dashboard/layout/listings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ export function ListingsPage() {
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{[...Array(6)].map((_, index) => (
<div key={index} className="border rounded-lg overflow-hidden">
<Skeleton className="h-64 w-full" />
<div className="p-4 space-y-3">
<Skeleton className="h-6 w-3/4" />
<Skeleton className="h-4 w-1/2" />
<Skeleton className="h-10 w-full mt-4" />
<div className="flex h-full">
<div className="relative w-24 h-full min-h-[100px] flex-shrink-0 overflow-hidden">
<Skeleton className="h-full w-full" />
</div>
<div className="flex-1 p-4 space-y-3">
<div className="flex justify-between items-start gap-2">
<Skeleton className="h-6 w-3/4" />
<Skeleton className="h-5 w-16" />
</div>
<Skeleton className="h-4 w-1/2" />
</div>
</div>
</div>
))}
Expand Down
32 changes: 19 additions & 13 deletions frontend/vizzy/app/listing/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
});
}
};

Expand Down
19 changes: 13 additions & 6 deletions frontend/vizzy/components/marketplace/filters-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,24 @@ export function FiltersSection({
value={locationDistance}
onValueChange={handleDistanceChange}
>
<SelectTrigger className="w-full h-9">
<SelectTrigger className="w-full h-9 cursor-pointer">
<SelectValue
placeholder={t('filters.distancePlaceholder')}
/>
</SelectTrigger>
<SelectContent>
<SelectItem value="1000">1 km</SelectItem>
<SelectItem value="5000">5 km</SelectItem>
<SelectItem value="10000">10 km</SelectItem>
<SelectItem value="25000">25 km</SelectItem>
<SelectItem value="50000">50 km</SelectItem>
<SelectItem value="1000" className="cursor-pointer">
1 km
</SelectItem>
<SelectItem value="5000" className="cursor-pointer">
5 km
</SelectItem>
<SelectItem value="10000" className="cursor-pointer">
10 km
</SelectItem>
<SelectItem value="25000" className="cursor-pointer">
25 km
</SelectItem>
</SelectContent>
</Select>
</div>
Expand Down
8 changes: 7 additions & 1 deletion frontend/vizzy/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 7 additions & 1 deletion frontend/vizzy/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down