tahamajs/IE / Projects /front /src /components /profile /ProfileWindow.tsx
tahamajs's picture
download
raw
3.12 kB
import { useAuth } from "@/context/AuthContext";
import { useProfile } from "@/hooks/useProfile";
import { GlassCard } from "@/components/ui/GlassCard";
import { Edit2, Users, Heart, Calendar, Mail, MapPin, Link as LinkIcon } from "lucide-react";
import { Link } from "react-router-dom";
export function ProfileWindow() {
const { user } = useAuth();
const { profile } = useProfile(user?.username);
if (!profile) return <div className="p-6 text-center">Loading...</div>;
return (
<GlassCard className="p-6 max-w-2xl mx-auto">
<div className="flex items-center gap-4">
<div className="w-20 h-20 rounded-full bg-gradient-to-br from-primary to-secondary flex items-center justify-center text-white text-2xl font-bold">
{profile.username[0].toUpperCase()}
</div>
<div>
<h2 className="text-xl font-bold">{profile.fullName || profile.username}</h2>
<p className="text-gray-500">@{profile.username}</p>
<div className="flex gap-3 mt-1 text-sm">
<span><strong>{profile.followersCount}</strong> followers</span>
<span><strong>{profile.followingCount}</strong> following</span>
<span><strong>{profile.articlesCount}</strong> articles</span>
</div>
</div>
<div className="ml-auto">
<button
onClick={() => window.dispatchEvent(new CustomEvent("openWindow", { detail: { app: "edit-profile" } }))}
className="glass-card p-2 rounded-full"
>
<Edit2 className="w-5 h-5" />
</button>
</div>
</div>
{profile.bio && <p className="mt-4">{profile.bio}</p>}
{profile.affiliation && <p className="flex items-center gap-1 text-sm mt-2"><MapPin className="w-4 h-4" /> {profile.affiliation}</p>}
{profile.email && <p className="flex items-center gap-1 text-sm mt-1"><Mail className="w-4 h-4" /> {profile.email}</p>}
{profile.website && (
<a href={profile.website} target="_blank" className="flex items-center gap-1 text-sm mt-1 text-primary"><LinkIcon className="w-4 h-4" /> {profile.website}</a>
)}
<div className="flex gap-3 mt-4 pt-3 border-t">
<button
onClick={() => window.dispatchEvent(new CustomEvent("openWindow", { detail: { app: "followers" } }))}
className="glass-card px-3 py-1 rounded-full text-sm flex items-center gap-1"
>
<Users className="w-4 h-4" /> Followers
</button>
<button
onClick={() => window.dispatchEvent(new CustomEvent("openWindow", { detail: { app: "following" } }))}
className="glass-card px-3 py-1 rounded-full text-sm flex items-center gap-1"
>
<Users className="w-4 h-4" /> Following
</button>
<button
onClick={() => window.dispatchEvent(new CustomEvent("openWindow", { detail: { app: "liked-articles" } }))}
className="glass-card px-3 py-1 rounded-full text-sm flex items-center gap-1"
>
<Heart className="w-4 h-4" /> Liked Articles
</button>
</div>
</GlassCard>
);
}

Xet Storage Details

Size:
3.12 kB
·
Xet hash:
22099087e897b08810789bf7acdad3f55b532359d934144231d3a6f8d60a54a1

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.