feat: move replaceImgUrlIfNeed

This commit is contained in:
DIYgod 2024-12-10 12:36:24 +08:00
parent 8e248ad733
commit 4a4ecee7f1
No known key found for this signature in database
3 changed files with 4 additions and 7 deletions

View File

@ -7,7 +7,6 @@ import {
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
import type { FeedOrListRespModel } from "@follow/models/types"
import { replaceImgUrlIfNeed } from "@follow/utils/img-proxy"
import { cn } from "@follow/utils/utils"
import { useTranslation } from "react-i18next"
@ -60,7 +59,7 @@ export const FeedCertification = ({
<span>{t("feed_item.claimed_by_owner")}</span>
{feed.owner ? (
<Avatar className="inline-flex aspect-square size-5 rounded-full">
<AvatarImage src={replaceImgUrlIfNeed(feed.owner.image || undefined)} />
<AvatarImage src={feed.owner.image || undefined} />
<AvatarFallback>{feed.owner.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
) : (

View File

@ -8,7 +8,6 @@ import { Button } from "@follow/components/ui/button/index.jsx"
import { FeedIcon } from "@follow/components/ui/feed-icon/index.jsx"
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { useTitle } from "@follow/hooks"
import { replaceImgUrlIfNeed } from "@follow/utils/img-proxy"
import { UrlBuilder } from "@follow/utils/url-builder"
import { cn } from "@follow/utils/utils"
import { Fragment } from "react"
@ -35,10 +34,7 @@ export const Component = () => {
) : (
<Fragment>
<Avatar className="aspect-square size-16">
<AvatarImage
className="duration-200 animate-in fade-in-0"
src={replaceImgUrlIfNeed(user.data?.image || undefined)}
/>
<AvatarImage className="duration-200 animate-in fade-in-0" src={user.data?.image} />
<AvatarFallback>{user.data?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
<div className="mb-8 flex flex-col items-center">

View File

@ -1,3 +1,4 @@
import { replaceImgUrlIfNeed } from "@follow/utils/img-proxy"
import { cn } from "@follow/utils/utils"
import * as AvatarPrimitive from "@radix-ui/react-avatar"
import * as React from "react"
@ -21,6 +22,7 @@ export const AvatarImage = React.forwardRef<
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square size-full", className)}
src={replaceImgUrlIfNeed(props.src)}
{...props}
/>
))