feat: update profile UI visual hierachy

This commit is contained in:
Hamzat Victor 2025-01-08 00:16:06 +01:00
parent 2c7527055f
commit 103faf1d09
2 changed files with 65 additions and 56 deletions

View File

@ -218,10 +218,10 @@ function ProfileCard({
</TooltipProvider> </TooltipProvider>
</div> </div>
)} )}
<CardContent className="flex flex-col gap-4 items-center pt-6"> <CardContent className="flex flex-col gap-4 pt-6">
<Avatar name={name} avatarUrl={avatarUrl} className="size-36" />
{isEditing ? ( {isEditing ? (
<div className="flex flex-col gap-2 items-center ">
<Avatar name={name} avatarUrl={avatarUrl} className="size-36" />
<EditProfileForm <EditProfileForm
{...{ {...{
name, name,
@ -233,31 +233,20 @@ function ProfileCard({
toggleEdit, toggleEdit,
}} }}
/> />
</div>
) : ( ) : (
<div className="flex flex-col gap-2.5 items-center"> <>
<div className="space-y-1.5"> <div className="flex flex-col gap-2 items-center">
<div className=""> <Avatar name={name} avatarUrl={avatarUrl} className="size-36" />
<div className="space-y-1">
<CardTitle className="text-2xl text-center">{name}</CardTitle> <CardTitle className="text-2xl text-center">{name}</CardTitle>
<CardDescription className="text-center">{`@${username}`}</CardDescription> <CardDescription className="text-center">{`@${username}`}</CardDescription>
</div> </div>
{typeof generations === "number" && (
<div className="flex justify-center">
<SubscriptionBadge
generations={generations}
tier={tier as keyof typeof TIERS}
/>
</div>
)}
</div>
<div className="flex gap-4">
<StatsItem icon={Package2} label={stats.sandboxes} />
<StatsItem icon={Heart} label={stats.likes} />
</div>
{bio && <p className="text-sm text-center">{bio}</p>} {bio && <p className="text-sm text-center">{bio}</p>}
{(socialLinks.length > 0 || personalWebsite) && ( {(socialLinks.length > 0 || personalWebsite) && (
<div className="flex gap-2 justify-center"> <div className="flex gap-2 justify-center">
{personalWebsite && ( {personalWebsite && (
<Button variant="ghost" size="smIcon" asChild> <Button variant="secondary" size="smIcon" asChild>
<a <a
href={personalWebsite} href={personalWebsite}
target="_blank" target="_blank"
@ -271,7 +260,12 @@ function ProfileCard({
{socialLinks.map((link, index) => { {socialLinks.map((link, index) => {
const Icon = socialIcons[link.platform] const Icon = socialIcons[link.platform]
return ( return (
<Button key={index} variant="ghost" size="smIcon" asChild> <Button
key={index}
variant="secondary"
size="smIcon"
asChild
>
<a <a
href={link.url} href={link.url}
target="_blank" target="_blank"
@ -285,10 +279,25 @@ function ProfileCard({
})} })}
</div> </div>
)} )}
</div>
<div className="flex flex-col gap-1 items-center">
{typeof generations === "number" && (
<div className="flex justify-center">
<SubscriptionBadge
generations={generations}
tier={tier as keyof typeof TIERS}
/>
</div>
)}
<div className="flex gap-4">
<StatsItem icon={Package2} label={stats.sandboxes} />
<StatsItem icon={Heart} label={stats.likes} />
</div>
</div>
<p className="text-xs mt-2 text-muted-foreground text-center"> <p className="text-xs mt-2 text-muted-foreground text-center">
{joinedAt} {joinedAt}
</p> </p>
</div> </>
)} )}
</CardContent> </CardContent>
</Card> </Card>
@ -713,7 +722,7 @@ const SubscriptionBadge = ({
</Badge> </Badge>
<HoverCard> <HoverCard>
<HoverCardTrigger> <HoverCardTrigger>
<Button variant="ghost" size="smIcon"> <Button variant="ghost" size="smIcon" className="size-[26px]">
<Info size={16} /> <Info size={16} />
</Button> </Button>
</HoverCardTrigger> </HoverCardTrigger>

View File

@ -26,7 +26,7 @@ const buttonVariants = cva(
sm: "h-8 rounded-md px-3 text-xs", sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8", lg: "h-10 rounded-md px-8",
icon: "h-9 w-9", icon: "h-9 w-9",
smIcon: "h-8 w-8", smIcon: "size-8",
}, },
}, },
defaultVariants: { defaultVariants: {