feat: others relays

This commit is contained in:
codytseng
2025-01-17 12:07:22 +08:00
parent 6543f29529
commit 64a5573969
12 changed files with 174 additions and 36 deletions

View File

@@ -0,0 +1,27 @@
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Server } from 'lucide-react'
import { useMemo } from 'react'
export default function RelayIcon({
url,
className = 'w-6 h-6',
iconSize = 14
}: {
url: string
className?: string
iconSize?: number
}) {
const icon = useMemo(() => {
const u = new URL(url)
return `${u.protocol === 'wss:' ? 'https:' : 'http:'}//${u.host}/favicon.ico`
}, [url])
return (
<Avatar className={className}>
<AvatarImage src={icon} />
<AvatarFallback>
<Server size={iconSize} />
</AvatarFallback>
</Avatar>
)
}