feat: getRandomAvatarUrl function
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useMemo } from "react"
|
||||
|
||||
import { Image } from "~/components/ui/Image"
|
||||
import { getRandomAvatarUrl } from "~/lib/helpers"
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
import { cn } from "~/lib/utils"
|
||||
|
||||
@@ -35,7 +36,7 @@ export const Avatar = ({
|
||||
const borderRadius = rounded === false ? "rounded-lg" : "rounded-full"
|
||||
|
||||
if (!image) {
|
||||
image = `https://api.dicebear.com/6.x/bottts-neutral/svg?seed=${cid}`
|
||||
image = getRandomAvatarUrl(cid || "")
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from "~/lib/types"
|
||||
|
||||
import { detectLanguage } from "./detect-lang"
|
||||
import { getNoteSlug } from "./helpers"
|
||||
import { getNoteSlug, getRandomAvatarUrl } from "./helpers"
|
||||
|
||||
export const expandCrossbellNote = async ({
|
||||
note,
|
||||
@@ -290,7 +290,7 @@ export const expandCrossbellCharacter = async (site: CharacterEntity) => {
|
||||
.filter(Boolean)
|
||||
} else {
|
||||
expandedCharacter.metadata.content.avatars = [
|
||||
`https://api.dicebear.com/6.x/bottts-neutral/svg?seed=${expandedCharacter.characterId}`,
|
||||
getRandomAvatarUrl(expandedCharacter.characterId),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -88,3 +88,6 @@ export const getSiteRelativeUrl = (pathname: string, address: string) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getRandomAvatarUrl = (seed: string | number) =>
|
||||
`https://api.dicebear.com/7.x/bottts-neutral/svg?seed=${seed}`
|
||||
|
||||
Reference in New Issue
Block a user