@@ -4,8 +4,12 @@ import {
44 PRESENCE_AWAY_WINDOW_MS ,
55 PRESENCE_ONLINE_WINDOW_MS ,
66} from "@cossistant/types" ;
7- import * as AvatarPrimitive from "@radix-ui/react-avatar" ;
8- import { Facehash as FacehashComponent } from "facehash" ;
7+ import {
8+ AvatarFallback as FacehashAvatarFallbackPrimitive ,
9+ AvatarImage as FacehashAvatarImagePrimitive ,
10+ Avatar as FacehashAvatarPrimitive ,
11+ Facehash as FacehashComponent ,
12+ } from "facehash" ;
913import type * as React from "react" ;
1014import { useEffect , useState } from "react" ;
1115import { formatTimeAgo } from "@/lib/date" ;
@@ -16,9 +20,9 @@ import { TooltipOnHover } from "./tooltip";
1620function AvatarContainer ( {
1721 className,
1822 ...props
19- } : React . ComponentProps < typeof AvatarPrimitive . Root > ) {
23+ } : React . ComponentProps < typeof FacehashAvatarPrimitive > ) {
2024 return (
21- < AvatarPrimitive . Root
25+ < FacehashAvatarPrimitive
2226 className = { cn (
2327 "relative flex size-8 shrink-0 overflow-hidden rounded" ,
2428 className
@@ -32,9 +36,9 @@ function AvatarContainer({
3236function AvatarImage ( {
3337 className,
3438 ...props
35- } : React . ComponentProps < typeof AvatarPrimitive . Image > ) {
39+ } : React . ComponentProps < typeof FacehashAvatarImagePrimitive > ) {
3640 return (
37- < AvatarPrimitive . Image
41+ < FacehashAvatarImagePrimitive
3842 className = { cn ( "aspect-square size-full" , className ) }
3943 data-slot = "avatar-image"
4044 { ...props }
@@ -43,7 +47,10 @@ function AvatarImage({
4347}
4448
4549interface AvatarFallbackProps
46- extends React . ComponentProps < typeof AvatarPrimitive . Fallback > {
50+ extends Omit <
51+ React . ComponentProps < typeof FacehashAvatarFallbackPrimitive > ,
52+ "children" | "facehashProps" | "name"
53+ > {
4754 value ?: string | null ;
4855 children ?: string ;
4956}
@@ -87,6 +94,7 @@ function Facehash({
8794
8895function AvatarFallback ( {
8996 className,
97+ style,
9098 value,
9199 children,
92100 ...props
@@ -95,16 +103,25 @@ function AvatarFallback({
95103 getNonEmptyString ( value ) ?? getNonEmptyString ( children ) ?? "avatar" ;
96104
97105 return (
98- < AvatarPrimitive . Fallback
106+ < FacehashAvatarFallbackPrimitive
99107 className = { cn (
100108 "flex size-full items-center justify-center text-black dark:text-black" ,
101109 className
102110 ) }
103111 data-slot = "avatar-fallback"
112+ facehashProps = { {
113+ colorClasses : COSSISTANT_FACEHASH_COLOR_CLASSES ,
114+ enableBlink : true ,
115+ intensity3d : "dramatic" ,
116+ interactive : false ,
117+ } }
118+ name = { facehashName }
119+ style = { {
120+ color : "#000000" ,
121+ ...style ,
122+ } }
104123 { ...props }
105- >
106- < Facehash name = { facehashName } />
107- </ AvatarPrimitive . Fallback >
124+ />
108125 ) ;
109126}
110127
0 commit comments