Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor: add composable avatar slot wrappers (#34058)
yyhb4af0d0f9a03
diff --git a/web/app/components/base/avatar/index.tsx b/web/app/components/base/avatar/index.tsxindex 461154226db..f53e1f8985c 100644--- a/web/app/components/base/avatar/index.tsx+++ b/web/app/components/base/avatar/index.tsx@@ -1,8 +1,9 @@import type { ImageLoadingStatus } from '@base-ui/react/avatar'+import type * as React from 'react'import { Avatar as BaseAvatar } from '@base-ui/react/avatar'import { cn } from '@/utils/classnames'-export const avatarSizeClasses = {+const avatarSizeClasses = {'xxs': { root: 'size-4', text: 'text-[7px]' },'xs': { root: 'size-5', text: 'text-[8px]' },'sm': { root: 'size-6', text: 'text-[10px]' },@@ -15,8 +16,6 @@ export const avatarSizeClasses = {export type AvatarSize = keyof typeof avatarSizeClasses-export const getAvatarSizeClassNames = (size: AvatarSize) => avatarSizeClasses[size]-export type AvatarProps = {name: stringavatar: string | null@@ -25,13 +24,61 @@ export type AvatarProps = {onLoadingStatusChange?: (status: ImageLoadingStatus) => void}-export const AvatarRoot = BaseAvatar.Root-export const AvatarImage = BaseAvatar.Image-export const AvatarFallback = BaseAvatar.Fallback+export type AvatarRootProps = React.ComponentPropsWithRef<typeof BaseAvatar.Root> & {+ size?: AvatarSize+}++export function AvatarRoot({+ size = 'md',+ className,+ ...props+}: AvatarRootProps) {+ return (+ <BaseAvatar.Root+ className={cn(+ 'relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full bg-primary-600',+ avatarSizeClasses[size].root,+ className,+ )}+ {...props}+ />+ )+}++export type AvatarImageProps = React.ComponentPropsWithRef<typeof BaseAvatar.Image>++export function AvatarImage({+ className,+ ...props+}: AvatarImageProps) {+ return (+ <BaseAvatar.Image+ className={cn('absolute inset-0 size-full object-cover', className)}+ {...props}+ />+ )+}++export type AvatarFallbackProps = React.ComponentPropsWithRef<typeof BaseAvatar.Fallback> & {+ size?: AvatarSize+}-const ROOT_CLASS_NAME = 'relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full bg-primary-600'-const IMAGE_CLASS_NAME = 'absolute inset-0 size-full object-cover'-const FALLBACK_CLASS_NAME = 'flex size-full items-center justify-center font-medium text-white'+export function AvatarFallback({+ size = 'md',+ className,+ ...props+}: AvatarFallbackProps) {+ return (+ <BaseAvatar.Fallback+ className={cn(+ 'flex size-full items-center justify-center font-medium text-white',+ avatarSizeClasses[size].text,+ className,+ )}+ {...props}+ />+ )+}export const Avatar = ({name,@@ -40,19 +87,16 @@ export const Avatar = ({className,onLoadingStatusChange,}: AvatarProps) => {- const sizeClassNames = getAvatarSizeClassNames(size)-return (- <AvatarRoot className={cn(ROOT_CLASS_NAME, sizeClassNames.root, className)}>+ <AvatarRoot size={size} className={className}>{avatar && (<AvatarImagesrc={avatar}alt={name}- className={IMAGE_CLASS_NAME}onLoadingStatusChange={onLoadingStatusChange}/>)}- <AvatarFallback className={cn(FALLBACK_CLASS_NAME, sizeClassNames.text)}>+ <AvatarFallback size={size}>{name?.[0]?.toLocaleUpperCase()}</AvatarFallback></AvatarRoot>