Skip to content

Commit 8a81c9a

Browse files
committed
improve: team avatar appearance & upload ui
1 parent 8ced6be commit 8a81c9a

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

src/features/dashboard/sidebar/menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ export default function SidebarMenu({ className }: SidebarMenuProps) {
7979
className
8080
)}
8181
>
82-
<Avatar className="size-9 shrink-0 border-none drop-shadow-lg filter">
82+
<Avatar
83+
className={cn('size-9 shrink-0', {
84+
'border-none drop-shadow-lg filter':
85+
selectedTeam?.profile_picture_url,
86+
})}
87+
>
8388
<AvatarImage
8489
src={selectedTeam?.profile_picture_url || undefined}
8590
/>

src/features/dashboard/team/profile-picture-card.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ import { useRef, useState } from 'react'
66
import { useToast } from '@/lib/hooks/use-toast'
77
import { Avatar, AvatarImage, AvatarFallback } from '@/ui/primitives/avatar'
88
import { cn, exponentialSmoothing } from '@/lib/utils'
9-
import { Pencil, Loader2 } from 'lucide-react'
9+
import {
10+
Pencil,
11+
Loader2,
12+
ImageIcon,
13+
ChevronsUp,
14+
ImagePlusIcon,
15+
} from 'lucide-react'
1016
import { motion, AnimatePresence } from 'framer-motion'
1117
import { cardVariants } from '@/ui/primitives/card'
1218
import { uploadTeamProfilePictureAction } from '@/server/team/team-actions'
1319
import { useAction } from 'next-safe-action/hooks'
1420
import { defaultSuccessToast, defaultErrorToast } from '@/lib/hooks/use-toast'
21+
import { Badge } from '@/ui/primitives/badge'
1522

1623
interface ProfilePictureCardProps {
1724
className?: string
@@ -87,18 +94,23 @@ export function ProfilePictureCard({ className }: ProfilePictureCardProps) {
8794
onMouseLeave={() => setIsHovered(false)}
8895
>
8996
<Avatar
90-
className={cn('h-24 w-24 border-none drop-shadow-lg filter', className)}
97+
className={cn(
98+
'h-24 w-24',
99+
{
100+
'border-none drop-shadow-lg filter': team?.profile_picture_url,
101+
},
102+
className
103+
)}
91104
>
92105
<AvatarImage
93106
src={team?.profile_picture_url || ''}
94107
alt={`${team?.name}'s profile picture`}
95108
/>
96-
<AvatarFallback className="relative text-2xl font-semibold">
97-
{team ? (
98-
team?.name?.charAt(0).toUpperCase()
99-
) : (
100-
<Skeleton className="absolute inset-0" />
101-
)}
109+
<AvatarFallback className="bg-bg-200 relative text-2xl font-semibold">
110+
<ImagePlusIcon className="text-fg-500" />
111+
<Badge className="text-fg-300 absolute bottom-3 left-1/2 -translate-x-1/2 whitespace-nowrap uppercase backdrop-blur-md">
112+
Upload <ChevronsUp className="text-accent size-4" />
113+
</Badge>
102114
</AvatarFallback>
103115
</Avatar>
104116

0 commit comments

Comments
 (0)