Skip to content

Commit

Permalink
fix(ui): avatar uploading ui bugs in profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne committed Mar 30, 2024
1 parent 4e5bbec commit 6065b8a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ee/tabby-ui/app/(dashboard)/profile/components/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { toast } from 'sonner'
import { graphql } from '@/lib/gql/generates'
import { useMe } from '@/lib/hooks/use-me'
import { useMutation } from '@/lib/tabby/gql'
import { delay } from '@/lib/utils'
import { delay, cn } from '@/lib/utils'

import { Button } from '@/components/ui/button'
import { IconCloudUpload, IconSpinner } from '@/components/ui/icons'
import { Separator } from '@/components/ui/separator'
Expand Down Expand Up @@ -65,11 +66,10 @@ export const Avatar = () => {
await delay(1000)
mutateAvatar(data.me.id)
toast.success('Successfully updated your profile picture!')

await delay(200)
setUploadedImgString('')
}


setUploadedImgString('')
setIsSubmitting(false)
}

Expand All @@ -96,7 +96,10 @@ export const Avatar = () => {
alt="avatar to be uploaded"
/>
)}
<UserAvatar className="relative h-16 w-16 border" />
<UserAvatar
className={cn("relative h-16 w-16 border", {
'opacity-0': uploadedImgString
})} />
</div>

<Separator />
Expand All @@ -114,7 +117,7 @@ export const Avatar = () => {
Save Changes
</Button>

<div className="mt-1.5 flex flex-1 justify-end">
<div className="flex flex-1 justify-end">
<p className=" text-xs text-muted-foreground lg:text-sm">
{`Square image recommended. Accepted file types: .png, .jpg. Max file size: ${MAX_UPLOAD_SIZE_KB}KB.`}
</p>
Expand Down

0 comments on commit 6065b8a

Please sign in to comment.