feat: make preview non-clickable
This commit is contained in:
@@ -23,13 +23,11 @@ const Content = memo(
|
|||||||
({
|
({
|
||||||
event,
|
event,
|
||||||
className,
|
className,
|
||||||
size = 'normal',
|
size = 'normal'
|
||||||
disableLightbox = false
|
|
||||||
}: {
|
}: {
|
||||||
event: Event
|
event: Event
|
||||||
className?: string
|
className?: string
|
||||||
size?: 'normal' | 'small'
|
size?: 'normal' | 'small'
|
||||||
disableLightbox?: boolean
|
|
||||||
}) => {
|
}) => {
|
||||||
const { content, images, videos, embeddedNotes, lastNonMediaUrl } = preprocess(event)
|
const { content, images, videos, embeddedNotes, lastNonMediaUrl } = preprocess(event)
|
||||||
const isNsfw = isNsfwEvent(event)
|
const isNsfw = isNsfwEvent(event)
|
||||||
@@ -50,7 +48,6 @@ const Content = memo(
|
|||||||
images={images}
|
images={images}
|
||||||
isNsfw={isNsfw}
|
isNsfw={isNsfw}
|
||||||
size={size}
|
size={size}
|
||||||
disableLightbox={disableLightbox}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,12 @@ export default function ImageGallery({
|
|||||||
className,
|
className,
|
||||||
images,
|
images,
|
||||||
isNsfw = false,
|
isNsfw = false,
|
||||||
size = 'normal',
|
size = 'normal'
|
||||||
disableLightbox = false
|
|
||||||
}: {
|
}: {
|
||||||
className?: string
|
className?: string
|
||||||
images: TImageInfo[]
|
images: TImageInfo[]
|
||||||
isNsfw?: boolean
|
isNsfw?: boolean
|
||||||
size?: 'normal' | 'small'
|
size?: 'normal' | 'small'
|
||||||
disableLightbox?: boolean
|
|
||||||
}) {
|
}) {
|
||||||
const { isSmallScreen } = useScreenSize()
|
const { isSmallScreen } = useScreenSize()
|
||||||
const [index, setIndex] = useState(-1)
|
const [index, setIndex] = useState(-1)
|
||||||
@@ -35,11 +33,7 @@ export default function ImageGallery({
|
|||||||
imageContent = (
|
imageContent = (
|
||||||
<Image
|
<Image
|
||||||
key={0}
|
key={0}
|
||||||
className={cn(
|
className={cn('rounded-lg', size === 'small' ? 'max-h-[15vh]' : 'max-h-[30vh]')}
|
||||||
'rounded-lg',
|
|
||||||
!disableLightbox ? 'cursor-auto' : '',
|
|
||||||
size === 'small' ? 'max-h-[15vh]' : 'max-h-[30vh]'
|
|
||||||
)}
|
|
||||||
classNames={{
|
classNames={{
|
||||||
errorPlaceholder: cn('aspect-square', size === 'small' ? 'h-[15vh]' : 'h-[30vh]')
|
errorPlaceholder: cn('aspect-square', size === 'small' ? 'h-[15vh]' : 'h-[30vh]')
|
||||||
}}
|
}}
|
||||||
@@ -53,7 +47,7 @@ export default function ImageGallery({
|
|||||||
{images.map((image, i) => (
|
{images.map((image, i) => (
|
||||||
<Image
|
<Image
|
||||||
key={i}
|
key={i}
|
||||||
className={cn('aspect-square w-full rounded-lg', !disableLightbox ? 'cursor-auto' : '')}
|
className={cn('aspect-square w-full rounded-lg')}
|
||||||
image={image}
|
image={image}
|
||||||
onClick={(e) => handlePhotoClick(e, i)}
|
onClick={(e) => handlePhotoClick(e, i)}
|
||||||
/>
|
/>
|
||||||
@@ -66,7 +60,7 @@ export default function ImageGallery({
|
|||||||
{images.map((image, i) => (
|
{images.map((image, i) => (
|
||||||
<Image
|
<Image
|
||||||
key={i}
|
key={i}
|
||||||
className={cn('aspect-square w-full rounded-lg', !disableLightbox ? 'cursor-auto' : '')}
|
className={cn('aspect-square w-full rounded-lg')}
|
||||||
image={image}
|
image={image}
|
||||||
onClick={(e) => handlePhotoClick(e, i)}
|
onClick={(e) => handlePhotoClick(e, i)}
|
||||||
/>
|
/>
|
||||||
@@ -79,7 +73,7 @@ export default function ImageGallery({
|
|||||||
{images.map((image, i) => (
|
{images.map((image, i) => (
|
||||||
<Image
|
<Image
|
||||||
key={i}
|
key={i}
|
||||||
className={cn('aspect-square w-full rounded-lg', !disableLightbox ? 'cursor-auto' : '')}
|
className={cn('aspect-square w-full rounded-lg')}
|
||||||
image={image}
|
image={image}
|
||||||
onClick={(e) => handlePhotoClick(e, i)}
|
onClick={(e) => handlePhotoClick(e, i)}
|
||||||
/>
|
/>
|
||||||
@@ -92,7 +86,6 @@ export default function ImageGallery({
|
|||||||
<div className={cn('relative', images.length === 1 ? 'w-fit max-w-full' : 'w-full', className)}>
|
<div className={cn('relative', images.length === 1 ? 'w-fit max-w-full' : 'w-full', className)}>
|
||||||
{imageContent}
|
{imageContent}
|
||||||
{index >= 0 &&
|
{index >= 0 &&
|
||||||
!disableLightbox &&
|
|
||||||
createPortal(
|
createPortal(
|
||||||
<div onClick={(e) => e.stopPropagation()}>
|
<div onClick={(e) => e.stopPropagation()}>
|
||||||
<Lightbox
|
<Lightbox
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function Preview({ content }: { content: string }) {
|
|||||||
pubkey: '',
|
pubkey: '',
|
||||||
sig: ''
|
sig: ''
|
||||||
}}
|
}}
|
||||||
disableLightbox
|
className="pointer-events-none"
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user