Skip to content

Commit cb5a6d4

Browse files
committed
refactor(features): enhance FeatureGuard for multi-city registration support
1 parent 7efba9f commit cb5a6d4

1 file changed

Lines changed: 44 additions & 16 deletions

File tree

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import CTAFinal from "@/components/CTAFinal";
22

3-
export const FeatureGuard = ({ children, featureName }) => {
3+
export const FeatureGuard = ({ children, featureName, cityData }) => {
44
const features = {
55
registration: {
66
enabled: process.env.NEXT_PUBLIC_FEATURE_REGISTRATION === "true",
7-
title: "Registro PyDay 2025",
8-
subtitle: "El formulario de registro estará disponible próximamente",
9-
showCTA: false,
10-
buttonText: "Acceder al registro externo",
11-
href: "https://registro.externo.com/pyday",
7+
title: `Registro PyDay ${cityData?.name || "2025"}`,
8+
subtitle: cityData?.registrationLink
9+
? "¡Regístrate ahora para asegurar tu lugar en el PyDay 2025!"
10+
: "El registro abrirá próximamente. Mantente atento a nuestras redes sociales",
11+
showCTA: !!cityData?.registrationLink,
12+
buttonText: "Registrarme ahora",
13+
href: cityData?.registrationLink || "",
1214
},
1315
sponsors: {
1416
enabled: process.env.NEXT_PUBLIC_FEATURE_SPONSORS === "true",
@@ -32,13 +34,39 @@ export const FeatureGuard = ({ children, featureName }) => {
3234
const { enabled, ...ctaProps } = features[featureName];
3335

3436
return enabled ? (
35-
children
36-
) : ctaProps.showCTA ? (
37-
<CTAFinal {...ctaProps} />
38-
) : (
39-
<div className="text-center py-12">
40-
<h2 className="section-title">{ctaProps.title}</h2>
41-
<p className="text-white/80">{ctaProps.subtitle}</p>
42-
</div>
43-
);
44-
};
37+
<>
38+
<h2 className="section-title">Formulario de Registro</h2>
39+
{children}
40+
</>
41+
) : (
42+
<div className="text-center py-12">
43+
<h2 className="section-title">{ctaProps.title}</h2>
44+
<p className="text-white/80 mb-6">{ctaProps.subtitle}</p>
45+
{ctaProps.showCTA && (
46+
<a
47+
href={ctaProps.href}
48+
className="btn-secondary inline-flex items-center justify-center px-4 py-2 text-base"
49+
target="_blank"
50+
rel="noopener noreferrer"
51+
>
52+
{ctaProps.buttonText}
53+
<svg
54+
xmlns="http://www.w3.org/2000/svg"
55+
className="h-5 w-5 ml-2"
56+
viewBox="0 0 20 20"
57+
fill="currentColor"
58+
>
59+
<path
60+
fillRule="evenodd"
61+
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"
62+
clipRule="evenodd"
63+
/>
64+
</svg>
65+
</a>
66+
)}
67+
68+
</div>
69+
);
70+
};
71+
72+

0 commit comments

Comments
 (0)