Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): avatar uploading ui bugs in profile page #1747

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 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,7 @@ 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 { cn, delay } 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 +65,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 +95,11 @@ 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
Loading