11import * as React from "react" ;
2- import { Upload } from "lucide-react" ;
2+ import { Upload , X } from "lucide-react" ;
33
44import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar" ;
55import { useAvatarUpload } from "@/features/profile/useAvatarUpload" ;
@@ -14,12 +14,14 @@ export function AgentCreationPreview({
1414 avatarUrl,
1515 disabled = false ,
1616 label,
17+ onClearAvatar,
1718 onUploadPendingChange,
1819 onSelectAvatar,
1920} : {
2021 avatarUrl : string | null ;
2122 disabled ?: boolean ;
2223 label : string ;
24+ onClearAvatar ?: ( ) => void ;
2325 onUploadPendingChange ?: ( isPending : boolean ) => void ;
2426 onSelectAvatar : ( avatarUrl : string ) => void ;
2527} ) {
@@ -143,7 +145,7 @@ export function AgentCreationPreview({
143145 </ p >
144146 ) : null }
145147
146- < div className = "absolute inset-x-3 bottom-3 flex justify-center" >
148+ < div className = "absolute inset-x-3 bottom-3 flex justify-center gap-2 " >
147149 < button
148150 className = "inline-flex h-8 translate-y-1 items-center justify-center gap-1.5 rounded-full border border-border/70 bg-background/90 px-3 text-xs font-medium text-foreground opacity-0 shadow-xs transition-[background-color,opacity,transform] duration-150 hover:bg-muted focus-visible:translate-y-0 focus-visible:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring group-hover/avatar-preview:translate-y-0 group-hover/avatar-preview:opacity-100 group-focus-within/avatar-preview:translate-y-0 group-focus-within/avatar-preview:opacity-100"
149151 disabled = { disabled || isUploading }
@@ -160,6 +162,18 @@ export function AgentCreationPreview({
160162 ) }
161163 { isUploading ? "Uploading..." : "Edit avatar" }
162164 </ button >
165+ { avatarUrl && onClearAvatar ? (
166+ < button
167+ className = "inline-flex h-8 translate-y-1 items-center justify-center gap-1.5 rounded-full border border-border/70 bg-background/90 px-3 text-xs font-medium text-foreground opacity-0 shadow-xs transition-[background-color,opacity,transform] duration-150 hover:bg-muted focus-visible:translate-y-0 focus-visible:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring group-hover/avatar-preview:translate-y-0 group-hover/avatar-preview:opacity-100 group-focus-within/avatar-preview:translate-y-0 group-focus-within/avatar-preview:opacity-100"
168+ disabled = { disabled || isUploading }
169+ onClick = { onClearAvatar }
170+ title = "Remove avatar"
171+ type = "button"
172+ >
173+ < X className = "h-3.5 w-3.5" />
174+ Remove
175+ </ button >
176+ ) : null }
163177 </ div >
164178 </ fieldset >
165179 </ div >
0 commit comments