feat(equipe): ajout de la page équipe avec système de loaders créateurs

Nouvelle page séparée /?p/equipe/ affichant les contributeurs
depuis un fichier JSON. Le JS résout les chemins et génère
automatiquement une grille de cartes avec avatar, nom, rôle,
date d'arrivée et liens.
This commit is contained in:
BlackAngelTV committed 2026-08-24 18:33:52 +02:00
1 parent c2b4d58839
commit 0a63ccb710
5 files changed
+291

No files matched your search

+108
View File
@@ -0,0 +1,108 @@
(() => {
function formatDate(iso) {
if (!iso) return null;
try {
const d = new Date(iso);
return d.toLocaleDateString("fr-FR", {
year: "numeric",
month: "long",
day: "numeric",
});
} catch {
return iso;
}
}
function createCreatorCard(creator) {
const card = document.createElement("article");
card.className = "creator-card";
if (creator.avatar) {
const img = document.createElement("img");
img.className = "creator-avatar";
img.src = creator.avatar;
img.alt = creator.name || creator.role || "";
img.loading = "lazy";
card.appendChild(img);
}
const info = document.createElement("div");
info.className = "creator-info";
if (creator.name) {
const name = document.createElement("h3");
name.className = "creator-name";
name.textContent = creator.name;
info.appendChild(name);
}
if (creator.role) {
const role = document.createElement("span");
role.className = "creator-role";
role.textContent = creator.role;
info.appendChild(role);
}
if (creator.joined) {
const joined = document.createElement("span");
joined.className = "creator-joined";
joined.textContent = "A rejoint le " + formatDate(creator.joined);
info.appendChild(joined);
}
if (creator.email) {
const email = document.createElement("a");
email.className = "creator-email";
email.href = "mailto:" + creator.email;
email.textContent = creator.email;
info.appendChild(email);
}
if (creator.links && creator.links.length > 0) {
const links = document.createElement("div");
links.className = "creator-links";
for (const link of creator.links) {
const a = document.createElement("a");
a.className = "creator-link";
a.href = link.url;
a.target = "_blank";
a.rel = "noopener noreferrer";
a.textContent = link.label || link.url;
links.appendChild(a);
}
info.appendChild(links);
}
card.appendChild(info);
return card;
}
async function loadCreators() {
const containers = document.querySelectorAll("[data-creators-src]");
for (const container of containers) {
const src = container.getAttribute("data-creators-src");
if (!src) continue;
try {
const response = await fetch(src, { cache: "no-store" });
if (!response.ok) throw new Error("Erreur " + response.status);
const creators = await response.json();
const grid = document.createElement("div");
grid.className = "creators-grid";
for (const creator of creators) {
grid.appendChild(createCreatorCard(creator));
}
container.innerHTML = "";
container.appendChild(grid);
} catch (err) {
container.innerHTML =
'<p class="creators-error">Impossible de charger les données des créateurs.</p>';
}
}
}
loadCreators();
})();