SEO: robots.txt, sitemap, Organization & Event schema; dashboard fmtTime fix; frontend updates
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import Link from 'next/link';
|
|||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { useAuth } from '@/context/AuthContext';
|
import { useAuth } from '@/context/AuthContext';
|
||||||
import { eventsApi, ticketsApi, paymentOptionsApi, Event, PaymentOptionsConfig } from '@/lib/api';
|
import { eventsApi, ticketsApi, paymentOptionsApi, Event, PaymentOptionsConfig } from '@/lib/api';
|
||||||
import { formatPrice } from '@/lib/utils';
|
import { formatPrice, formatDateLong, formatTime } from '@/lib/utils';
|
||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import Input from '@/components/ui/Input';
|
import Input from '@/components/ui/Input';
|
||||||
@@ -217,21 +217,8 @@ export default function BookingPage() {
|
|||||||
}
|
}
|
||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateLong(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const validateForm = (): boolean => {
|
const validateForm = (): boolean => {
|
||||||
const newErrors: Partial<Record<keyof BookingFormData, string>> = {};
|
const newErrors: Partial<Record<keyof BookingFormData, string>> = {};
|
||||||
@@ -879,7 +866,7 @@ export default function BookingPage() {
|
|||||||
<div className="text-sm text-gray-600 space-y-2">
|
<div className="text-sm text-gray-600 space-y-2">
|
||||||
<p><strong>{t('booking.success.event')}:</strong> {event?.title}</p>
|
<p><strong>{t('booking.success.event')}:</strong> {event?.title}</p>
|
||||||
<p><strong>{t('booking.success.date')}:</strong> {event && formatDate(event.startDatetime)}</p>
|
<p><strong>{t('booking.success.date')}:</strong> {event && formatDate(event.startDatetime)}</p>
|
||||||
<p><strong>{t('booking.success.time')}:</strong> {event && formatTime(event.startDatetime)}</p>
|
<p><strong>{t('booking.success.time')}:</strong> {event && fmtTime(event.startDatetime)}</p>
|
||||||
<p><strong>{t('booking.success.location')}:</strong> {event?.location}</p>
|
<p><strong>{t('booking.success.location')}:</strong> {event?.location}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -955,7 +942,7 @@ export default function BookingPage() {
|
|||||||
<div className="text-sm text-gray-600 space-y-2">
|
<div className="text-sm text-gray-600 space-y-2">
|
||||||
<p><strong>{t('booking.success.event')}:</strong> {event.title}</p>
|
<p><strong>{t('booking.success.event')}:</strong> {event.title}</p>
|
||||||
<p><strong>{t('booking.success.date')}:</strong> {formatDate(event.startDatetime)}</p>
|
<p><strong>{t('booking.success.date')}:</strong> {formatDate(event.startDatetime)}</p>
|
||||||
<p><strong>{t('booking.success.time')}:</strong> {formatTime(event.startDatetime)}</p>
|
<p><strong>{t('booking.success.time')}:</strong> {fmtTime(event.startDatetime)}</p>
|
||||||
<p><strong>{t('booking.success.location')}:</strong> {event.location}</p>
|
<p><strong>{t('booking.success.location')}:</strong> {event.location}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1045,7 +1032,7 @@ export default function BookingPage() {
|
|||||||
<div className="p-4 space-y-2 text-sm">
|
<div className="p-4 space-y-2 text-sm">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<CalendarIcon className="w-5 h-5 text-primary-yellow" />
|
<CalendarIcon className="w-5 h-5 text-primary-yellow" />
|
||||||
<span>{formatDate(event.startDatetime)} • {formatTime(event.startDatetime)}</span>
|
<span>{formatDate(event.startDatetime)} • {fmtTime(event.startDatetime)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<MapPinIcon className="w-5 h-5 text-primary-yellow" />
|
<MapPinIcon className="w-5 h-5 text-primary-yellow" />
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useParams, useSearchParams } from 'next/navigation';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { ticketsApi, paymentOptionsApi, Ticket, PaymentOptionsConfig } from '@/lib/api';
|
import { ticketsApi, paymentOptionsApi, Ticket, PaymentOptionsConfig } from '@/lib/api';
|
||||||
import { formatPrice } from '@/lib/utils';
|
import { formatPrice, formatDateLong, formatTime } from '@/lib/utils';
|
||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import {
|
import {
|
||||||
@@ -152,21 +152,8 @@ export default function BookingPaymentPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateLong(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Loading state
|
// Loading state
|
||||||
if (step === 'loading') {
|
if (step === 'loading') {
|
||||||
@@ -237,7 +224,7 @@ export default function BookingPaymentPage() {
|
|||||||
<div className="text-sm text-gray-600 space-y-2">
|
<div className="text-sm text-gray-600 space-y-2">
|
||||||
<p><strong>{locale === 'es' ? 'Evento' : 'Event'}:</strong> {ticket.event.title}</p>
|
<p><strong>{locale === 'es' ? 'Evento' : 'Event'}:</strong> {ticket.event.title}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Fecha' : 'Date'}:</strong> {formatDate(ticket.event.startDatetime)}</p>
|
<p><strong>{locale === 'es' ? 'Fecha' : 'Date'}:</strong> {formatDate(ticket.event.startDatetime)}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Hora' : 'Time'}:</strong> {formatTime(ticket.event.startDatetime)}</p>
|
<p><strong>{locale === 'es' ? 'Hora' : 'Time'}:</strong> {fmtTime(ticket.event.startDatetime)}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Ubicación' : 'Location'}:</strong> {ticket.event.location}</p>
|
<p><strong>{locale === 'es' ? 'Ubicación' : 'Location'}:</strong> {ticket.event.location}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -286,7 +273,7 @@ export default function BookingPaymentPage() {
|
|||||||
<div className="text-sm text-gray-600 space-y-2">
|
<div className="text-sm text-gray-600 space-y-2">
|
||||||
<p><strong>{locale === 'es' ? 'Evento' : 'Event'}:</strong> {ticket.event.title}</p>
|
<p><strong>{locale === 'es' ? 'Evento' : 'Event'}:</strong> {ticket.event.title}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Fecha' : 'Date'}:</strong> {formatDate(ticket.event.startDatetime)}</p>
|
<p><strong>{locale === 'es' ? 'Fecha' : 'Date'}:</strong> {formatDate(ticket.event.startDatetime)}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Hora' : 'Time'}:</strong> {formatTime(ticket.event.startDatetime)}</p>
|
<p><strong>{locale === 'es' ? 'Hora' : 'Time'}:</strong> {fmtTime(ticket.event.startDatetime)}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Ubicación' : 'Location'}:</strong> {ticket.event.location}</p>
|
<p><strong>{locale === 'es' ? 'Ubicación' : 'Location'}:</strong> {ticket.event.location}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -333,7 +320,7 @@ export default function BookingPaymentPage() {
|
|||||||
<div className="p-4 space-y-2 text-sm">
|
<div className="p-4 space-y-2 text-sm">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<CalendarIcon className="w-5 h-5 text-primary-yellow" />
|
<CalendarIcon className="w-5 h-5 text-primary-yellow" />
|
||||||
<span>{formatDate(ticket.event.startDatetime)} - {formatTime(ticket.event.startDatetime)}</span>
|
<span>{formatDate(ticket.event.startDatetime)} - {fmtTime(ticket.event.startDatetime)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<MapPinIcon className="w-5 h-5 text-primary-yellow" />
|
<MapPinIcon className="w-5 h-5 text-primary-yellow" />
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useParams } from 'next/navigation';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { ticketsApi, Ticket } from '@/lib/api';
|
import { ticketsApi, Ticket } from '@/lib/api';
|
||||||
|
import { formatDateLong, formatTime } from '@/lib/utils';
|
||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import {
|
import {
|
||||||
@@ -69,21 +70,8 @@ export default function BookingSuccessPage() {
|
|||||||
};
|
};
|
||||||
}, [ticketId]);
|
}, [ticketId]);
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateLong(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -191,7 +179,7 @@ export default function BookingSuccessPage() {
|
|||||||
<>
|
<>
|
||||||
<p><strong>{locale === 'es' ? 'Evento' : 'Event'}:</strong> {ticket.event.title}</p>
|
<p><strong>{locale === 'es' ? 'Evento' : 'Event'}:</strong> {ticket.event.title}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Fecha' : 'Date'}:</strong> {formatDate(ticket.event.startDatetime)}</p>
|
<p><strong>{locale === 'es' ? 'Fecha' : 'Date'}:</strong> {formatDate(ticket.event.startDatetime)}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Hora' : 'Time'}:</strong> {formatTime(ticket.event.startDatetime)}</p>
|
<p><strong>{locale === 'es' ? 'Hora' : 'Time'}:</strong> {fmtTime(ticket.event.startDatetime)}</p>
|
||||||
<p><strong>{locale === 'es' ? 'Ubicación' : 'Location'}:</strong> {ticket.event.location}</p>
|
<p><strong>{locale === 'es' ? 'Ubicación' : 'Location'}:</strong> {ticket.event.location}</p>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { eventsApi, Event } from '@/lib/api';
|
import { eventsApi, Event } from '@/lib/api';
|
||||||
import { formatPrice } from '@/lib/utils';
|
import { formatPrice, formatDateLong, formatTime } from '@/lib/utils';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import { CalendarIcon, MapPinIcon } from '@heroicons/react/24/outline';
|
import { CalendarIcon, MapPinIcon } from '@heroicons/react/24/outline';
|
||||||
@@ -27,21 +27,8 @@ export default function NextEventSection({ initialEvent }: NextEventSectionProps
|
|||||||
.finally(() => setLoading(false));
|
.finally(() => setLoading(false));
|
||||||
}, [initialEvent]);
|
}, [initialEvent]);
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateLong(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -84,7 +71,7 @@ export default function NextEventSection({ initialEvent }: NextEventSectionProps
|
|||||||
<span className="w-5 h-5 flex items-center justify-center text-primary-yellow font-bold">
|
<span className="w-5 h-5 flex items-center justify-center text-primary-yellow font-bold">
|
||||||
⏰
|
⏰
|
||||||
</span>
|
</span>
|
||||||
<span>{formatTime(nextEvent.startDatetime)}</span>
|
<span>{fmtTime(nextEvent.startDatetime)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3 text-gray-700">
|
<div className="flex items-center gap-3 text-gray-700">
|
||||||
<MapPinIcon className="w-5 h-5 text-primary-yellow" />
|
<MapPinIcon className="w-5 h-5 text-primary-yellow" />
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export default function PaymentsTab({ payments, language }: PaymentsTabProps) {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export default function ProfileTab({ onUpdate }: ProfileTabProps) {
|
|||||||
{profile?.memberSince
|
{profile?.memberSince
|
||||||
? new Date(profile.memberSince).toLocaleDateString(
|
? new Date(profile.memberSince).toLocaleDateString(
|
||||||
language === 'es' ? 'es-ES' : 'en-US',
|
language === 'es' ? 'es-ES' : 'en-US',
|
||||||
{ year: 'numeric', month: 'long', day: 'numeric' }
|
{ year: 'numeric', month: 'long', day: 'numeric', timeZone: 'America/Asuncion' }
|
||||||
)
|
)
|
||||||
: '-'}
|
: '-'}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export default function SecurityTab() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function TicketsTab({ tickets, language }: TicketsTabProps) {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useAuth } from '@/context/AuthContext';
|
|||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import { dashboardApi, DashboardSummary, NextEventInfo, UserTicket, UserPayment } from '@/lib/api';
|
import { dashboardApi, DashboardSummary, NextEventInfo, UserTicket, UserPayment } from '@/lib/api';
|
||||||
|
import { formatDateLong, formatTime } from '@/lib/utils';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import {
|
import {
|
||||||
@@ -85,21 +86,8 @@ export default function DashboardPage() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateLong(dateStr, language as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(language === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, language as 'en' | 'es');
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(language === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="section-padding min-h-[70vh]">
|
<div className="section-padding min-h-[70vh]">
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Link from 'next/link';
|
|||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { eventsApi, Event } from '@/lib/api';
|
import { eventsApi, Event } from '@/lib/api';
|
||||||
import { formatPrice } from '@/lib/utils';
|
import { formatPrice, formatDateLong, formatTime } from '@/lib/utils';
|
||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import ShareButtons from '@/components/ShareButtons';
|
import ShareButtons from '@/components/ShareButtons';
|
||||||
@@ -54,21 +54,8 @@ export default function EventDetailClient({ eventId, initialEvent }: EventDetail
|
|||||||
setTicketQuantity(prev => Math.min(maxTickets, prev + 1));
|
setTicketQuantity(prev => Math.min(maxTickets, prev + 1));
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateLong(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const isCancelled = event.status === 'cancelled';
|
const isCancelled = event.status === 'cancelled';
|
||||||
// Only calculate isPastEvent after mount to avoid hydration mismatch
|
// Only calculate isPastEvent after mount to avoid hydration mismatch
|
||||||
@@ -228,8 +215,8 @@ export default function EventDetailClient({ eventId, initialEvent }: EventDetail
|
|||||||
<div>
|
<div>
|
||||||
<p className="font-medium text-sm">{t('events.details.time')}</p>
|
<p className="font-medium text-sm">{t('events.details.time')}</p>
|
||||||
<p className="text-gray-600" suppressHydrationWarning>
|
<p className="text-gray-600" suppressHydrationWarning>
|
||||||
{formatTime(event.startDatetime)}
|
{fmtTime(event.startDatetime)}
|
||||||
{event.endDatetime && ` - ${formatTime(event.endDatetime)}`}
|
{event.endDatetime && ` - ${fmtTime(event.endDatetime)}`}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -97,9 +97,7 @@ function generateEventJsonLd(event: Event) {
|
|||||||
eventAttendanceMode: 'https://schema.org/OfflineEventAttendanceMode',
|
eventAttendanceMode: 'https://schema.org/OfflineEventAttendanceMode',
|
||||||
eventStatus: isCancelled
|
eventStatus: isCancelled
|
||||||
? 'https://schema.org/EventCancelled'
|
? 'https://schema.org/EventCancelled'
|
||||||
: isPastEvent
|
: 'https://schema.org/EventScheduled',
|
||||||
? 'https://schema.org/EventPostponed'
|
|
||||||
: 'https://schema.org/EventScheduled',
|
|
||||||
location: {
|
location: {
|
||||||
'@type': 'Place',
|
'@type': 'Place',
|
||||||
name: event.location,
|
name: event.location,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { eventsApi, Event } from '@/lib/api';
|
import { eventsApi, Event } from '@/lib/api';
|
||||||
import { formatPrice } from '@/lib/utils';
|
import { formatPrice, formatDateShort, formatTime } from '@/lib/utils';
|
||||||
import Card from '@/components/ui/Card';
|
import Card from '@/components/ui/Card';
|
||||||
import Button from '@/components/ui/Button';
|
import Button from '@/components/ui/Button';
|
||||||
import { CalendarIcon, MapPinIcon, UserGroupIcon } from '@heroicons/react/24/outline';
|
import { CalendarIcon, MapPinIcon, UserGroupIcon } from '@heroicons/react/24/outline';
|
||||||
@@ -33,20 +33,8 @@ export default function EventsPage() {
|
|||||||
|
|
||||||
const displayedEvents = filter === 'upcoming' ? upcomingEvents : pastEvents;
|
const displayedEvents = filter === 'upcoming' ? upcomingEvents : pastEvents;
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateShort(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'short',
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const getStatusBadge = (event: Event) => {
|
const getStatusBadge = (event: Event) => {
|
||||||
if (event.status === 'cancelled') {
|
if (event.status === 'cancelled') {
|
||||||
@@ -130,7 +118,7 @@ export default function EventsPage() {
|
|||||||
<div className="mt-4 space-y-2 text-sm text-gray-600">
|
<div className="mt-4 space-y-2 text-sm text-gray-600">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<CalendarIcon className="w-4 h-4" />
|
<CalendarIcon className="w-4 h-4" />
|
||||||
<span>{formatDate(event.startDatetime)} - {formatTime(event.startDatetime)}</span>
|
<span>{formatDate(event.startDatetime)} - {fmtTime(event.startDatetime)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<MapPinIcon className="w-4 h-4" />
|
<MapPinIcon className="w-4 h-4" />
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const metadata: Metadata = {
|
|||||||
const organizationSchema = {
|
const organizationSchema = {
|
||||||
'@context': 'https://schema.org',
|
'@context': 'https://schema.org',
|
||||||
'@type': 'Organization',
|
'@type': 'Organization',
|
||||||
name: 'Spanglish',
|
name: 'Spanglish Community',
|
||||||
url: siteUrl,
|
url: siteUrl,
|
||||||
logo: `${siteUrl}/images/logo.png`,
|
logo: `${siteUrl}/images/logo.png`,
|
||||||
description: 'Language exchange community organizing English and Spanish meetups in Asunción, Paraguay.',
|
description: 'Language exchange community organizing English and Spanish meetups in Asunción, Paraguay.',
|
||||||
@@ -30,7 +30,7 @@ const organizationSchema = {
|
|||||||
addressCountry: 'PY',
|
addressCountry: 'PY',
|
||||||
},
|
},
|
||||||
sameAs: [
|
sameAs: [
|
||||||
process.env.NEXT_PUBLIC_INSTAGRAM_URL,
|
'https://instagram.com/spanglishsocialpy',
|
||||||
process.env.NEXT_PUBLIC_WHATSAPP_URL,
|
process.env.NEXT_PUBLIC_WHATSAPP_URL,
|
||||||
process.env.NEXT_PUBLIC_TELEGRAM_URL,
|
process.env.NEXT_PUBLIC_TELEGRAM_URL,
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
|
|
||||||
const description = `Next event: ${eventDate} – ${event.title}. Practice English and Spanish at relaxed social events in Asunción. Meet locals and internationals.`;
|
const description = `Next event: ${eventDate} – ${event.title}. Practice English and Spanish at relaxed social events in Asunción. Meet locals and internationals.`;
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ export default function AdminBookingsPage() {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export default function AdminContactsPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ export default function AdminEmailsPage() {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -545,7 +546,7 @@ export default function AdminEmailsPage() {
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{hasDraft && (
|
{hasDraft && (
|
||||||
<span className="text-xs text-gray-500">
|
<span className="text-xs text-gray-500">
|
||||||
Draft saved {composeForm.savedAt ? new Date(composeForm.savedAt).toLocaleString() : ''}
|
Draft saved {composeForm.savedAt ? new Date(composeForm.savedAt).toLocaleString(locale === 'es' ? 'es-ES' : 'en-US', { timeZone: 'America/Asuncion' }) : ''}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<Button variant="outline" size="sm" onClick={saveDraft}>
|
<Button variant="outline" size="sm" onClick={saveDraft}>
|
||||||
@@ -571,7 +572,7 @@ export default function AdminEmailsPage() {
|
|||||||
<option value="">Choose an event</option>
|
<option value="">Choose an event</option>
|
||||||
{events.filter(e => e.status === 'published').map((event) => (
|
{events.filter(e => e.status === 'published').map((event) => (
|
||||||
<option key={event.id} value={event.id}>
|
<option key={event.id} value={event.id}>
|
||||||
{event.title} - {new Date(event.startDatetime).toLocaleDateString()}
|
{event.title} - {new Date(event.startDatetime).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', { timeZone: 'America/Asuncion' })}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ export default function AdminEventDetailPage() {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -201,6 +202,7 @@ export default function AdminEventDetailPage() {
|
|||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -754,7 +756,7 @@ export default function AdminEventDetailPage() {
|
|||||||
{getStatusBadge(ticket.status)}
|
{getStatusBadge(ticket.status)}
|
||||||
{ticket.checkinAt && (
|
{ticket.checkinAt && (
|
||||||
<p className="text-xs text-gray-400 mt-1">
|
<p className="text-xs text-gray-400 mt-1">
|
||||||
{new Date(ticket.checkinAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
|
{new Date(ticket.checkinAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: 'America/Asuncion' })}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
@@ -768,7 +770,7 @@ export default function AdminEventDetailPage() {
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 text-sm text-gray-600">
|
<td className="px-6 py-4 text-sm text-gray-600">
|
||||||
{new Date(ticket.createdAt).toLocaleDateString()}
|
{new Date(ticket.createdAt).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', { timeZone: 'America/Asuncion' })}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4">
|
<td className="px-6 py-4">
|
||||||
<div className="flex items-center justify-end gap-2">
|
<div className="flex items-center justify-end gap-2">
|
||||||
@@ -927,6 +929,7 @@ export default function AdminEventDetailPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
<span className="text-gray-400">—</span>
|
<span className="text-gray-400">—</span>
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ export default function AdminEventsPage() {
|
|||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export default function AdminGalleryPage() {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ export default function AdminLegalPagesPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
return dateStr;
|
return dateStr;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export default function AdminDashboardPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ export default function AdminPaymentsPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ function ScanResultModal({
|
|||||||
const statusSubtitle = isSuccess ? 'Ready for check-in' :
|
const statusSubtitle = isSuccess ? 'Ready for check-in' :
|
||||||
isAlreadyCheckedIn ? (
|
isAlreadyCheckedIn ? (
|
||||||
scanResult.validation?.ticket?.checkinAt
|
scanResult.validation?.ticket?.checkinAt
|
||||||
? `Checked in at ${new Date(scanResult.validation.ticket.checkinAt).toLocaleTimeString()}${scanResult.validation?.ticket?.checkedInBy ? ` by ${scanResult.validation.ticket.checkedInBy}` : ''}`
|
? `Checked in at ${new Date(scanResult.validation.ticket.checkinAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: 'America/Asuncion' })}${scanResult.validation?.ticket?.checkedInBy ? ` by ${scanResult.validation.ticket.checkedInBy}` : ''}`
|
||||||
: 'This ticket was already used'
|
: 'This ticket was already used'
|
||||||
) :
|
) :
|
||||||
isPending ? 'Ticket not yet confirmed' :
|
isPending ? 'Ticket not yet confirmed' :
|
||||||
@@ -400,7 +400,7 @@ export default function AdminScannerPage() {
|
|||||||
setRecentCheckins(prev => [
|
setRecentCheckins(prev => [
|
||||||
{
|
{
|
||||||
name: result.ticket.attendeeName || 'Guest',
|
name: result.ticket.attendeeName || 'Guest',
|
||||||
time: new Date().toLocaleTimeString()
|
time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: 'America/Asuncion' })
|
||||||
},
|
},
|
||||||
...prev.slice(0, 4),
|
...prev.slice(0, 4),
|
||||||
]);
|
]);
|
||||||
@@ -441,6 +441,7 @@ export default function AdminScannerPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ export default function AdminSettingsPage() {
|
|||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-amber-600 mt-1">
|
<p className="text-xs text-amber-600 mt-1">
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ export default function AdminTicketsPage() {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export default function AdminUsersPage() {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
timeZone: 'America/Asuncion',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useLanguage } from '@/context/LanguageContext';
|
import { useLanguage } from '@/context/LanguageContext';
|
||||||
import { eventsApi, Event } from '@/lib/api';
|
import { eventsApi, Event } from '@/lib/api';
|
||||||
import { formatPrice } from '@/lib/utils';
|
import { formatPrice, formatDateShort, formatTime } from '@/lib/utils';
|
||||||
import {
|
import {
|
||||||
CalendarIcon,
|
CalendarIcon,
|
||||||
MapPinIcon,
|
MapPinIcon,
|
||||||
@@ -29,20 +29,8 @@ export default function LinktreePage() {
|
|||||||
.finally(() => setLoading(false));
|
.finally(() => setLoading(false));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const formatDate = (dateStr: string) => {
|
const formatDate = (dateStr: string) => formatDateShort(dateStr, locale as 'en' | 'es');
|
||||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
const fmtTime = (dateStr: string) => formatTime(dateStr, locale as 'en' | 'es');
|
||||||
weekday: 'short',
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTime = (dateStr: string) => {
|
|
||||||
return new Date(dateStr).toLocaleTimeString(locale === 'es' ? 'es-ES' : 'en-US', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle both full URLs and handles
|
// Handle both full URLs and handles
|
||||||
const instagramUrl = instagramHandle
|
const instagramUrl = instagramHandle
|
||||||
@@ -89,7 +77,7 @@ export default function LinktreePage() {
|
|||||||
<div className="mt-3 space-y-2">
|
<div className="mt-3 space-y-2">
|
||||||
<div className="flex items-center gap-2 text-gray-300 text-sm">
|
<div className="flex items-center gap-2 text-gray-300 text-sm">
|
||||||
<CalendarIcon className="w-4 h-4 text-primary-yellow flex-shrink-0" />
|
<CalendarIcon className="w-4 h-4 text-primary-yellow flex-shrink-0" />
|
||||||
<span>{formatDate(nextEvent.startDatetime)} • {formatTime(nextEvent.startDatetime)}</span>
|
<span>{formatDate(nextEvent.startDatetime)} • {fmtTime(nextEvent.startDatetime)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2 text-gray-300 text-sm">
|
<div className="flex items-center gap-2 text-gray-300 text-sm">
|
||||||
<MapPinIcon className="w-4 h-4 text-primary-yellow flex-shrink-0" />
|
<MapPinIcon className="w-4 h-4 text-primary-yellow flex-shrink-0" />
|
||||||
|
|||||||
@@ -7,30 +7,16 @@ export default function robots(): MetadataRoute.Robots {
|
|||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
userAgent: '*',
|
userAgent: '*',
|
||||||
allow: [
|
allow: '/',
|
||||||
'/',
|
|
||||||
'/events',
|
|
||||||
'/events/*',
|
|
||||||
'/community',
|
|
||||||
'/contact',
|
|
||||||
'/faq',
|
|
||||||
'/legal/*',
|
|
||||||
'/llms.txt',
|
|
||||||
],
|
|
||||||
disallow: [
|
disallow: [
|
||||||
'/admin',
|
'/admin/',
|
||||||
'/admin/*',
|
'/dashboard/',
|
||||||
'/dashboard',
|
'/api/',
|
||||||
'/dashboard/*',
|
'/book/',
|
||||||
'/api',
|
'/booking/',
|
||||||
'/api/*',
|
|
||||||
'/book',
|
|
||||||
'/book/*',
|
|
||||||
'/booking',
|
|
||||||
'/booking/*',
|
|
||||||
'/login',
|
'/login',
|
||||||
'/register',
|
'/register',
|
||||||
'/auth/*',
|
'/auth/',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,89 +3,109 @@ import { MetadataRoute } from 'next';
|
|||||||
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://spanglish.com.py';
|
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://spanglish.com.py';
|
||||||
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
|
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
|
||||||
|
|
||||||
interface Event {
|
interface SitemapEvent {
|
||||||
id: string;
|
id: string;
|
||||||
status: string;
|
status: string;
|
||||||
|
startDatetime: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPublishedEvents(): Promise<Event[]> {
|
/**
|
||||||
|
* Fetch all indexable events: published, completed, and cancelled.
|
||||||
|
* Sold-out / past events stay in the index (marked as expired, not removed).
|
||||||
|
* Only draft and archived events are excluded.
|
||||||
|
*/
|
||||||
|
async function getIndexableEvents(): Promise<SitemapEvent[]> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${apiUrl}/api/events?status=published`, {
|
const [publishedRes, completedRes] = await Promise.all([
|
||||||
next: { tags: ['events-sitemap'] },
|
fetch(`${apiUrl}/api/events?status=published`, {
|
||||||
});
|
next: { tags: ['events-sitemap'] },
|
||||||
if (!response.ok) return [];
|
}),
|
||||||
const data = await response.json();
|
fetch(`${apiUrl}/api/events?status=completed`, {
|
||||||
return data.events || [];
|
next: { tags: ['events-sitemap'] },
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const published = publishedRes.ok
|
||||||
|
? ((await publishedRes.json()).events as SitemapEvent[]) || []
|
||||||
|
: [];
|
||||||
|
const completed = completedRes.ok
|
||||||
|
? ((await completedRes.json()).events as SitemapEvent[]) || []
|
||||||
|
: [];
|
||||||
|
|
||||||
|
return [...published, ...completed];
|
||||||
} catch {
|
} catch {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||||
// Fetch published events for dynamic event pages
|
const events = await getIndexableEvents();
|
||||||
const events = await getPublishedEvents();
|
const now = new Date();
|
||||||
|
|
||||||
// Static pages
|
// Static pages
|
||||||
const staticPages: MetadataRoute.Sitemap = [
|
const staticPages: MetadataRoute.Sitemap = [
|
||||||
{
|
{
|
||||||
url: siteUrl,
|
url: siteUrl,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'weekly',
|
changeFrequency: 'weekly',
|
||||||
priority: 1,
|
priority: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/events`,
|
url: `${siteUrl}/events`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'daily',
|
changeFrequency: 'daily',
|
||||||
priority: 0.9,
|
priority: 0.9,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/community`,
|
url: `${siteUrl}/community`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'monthly',
|
changeFrequency: 'monthly',
|
||||||
priority: 0.7,
|
priority: 0.7,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/contact`,
|
url: `${siteUrl}/contact`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'monthly',
|
changeFrequency: 'monthly',
|
||||||
priority: 0.6,
|
priority: 0.6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/faq`,
|
url: `${siteUrl}/faq`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'monthly',
|
changeFrequency: 'monthly',
|
||||||
priority: 0.6,
|
priority: 0.6,
|
||||||
},
|
},
|
||||||
// Legal pages
|
// Legal pages
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/legal/terms-policy`,
|
url: `${siteUrl}/legal/terms-policy`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'yearly',
|
changeFrequency: 'yearly',
|
||||||
priority: 0.3,
|
priority: 0.3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/legal/privacy-policy`,
|
url: `${siteUrl}/legal/privacy-policy`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'yearly',
|
changeFrequency: 'yearly',
|
||||||
priority: 0.3,
|
priority: 0.3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: `${siteUrl}/legal/refund-cancelation-policy`,
|
url: `${siteUrl}/legal/refund-cancelation-policy`,
|
||||||
lastModified: new Date(),
|
lastModified: now,
|
||||||
changeFrequency: 'yearly',
|
changeFrequency: 'yearly',
|
||||||
priority: 0.3,
|
priority: 0.3,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// Dynamic event pages
|
// Dynamic event pages — upcoming events get higher priority
|
||||||
const eventPages: MetadataRoute.Sitemap = events.map((event) => ({
|
const eventPages: MetadataRoute.Sitemap = events.map((event) => {
|
||||||
url: `${siteUrl}/events/${event.id}`,
|
const isUpcoming = new Date(event.startDatetime) > now;
|
||||||
lastModified: new Date(event.updatedAt),
|
return {
|
||||||
changeFrequency: 'weekly' as const,
|
url: `${siteUrl}/events/${event.id}`,
|
||||||
priority: 0.8,
|
lastModified: new Date(event.updatedAt),
|
||||||
}));
|
changeFrequency: isUpcoming ? ('weekly' as const) : ('monthly' as const),
|
||||||
|
priority: isUpcoming ? 0.8 : 0.5,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return [...staticPages, ...eventPages];
|
return [...staticPages, ...eventPages];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,111 @@
|
|||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Date / time formatting
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// All helpers pin the timezone to America/Asuncion so the output is identical
|
||||||
|
// on the server (often UTC) and the client (user's local TZ). This prevents
|
||||||
|
// React hydration mismatches like "07:20 PM" (server) vs "04:20 PM" (client).
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const EVENT_TIMEZONE = 'America/Asuncion';
|
||||||
|
|
||||||
|
type Locale = 'en' | 'es';
|
||||||
|
|
||||||
|
function pickLocale(locale: Locale): string {
|
||||||
|
return locale === 'es' ? 'es-ES' : 'en-US';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Sat, Feb 14" / "sáb, 14 feb"
|
||||||
|
*/
|
||||||
|
export function formatDateShort(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleDateString(pickLocale(locale), {
|
||||||
|
weekday: 'short',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Saturday, February 14, 2026" / "sábado, 14 de febrero de 2026"
|
||||||
|
*/
|
||||||
|
export function formatDateLong(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleDateString(pickLocale(locale), {
|
||||||
|
weekday: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "February 14, 2026" / "14 de febrero de 2026" (no weekday)
|
||||||
|
*/
|
||||||
|
export function formatDateMedium(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleDateString(pickLocale(locale), {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Feb 14, 2026" / "14 feb 2026"
|
||||||
|
*/
|
||||||
|
export function formatDateCompact(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleDateString(pickLocale(locale), {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "04:30 PM" / "16:30"
|
||||||
|
*/
|
||||||
|
export function formatTime(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleTimeString(pickLocale(locale), {
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Feb 14, 2026, 04:30 PM" — compact date + time combined
|
||||||
|
*/
|
||||||
|
export function formatDateTime(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleString(pickLocale(locale), {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Sat, Feb 14, 04:30 PM" — short date + time combined
|
||||||
|
*/
|
||||||
|
export function formatDateTimeShort(dateStr: string, locale: Locale = 'en'): string {
|
||||||
|
return new Date(dateStr).toLocaleString(pickLocale(locale), {
|
||||||
|
weekday: 'short',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
timeZone: EVENT_TIMEZONE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Price formatting
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format price - shows decimals only if needed
|
* Format price - shows decimals only if needed
|
||||||
* Uses space as thousands separator (common in Paraguay)
|
* Uses space as thousands separator (common in Paraguay)
|
||||||
|
|||||||
Reference in New Issue
Block a user