ajout de la date et le tri desc par date des projects

This commit is contained in:
toine 2025-10-05 15:30:15 +02:00
parent cdb70ca5ea
commit 80dc10855f
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,9 @@
interface Project {
id: string;
created_at: number;
// ... autres propriétés
}
async function getProjects() {
const baseUrl = process.env.BACKEND_URL;
if (!baseUrl) {
@ -46,7 +52,9 @@ export default async function ProjectsPage() {
<div className="container">
<h2 className="section-title">Mes projets</h2>
<ul className="projects-list">
{projects.map((p: any) => {
{projects
.sort((a: Project, b: Project) => b.created_at - a.created_at)
.map((p: any) => {
const tags = toTags(p.technologies);
const href = p.link || p.url || '#';
const imgUrl = normalizeImageUrl(p.image);
@ -76,6 +84,9 @@ export default async function ProjectsPage() {
p.technologies ? <span className="badge badge--mono">{String(p.technologies)}</span> : null
)}
</div>
<div>
Crée le {new Date(p.created_at * 1000).toLocaleDateString()}
</div>
</div>
</a>
</li>