File tree Expand file tree Collapse file tree 3 files changed +24
-11
lines changed
Expand file tree Collapse file tree 3 files changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010} from './auth' ;
1111
1212// Mock the logger to prevent console output during tests
13- vi . mock ( '../lib/logger' , ( ) => ( {
13+ vi . mock ( '../../ lib/logger' , ( ) => ( {
1414 logger : {
1515 warn : vi . fn ( ) ,
1616 error : vi . fn ( ) ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ interface FaviconImageProps {
99 altText ?: string ;
1010 size ?: number ;
1111 className ?: string ;
12+ fallbackIcon ?: React . ReactNode ;
1213}
1314
1415const hostnameRegex = / ^ h t t p s ? : \/ \/ / ;
@@ -19,6 +20,7 @@ export function FaviconImage({
1920 altText,
2021 size = 20 ,
2122 className = '' ,
23+ fallbackIcon,
2224} : FaviconImageProps ) {
2325 const [ error , setError ] = useState ( false ) ;
2426
@@ -44,12 +46,14 @@ export function FaviconImage({
4446 className = { `${ className } flex items-center justify-center rounded-sm` }
4547 style = { { width : size , height : size } }
4648 >
47- < GlobeIcon
48- aria-label = { altText || 'Website icon' }
49- className = "not-dark:text-primary text-muted-foreground"
50- size = { size }
51- weight = "duotone"
52- />
49+ { fallbackIcon || (
50+ < GlobeIcon
51+ aria-label = { altText || 'Website icon' }
52+ className = "not-dark:text-primary text-muted-foreground"
53+ size = { size }
54+ weight = "duotone"
55+ />
56+ ) }
5357 </ div >
5458 ) ;
5559 }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { CaretLeftIcon, PlanetIcon } from '@phosphor-icons/react';
33import Link from 'next/link' ;
44import { Button } from '@/components/ui/button' ;
55import { Skeleton } from '@/components/ui/skeleton' ;
6+ import { FaviconImage } from '@/components/analytics/favicon-image' ;
67
78interface WebsiteHeaderProps {
89 website : Website | null | undefined ;
@@ -31,10 +32,18 @@ export function WebsiteHeader({ website }: WebsiteHeaderProps) {
3132
3233 < div className = "rounded-lg border border-border/50 bg-accent/30 px-2 py-2" >
3334 < h2 className = "flex items-center truncate font-semibold text-base" >
34- < PlanetIcon
35- className = "mr-2 h-5 w-5 text-primary/70"
36- size = { 64 }
37- weight = "duotone"
35+ < FaviconImage
36+ altText = { `${ website ?. name || website ?. domain || 'Website' } favicon` }
37+ className = "mr-2"
38+ domain = { website ?. domain || '' }
39+ fallbackIcon = {
40+ < PlanetIcon
41+ className = "text-primary/70"
42+ size = { 20 }
43+ weight = "duotone"
44+ />
45+ }
46+ size = { 20 }
3847 />
3948 { website ?. name || website ?. domain || (
4049 < Skeleton className = "h-5 w-36" />
You can’t perform that action at this time.
0 commit comments