Skip to content

Commit 683718f

Browse files
committed
feat: display sorted schedule agenda with room information in city pages
1 parent e44b8a9 commit 683718f

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

src/app/[city]/page.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ export default async function CityPage({ params }) {
3939
notFound();
4040
}
4141

42+
// Función para extraer la hora de inicio
43+
const getStartTime = (timeStr) => {
44+
if (timeStr.includes(' - ')) {
45+
return timeStr.split(' - ')[0];
46+
}
47+
return timeStr;
48+
};
49+
50+
// Ordenar eventos por hora
51+
const sortedSchedule = [...data.schedule].sort((a, b) => {
52+
return getStartTime(a.time).localeCompare(getStartTime(b.time));
53+
});
54+
4255
return (
4356
<>
4457
{/* Hero Section */}
@@ -59,6 +72,7 @@ export default async function CityPage({ params }) {
5972
<p className="text-xl md:text-2xl opacity-90">{data.date}</p>
6073
<p className="text-lg opacity-80">{data.venue}</p>
6174
</HeroSection>
75+
6276
{/* Sección de introducción - Solo se muestra si existe */}
6377
{data.introduction && (
6478
<section className="container-py">
@@ -104,18 +118,22 @@ export default async function CityPage({ params }) {
104118

105119
{/* Registro Section */}
106120
<section id="registro" className="container-py">
107-
<FeatureGuard featureName="registration"cityData={data}>
121+
<FeatureGuard featureName="registration" cityData={data}>
108122
<RegistrationForm />
109123
</FeatureGuard>
110124
</section>
111125

112126
{/* Agenda*/}
113127
<section className="container-py">
114128
<h2 className="section-title">Agenda</h2>
115-
{data.length > 0 ? (
129+
{sortedSchedule.length > 0 ? (
116130
<div className="space-y-4 md:space-y-6 mt-6 md:mt-8 max-w-4xl mx-auto">
117-
{data.schedule.map((talk, index) => (
118-
<TalkCard key={talk.id} talk={talk} />
131+
{sortedSchedule.map((talk) => (
132+
<TalkCard
133+
key={talk.id}
134+
talk={talk}
135+
showRoom={true} // Mostrar la sala en la vista de ciudad
136+
/>
119137
))}
120138
</div>
121139
) : (
@@ -230,4 +248,4 @@ export default async function CityPage({ params }) {
230248
</footer>
231249
</>
232250
);
233-
}
251+
}

0 commit comments

Comments
 (0)