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,
|
image,
|
||||||
className,
|
className,
|
||||||
classNames = {},
|
classNames = {},
|
||||||
errorPlaceholder
|
errorPlaceholder,
|
||||||
|
ignoreAutoLoadPolicy = false
|
||||||
}: {
|
}: {
|
||||||
image: TImetaInfo
|
image: TImetaInfo
|
||||||
className?: string
|
className?: string
|
||||||
@@ -22,11 +23,12 @@ export default function ImageWithLightbox({
|
|||||||
wrapper?: string
|
wrapper?: string
|
||||||
}
|
}
|
||||||
errorPlaceholder?: string
|
errorPlaceholder?: string
|
||||||
|
ignoreAutoLoadPolicy?: boolean
|
||||||
}) {
|
}) {
|
||||||
const id = useMemo(() => `image-with-lightbox-${randomString()}`, [])
|
const id = useMemo(() => `image-with-lightbox-${randomString()}`, [])
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { autoLoadMedia } = useContentPolicy()
|
const { autoLoadMedia } = useContentPolicy()
|
||||||
const [display, setDisplay] = useState(autoLoadMedia)
|
const [display, setDisplay] = useState(ignoreAutoLoadPolicy ? true : autoLoadMedia)
|
||||||
const [index, setIndex] = useState(-1)
|
const [index, setIndex] = useState(-1)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export default function AvatarWithLightbox({ userId }: { userId: string }) {
|
|||||||
wrapper:
|
wrapper:
|
||||||
'shrink-0 rounded-full bg-background w-24 h-24 absolute left-3 bottom-0 translate-y-1/2 border-4 border-background'
|
'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'
|
wrapper: 'rounded-none border-none'
|
||||||
}}
|
}}
|
||||||
errorPlaceholder={defaultBanner}
|
errorPlaceholder={defaultBanner}
|
||||||
|
ignoreAutoLoadPolicy
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user