Refactor event date handling in EventsSection and PlayerStats components: Serialize event dates for consistent formatting and update date display to use localized string representation. Remove profile link from Navigation and integrate it into PlayerStats for improved user experience.

This commit is contained in:
Julien Froidefond
2025-12-10 05:49:44 +01:00
parent a6c329ff15
commit 95e580aff6
4 changed files with 33 additions and 24 deletions

View File

@@ -2,6 +2,7 @@
import { useEffect, useState } from "react";
import { useSession } from "next-auth/react";
import Link from "next/link";
interface UserData {
username: string;
@@ -125,27 +126,31 @@ export default function PlayerStats({ initialUserData }: PlayerStatsProps) {
return (
<div className="flex items-center gap-3">
{/* Avatar */}
<div className="w-10 h-10 rounded-full border border-pixel-gold/20 overflow-hidden bg-gray-900 flex items-center justify-center">
{avatar ? (
<img
src={avatar}
alt={username}
className="w-full h-full object-cover"
/>
) : (
<span className="text-pixel-gold text-xs font-bold">
{username.charAt(0).toUpperCase()}
</span>
)}
</div>
<Link href="/profile" className="cursor-pointer hover:opacity-80 transition-opacity">
<div className="w-10 h-10 rounded-full border border-pixel-gold/20 overflow-hidden bg-gray-900 flex items-center justify-center">
{avatar ? (
<img
src={avatar}
alt={username}
className="w-full h-full object-cover"
/>
) : (
<span className="text-pixel-gold text-xs font-bold">
{username.charAt(0).toUpperCase()}
</span>
)}
</div>
</Link>
{/* Stats */}
<div className="flex flex-col gap-1.5 min-w-[200px]">
{/* Username & Level */}
<div className="flex items-center gap-2">
<div className="text-pixel-gold font-gaming font-bold text-sm tracking-wider">
{username}
</div>
<Link href="/profile" className="cursor-pointer hover:text-pixel-gold/80 transition-colors">
<div className="text-pixel-gold font-gaming font-bold text-sm tracking-wider">
{username}
</div>
</Link>
<div className="text-gray-400 font-pixel text-xs uppercase border border-pixel-gold/30 px-1.5 py-0.5 bg-black/40">
Lv.{level}
</div>