Skip to content

Commit 0386348

Browse files
committed
Impove previous edition button functionallity
1 parent fe7d4ab commit 0386348

7 files changed

Lines changed: 71 additions & 24 deletions

File tree

16.5 KB
Loading
-102 KB
Binary file not shown.

src/app/layout.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ export const metadata = {
9999
url: "https://pyday.vercel.app/",
100100
images: [
101101
{
102-
url: "https://pyday.vercel.app/images/logo_bg.png",
103-
width: 500,
104-
height: 500,
105-
alt: "Logo PyDay Chile",
102+
url: "/images/banner-og.webp",
103+
width: 1200,
104+
height: 630,
105+
alt: "PyDay Chile 2025 - Un día de Python en tu ciudad",
106106
},
107+
// {
108+
// url: "https://pyday.vercel.app/images/logo_bg.png",
109+
// width: 500,
110+
// height: 500,
111+
// alt: "Logo PyDay Chile",
112+
// },
107113
],
108114
},
109115
twitter: {

src/app/previous-editions/page.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
import Link from "next/link";
21
import Image from "next/image";
2+
import Link from "next/link";
33
import pastEvents from "@/data/pastEvents";
4+
import { images, videos } from "@/data/multimedia";
5+
import { SmartButton } from "@/components/SmartButton";
6+
7+
const hasMediaForYear = (year, type) => {
8+
if (type === "photos") return images.some((img) => img.year === year);
9+
if (type === "videos") return videos.some((v) => v.date.startsWith(year));
10+
return false;
11+
};
412

513
export default function PreviousEditionsPage() {
614
return (
@@ -75,29 +83,27 @@ export default function PreviousEditionsPage() {
7583
<p className="text-py-text">{event.highlights}</p>
7684
</div>
7785
</div>
78-
<div className="mt-6 flex justify-center gap-4">
79-
<Link
86+
<div className="mt-6 flex justify-center gap-4 flex-wrap">
87+
<SmartButton
8088
href={`/multimedia#photos-${event.year}`}
81-
target="_blank"
82-
className="btn-secondary"
89+
isAvailable={hasMediaForYear(event.year, "photos")}
8390
>
8491
Fotos {event.year}
85-
</Link>
86-
<Link
92+
</SmartButton>
93+
94+
<SmartButton
8795
href={event.webpageLink}
88-
target="_blank"
89-
className="btn-primary"
96+
isAvailable={!!event.webpageLink}
9097
>
9198
Sitio Web {event.year}
92-
</Link>
93-
<Link
99+
</SmartButton>
100+
101+
<SmartButton
94102
href={`/multimedia#videos-${event.year}`}
95-
target="_blank"
96-
className="btn-secondary"
103+
isAvailable={hasMediaForYear(event.year, "videos")}
97104
>
98105
Videos {event.year}
99-
</Link>
100-
106+
</SmartButton>
101107
</div>
102108
</div>
103109
</div>

src/components/SmartButton.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"use client";
2+
3+
import Link from "next/link";
4+
import { classNames } from "@/lib/utils";
5+
6+
export const SmartButton = ({ href, children, isAvailable, className }) => {
7+
if (!isAvailable) {
8+
return (
9+
<div className="relative group inline-block">
10+
<button
11+
disabled
12+
className={classNames(
13+
className,
14+
"btn-secondary opacity-50 cursor-not-allowed"
15+
)}
16+
>
17+
{children}
18+
</button>
19+
<span className="absolute hidden group-hover:block -top-8 left-1/2 -translate-x-1/2 bg-gray-800 text-white px-2 py-1 rounded text-sm whitespace-nowrap">
20+
Contenido no disponible
21+
</span>
22+
</div>
23+
);
24+
}
25+
26+
return (
27+
<Link href={href} className="btn-primary">
28+
{children}
29+
</Link>
30+
);
31+
};

src/data/pastEvents.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// FIXME: Agregar los respectivos links a "webpageLink"
12
const pastEvents = [
23
{
34
year: "2024",
@@ -12,7 +13,7 @@ const pastEvents = [
1213
"En la edición 2024 de PyDay Chile, la comunidad organizó con éxito un evento en Copiapó en conjunto con Inacap. Con actividades presenciales y participación online, el PyDay Copiapó 2024 reforzó el compromiso de Python Chile de expandir el alcance del lenguaje a más regiones del país.",
1314
photosLink: "/multimedia?year=2024",
1415
videosLink: "/multimedia?videos=2024",
15-
webpageLink: "/2024/",
16+
webpageLink: "",
1617
},
1718
{
1819
year: "2023",
@@ -27,7 +28,7 @@ const pastEvents = [
2728
"PyDay 2023 introdujo por primera vez una Hackatón en Santiago con más de 100 participantes, enfocada en IA generativa. Las charlas sobre ciencia de datos y desarrollo web fueron las más populares, y se estableció una mesa redonda sobre la comunidad Python en Chile.",
2829
photosLink: "/multimedia?year=2023",
2930
videosLink: "/multimedia?videos=2023",
30-
webpageLink: "/2023/",
31+
webpageLink: "",
3132
},
3233
{
3334
year: "2022",
@@ -42,12 +43,12 @@ const pastEvents = [
4243
"La primera edición presencial después de la pandemia reunió a entusiastas de Python de todo el país. Se celebraron talleres prácticos de Django, Data Science y automatización. El networking post-evento estableció colaboraciones entre empresas y desarrolladores.",
4344
photosLink: "/multimedia?year=2022",
4445
videosLink: "/multimedia?videos=2022",
45-
webpageLink: "/2022/",
46+
webpageLink: "",
4647
},
4748
{
4849
year: "2020",
4950
cities: ["Online"],
50-
mainImage: "/images/gallery/pyday2020_poster.png", // Asegúrate que exista esa imagen
51+
mainImage: "/images/gallery/online/PYDAY_2020_ONLINE_01.webp", // Asegúrate que exista esa imagen
5152
attendees: "+700 por Discord",
5253
viewers: "+1000",
5354
talks: 25,
@@ -56,7 +57,7 @@ const pastEvents = [
5657
highlights:"La primera edición nacional de PyDay Chile, realizada de manera online debido a la pandemia, fue el inicio de un sueño hecho realidad para la comunidad. Transmitido en YouTube, con participación activa en Discord y la presencia de speakers nacionales e internacionales, este evento marcó un hito para Python Chile, consolidándose como un espacio de encuentro, aprendizaje y colaboración para entusiastas de Python en el país.",
5758
photosLink: "/multimedia?year=2020",
5859
videosLink: "/multimedia?videos=2020",
59-
webpageLink: "/2020/",
60+
webpageLink: "",
6061
},
6162
];
6263

src/lib/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function classNames(...classes) {
2+
return classes.filter(Boolean).join(' ');
3+
}

0 commit comments

Comments
 (0)