@@ -2,16 +2,26 @@ import Link from "next/link";
22import cityData from "@/data/cities" ;
33
44export default function RegistrationState ( { cityId } ) {
5- const citiesWithRegistration = Object . values ( cityData )
6- . filter ( ( city ) => ! ! city . registrationLink )
7- . map ( ( city ) => ( {
5+ // Filtramos solo ciudades con registro disponible y que NO estén agotadas
6+ const citiesWithRegistration = Object . entries ( cityData )
7+ . filter ( ( [ _ , city ] ) => city . registrationLink && city . registrationStatus !== "soldout" )
8+ . map ( ( [ _ , city ] ) => ( {
89 name : city . name ,
910 link : city . registrationLink ,
1011 } ) ) ;
1112
1213 const getContent = ( ) => {
1314 if ( cityId ) {
1415 const city = cityData [ cityId ] ;
16+
17+ if ( city . registrationStatus === "soldout" ) {
18+ return {
19+ title : "Cupos agotados" ,
20+ message : `Los cupos para PyDay ${ city . name } ya se han agotado.` ,
21+ links : [ ] , // Sin links ni botones
22+ } ;
23+ }
24+
1525 return {
1626 title : city . registrationLink ? "Registro disponible" : "Registro cerrado" ,
1727 message : city . registrationLink
@@ -36,38 +46,38 @@ export default function RegistrationState({ cityId }) {
3646
3747 const { title, message, links } = getContent ( ) ;
3848
39- if ( links . length === 0 ) return null ;
40-
49+ // Si no hay links, no mostramos botones, solo el texto
4150 return (
4251 < div className = "backdrop-blur-sm rounded-lg p-6 md:p-8 text-center" >
4352 < h3 className = "text-lg md:text-xl font-bold mb-2 text-py-text" > { title } </ h3 >
4453 < p className = "text-py-text/80 mb-6" > { message } </ p >
4554
46- < div className = "flex flex-wrap justify-center gap-3 md:gap-4 w-full px-4" >
47- { links . map ( ( city , index ) => (
48- < Link
49- key = { index }
50- href = { city . link }
51- target = "_blank"
52- className = "btn-secondary inline-flex items-center flex-shrink-0 px-4 py-2 text-sm md:text-base"
53- >
54- < span className = "whitespace-nowrap" > { city . name } </ span >
55- < svg
56- xmlns = "http://www.w3.org/2000/svg"
57- className = "h-4 w-4 md:h-5 md:w-5 ml-1.5"
58- viewBox = "0 0 20 20"
59- fill = "currentColor"
60- >
61- < path
62- fillRule = "evenodd"
63- d = "M10.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 11H5a1 1 0 110-2h7.586l-2.293-2.293a1 1 0 010-1.414z"
64- clipRule = "evenodd"
65- />
66- </ svg >
67- </ Link >
68- ) ) }
69- </ div >
55+ { links . length > 0 && (
56+ < div className = "flex flex-wrap justify-center gap-3 md:gap-4 w-full px-4" >
57+ { links . map ( ( city , index ) => (
58+ < Link
59+ key = { index }
60+ href = { city . link }
61+ target = "_blank"
62+ className = "btn-secondary inline-flex items-center flex-shrink-0 px-4 py-2 text-sm md:text-base"
63+ >
64+ < span className = "whitespace-nowrap" > { city . name } </ span >
65+ < svg
66+ xmlns = "http://www.w3.org/2000/svg"
67+ className = "h-4 w-4 md:h-5 md:w-5 ml-1.5"
68+ viewBox = "0 0 20 20"
69+ fill = "currentColor"
70+ >
71+ < path
72+ fillRule = "evenodd"
73+ d = "M10.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 11H5a1 1 0 110-2h7.586l-2.293-2.293a1 1 0 010-1.414z"
74+ clipRule = "evenodd"
75+ />
76+ </ svg >
77+ </ Link >
78+ ) ) }
79+ </ div >
80+ ) }
7081 </ div >
7182 ) ;
7283}
73-
0 commit comments