From 9e20c9f20b7317ed23691145a20e41223a70f7c8 Mon Sep 17 00:00:00 2001 From: zealves99 Date: Fri, 30 May 2025 13:47:43 +0100 Subject: [PATCH] feat: listing dialogs translations Added translations to the create listing dialogs. Also added cursor-pointer to all the remaining buttons. --- .../app/dashboard/dashboard-page-client.tsx | 1 + .../listings/create-listing-dialog.tsx | 183 ++++++++++-------- .../components/marketplace/search-bar.tsx | 2 +- .../components/proposals/proposal-card.tsx | 7 +- .../components/proposals/rent-now-dialog.tsx | 45 ++++- .../proposals/rental-proposal-dialog.tsx | 45 ++++- .../components/ui/data-display/calendar.tsx | 6 +- .../ui/data-display/filter-dropdown.tsx | 8 +- .../components/ui/navigation/pagination.tsx | 11 +- .../vizzy/components/ui/overlay/dialog.tsx | 2 +- frontend/vizzy/messages/en.json | 130 ++++++++++++- frontend/vizzy/messages/pt.json | 130 ++++++++++++- 12 files changed, 471 insertions(+), 99 deletions(-) diff --git a/frontend/vizzy/app/dashboard/dashboard-page-client.tsx b/frontend/vizzy/app/dashboard/dashboard-page-client.tsx index 5f41adac..b6f2270c 100644 --- a/frontend/vizzy/app/dashboard/dashboard-page-client.tsx +++ b/frontend/vizzy/app/dashboard/dashboard-page-client.tsx @@ -110,6 +110,7 @@ export default function DashboardPageClient() { diff --git a/frontend/vizzy/components/listings/create-listing-dialog.tsx b/frontend/vizzy/components/listings/create-listing-dialog.tsx index 17954efd..99822694 100644 --- a/frontend/vizzy/components/listings/create-listing-dialog.tsx +++ b/frontend/vizzy/components/listings/create-listing-dialog.tsx @@ -45,6 +45,7 @@ import { updateListingImageUrl } from '@/lib/api/listings/update-listing-images- import { stripTimezone } from '@/lib/utils/dates'; import { getProductCategories } from '@/lib/api/listings/get-product-categories'; import { toast } from 'sonner'; +import { useTranslations } from 'next-intl'; type ListingType = 'sale' | 'swap' | 'rental' | 'giveaway'; @@ -59,6 +60,7 @@ export function ListingDialog({ onOpenChange, onListingCreated, }: ListingDialogProps) { + const t = useTranslations('createListingDialogs'); const [internalOpen, setInternalOpen] = useState(false); const isControlled = controlledOpen !== undefined; const open = isControlled ? controlledOpen : internalOpen; @@ -278,15 +280,15 @@ export function ListingDialog({ setImages([]); setPreviewUrls([]); - toast.success('Listing created successfully!', { - description: 'Your listing has been published.', + toast.success(t('common.createListingSuccess'), { + description: t('common.createListingSuccessDescription'), }); onListingCreated?.(); } catch (error) { console.error('Error submitting form:', error); - toast.error('Failed to create listing', { - description: 'Please try again later.', + toast.error(t('common.createListingError'), { + description: t('common.createListingErrorDescription'), }); } finally { setIsSubmitting(false); @@ -317,10 +319,8 @@ export function ListingDialog({ }} > - Create Listing - - Fill out the details for your new listing. - + {t('common.title')} + {t('common.titleDescription')}
@@ -332,40 +332,40 @@ export function ListingDialog({ name="listingType" render={({ field }) => ( - Listing Type + {t('common.listingType.label')} @@ -380,9 +380,12 @@ export function ListingDialog({ name="title" render={({ field }) => ( - Title + {t('common.titleLabel')} - + @@ -394,34 +397,38 @@ export function ListingDialog({ name="category" render={({ field }) => ( - Category + {t('common.category.categoryLabel')}