fix: show profile banner and avatar when media auto-load is disabled
This commit is contained in:
@@ -14,7 +14,8 @@ export default function ImageWithLightbox({
|
||||
image,
|
||||
className,
|
||||
classNames = {},
|
||||
errorPlaceholder
|
||||
errorPlaceholder,
|
||||
ignoreAutoLoadPolicy = false
|
||||
}: {
|
||||
image: TImetaInfo
|
||||
className?: string
|
||||
@@ -22,11 +23,12 @@ export default function ImageWithLightbox({
|
||||
wrapper?: string
|
||||
}
|
||||
errorPlaceholder?: string
|
||||
ignoreAutoLoadPolicy?: boolean
|
||||
}) {
|
||||
const id = useMemo(() => `image-with-lightbox-${randomString()}`, [])
|
||||
const { t } = useTranslation()
|
||||
const { autoLoadMedia } = useContentPolicy()
|
||||
const [display, setDisplay] = useState(autoLoadMedia)
|
||||
const [display, setDisplay] = useState(ignoreAutoLoadPolicy ? true : autoLoadMedia)
|
||||
const [index, setIndex] = useState(-1)
|
||||
useEffect(() => {
|
||||
if (index >= 0) {
|
||||
|
||||
@@ -27,6 +27,7 @@ export default function AvatarWithLightbox({ userId }: { userId: string }) {
|
||||
wrapper:
|
||||
'shrink-0 rounded-full bg-background w-24 h-24 absolute left-3 bottom-0 translate-y-1/2 border-4 border-background'
|
||||
}}
|
||||
ignoreAutoLoadPolicy
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ export default function BannerWithLightbox({
|
||||
wrapper: 'rounded-none border-none'
|
||||
}}
|
||||
errorPlaceholder={defaultBanner}
|
||||
ignoreAutoLoadPolicy
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user