From 3f400547c839c88973de0635001eec4ce66e477d Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Tue, 22 Aug 2023 14:13:34 -0500 Subject: [PATCH] fix image being blurred event if setting was off --- src/components/embed-types/image.tsx | 5 ++++- src/components/note/expanded.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/embed-types/image.tsx b/src/components/embed-types/image.tsx index f8f1b63e1..796f0baaf 100644 --- a/src/components/embed-types/image.tsx +++ b/src/components/embed-types/image.tsx @@ -18,6 +18,7 @@ import { useRegisterSlide } from "../lightbox-provider"; import { isImageURL } from "../../helpers/url"; import PhotoGallery, { PhotoWithoutSize } from "../photo-gallery"; import { NostrEvent } from "../../types/nostr-event"; +import useAppSettings from "../../hooks/use-app-settings"; function useElementBlur(initBlur = false): { style: CSSProperties; onClick: MouseEventHandler } { const [blur, setBlur] = useState(initBlur); @@ -41,6 +42,7 @@ function useElementBlur(initBlur = false): { style: CSSProperties; onClick: Mous export type TrustImageProps = ImageProps; export const TrustImage = forwardRef((props, ref) => { + const { blurImages } = useAppSettings(); const trusted = useTrusted(); const { onClick, style } = useElementBlur(!trusted); @@ -54,7 +56,8 @@ export const TrustImage = forwardRef((props, [onClick, props.onClick], ); - return ; + if (!blurImages) return ; + else return ; }); export type EmbeddedImageProps = TrustImageProps & { diff --git a/src/components/note/expanded.tsx b/src/components/note/expanded.tsx index bdeb5ba09..e078f4a9a 100644 --- a/src/components/note/expanded.tsx +++ b/src/components/note/expanded.tsx @@ -1,5 +1,5 @@ import { useDisclosure } from "@chakra-ui/react"; -import React, { PropsWithChildren, useContext, useMemo } from "react"; +import React, { PropsWithChildren, useContext } from "react"; type ContextType = { expanded: boolean; onExpand: () => void; onCollapse: () => void; onToggle: () => void };